{
  "openapi": "3.1.0",
  "info": {
    "title": "Gregale API",
    "version": "1.0.0",
    "summary": "The Gregale platform REST API.",
    "description": "The public REST API of Gregale. Protected routes accept an account Bearer\nAPI key (`fp_live_…`), or the tenant-bound `fp_tenant_…` credential on\nthe explicitly documented tenant-self routes. Authentication is\nrate-limited per client IP (10 failed attempts a minute), except\nprovider-signed durable inbound webhook deliveries.\nSuccessful POSTs generally accept an `Idempotency-Key` header (24h TTL)\nand replay with `Idempotent-Replayed: true`; the one-time token-creation\nendpoint deliberately does not cache plaintext for retries. A key is\nbound to the request it was first used for: the same key with a\ndifferent body, query or precondition header returns\n`422 idempotency_key_reused` and does not run.\n\nErrors use RFC 9457 `application/problem+json` with a stable `code`\nfield — see `Problem` schema. Authentication rate limits use the same\nenvelope with `code: auth_rate_limited` and a `Retry-After` header.\nGregale's own problems are sent as 503 where an operation lists 502 or\n504, with the same `code` and an `X-Faas-Error-Code` header, because the\nCDN in front of the API replaces 502 and 504 bodies.\nEdges released before that change still send 502 or 504, so both are\nlisted. Key on `code`, not on the status.\n\nDashboard pages, server-sent event streams (account events and\ndeployment logs), the CLI sign-in flow and operator-only routes are not\npart of this reference.\n",
    "contact": {
      "name": "Gregale",
      "url": "https://gregale.dev/docs"
    },
    "license": {
      "name": "Proprietary",
      "identifier": "LicenseRef-Gregale-Proprietary"
    }
  },
  "servers": [
    {
      "url": "https://{host}",
      "description": "Gregale API.",
      "variables": {
        "host": {
          "default": "api.gregale.dev",
          "description": "API hostname."
        }
      }
    }
  ],
  "tags": [
    {
      "name": "support",
      "description": "Gregale customer assistance, public conversations and resolution episodes."
    },
    {
      "name": "operations",
      "description": "Staged customer-owned HTTP work, scoped status and durable progress; production admission is disabled."
    },
    {
      "name": "flags",
      "description": "Customer-aware application behavior releases and decision evidence."
    },
    {
      "name": "outbound",
      "description": "Bind apps to account-owned, operator-provisioned managed outbound integrations without exposing provider credentials."
    },
    {
      "name": "storage",
      "description": "Private customer object-storage preview, separate from runtime snapshots and image layers."
    },
    {
      "name": "managed_postgres",
      "description": "Provider-neutral managed PostgreSQL databases and workload bindings."
    },
    {
      "name": "realtime",
      "description": "Durable managed realtime endpoint configuration for long-lived WebSocket clients."
    },
    {
      "name": "account",
      "description": "Account & billing (self-service, GDPR, plan)."
    },
    {
      "name": "apps",
      "description": "App lifecycle (create, update, delete, wake, park)."
    },
    {
      "name": "networking",
      "description": "Effective app networking and provider-neutral private-network attachment intent."
    },
    {
      "name": "consumers",
      "description": "Stable end-customer identities and credentials for monetized APIs."
    },
    {
      "name": "platform-tenants",
      "description": "Account-level end customers spanning app consumers and tenant surfaces."
    },
    {
      "name": "debugger",
      "description": "Customer production debugger request evidence and safe replay."
    },
    {
      "name": "uploads",
      "description": "Resumable upload sessions. A session\nopens at POST /v1/uploads, accepts byte-range PATCHes, and\nfinalizes via POST /v1/uploads/{id}/commit. Per-account open-\nsession cap is 5; per-plan SourceTarballMaxMB caps total_size\n(Free/Hobby 100 MB, Pro/Scale 250 MB). The legacy single-shot\n`source-tarball` endpoint stays active during the migration and\nadvertises RFC 9745 Deprecation, RFC 8594 Sunset, and RFC 8288\nsuccessor/deprecation links on every response.\n"
    },
    {
      "name": "previews",
      "description": "Preview environments. A preview is a\nper-PR child app created by the GitHub bridge; the customer\nwakes the preview URL to exercise the change before merge.\nThis tag groups the customer-facing destroy route\n(POST /v1/preview/{slug}/destroy) — the dashboard surface is\nunder `apps` (the preview panel) and the build-pipeline\nsurface is under `deployments` (preview kind deployments).\nCross-tagged with `apps` so a tag filter of `apps` surfaces\npreview-destroy alongside the parent-app lifecycle.\n"
    },
    {
      "name": "mcp",
      "description": "MCP hosting health and catalog integrity checks for app deployments."
    },
    {
      "name": "dev",
      "description": "Stable, expiring remote developer environments used by `gregale dev`."
    },
    {
      "name": "deploydiff",
      "description": "Read-only pre-deploy preview."
    },
    {
      "name": "edge_rules",
      "description": "Edge rules (route, rewrite, redirect, headers, cors, jwt, ip, validate, geo, async) per app."
    },
    {
      "name": "mirror",
      "description": "Traffic mirroring rules. Each rule\npins a source deployment to a mirror deployment; the gateway\nfans out a percentage of live traffic to the mirror VM without\ninfluencing the source response. Plan caps: Pro = 1, Scale = 3,\nFree/Hobby = 0.\n"
    },
    {
      "name": "cors_presets",
      "description": "CORS presets. A preset is a\ncustomer-owned, named, reusable CORS configuration (allow_origins,\nallow_methods, allow_headers, expose_headers, allow_credentials,\nmax_age_seconds). A preset is referenced by a kind=cors edge rule\nvia EdgeRuleCORSAction.cors_preset_id; the gateway merges the\npreset into the rule's resolved action at compile time (state.\nMergeCorsPresetIntoRule). Presets are account-scoped (app_id is\nnull on the wire) or app-scoped (app_id is set). Free plan:\nfeature gated off (402 plan_cors_preset_not_allowed). Hobby/\nPro/Scale: per-account and per-app caps enforced via\nplan_cors_preset_quota_reached.\n"
    },
    {
      "name": "telemetry",
      "description": "Production-debugger telemetry ingestion. The\nOTel spans writer is a sidecar protocol consumed by OTel\nSDKs, not a customer REST surface; the SDK does not model\nthis route (routeExclude on both sdk-coverage and\nspec_compliance gates). OTLP/HTTP body shape is externally\ndefined by the OpenTelemetry proto — the spec deliberately\ndocuments the endpoint metadata only.\n"
    },
    {
      "name": "deployments",
      "description": "Deployments & build status."
    },
    {
      "name": "openapi_discovery",
      "description": "Captured OpenAPI documents per deployment."
    },
    {
      "name": "openapi_import",
      "description": "Imported OpenAPI documents per app + auto-generated merged spec."
    },
    {
      "name": "instances",
      "description": "Read-only instance view."
    },
    {
      "name": "domains",
      "description": "Custom domain bindings."
    },
    {
      "name": "crons",
      "description": "Scheduled HTTP-path requests or deployment-attached command runs."
    },
    {
      "name": "triggers",
      "description": "Event source mappings. A trigger is a\nunified resource that pulls records from a broker (kafka, nats,\nredis_streams, sqs_compat, queue) or a schedule (cron) and fans\nthem into the function via batched invocations. The cron kind\nis a thin alias over /v1/crons — see the `crons` tag for the\ncanonical cron API. Records carry ReportBatchItemFailures\nsemantics stolen verbatim from AWS Lambda (the function\nreturns `{\"batchItemFailures\":[{\"item_identifier\":\"...\"}]}`).\n"
    },
    {
      "name": "webhooks",
      "description": "Outbound webhook subscriptions. One row\nper (app, target_url) customer subscription; the dispatcher in\nthe scheduler POSTs signed payloads to the target with exponential\nbackoff + jitter and DLQs at attempt 7. The deliveries subroute\nsurfaces the per-attempt retry state + a manual retry endpoint\nthat clears status='dead' back to 'pending'.\n"
    },
    {
      "name": "inbound_webhooks",
      "description": "Provider-verified webhook ingress that persists an app invocation before\nreturning 202, then uses the normal wake, retry, and dead-letter path.\nStripe is the initial provider adapter.\n"
    },
    {
      "name": "alert_rules",
      "description": "Customer-configurable alert rules.\nA rule pins a metric (latency_p99_ms, error_rate_pct, …) to a\nthreshold + comparison + window; when the threshold is breached\nthe metering service dispatcher POSTs a signed payload to webhook_url.\nAccount-wide rules (app_id == \"\") are visible in every per-app\nlisting but the create/update/delete endpoints pin to a specific\napp.\n"
    },
    {
      "name": "operator",
      "description": "Typed operator runtime configuration and fleet controls."
    },
    {
      "name": "invocations",
      "description": "Sync / async function invocations (event-driven surface, Move 2)."
    },
    {
      "name": "exclusive-operations"
    },
    {
      "name": "jobs",
      "description": "Run-to-completion batch jobs.\nCustomers POST a stored image + command + env; the platform boots\na Firecracker microVM, runs the command to completion, captures\nthe exit code, and reports back. Lifecycle (created → running →\nsucceeded | failed | timeout | oom | cancelled), per-task retry\nwith backoff, dead-letter accounting on exhaustion.\n"
    },
    {
      "name": "runs",
      "description": "Disposable, one-shot execution of caller-supplied Node.js or Python\nsource inside a fresh, networkless Firecracker microVM. The VM is\ndestroyed after every terminal result; no customer storage disk or\npersistent sandbox state is exposed by this API.\n"
    },
    {
      "name": "workflows",
      "description": "Durable multi-step workflow runs and external events."
    },
    {
      "name": "events",
      "description": "Tenant-scoped internal event ingress (EPIC #1278)."
    },
    {
      "name": "queues",
      "description": "Per-app FIFO queues (send / receive / ack)."
    },
    {
      "name": "delayed_tasks",
      "description": "Scheduled future invocations (cron-style, one-shot)."
    },
    {
      "name": "observability",
      "description": "Per-app observability surfaces —\nstructured event timelines a customer or operator can query\nfor a single wake. Cross-tagged with `apps` so a tag filter\nof `apps` surfaces lifecycle endpoints alongside the wake\ntimeline.\n"
    },
    {
      "name": "keys",
      "description": "API key management. ships\nthe org-scoped surface under `/v1/orgs/{slug}/keys` — use those\npaths when minting/rotating/revoking keys for a specific org.\nThe legacy `/v1/keys/*` paths stamp `org_id = caller's personal\norg` and dual-emit for one release cycle; drops them.\n"
    },
    {
      "name": "orgs",
      "description": "Organization surface. All routes\ncompose the LoadOrg middleware (`X-Active-Org: {slug}` or\n`?org={slug}`) and resolve the principal's role via the closed\n`OrgAction*` vocabulary. Cross-org access is denied with 403\n`org_role_forbidden` — never 404, to keep the IDOR-safe wire shape.\n"
    },
    {
      "name": "audit",
      "description": "Customer-facing security event timeline. Append-only; read-only."
    },
    {
      "name": "secrets",
      "description": "Per-app sealed secrets, injected into authorized app VMs at wake."
    },
    {
      "name": "registry",
      "description": "Per-app private-registry Basic Auth credentials.\nPassword is sealed at rest with secretbox under the host X25519\nrecipient (namespace `registry_creds`); the image service transiently unseals\nin the pull path. The plaintext never lands in PG.\n"
    },
    {
      "name": "env",
      "description": "Per-app plaintext env vars. Non-sensitive\nruntime config — credentials stay on /secrets. Values are\nstored as-is and applied on next wake.\n"
    },
    {
      "name": "security",
      "description": "Per-app security surfaces: the customer-scoped GET posture report,\nplus operator-only PATCH /v1/apps/{slug}/security (admin + MFA)\nfor the require_signed flag and trusted_signers CRUD for the\nper-app cosign trusted-publisher list.\n"
    },
    {
      "name": "internal",
      "description": "Inter-daemon RPC surface (the scheduler ↔ the gateway). The\n`invocations:dispatch_batch` endpoint under this tag is\nscheduler-driven — the scheduler calls the gateway to dispatch\na batch of records against a parked instance, and the function\nrunner returns ReportBatchItemFailures. Not customer-facing.\n"
    },
    {
      "name": "tenant-surfaces",
      "description": "Tenant hostname groupings. One surface\nholds N hostnames under one SAN bundle. Soft-deleted surfaces\nare filtered out of list/get; the cert engine picks up\npending-state surfaces via pg_notify('tenant_surface_changed')\nto mint the cert. Returns 503 when the\n`FAAS_TENANT_SURFACES_ENABLED` flag is off.\n"
    },
    {
      "name": "usage",
      "description": "Usage roll-up and metering."
    },
    {
      "name": "upstreams",
      "description": "Customer-managed data upstreams.\nEach row is an outbound connection the platform probes for\nRTT before biasing wake-time placement toward the region with\nthe lowest observed latency. The probe loop in the metering service dials\n`host:port` via `crypto/tls.Dial` (never `http.Get`) and\nrecords per-region samples in `data_upstream_probes`; the\nchooser in the scheduler reads them synchronously at wake via\n`upstreamAffinity.Score(appID, deploymentScope)` (each deployment reads its own probe\nbias). Plaintext host is never\nemitted on the wire — only the sha256(salt||host) 8-hex\nprefix appears as a metric label.\n"
    },
    {
      "name": "billing",
      "description": "Billing surface. Portal URLs are generated by\nthe configured billing provider when supported, with the operator-\nconfigured URL as a fallback. Customer-facing mutations live inside\nthe provider portal. Future endpoints (invoice list, etc.) share\nthis tag.\n"
    },
    {
      "name": "admin",
      "description": "Operator-only routes. Two-layer auth: the\nBearer must carry the admin scope AND the caller's email\nmust be in FAAS_ADMIN_EMAILS. CLI surface:\n`faas admin credit <account_uuid> <cents> --reason <text>`.\n"
    },
    {
      "name": "status",
      "description": "Public platform status and operator-managed incident timelines."
    },
    {
      "name": "auth",
      "description": "Dashboard authentication.\nEmail + password (Argon2id), Google OAuth, GitHub OAuth,\npassword reset, session lifecycle. Cookies carry the session\nartifact; the device-code flow is the SDK programmatic-auth path.\n"
    },
    {
      "name": "mfa",
      "description": "Optional TOTP MFA on dashboard sessions. Five\nPOST endpoints: enroll (one-shot secret + recovery codes),\nconfirm (first TOTP code), verify (step-up for an\nmfa_pending session), recover (burn a recovery code), and\ndisable (opt-out via password or recovery code). Enrollment\nis never triggered automatically by plan, billing, or deploy\nevents.\n"
    },
    {
      "name": "github",
      "description": "GitHub App integration. The dashboard bind\npicker surfaces the (installation_id, repo, branch) edge;\n/v1/auth/github + /oauth/callback handle the OAuth handshake\nand ownership proof.\n"
    },
    {
      "name": "meta",
      "description": "Self-description endpoints (this spec). Anonymous."
    },
    {
      "name": "projects",
      "description": "Multi-workload repo decomposition. /v1/projects/scan is\nthe dry-run that returns the PlanResponse (can_apply, plan_token);\n/v1/projects is the transactional apply that creates the project,\nits apps, and its crons in one Tx.\n"
    },
    {
      "name": "orgs",
      "description": "Organization surface. Path-scoped\norg CRUD, member management, invitations, and ownership transfer.\nThe active-org hint is accepted via `X-Active-Org` / `?org=`\non every org-scoped route (matches LoadOrg middleware precedence);\npath-scoped routes resolve via `{slug}` regardless.\n"
    },
    {
      "name": "templates",
      "description": "Starter template catalog. The\ndashboard's /dashboard/apps/new wizard renders the GET\n/v1/templates response as the \"Starting template\" dropdown;\nthe CLI's `gregale deploy --template NAME` and `gregale init\n--template NAME` validators reference the same source on the\nCLI side. Cookie-session-authenticated (NOT API-key) — the dashboard is the install-token trust root.\n"
    },
    {
      "name": "data_pipelines",
      "description": "Staged managed PostgreSQL mirrors with encrypted source registration and read-only application access."
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v1/support/notifications": {
      "get": {
        "tags": [
          "support"
        ],
        "operationId": "personalSupportNotificationsFeed",
        "summary": "List personal support notifications",
        "description": "Personal support. Metadata-only updates for the current caller. Read state is personal to this account and support audience. Private notes never create customer notifications.",
        "parameters": [
          {
            "name": "before",
            "in": "query",
            "required": false,
            "description": "Sequence from the previous notification page. Applies to personalSupportNotificationsFeed.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            }
          },
          {
            "name": "unread",
            "in": "query",
            "required": false,
            "description": "Return only unread updates. Applies to personalSupportNotificationsFeed.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current caller notification feed and scoped unread count. Applies to personalSupportNotificationsFeed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportNotificationPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/SupportInvalid"
          },
          "401": {
            "$ref": "#/components/responses/SupportUnauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/SupportForbidden"
          },
          "404": {
            "$ref": "#/components/responses/SupportMissing"
          },
          "409": {
            "$ref": "#/components/responses/SupportConflict"
          },
          "413": {
            "$ref": "#/components/responses/SupportTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/SupportLimited"
          },
          "503": {
            "$ref": "#/components/responses/SupportUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/support/tickets/{ticket}/read": {
      "post": {
        "tags": [
          "support"
        ],
        "operationId": "personalSupportMarkNotificationsRead",
        "summary": "Mark personal support updates read",
        "description": "Personal support. Marks only this caller's existing ticket notifications through the observed sequence. Later updates stay unread. Repeating the request is intrinsically idempotent; no permanent receipt or expected ticket revision is required.",
        "parameters": [
          {
            "name": "ticket",
            "in": "path",
            "required": true,
            "description": "Support ticket UUID in this scope. Applies to personalSupportMarkNotificationsRead.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Read state committed without changing the ticket revision. Applies to personalSupportMarkNotificationsRead.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportReadResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/SupportInvalid"
          },
          "401": {
            "$ref": "#/components/responses/SupportUnauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/SupportForbidden"
          },
          "404": {
            "$ref": "#/components/responses/SupportMissing"
          },
          "409": {
            "$ref": "#/components/responses/SupportConflict"
          },
          "413": {
            "$ref": "#/components/responses/SupportTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/SupportLimited"
          },
          "503": {
            "$ref": "#/components/responses/SupportUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupportReadRequest"
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{org}/support/notifications": {
      "get": {
        "tags": [
          "support"
        ],
        "operationId": "organizationSupportNotificationsFeed",
        "summary": "List organization support notifications",
        "description": "Organization support. Metadata-only updates for the current caller. Read state is personal to this account and support audience. Private notes never create customer notifications.",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "description": "Organization slug; current owner or administrator membership is required. Applies to organizationSupportNotificationsFeed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "description": "Sequence from the previous notification page. Applies to organizationSupportNotificationsFeed.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            }
          },
          {
            "name": "unread",
            "in": "query",
            "required": false,
            "description": "Return only unread updates. Applies to organizationSupportNotificationsFeed.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current caller notification feed and scoped unread count. Applies to organizationSupportNotificationsFeed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportNotificationPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/SupportInvalid"
          },
          "401": {
            "$ref": "#/components/responses/SupportUnauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/SupportForbidden"
          },
          "404": {
            "$ref": "#/components/responses/SupportMissing"
          },
          "409": {
            "$ref": "#/components/responses/SupportConflict"
          },
          "413": {
            "$ref": "#/components/responses/SupportTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/SupportLimited"
          },
          "503": {
            "$ref": "#/components/responses/SupportUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/orgs/{org}/support/tickets/{ticket}/read": {
      "post": {
        "tags": [
          "support"
        ],
        "operationId": "organizationSupportMarkNotificationsRead",
        "summary": "Mark organization support updates read",
        "description": "Organization support. Marks only this caller's existing ticket notifications through the observed sequence. Later updates stay unread. Repeating the request is intrinsically idempotent; no permanent receipt or expected ticket revision is required.",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "description": "Organization slug; current owner or administrator membership is required. Applies to organizationSupportMarkNotificationsRead.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ticket",
            "in": "path",
            "required": true,
            "description": "Support ticket UUID in this scope. Applies to organizationSupportMarkNotificationsRead.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Read state committed without changing the ticket revision. Applies to organizationSupportMarkNotificationsRead.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportReadResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/SupportInvalid"
          },
          "401": {
            "$ref": "#/components/responses/SupportUnauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/SupportForbidden"
          },
          "404": {
            "$ref": "#/components/responses/SupportMissing"
          },
          "409": {
            "$ref": "#/components/responses/SupportConflict"
          },
          "413": {
            "$ref": "#/components/responses/SupportTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/SupportLimited"
          },
          "503": {
            "$ref": "#/components/responses/SupportUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupportReadRequest"
              }
            }
          }
        }
      }
    },
    "/v1/support/tickets": {
      "get": {
        "tags": [
          "support"
        ],
        "operationId": "personalSupportList",
        "summary": "List personal support cases",
        "description": "Personal support list operation. Responses omit private notes, staff queues and engineering details. Writes require current verified access, the expected revision where applicable, and a UUID idempotency key.",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Last ticket UUID from the preceding page. This parameter belongs to personalSupportList.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Filter case status. This parameter belongs to personalSupportList.",
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "pending",
                "resolved"
              ]
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Search subject and currently visible public conversation text. This parameter belongs to personalSupportList.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current scoped support records. Result of personalSupportList.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportTicketPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/SupportInvalid"
          },
          "401": {
            "$ref": "#/components/responses/SupportUnauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/SupportForbidden"
          },
          "404": {
            "$ref": "#/components/responses/SupportMissing"
          },
          "409": {
            "$ref": "#/components/responses/SupportConflict"
          },
          "413": {
            "$ref": "#/components/responses/SupportTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/SupportLimited"
          },
          "503": {
            "$ref": "#/components/responses/SupportUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "post": {
        "tags": [
          "support"
        ],
        "operationId": "personalSupportCreate",
        "summary": "Create personal support case workflow",
        "description": "Personal support create operation. Responses omit private notes, staff queues and engineering details. Writes require current verified access, the expected revision where applicable, and a UUID idempotency key.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Client-generated UUID bound permanently to the actor, operation, resource and JSON request. Reuse it for retries. This parameter belongs to personalSupportCreate.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Support transaction accepted. Result of personalSupportCreate.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportSubmission"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/SupportInvalid"
          },
          "401": {
            "$ref": "#/components/responses/SupportUnauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/SupportForbidden"
          },
          "404": {
            "$ref": "#/components/responses/SupportMissing"
          },
          "409": {
            "$ref": "#/components/responses/SupportConflict"
          },
          "413": {
            "$ref": "#/components/responses/SupportTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/SupportLimited"
          },
          "503": {
            "$ref": "#/components/responses/SupportUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSupportTicketRequest"
              }
            }
          }
        }
      }
    },
    "/v1/support/tickets/{ticket}": {
      "get": {
        "tags": [
          "support"
        ],
        "operationId": "personalSupportGet",
        "summary": "Get personal support case workflow",
        "description": "Personal support get operation. Responses omit private notes, staff queues and engineering details. Writes require current verified access, the expected revision where applicable, and a UUID idempotency key.",
        "parameters": [
          {
            "name": "ticket",
            "in": "path",
            "required": true,
            "description": "Support case UUID in this scope. This parameter belongs to personalSupportGet.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current scoped support records. Result of personalSupportGet.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportTicket"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/SupportInvalid"
          },
          "401": {
            "$ref": "#/components/responses/SupportUnauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/SupportForbidden"
          },
          "404": {
            "$ref": "#/components/responses/SupportMissing"
          },
          "409": {
            "$ref": "#/components/responses/SupportConflict"
          },
          "413": {
            "$ref": "#/components/responses/SupportTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/SupportLimited"
          },
          "503": {
            "$ref": "#/components/responses/SupportUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/support/tickets/{ticket}/messages": {
      "get": {
        "tags": [
          "support"
        ],
        "operationId": "personalSupportMessages",
        "summary": "Messages personal support case workflow",
        "description": "Personal support messages operation. Responses omit private notes, staff queues and engineering details. Writes require current verified access, the expected revision where applicable, and a UUID idempotency key.",
        "parameters": [
          {
            "name": "ticket",
            "in": "path",
            "required": true,
            "description": "Support case UUID in this scope. This parameter belongs to personalSupportMessages.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "description": "Return messages after this global message sequence. This parameter belongs to personalSupportMessages.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current scoped support records. Result of personalSupportMessages.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportMessagePage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/SupportInvalid"
          },
          "401": {
            "$ref": "#/components/responses/SupportUnauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/SupportForbidden"
          },
          "404": {
            "$ref": "#/components/responses/SupportMissing"
          },
          "409": {
            "$ref": "#/components/responses/SupportConflict"
          },
          "413": {
            "$ref": "#/components/responses/SupportTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/SupportLimited"
          },
          "503": {
            "$ref": "#/components/responses/SupportUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "post": {
        "tags": [
          "support"
        ],
        "operationId": "personalSupportReply",
        "summary": "Reply personal support case workflow",
        "description": "Personal support reply operation. Responses omit private notes, staff queues and engineering details. Writes require current verified access, the expected revision where applicable, and a UUID idempotency key.",
        "parameters": [
          {
            "name": "ticket",
            "in": "path",
            "required": true,
            "description": "Support case UUID in this scope. This parameter belongs to personalSupportReply.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Client-generated UUID bound permanently to the actor, operation, resource and JSON request. Reuse it for retries. This parameter belongs to personalSupportReply.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Support transaction accepted. Result of personalSupportReply.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportSubmission"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/SupportInvalid"
          },
          "401": {
            "$ref": "#/components/responses/SupportUnauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/SupportForbidden"
          },
          "404": {
            "$ref": "#/components/responses/SupportMissing"
          },
          "409": {
            "$ref": "#/components/responses/SupportConflict"
          },
          "413": {
            "$ref": "#/components/responses/SupportTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/SupportLimited"
          },
          "503": {
            "$ref": "#/components/responses/SupportUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupportMessageRequest"
              }
            }
          }
        }
      }
    },
    "/v1/support/tickets/{ticket}/close": {
      "post": {
        "tags": [
          "support"
        ],
        "operationId": "personalSupportClose",
        "summary": "Close personal support case workflow",
        "description": "Personal support close operation. Responses omit private notes, staff queues and engineering details. Writes require current verified access, the expected revision where applicable, and a UUID idempotency key.",
        "parameters": [
          {
            "name": "ticket",
            "in": "path",
            "required": true,
            "description": "Support case UUID in this scope. This parameter belongs to personalSupportClose.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Client-generated UUID bound permanently to the actor, operation, resource and JSON request. Reuse it for retries. This parameter belongs to personalSupportClose.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Support transaction accepted. Result of personalSupportClose.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportSubmission"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/SupportInvalid"
          },
          "401": {
            "$ref": "#/components/responses/SupportUnauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/SupportForbidden"
          },
          "404": {
            "$ref": "#/components/responses/SupportMissing"
          },
          "409": {
            "$ref": "#/components/responses/SupportConflict"
          },
          "413": {
            "$ref": "#/components/responses/SupportTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/SupportLimited"
          },
          "503": {
            "$ref": "#/components/responses/SupportUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CloseSupportTicketRequest"
              }
            }
          }
        }
      }
    },
    "/v1/support/tickets/{ticket}/reopen": {
      "post": {
        "tags": [
          "support"
        ],
        "operationId": "personalSupportReopen",
        "summary": "Reopen personal support case workflow",
        "description": "Personal support reopen operation. Responses omit private notes, staff queues and engineering details. Writes require current verified access, the expected revision where applicable, and a UUID idempotency key.",
        "parameters": [
          {
            "name": "ticket",
            "in": "path",
            "required": true,
            "description": "Support case UUID in this scope. This parameter belongs to personalSupportReopen.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Client-generated UUID bound permanently to the actor, operation, resource and JSON request. Reuse it for retries. This parameter belongs to personalSupportReopen.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Support transaction accepted. Result of personalSupportReopen.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportSubmission"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/SupportInvalid"
          },
          "401": {
            "$ref": "#/components/responses/SupportUnauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/SupportForbidden"
          },
          "404": {
            "$ref": "#/components/responses/SupportMissing"
          },
          "409": {
            "$ref": "#/components/responses/SupportConflict"
          },
          "413": {
            "$ref": "#/components/responses/SupportTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/SupportLimited"
          },
          "503": {
            "$ref": "#/components/responses/SupportUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReopenSupportTicketRequest"
              }
            }
          }
        }
      }
    },
    "/v1/support/tickets/{ticket}/satisfaction": {
      "get": {
        "tags": [
          "support"
        ],
        "operationId": "personalSupportSurvey",
        "summary": "Survey personal support case workflow",
        "description": "Personal support survey operation. Responses omit private notes, staff queues and engineering details. Writes require current verified access, the expected revision where applicable, and a UUID idempotency key.",
        "parameters": [
          {
            "name": "ticket",
            "in": "path",
            "required": true,
            "description": "Support case UUID in this scope. This parameter belongs to personalSupportSurvey.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current scoped support records. Result of personalSupportSurvey.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportSatisfaction"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/SupportInvalid"
          },
          "401": {
            "$ref": "#/components/responses/SupportUnauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/SupportForbidden"
          },
          "404": {
            "$ref": "#/components/responses/SupportMissing"
          },
          "409": {
            "$ref": "#/components/responses/SupportConflict"
          },
          "413": {
            "$ref": "#/components/responses/SupportTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/SupportLimited"
          },
          "503": {
            "$ref": "#/components/responses/SupportUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "post": {
        "tags": [
          "support"
        ],
        "operationId": "personalSupportRate",
        "summary": "Rate personal support case workflow",
        "description": "Personal support rate operation. Responses omit private notes, staff queues and engineering details. Writes require current verified access, the expected revision where applicable, and a UUID idempotency key.",
        "parameters": [
          {
            "name": "ticket",
            "in": "path",
            "required": true,
            "description": "Support case UUID in this scope. This parameter belongs to personalSupportRate.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Client-generated UUID bound permanently to the actor, operation, resource and JSON request. Reuse it for retries. This parameter belongs to personalSupportRate.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Support transaction accepted. Result of personalSupportRate.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportSatisfactionSubmission"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/SupportInvalid"
          },
          "401": {
            "$ref": "#/components/responses/SupportUnauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/SupportForbidden"
          },
          "404": {
            "$ref": "#/components/responses/SupportMissing"
          },
          "409": {
            "$ref": "#/components/responses/SupportConflict"
          },
          "413": {
            "$ref": "#/components/responses/SupportTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/SupportLimited"
          },
          "503": {
            "$ref": "#/components/responses/SupportUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupportSatisfactionRequest"
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{org}/support/tickets": {
      "get": {
        "tags": [
          "support"
        ],
        "operationId": "organizationSupportList",
        "summary": "List organization support cases",
        "description": "Organization support list operation. Responses omit private notes, staff queues and engineering details. Writes require current verified access, the expected revision where applicable, and a UUID idempotency key.",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "description": "Organization slug; current owner or administrator membership is required. This parameter belongs to organizationSupportList.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Last ticket UUID from the preceding page. This parameter belongs to organizationSupportList.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Filter case status. This parameter belongs to organizationSupportList.",
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "pending",
                "resolved"
              ]
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Search subject and currently visible public conversation text. This parameter belongs to organizationSupportList.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current scoped support records. Result of organizationSupportList.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportTicketPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/SupportInvalid"
          },
          "401": {
            "$ref": "#/components/responses/SupportUnauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/SupportForbidden"
          },
          "404": {
            "$ref": "#/components/responses/SupportMissing"
          },
          "409": {
            "$ref": "#/components/responses/SupportConflict"
          },
          "413": {
            "$ref": "#/components/responses/SupportTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/SupportLimited"
          },
          "503": {
            "$ref": "#/components/responses/SupportUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "post": {
        "tags": [
          "support"
        ],
        "operationId": "organizationSupportCreate",
        "summary": "Create organization support case workflow",
        "description": "Organization support create operation. Responses omit private notes, staff queues and engineering details. Writes require current verified access, the expected revision where applicable, and a UUID idempotency key.",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "description": "Organization slug; current owner or administrator membership is required. This parameter belongs to organizationSupportCreate.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Client-generated UUID bound permanently to the actor, operation, resource and JSON request. Reuse it for retries. This parameter belongs to organizationSupportCreate.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Support transaction accepted. Result of organizationSupportCreate.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportSubmission"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/SupportInvalid"
          },
          "401": {
            "$ref": "#/components/responses/SupportUnauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/SupportForbidden"
          },
          "404": {
            "$ref": "#/components/responses/SupportMissing"
          },
          "409": {
            "$ref": "#/components/responses/SupportConflict"
          },
          "413": {
            "$ref": "#/components/responses/SupportTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/SupportLimited"
          },
          "503": {
            "$ref": "#/components/responses/SupportUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSupportTicketRequest"
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{org}/support/tickets/{ticket}": {
      "get": {
        "tags": [
          "support"
        ],
        "operationId": "organizationSupportGet",
        "summary": "Get organization support case workflow",
        "description": "Organization support get operation. Responses omit private notes, staff queues and engineering details. Writes require current verified access, the expected revision where applicable, and a UUID idempotency key.",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "description": "Organization slug; current owner or administrator membership is required. This parameter belongs to organizationSupportGet.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ticket",
            "in": "path",
            "required": true,
            "description": "Support case UUID in this scope. This parameter belongs to organizationSupportGet.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current scoped support records. Result of organizationSupportGet.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportTicket"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/SupportInvalid"
          },
          "401": {
            "$ref": "#/components/responses/SupportUnauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/SupportForbidden"
          },
          "404": {
            "$ref": "#/components/responses/SupportMissing"
          },
          "409": {
            "$ref": "#/components/responses/SupportConflict"
          },
          "413": {
            "$ref": "#/components/responses/SupportTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/SupportLimited"
          },
          "503": {
            "$ref": "#/components/responses/SupportUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/orgs/{org}/support/tickets/{ticket}/messages": {
      "get": {
        "tags": [
          "support"
        ],
        "operationId": "organizationSupportMessages",
        "summary": "Messages organization support case workflow",
        "description": "Organization support messages operation. Responses omit private notes, staff queues and engineering details. Writes require current verified access, the expected revision where applicable, and a UUID idempotency key.",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "description": "Organization slug; current owner or administrator membership is required. This parameter belongs to organizationSupportMessages.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ticket",
            "in": "path",
            "required": true,
            "description": "Support case UUID in this scope. This parameter belongs to organizationSupportMessages.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "description": "Return messages after this global message sequence. This parameter belongs to organizationSupportMessages.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current scoped support records. Result of organizationSupportMessages.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportMessagePage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/SupportInvalid"
          },
          "401": {
            "$ref": "#/components/responses/SupportUnauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/SupportForbidden"
          },
          "404": {
            "$ref": "#/components/responses/SupportMissing"
          },
          "409": {
            "$ref": "#/components/responses/SupportConflict"
          },
          "413": {
            "$ref": "#/components/responses/SupportTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/SupportLimited"
          },
          "503": {
            "$ref": "#/components/responses/SupportUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "post": {
        "tags": [
          "support"
        ],
        "operationId": "organizationSupportReply",
        "summary": "Reply organization support case workflow",
        "description": "Organization support reply operation. Responses omit private notes, staff queues and engineering details. Writes require current verified access, the expected revision where applicable, and a UUID idempotency key.",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "description": "Organization slug; current owner or administrator membership is required. This parameter belongs to organizationSupportReply.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ticket",
            "in": "path",
            "required": true,
            "description": "Support case UUID in this scope. This parameter belongs to organizationSupportReply.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Client-generated UUID bound permanently to the actor, operation, resource and JSON request. Reuse it for retries. This parameter belongs to organizationSupportReply.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Support transaction accepted. Result of organizationSupportReply.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportSubmission"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/SupportInvalid"
          },
          "401": {
            "$ref": "#/components/responses/SupportUnauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/SupportForbidden"
          },
          "404": {
            "$ref": "#/components/responses/SupportMissing"
          },
          "409": {
            "$ref": "#/components/responses/SupportConflict"
          },
          "413": {
            "$ref": "#/components/responses/SupportTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/SupportLimited"
          },
          "503": {
            "$ref": "#/components/responses/SupportUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupportMessageRequest"
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{org}/support/tickets/{ticket}/close": {
      "post": {
        "tags": [
          "support"
        ],
        "operationId": "organizationSupportClose",
        "summary": "Close organization support case workflow",
        "description": "Organization support close operation. Responses omit private notes, staff queues and engineering details. Writes require current verified access, the expected revision where applicable, and a UUID idempotency key.",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "description": "Organization slug; current owner or administrator membership is required. This parameter belongs to organizationSupportClose.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ticket",
            "in": "path",
            "required": true,
            "description": "Support case UUID in this scope. This parameter belongs to organizationSupportClose.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Client-generated UUID bound permanently to the actor, operation, resource and JSON request. Reuse it for retries. This parameter belongs to organizationSupportClose.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Support transaction accepted. Result of organizationSupportClose.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportSubmission"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/SupportInvalid"
          },
          "401": {
            "$ref": "#/components/responses/SupportUnauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/SupportForbidden"
          },
          "404": {
            "$ref": "#/components/responses/SupportMissing"
          },
          "409": {
            "$ref": "#/components/responses/SupportConflict"
          },
          "413": {
            "$ref": "#/components/responses/SupportTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/SupportLimited"
          },
          "503": {
            "$ref": "#/components/responses/SupportUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CloseSupportTicketRequest"
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{org}/support/tickets/{ticket}/reopen": {
      "post": {
        "tags": [
          "support"
        ],
        "operationId": "organizationSupportReopen",
        "summary": "Reopen organization support case workflow",
        "description": "Organization support reopen operation. Responses omit private notes, staff queues and engineering details. Writes require current verified access, the expected revision where applicable, and a UUID idempotency key.",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "description": "Organization slug; current owner or administrator membership is required. This parameter belongs to organizationSupportReopen.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ticket",
            "in": "path",
            "required": true,
            "description": "Support case UUID in this scope. This parameter belongs to organizationSupportReopen.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Client-generated UUID bound permanently to the actor, operation, resource and JSON request. Reuse it for retries. This parameter belongs to organizationSupportReopen.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Support transaction accepted. Result of organizationSupportReopen.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportSubmission"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/SupportInvalid"
          },
          "401": {
            "$ref": "#/components/responses/SupportUnauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/SupportForbidden"
          },
          "404": {
            "$ref": "#/components/responses/SupportMissing"
          },
          "409": {
            "$ref": "#/components/responses/SupportConflict"
          },
          "413": {
            "$ref": "#/components/responses/SupportTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/SupportLimited"
          },
          "503": {
            "$ref": "#/components/responses/SupportUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReopenSupportTicketRequest"
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{org}/support/tickets/{ticket}/satisfaction": {
      "get": {
        "tags": [
          "support"
        ],
        "operationId": "organizationSupportSurvey",
        "summary": "Survey organization support case workflow",
        "description": "Organization support survey operation. Responses omit private notes, staff queues and engineering details. Writes require current verified access, the expected revision where applicable, and a UUID idempotency key.",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "description": "Organization slug; current owner or administrator membership is required. This parameter belongs to organizationSupportSurvey.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ticket",
            "in": "path",
            "required": true,
            "description": "Support case UUID in this scope. This parameter belongs to organizationSupportSurvey.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current scoped support records. Result of organizationSupportSurvey.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportSatisfaction"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/SupportInvalid"
          },
          "401": {
            "$ref": "#/components/responses/SupportUnauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/SupportForbidden"
          },
          "404": {
            "$ref": "#/components/responses/SupportMissing"
          },
          "409": {
            "$ref": "#/components/responses/SupportConflict"
          },
          "413": {
            "$ref": "#/components/responses/SupportTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/SupportLimited"
          },
          "503": {
            "$ref": "#/components/responses/SupportUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "post": {
        "tags": [
          "support"
        ],
        "operationId": "organizationSupportRate",
        "summary": "Rate organization support case workflow",
        "description": "Organization support rate operation. Responses omit private notes, staff queues and engineering details. Writes require current verified access, the expected revision where applicable, and a UUID idempotency key.",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "description": "Organization slug; current owner or administrator membership is required. This parameter belongs to organizationSupportRate.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ticket",
            "in": "path",
            "required": true,
            "description": "Support case UUID in this scope. This parameter belongs to organizationSupportRate.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Client-generated UUID bound permanently to the actor, operation, resource and JSON request. Reuse it for retries. This parameter belongs to organizationSupportRate.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Support transaction accepted. Result of organizationSupportRate.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SupportSatisfactionSubmission"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/SupportInvalid"
          },
          "401": {
            "$ref": "#/components/responses/SupportUnauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/SupportForbidden"
          },
          "404": {
            "$ref": "#/components/responses/SupportMissing"
          },
          "409": {
            "$ref": "#/components/responses/SupportConflict"
          },
          "413": {
            "$ref": "#/components/responses/SupportTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/SupportLimited"
          },
          "503": {
            "$ref": "#/components/responses/SupportUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SupportSatisfactionRequest"
              }
            }
          }
        }
      }
    },
    "/v1/project-migrations": {
      "post": {
        "operationId": "createProjectMigration",
        "tags": [
          "projects"
        ],
        "summary": "Save and apply a reviewed multi-service migration",
        "description": "Save and apply a reviewed multi-service migration. Source-backed HTTP and GraphQL services only. Secret values are request-only; the receipt retains key names. Existing reconcile, sealing, deployment admission, verification and cutover owners remain authoritative. No domain or production traffic changes are performed by this endpoint.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Save and apply a reviewed multi-service migration result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectMigration"
                }
              }
            }
          },
          "default": {
            "description": "Save and apply a reviewed multi-service migration error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateProjectMigrationRequest"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listProjectMigrations",
        "tags": [
          "projects"
        ],
        "summary": "List saved project migrations for the authenticated account",
        "description": "List saved project migrations for the authenticated account. Source-backed HTTP and GraphQL services only. Secret values are request-only; the receipt retains key names. Existing reconcile, sealing, deployment admission, verification and cutover owners remain authoritative. No domain or production traffic changes are performed by this endpoint.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "List saved project migrations for the authenticated account result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectMigrationList"
                }
              }
            }
          },
          "default": {
            "description": "List saved project migrations for the authenticated account error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "project",
            "in": "query",
            "description": "Optional exact project slug to filter migration records.",
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/v1/project-migrations/{migration}": {
      "get": {
        "operationId": "getProjectMigration",
        "tags": [
          "projects"
        ],
        "summary": "Inspect each reserved deployment and its recorded verification and cutover",
        "description": "Inspect each reserved deployment and its recorded verification and cutover. Source-backed HTTP and GraphQL services only. Secret values are request-only; the receipt retains key names. Existing reconcile, sealing, deployment admission, verification and cutover owners remain authoritative. No domain or production traffic changes are performed by this endpoint.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Inspect each reserved deployment and its recorded verification and cutover result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectMigration"
                }
              }
            }
          },
          "default": {
            "description": "Inspect each reserved deployment and its recorded verification and cutover error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "migration",
            "in": "path",
            "required": true,
            "description": "Creator-owned migration journal UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ]
      }
    },
    "/v1/project-migrations/{migration}/resume": {
      "post": {
        "operationId": "resumeProjectMigration",
        "tags": [
          "projects"
        ],
        "summary": "Resume unfinished migration services while preserving accepted deployments",
        "description": "Resume unfinished migration services while preserving accepted deployments. Source-backed HTTP and GraphQL services only. Secret values are request-only; the receipt retains key names. Existing reconcile, sealing, deployment admission, verification and cutover owners remain authoritative. No domain or production traffic changes are performed by this endpoint.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Resume unfinished migration services while preserving accepted deployments result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectMigration"
                }
              }
            }
          },
          "default": {
            "description": "Resume unfinished migration services while preserving accepted deployments error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResumeProjectMigrationRequest"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "migration",
            "in": "path",
            "required": true,
            "description": "Saved migration to resume after reviewing unfinished services.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ]
      }
    },
    "/v1/apps/{slug}/migration-cutovers": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listMigrationCutovers",
        "summary": "List saved production cutover plans.",
        "description": "Return the latest app-owned production switch plans, newest first. Revalidate\ndeployment, configuration and domain binding evidence without starting network\nprobes. Up to twenty plans are retained; terminal plans may be pruned after\nninety days. Requires app read scope and MFA.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Latest retained plans with current deployment and binding validity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MigrationCutoverList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "createMigrationCutover",
        "summary": "Prepare a production switch without changing traffic.",
        "description": "Save a plan for a currently passed default-scope verification. Supply a stable\ncaller UUID, production hostname, previous routing records and TTLs, previous\nproxy setting and traffic budgets. Reusing an ID returns its original intent;\nchanged intent conflicts. Preparation edits no DNS, domain binding, rollout,\ndefault hostname or monitor policy. Connect the domain through the existing\ndomain API before starting checks. Requires deployment write scope, verified\nemail and MFA.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "New or replayed immutable production switch plan; traffic remains unchanged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MigrationCutover"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateMigrationCutoverRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/migration-cutovers/{plan}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "plan",
          "in": "path",
          "required": true,
          "description": "Identity of the retained production switch to inspect.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getMigrationCutover",
        "summary": "Read a saved production cutover plan.",
        "description": "Read one saved production switch and its original DNS recovery settings.\nChanged source verification, deployment configuration or domain binding blocks\nits evidence. Reads perform no HTTP or DNS probes. Requires app read scope\nand MFA; a blocked plan retains its previous-provider routing instructions.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Requested plan, saved recovery settings and validity of its evidence.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MigrationCutover"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/migration-cutovers/{plan}/actions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "plan",
          "in": "path",
          "required": true,
          "description": "Identity of the production switch receiving this explicit action.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "actOnMigrationCutover",
        "summary": "Start checks, complete a switch or record recovery.",
        "description": "start_checks explicitly arms thirty minutes of durable server checks after\ndomain connection and a customer DNS change. Complete performs fresh DNS,\ntrusted TLS and exact deployment response checks through the published Gregale\nedge, refuses sustained traffic budget violations and requires acknowledgement\nfor limited coverage. Cancel stops checking only. confirm_restored records\na customer attestation after manually restoring the saved provider routing,\nTTL and proxy settings. No action edits external DNS or monitor policies.\nRequires deployment write scope, verified email and MFA.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Updated cutover progress or customer acknowledgement of manual recovery.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MigrationCutover"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MigrationCutoverActionRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/migration-verifications": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listMigrationVerifications",
        "summary": "List saved migration verification reports.",
        "description": "Return the latest twenty app-owned migration reports, newest first.\nEach report is checked against the current deployment and scoped runtime\nconfiguration; changed evidence is blocked. Reading never starts work.\nRequires app read scope and MFA. Old reports are pruned after thirty\ndays on subsequent creation; no connection values or response bodies\nare returned.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Latest retained migration reports with current validity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MigrationVerificationList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "createMigrationVerification",
        "summary": "Start a resumable migration verification.",
        "description": "Save immutable checks for the current public HTTP deployment with all\nGregale traffic. Supply a stable caller-generated UUID to reconcile\nresponse loss. Creation queues durable background execution; clients\nmay close while the API worker drives checks. Cold-wake consent permits briefly parking this Gregale\napp while production remains on the previous provider. One unfinished,\nrun per app, including cancellation/recovery, and a ten-minute checking deadline. Requires deployment\nwrite scope, verified email and MFA. Checks select saved environment\nnames; credentials are resolved only inside task guests.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateMigrationVerificationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Original or newly saved verification intent and receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MigrationVerification"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/migration-verifications/{run}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "run",
          "in": "path",
          "required": true,
          "description": "Receipt UUID to inspect.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getMigrationVerification",
        "summary": "Read a migration verification and current configuration validity.",
        "description": "Read one owned receipt and re-evaluate deployment/configuration validity.\nPassed evidence becomes blocked when recorded inputs change. Reads never\nadvance checks, park an app or request a wake. Requires app read scope\nand MFA. This is the recovery operation after an uncertain advance.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Owned verification status and current evidence validity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MigrationVerification"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/migration-verifications/{run}/advance": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "run",
          "in": "path",
          "required": true,
          "description": "Receipt UUID to advance.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "advanceMigrationVerification",
        "summary": "Advance one saved migration verification step.",
        "description": "Advance one leased step of an existing migration receipt. Dependency\ntasks and their IDs commit atomically. Startup and post-wake HTTP checks\nrequire a successful exact-deployment gateway response proof. Cold wake\nwaits for zero active instances and a running instance with the saved\nwake identity. Replays preserve task IDs and wake correlation. The\nserver worker continues pending runs independently of clients and\nresumes after restart. This operation is an optional compatibility\naction; clients normally poll GET. Cancelled, expired or invalidated\nruns stop tasks and restore a service they may have parked before\nbecoming terminal. Recovery retries continue beyond the checking deadline.\nRequires deployment write scope, verified email and MFA. Changed inputs\nblock qualification; infrastructure errors preserve resumable progress.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Journaled progress after one bounded verification step.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MigrationVerification"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/migration-verifications/{run}/cancel": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "run",
          "in": "path",
          "required": true,
          "description": "Receipt UUID to cancel.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "cancelMigrationVerification",
        "summary": "Cancel saved migration checks and recover a parked service.",
        "description": "Persist idempotent cancellation intent. An active worker lease remains\nfenced until its bounded step ends or the lease expires. No further\nchecks can commit after cancellation. Background cleanup cancels saved\ntasks and restores the same deployment if this run may have parked it.\nStatus remains pending while cleanup runs; recovery_status describes\nrestoration, supersession by another deployment or an account/security\nblock. A wake notification alone never means service was restored.\nCompleted runs are unchanged. Requires deployment write scope, verified\nemail and MFA; remains available when task admission is disabled.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Saved cancellation intent or the unchanged terminal report.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MigrationVerification"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/projects/apply-plan": {
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "applyCachedProjectPlan",
        "summary": "Deploy an account-owned reviewed project source without another upload.",
        "description": "Applies the exact archive retained by a project scan, not the current\nhead of a mutable Git ref. The normal scanner and apply admission gates\nrun again. The account-scoped source expires after one hour; rescan on\npreview_expired. Initial secrets require secrets:write or admin and are\nsealed before any deployment is enqueued. Failed configuration starts\nno builds; saved apps and any completed configuration remain available\nfor correction. Values are never included in responses or scan plans.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplyCachedProjectPlanRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Project applied with per-workload deployment receipts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplyResponse"
                }
              }
            }
          },
          "403": {
            "description": "The caller lacks deployment or secret write permission.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The plan is stale, blocked, or requires environment approval.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "The account-owned reviewed source expired; scan again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/alerts/{id}/mcp-readiness-pagerduty-acknowledgements": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Application owning the PagerDuty acknowledgement subscription.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Readiness rule receiving signed PagerDuty acknowledgements.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "mcp"
        ],
        "operationId": "getMCPReadinessPagerDutyAcknowledgements",
        "summary": "Read masked PagerDuty webhook acknowledgement settings",
        "parameters": [
          {
            "name": "destination",
            "in": "query",
            "description": "Select an independent primary or fallback binding. Omit to read the binding owning the original callback URL.",
            "schema": {
              "type": "string",
              "enum": [
                "primary",
                "fallback"
              ]
            }
          }
        ],
        "description": "Read scope and MFA required. Version zero is disabled. The stable relative webhook path is returned before configuration; concatenate it with the trusted API origin when creating the PagerDuty v3 subscription.",
        "responses": {
          "200": {
            "description": "Current masked acknowledgement webhook binding",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPReadinessPagerDutyAcknowledgementPolicy"
                }
              }
            }
          },
          "400": {
            "description": "Invalid getMCPReadinessPagerDutyAcknowledgements parameters or body"
          },
          "401": {
            "description": "Authentication required for getMCPReadinessPagerDutyAcknowledgements"
          },
          "403": {
            "description": "Insufficient scope or MFA for getMCPReadinessPagerDutyAcknowledgements"
          },
          "404": {
            "description": "No owned rule for getMCPReadinessPagerDutyAcknowledgements"
          }
        }
      },
      "put": {
        "tags": [
          "mcp"
        ],
        "operationId": "setMCPReadinessPagerDutyAcknowledgements",
        "summary": "Configure signed PagerDuty acknowledgement sync",
        "description": "Admin scope and MFA required. Enable with the selected primary or fallback native PagerDuty version, service ID and write-only v3 subscription signing secret. Destination defaults to primary; fallback requires expected_fallback_version instead of expected_pagerduty_version and matches only incidents with activated fallback. The server binds the native receiver fingerprint and region. Only the supplied current signing secret is accepted; use a fresh secret to rotate credentials. Each destination has independent secrets and policy versions. Saving one leaves the other unchanged. Disabling clears only the selected destination credentials immediately; when destination is omitted on disable, the original callback binding is selected. Signed acknowledgements stop reminders only for a matching pinned incident. Optional sync_unacknowledgements accepts signed incident.unacknowledged events. Reminders resume within the existing interval and budget only after every tracked provider acknowledgement clears. Existing untracked or manual acknowledgements require local release. Monitoring and recovery remain driven by readiness probes.",
        "requestBody": {
          "required": true,
          "description": "Complete replacement of the signed acknowledgement binding and credential.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetMCPReadinessPagerDutyAcknowledgementsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved acknowledgement webhook binding with its new version",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPReadinessPagerDutyAcknowledgementPolicy"
                }
              }
            }
          },
          "400": {
            "description": "Invalid setMCPReadinessPagerDutyAcknowledgements parameters or body"
          },
          "401": {
            "description": "Authentication required for setMCPReadinessPagerDutyAcknowledgements"
          },
          "403": {
            "description": "Insufficient scope or MFA for setMCPReadinessPagerDutyAcknowledgements"
          },
          "404": {
            "description": "No owned rule for setMCPReadinessPagerDutyAcknowledgements"
          },
          "409": {
            "description": "Webhook policy or selected receiver version changed; reload both bindings"
          }
        }
      }
    },
    "/v1/apps/{slug}/alerts/{id}/mcp-readiness-pagerduty-acknowledgements/events": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Application owning PagerDuty acknowledgement receipts.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Readiness rule whose provider acknowledgement history is listed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "mcp"
        ],
        "operationId": "listMCPReadinessPagerDutyAcknowledgementEvents",
        "summary": "Inspect PagerDuty acknowledgement event receipts",
        "description": "Read scope and MFA required. Bounded immutable provider decisions ordered by receipt time and ID; raw webhook bodies, signatures, credentials and actor details are never retained.",
        "parameters": [
          {
            "name": "before",
            "in": "query",
            "description": "Exclusive opaque cursor from the preceding provider event page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum provider event receipts in this page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retained provider acknowledgement event page",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPReadinessPagerDutyAcknowledgementEvents"
                }
              }
            }
          },
          "400": {
            "description": "Invalid listMCPReadinessPagerDutyAcknowledgementEvents parameters or body"
          },
          "401": {
            "description": "Authentication required for listMCPReadinessPagerDutyAcknowledgementEvents"
          },
          "403": {
            "description": "Insufficient scope or MFA for listMCPReadinessPagerDutyAcknowledgementEvents"
          },
          "404": {
            "description": "No owned rule for listMCPReadinessPagerDutyAcknowledgementEvents"
          }
        }
      }
    },
    "/v1/apps/{slug}/alerts/{id}/mcp-readiness-pagerduty": {
      "parameters": [
        {
          "name": "slug",
          "description": "Application owning the native PagerDuty configuration.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "id",
          "description": "Readiness webhook rule whose selected native PagerDuty receiver is configured.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "mcp"
        ],
        "operationId": "getMCPReadinessPagerDuty",
        "summary": "Inspect masked PagerDuty readiness configuration",
        "description": "Read scope and MFA required. Version zero is unconfigured and uses webhook primary. Integration keys and fingerprints are never returned. Only owned application readiness webhook rules are supported, including disabled rules.",
        "responses": {
          "200": {
            "description": "Current masked PagerDuty primary receiver policy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPReadinessPagerDutyPolicy"
                }
              }
            }
          },
          "400": {
            "description": "Invalid PagerDuty rule identifier or unsupported query parameters"
          },
          "401": {
            "description": "Authenticate to read native PagerDuty settings"
          },
          "403": {
            "description": "Native PagerDuty reads require read scope and MFA"
          },
          "404": {
            "description": "No owned readiness rule matches the PagerDuty configuration request"
          }
        }
      },
      "put": {
        "tags": [
          "mcp"
        ],
        "operationId": "setMCPReadinessPagerDuty",
        "summary": "Configure native PagerDuty primary delivery",
        "description": "Admin scope and MFA required. Enable using a write-only 32-character Events API v2 integration key for the selected US or EU endpoint (US by default). Configuration is pinned at an incident's first delivery attempt; changes and disabling affect unattempted incidents. Existing pinned receivers continue receiving recovery. Webhook and distinct native PagerDuty fallback remain available. Keys are encrypted with a dedicated namespace. Upgrade all readiness evaluators before enabling. PagerDuty acceptance does not confirm paging. A separate signed acknowledgement webhook policy can synchronize operator acknowledgement.",
        "requestBody": {
          "required": true,
          "description": "Complete PagerDuty configuration replacement fenced by its current version.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetMCPReadinessPagerDutyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated version and masked PagerDuty integration configuration",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPReadinessPagerDutyPolicy"
                }
              }
            }
          },
          "400": {
            "description": "Invalid PagerDuty key or versioned replacement settings"
          },
          "401": {
            "description": "Authenticate before replacing the native PagerDuty receiver"
          },
          "403": {
            "description": "PagerDuty configuration writes require admin scope and MFA"
          },
          "404": {
            "description": "Requested PagerDuty rule does not belong to this application"
          },
          "409": {
            "description": "PagerDuty policy version changed; reload its current configuration"
          }
        }
      }
    },
    "/v1/apps/{slug}/alerts/{id}/mcp-readiness-reminder-defaults": {
      "parameters": [
        {
          "name": "slug",
          "description": "Application owning the reminder defaults rule.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "id",
          "description": "Readiness webhook rule whose future incidents inherit reminders.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "mcp"
        ],
        "operationId": "getMCPReadinessReminderDefaults",
        "summary": "Read rule reminder defaults",
        "description": "Read scope and MFA required. Returns version zero and a disabled policy when unconfigured. Current settings apply only when an incident opens; existing incidents retain their captured policy and overrides. Only MCP readiness webhook rules support defaults.",
        "responses": {
          "200": {
            "description": "Current reminder defaults for future incidents",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPReadinessReminderDefaults"
                }
              }
            }
          },
          "400": {
            "description": "Invalid reminder defaults rule or query parameters"
          },
          "401": {
            "description": "Authenticate to inspect reminder defaults"
          },
          "403": {
            "description": "Reminder defaults inspection requires read scope and MFA"
          },
          "404": {
            "description": "Reminder defaults rule was not found in this application"
          }
        }
      },
      "put": {
        "tags": [
          "mcp"
        ],
        "operationId": "setMCPReadinessReminderDefaults",
        "summary": "Replace reminder defaults for future incidents",
        "description": "Admin scope and MFA required. Expected version fences configuration changes; zero is valid when unconfigured. A zero interval and zero budget disable defaults. Enabled policies use a 60–86400 second interval and 1–10 lifetime reminders per incident. Changes never alter existing incidents or reset their reminder budget. New incidents capture the policy and version atomically when they open. Upgrade all readiness evaluators before enabling defaults.",
        "requestBody": {
          "description": "Current defaults version and complete replacement reminder policy.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetMCPReadinessReminderDefaultsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Versioned replacement of rule reminder defaults",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPReadinessReminderDefaults"
                }
              }
            }
          },
          "400": {
            "description": "Invalid defaults interval or lifetime reminder budget"
          },
          "401": {
            "description": "Authenticate before replacing reminder defaults"
          },
          "403": {
            "description": "Reminder defaults changes require admin scope and MFA"
          },
          "404": {
            "description": "Target reminder defaults rule is not owned by this application"
          },
          "409": {
            "description": "Reminder defaults version changed; refresh the current configuration"
          }
        }
      }
    },
    "/v1/apps/{slug}/alerts/{id}/mcp-readiness-fallback": {
      "parameters": [
        {
          "name": "slug",
          "description": "Application that owns the readiness webhook rule.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "id",
          "description": "Readiness webhook alert rule UUID.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "mcp"
        ],
        "operationId": "getMCPReadinessFallback",
        "summary": "Inspect a readiness fallback destination policy",
        "description": "Read scope and MFA required. Returns version zero and disabled when unconfigured. Signing credentials are masked. The policy applies when an incident first claims delivery; existing incident receiver URLs stay pinned.",
        "responses": {
          "200": {
            "description": "Current masked readiness fallback policy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPReadinessFallbackPolicy"
                }
              }
            }
          },
          "400": {
            "description": "Invalid fallback rule identifier or unsupported rule family"
          },
          "401": {
            "description": "Authenticate to inspect a fallback destination"
          },
          "403": {
            "description": "Fallback inspection requires read scope and MFA"
          },
          "404": {
            "description": "No owned application and readiness rule match this fallback lookup"
          }
        }
      },
      "put": {
        "tags": [
          "mcp"
        ],
        "operationId": "setMCPReadinessFallback",
        "summary": "Replace a readiness fallback destination policy",
        "description": "Admin scope and MFA required. expected_version fences concurrent edits. Enable selects webhook (default) with a distinct public HTTP(S) destination and signing secret, or PagerDuty with a separate integration key and optional US/EU region. Primary and fallback cannot select the same PagerDuty integration. Threshold counts completed failed primary dispatch claims per logical event. Changes apply to incidents not yet attempted; a new webhook secret for the same URL also supplies ongoing pinned deliveries. PagerDuty provider, region and integration identity stay pinned; credential re-encryption for the identical integration refreshes ongoing deliveries. Disabling affects new incidents; disable the alert rule to pause existing deliveries. Upgrade all evaluators before enabling fallback.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetMCPReadinessFallbackRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Replaced fallback policy with its incremented version",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPReadinessFallbackPolicy"
                }
              }
            }
          },
          "400": {
            "description": "Invalid fallback destination or failure threshold"
          },
          "401": {
            "description": "Authenticate to change readiness fallback delivery"
          },
          "403": {
            "description": "Changing fallback delivery requires admin scope and MFA"
          },
          "404": {
            "description": "Application or rule for the fallback change is not owned"
          },
          "409": {
            "description": "Fallback policy version changed; refresh before replacing it"
          },
          "503": {
            "description": "Fallback secret sealing or persistence is unavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/mcp-readiness-attention": {
      "get": {
        "tags": [
          "mcp"
        ],
        "operationId": "listMCPReadinessAttention",
        "summary": "List incident acknowledgement and reminder state",
        "description": "Read scope and MFA required. Lists open incidents by default in ascending incident UUID order. Environment filters include all-environment incidents. State is separate from readiness and notification delivery. The next reminder time is eligibility only; fresh matching unhealthy evidence and no outstanding notification for this incident are required.",
        "parameters": [
          {
            "name": "slug",
            "description": "Application owning the readiness incidents.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scope",
            "description": "Environment; omission includes every environment.",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "after",
            "description": "Incident UUID from next_after on the previous page.",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "description": "Maximum number of incidents in this page.",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "include_resolved",
            "description": "Include resolved incidents and their retained attention state.",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current attention state from a consistent snapshot",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPReadinessAttentionPage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid incident attention filters or cursor"
          },
          "401": {
            "description": "Authenticate to inspect incident attention"
          },
          "403": {
            "description": "Incident attention inspection requires read scope and MFA"
          },
          "404": {
            "description": "Application owning the incident attention was not found"
          }
        }
      }
    },
    "/v1/apps/{slug}/mcp-readiness-incidents/{id}/attention-actions": {
      "parameters": [
        {
          "name": "slug",
          "description": "Application owning this incident.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "id",
          "description": "Readiness incident UUID.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "mcp"
        ],
        "operationId": "listMCPReadinessAttentionHistory",
        "summary": "Read audited incident attention decisions",
        "description": "Read scope and MFA required. Immutable decisions ordered by creation time and request UUID descending. History remains available after resolution. Ordinary evaluator observations and reminder creation do not add operator decisions.",
        "parameters": [
          {
            "name": "before",
            "description": "Opaque next_before cursor from the previous history page.",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "description": "Maximum number of retained attention decisions in this page.",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retained incident attention decisions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPReadinessAttentionHistory"
                }
              }
            }
          },
          "400": {
            "description": "Invalid incident attention history cursor"
          },
          "401": {
            "description": "Authenticate to read incident attention history"
          },
          "403": {
            "description": "Incident attention history requires read scope and MFA"
          },
          "404": {
            "description": "Attention history incident was not found in this application"
          }
        }
      },
      "post": {
        "tags": [
          "mcp"
        ],
        "operationId": "actMCPReadinessAttention",
        "summary": "Acknowledge an incident or configure finite reminders",
        "description": "Admin scope and MFA required. New decisions require an open readiness webhook incident and its current attention version. Disabled rules may be configured but cannot create or deliver reminders. Identical app-scoped request UUID retries return their durable receipt even after expiry or recovery; changed requests conflict. Acknowledgement only prevents reminder creation and suppresses unleased reminders. In-flight delivery may finish. Initial failure and recovery notifications retain their behavior. Reminders inherit optional rule defaults at incident opening and may be overridden per incident. Their lifetime creation budget never resets. Configure zero interval and zero budget to disable. Absolute acknowledgement expiry must be in the future and no more than 30 days away; omission acknowledges indefinitely. Native paging and fallback destinations are not configured here.",
        "requestBody": {
          "description": "Version-fenced decision with a stable idempotency UUID and retained reason.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MCPReadinessAttentionAction"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Original durable incident attention receipt",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPReadinessAttentionReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid acknowledgement expiry or reminder policy"
          },
          "401": {
            "description": "Authenticate before changing incident attention"
          },
          "403": {
            "description": "Incident attention decisions require admin scope and MFA"
          },
          "404": {
            "description": "Incident for this attention decision was not found"
          },
          "409": {
            "description": "Incident resolved or version or idempotency request changed"
          }
        }
      }
    },
    "/v1/apps/{slug}/mcp-readiness-notifications": {
      "get": {
        "tags": [
          "mcp"
        ],
        "operationId": "listMCPReadinessNotificationQueues",
        "summary": "Inspect readiness notification queue health",
        "description": "Read scope and MFA required. Returns a consistent snapshot ordered by rule UUID. Environment filters include all-environment rules with their whole queue so a blocking head is visible. Counts exclude delivered, suppressed and abandoned events. Maintenance is reported without mutating queued events.",
        "parameters": [
          {
            "name": "slug",
            "description": "Application whose readiness notification queues are inspected.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scope",
            "description": "Environment filter; omitted includes every rule and all-environment rules always remain visible.",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 40
            }
          },
          {
            "name": "after",
            "description": "Rule UUID returned as next_after on the preceding queue page.",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "description": "Maximum readiness notification queues per page.",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Snapshot of readiness notification delivery queues",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPReadinessNotificationQueues"
                }
              }
            }
          },
          "400": {
            "description": "Invalid notification queue environment or rule cursor"
          },
          "401": {
            "description": "Authenticate to inspect readiness notification delivery"
          },
          "403": {
            "description": "Queue inspection requires read scope and completed MFA"
          },
          "404": {
            "description": "Application for notification queue inspection was not found"
          }
        }
      }
    },
    "/v1/apps/{slug}/mcp-readiness-notifications/actions": {
      "post": {
        "tags": [
          "mcp"
        ],
        "operationId": "actMCPReadinessNotification",
        "summary": "Retry or abandon a readiness receiver or event",
        "description": "Admin scope and MFA required. With destination supplied the action changes only that receiver head and preserves other receivers. Omit destination to act on the oldest whole event. Retry makes a failed or expired-lease head eligible on the next evaluator pass. Abandon permanently stops the selected deliveries while retaining incident history. Actions recheck the selected queue order and lease plus rule enablement and maintenance. The shared event version fences stale requests. Reusing a request ID with the identical payload including destination returns the durable receipt; changed payload conflicts. A receipt confirms the decision rather than webhook delivery.",
        "parameters": [
          {
            "name": "slug",
            "description": "Application owning the notification recovery decision.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "Stable request ID, current head version and retained operator reason.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MCPReadinessNotificationAction"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Original durable notification recovery receipt",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPReadinessNotificationReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid notification recovery request or operator reason"
          },
          "401": {
            "description": "Authenticate before requesting notification recovery"
          },
          "403": {
            "description": "Notification recovery requires admin scope and completed MFA"
          },
          "404": {
            "description": "Recovery event does not belong to the requested application"
          },
          "409": {
            "description": "Queue head changed or recovery is prevented by its current state"
          }
        }
      }
    },
    "/v1/apps/{slug}/mcp-readiness-maintenance": {
      "parameters": [
        {
          "name": "slug",
          "description": "Application owning the maintenance window history.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "mcp"
        ],
        "operationId": "listMCPReadinessMaintenance",
        "summary": "List readiness maintenance windows for an environment",
        "description": "Newest created first, including expired and cancelled windows. Read scope and MFA required.",
        "parameters": [
          {
            "name": "scope",
            "description": "Exact environment whose maintenance windows are listed.",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "default",
              "maxLength": 40
            }
          },
          {
            "name": "before",
            "description": "Opaque maintenance-history cursor returned as next_before.",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 160
            }
          },
          {
            "name": "limit",
            "description": "Maximum number of maintenance windows in the response.",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Maintenance window history",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPReadinessMaintenancePage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid maintenance environment or history cursor"
          },
          "401": {
            "description": "Authenticate to read maintenance window history"
          },
          "403": {
            "description": "Maintenance history requires read scope and MFA"
          },
          "404": {
            "description": "Application for maintenance history was not found"
          }
        }
      },
      "post": {
        "tags": [
          "mcp"
        ],
        "operationId": "createMCPReadinessMaintenance",
        "summary": "Schedule maintenance or temporarily silence readiness notifications",
        "description": "Admin scope and MFA required. Monitoring and incident recording continue. Windows match exact environments and end automatically. An omitted start begins now; duration is at most 720 hours. Notifications already claimed may complete.",
        "requestBody": {
          "description": "Environment, finite time interval and reason for notification muting.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateMCPReadinessMaintenanceRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Scheduled maintenance window",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPReadinessMaintenanceWindow"
                }
              }
            }
          },
          "400": {
            "description": "Invalid maintenance start, end, environment or reason"
          },
          "401": {
            "description": "Authenticate before scheduling a maintenance window"
          },
          "403": {
            "description": "Scheduling maintenance requires admin scope and MFA"
          },
          "404": {
            "description": "Application for the new maintenance window was not found"
          }
        }
      }
    },
    "/v1/apps/{slug}/mcp-readiness-maintenance/{id}/cancel": {
      "post": {
        "tags": [
          "mcp"
        ],
        "operationId": "cancelMCPReadinessMaintenance",
        "summary": "Cancel a readiness maintenance window",
        "description": "Admin scope and MFA required. Cancellation preserves the window and original cancellation attribution. Other overlapping windows remain effective.",
        "parameters": [
          {
            "name": "slug",
            "description": "Application owning the window to cancel.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "description": "UUID of the retained maintenance window.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "description": "Reason retained with the original cancellation attribution.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelMCPReadinessMaintenanceRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Cancelled window, including attribution",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPReadinessMaintenanceWindow"
                }
              }
            }
          },
          "400": {
            "description": "Invalid maintenance window ID or cancellation reason"
          },
          "401": {
            "description": "Authenticate before cancelling a maintenance window"
          },
          "403": {
            "description": "Cancelling maintenance requires admin scope and MFA"
          },
          "404": {
            "description": "Maintenance window does not belong to the requested application"
          },
          "409": {
            "description": "The maintenance window ended before cancellation"
          }
        }
      }
    },
    "/v1/apps/{slug}/mcp-readiness-incidents": {
      "get": {
        "operationId": "listMCPReadinessIncidents",
        "summary": "List readiness incident events and notification status",
        "description": "Newest logical events first, independently of notification success. Retries update delivery status without adding timeline rows. Omitting scope lists every environment.",
        "parameters": [
          {
            "name": "slug",
            "description": "Application owning the requested readiness incident history.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scope",
            "description": "Exact environment selected for readiness incident history. Omission selects default.",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 40,
              "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
            }
          },
          {
            "name": "before",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 160
            },
            "description": "Opaque keyset cursor returned as next_before."
          },
          {
            "name": "limit",
            "description": "Maximum number of entries returned in this readiness incident history page.",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded incident event timeline",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPReadinessIncidentTimeline"
                }
              }
            }
          },
          "400": {
            "description": "Invalid environment or cursor"
          },
          "401": {
            "description": "Authenticate to list retained MCP readiness incident events."
          },
          "403": {
            "description": "Read scope and MFA required"
          },
          "404": {
            "description": "Owned app not found"
          }
        }
      }
    },
    "/v1/apps/{slug}/mcp-readiness-policy/history": {
      "parameters": [
        {
          "name": "slug",
          "description": "Application owning the requested readiness policy revision history.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "scope",
          "description": "Exact environment selected for readiness policy revision history. Omission selects default.",
          "in": "query",
          "required": false,
          "schema": {
            "type": "string",
            "maxLength": 40,
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
          }
        }
      ],
      "get": {
        "operationId": "listMCPReadinessPolicyHistory",
        "summary": "List recent policy revisions for one environment",
        "responses": {
          "200": {
            "description": "Readiness policy result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPReadinessPolicyHistory"
                }
              }
            }
          },
          "400": {
            "description": "Invalid scope, cursor, revisions or reason"
          },
          "404": {
            "description": "Owned app or scoped revision not found"
          },
          "409": {
            "description": "Current policy revision changed"
          }
        },
        "parameters": [
          {
            "name": "before_revision",
            "description": "Revision cursor returned by the preceding policy-history page.",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
            }
          },
          {
            "name": "limit",
            "description": "Maximum number of entries returned in this readiness policy revision history page.",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          }
        ]
      }
    },
    "/v1/apps/{slug}/mcp-readiness-policy/history/{revision}": {
      "parameters": [
        {
          "name": "slug",
          "description": "Application owning the requested one historical readiness policy revision.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "scope",
          "description": "Exact environment selected for one historical readiness policy revision. Omission selects default.",
          "in": "query",
          "required": false,
          "schema": {
            "type": "string",
            "maxLength": 40,
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
          }
        },
        {
          "name": "revision",
          "description": "Historical policy revision UUID selected for one historical readiness policy revision.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
          }
        }
      ],
      "get": {
        "operationId": "getMCPReadinessPolicyRevision",
        "summary": "Read one immutable environment policy revision",
        "responses": {
          "200": {
            "description": "Configuration and audit context for the requested historical policy revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPReadinessPolicy"
                }
              }
            }
          },
          "400": {
            "description": "The historical policy revision or its environment is invalid."
          },
          "404": {
            "description": "The requested historical policy revision was not found for this application."
          },
          "409": {
            "description": "The requested historical revision conflicts with current readiness state."
          }
        }
      }
    },
    "/v1/apps/{slug}/mcp-readiness-policy/diff": {
      "parameters": [
        {
          "name": "slug",
          "description": "Application owning the requested readiness policy revision comparison.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "scope",
          "description": "Exact environment selected for readiness policy revision comparison. Omission selects default.",
          "in": "query",
          "required": false,
          "schema": {
            "type": "string",
            "maxLength": 40,
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
          }
        }
      ],
      "get": {
        "operationId": "diffMCPReadinessPolicy",
        "summary": "Compare configuration between two revisions; omitted to_revision selects current",
        "responses": {
          "200": {
            "description": "Field changes between the selected readiness policy revisions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPReadinessPolicyDiff"
                }
              }
            }
          },
          "400": {
            "description": "Invalid policy comparison environment or revision pair."
          },
          "404": {
            "description": "A policy selected for comparison was not found for this application."
          },
          "409": {
            "description": "Policy comparison could not use the expected current revision."
          }
        },
        "parameters": [
          {
            "name": "from_revision",
            "description": "Historical readiness policy revision used as the comparison baseline.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
            }
          },
          {
            "name": "to_revision",
            "description": "Comparison policy revision UUID; omission compares against the current policy.",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
            }
          }
        ]
      }
    },
    "/v1/apps/{slug}/mcp-readiness-policy/history/{revision}/restore": {
      "parameters": [
        {
          "name": "slug",
          "description": "Application owning the requested readiness policy restoration.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "scope",
          "description": "Exact environment selected for readiness policy restoration. Omission selects default.",
          "in": "query",
          "required": false,
          "schema": {
            "type": "string",
            "maxLength": 40,
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
          }
        },
        {
          "name": "revision",
          "description": "Historical policy revision UUID selected for readiness policy restoration.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
          }
        }
      ],
      "post": {
        "operationId": "restoreMCPReadinessPolicy",
        "summary": "Restore historical configuration as a new audited revision requiring fresh probes",
        "responses": {
          "200": {
            "description": "New policy revision restored from the requested historical configuration.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPReadinessPolicy"
                }
              }
            }
          },
          "400": {
            "description": "Invalid policy restore environment, revision or audit reason."
          },
          "404": {
            "description": "The policy revision selected for restoration was not found."
          },
          "409": {
            "description": "The current readiness policy revision changed before restoration."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RestoreMCPReadinessPolicyRequest"
              }
            }
          }
        },
        "description": "Requires admin scope and applicable MFA. Expected revision must match the current policy in the same environment. Restores configuration only, validates current OAuth bindings and app applicability, and records a new revision, author, time, reason and restored_from. Existing evidence and emergency overrides cannot authorize traffic under the new revision."
      }
    },
    "/v1/apps/{slug}/mcp-readiness-policy": {
      "parameters": [
        {
          "name": "slug",
          "description": "Application owning the requested current environment readiness policy.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "scope",
          "in": "query",
          "required": false,
          "description": "Environment policy to select. Defaults to default; PUT body and query must agree.",
          "schema": {
            "type": "string",
            "maxLength": 40,
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
          }
        }
      ],
      "get": {
        "operationId": "getMCPReadinessPolicy",
        "summary": "Read the opt-in platform readiness promotion policy",
        "responses": {
          "200": {
            "description": "Readiness result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPReadinessPolicy"
                }
              }
            }
          },
          "404": {
            "description": "Owned application not found"
          }
        }
      },
      "put": {
        "operationId": "setMCPReadinessPolicy",
        "summary": "Administratively configure readiness with a revision CAS and audit reason",
        "description": "Requires admin scope and applicable MFA. Every update creates a new revision and invalidates prior readiness evidence only in the selected environment. Deploy candidates at zero traffic before probing.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetMCPReadinessPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Readiness policy configuration saved as a new environment revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPReadinessPolicy"
                }
              }
            }
          },
          "400": {
            "description": "Invalid policy"
          },
          "409": {
            "description": "Policy revision changed"
          }
        }
      }
    },
    "/v1/deployments/{id}/mcp-readiness": {
      "parameters": [
        {
          "name": "id",
          "description": "Deployment UUID selected for deployment readiness evidence and probes.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "operationId": "getMCPReadiness",
        "summary": "Read retained role evidence and emergency override audit for an owned deployment",
        "responses": {
          "200": {
            "description": "Retained policy-bound readiness evidence for the selected deployment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPReadinessSnapshot"
                }
              }
            }
          },
          "404": {
            "description": "Owned deployment not found"
          }
        }
      },
      "post": {
        "operationId": "probeMCPReadiness",
        "summary": "Run a server-side read-only role probe and retain revision-bound readiness evidence",
        "description": "Requires deploy write scope and applicable MFA. A failed probe is retained with passed=false. Raw client observations are never accepted. The endpoint is platform-generated; credentials and response bodies are not retained.",
        "parameters": [
          {
            "name": "MCP-Probe-Authorization",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 8192
            },
            "description": "Separate scoped MCP bearer token, never the platform API key."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MCPReadinessProbeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Readiness evidence recorded from the completed deployment probe.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPReadinessEvidence"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unconfigured role"
          },
          "404": {
            "description": "Owned deployment or configured probe role was not found."
          },
          "409": {
            "description": "Policy or deployment changed during probe"
          },
          "503": {
            "description": "Probe or evidence store unavailable"
          }
        }
      }
    },
    "/v1/deployments/{id}/mcp-readiness-overrides": {
      "parameters": [
        {
          "name": "id",
          "description": "Deployment UUID selected for audited deployment readiness overrides.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "operationId": "overrideMCPReadiness",
        "summary": "Create an audited five-minute readiness override for one traffic increase",
        "description": "Requires admin scope and applicable MFA. Bound to the current artifact and policy revision. Other admission guards remain enforced. Consumed atomically with a successful traffic mutation.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MCPReadinessOverrideRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Audited readiness override created for this deployment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPReadinessOverride"
                }
              }
            }
          },
          "404": {
            "description": "Owned live deployment not found"
          },
          "409": {
            "description": "Policy changed or is disabled"
          }
        }
      }
    },
    "/v1/mcp/admissions/{id}": {
      "get": {
        "operationId": "getMCPAdmissionReceipt",
        "summary": "Read a retained MCP admission receipt by evidence UUID",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Evidence UUID identifying the retained MCP admission receipt"
          }
        ],
        "responses": {
          "200": {
            "description": "Account-owned receipt",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPAdmissionEvidence"
                }
              }
            }
          },
          "404": {
            "description": "Receipt missing or owned by another account"
          }
        }
      }
    },
    "/v1/apps/{slug}/mcp-catalog-monitor": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "HTTP application whose catalog monitor is managed"
        }
      ],
      "get": {
        "operationId": "getMCPCatalogMonitor",
        "summary": "Read opt-in catalog monitoring state and retained transitions",
        "parameters": [
          {
            "name": "role",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_-]{0,31}$"
            },
            "description": "Independent reviewed authorization view; omit for default"
          },
          {
            "name": "all_roles",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "App summary of all roles; cannot combine with role or evidence"
          },
          {
            "name": "evidence",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Read one retained transition receipt"
          }
        ],
        "responses": {
          "200": {
            "description": "Configured snapshot, or an exact receipt when evidence is supplied",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/MCPCatalogMonitorSnapshot"
                    },
                    {
                      "$ref": "#/components/schemas/MCPCatalogReceipt"
                    },
                    {
                      "$ref": "#/components/schemas/MCPCatalogMonitorSummary"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Monitor or evidence unavailable to this account"
          }
        }
      },
      "put": {
        "operationId": "configureMCPCatalogMonitor",
        "summary": "Configure a reviewed role baseline and optional managed observer; secret binding also requires secrets-read scope",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MCPCatalogMonitorConfigRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Monitor revision; current observation is reset until this revision reports",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPCatalogMonitorSnapshot"
                }
              }
            }
          },
          "400": {
            "description": "Invalid complete baseline or freshness limit"
          },
          "404": {
            "description": "App unavailable to this account"
          }
        }
      }
    },
    "/v1/deployments/{id}/mcp-admissions": {
      "get": {
        "operationId": "listMCPAdmissionHistory",
        "summary": "Page retained MCP receipts newest first by audit sequence",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Deployment UUID whose admission receipts are listed"
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 50
            },
            "description": "Maximum number of matching admission receipts to return"
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Continuation cursor from the previous page"
          },
          {
            "name": "outcome",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "accepted",
                "rejected"
              ]
            },
            "description": "Filter receipts by the recorded admission outcome"
          }
        ],
        "responses": {
          "200": {
            "description": "Retained receipts; an omitted next_cursor means the end of matching history",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPAdmissionHistoryResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid UUID or pagination filter"
          },
          "404": {
            "description": "Deployment missing or owned by another account"
          }
        }
      }
    },
    "/v1/mcp-oauth-retirements": {
      "get": {
        "operationId": "listMCPOAuthRetirements",
        "summary": "Read administrator-only OAuth retirement history including deleted applications",
        "parameters": [
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000
            },
            "description": "Bounded history page offset"
          }
        ],
        "responses": {
          "200": {
            "description": "Up to fifty retirement records with sealed data omitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPOAuthRetirementsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid offset"
          },
          "403": {
            "description": "Administrator access required"
          }
        }
      }
    },
    "/v1/apps/{slug}/mcp-catalog-monitor/oauth": {
      "post": {
        "operationId": "mcpCatalogOAuth",
        "summary": "Begin, complete or disconnect guided OAuth for an observer role; requires deploy intent and secret-read permission",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application owning the OAuth connection"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MCPCatalogOAuthRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorization URL or completed connection state without token values",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPCatalogOAuthResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid connection request or unsuccessful authorization"
          },
          "403": {
            "description": "Missing connection permissions"
          },
          "404": {
            "description": "App or role unavailable to this account"
          },
          "409": {
            "description": "Expired, consumed or superseded authorization state"
          }
        }
      }
    },
    "/v1/mcp-oauth-retirements/{id}": {
      "post": {
        "operationId": "recoverMCPOAuthRetirement",
        "summary": "Retry retirement or record provider-side manual revocation; administrator access and MFA policy apply",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Account-owned retirement identifier"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MCPOAuthRetirementAction"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated public retirement status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPOAuthRetirement"
                }
              }
            }
          },
          "400": {
            "description": "Invalid recovery action or unavailable credentials"
          },
          "403": {
            "description": "Administrator access or MFA requirement not satisfied"
          },
          "404": {
            "description": "Retirement unavailable to this account"
          },
          "409": {
            "description": "Retirement is leased, terminal or expired"
          }
        }
      }
    },
    "/v1/mcp-connection-health": {
      "get": {
        "operationId": "getMCPConnectionHealth",
        "summary": "Account-wide MCP connection health and recovery guidance; administrator access required",
        "parameters": [
          {
            "name": "app",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Optional owned application slug"
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000
            },
            "description": "Issue page offset"
          }
        ],
        "responses": {
          "200": {
            "description": "Connection health metadata without credential values",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPConnectionHealthSnapshot"
                }
              }
            }
          },
          "400": {
            "description": "Invalid page offset"
          },
          "403": {
            "description": "Administrator scope required for the account connection inventory"
          },
          "404": {
            "description": "Application unavailable to this account"
          }
        }
      }
    },
    "/v1/apps/{slug}/mcp-catalog-monitor/observations": {
      "post": {
        "operationId": "reportMCPCatalogObservation",
        "summary": "Report an observed catalog or failed probe; requires metrics-write scope",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application receiving the catalog observation"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MCPCatalogObservationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Server-computed transition receipt; repeated unchanged observations reuse the receipt",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPCatalogReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid observation"
          },
          "404": {
            "description": "Monitor unavailable to this account"
          },
          "409": {
            "description": "Monitor disabled or baseline revision changed"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/publish-credentials": {
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "listRealtimePublisherCredentials",
        "summary": "Read publisher grant and usage metadata",
        "description": "Account/app-scoped publisher credential administration. Issuance/rotation/revocation require admin scope and MFA. Plaintext returned once; generic response caching is excluded. Revocation remains available when the endpoint or history preview is disabled.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for read publisher grant and usage metadata."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for read publisher grant and usage metadata."
          }
        ],
        "responses": {
          "200": {
            "description": "Operation result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RealtimePublisherCredential"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid payload or policy",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Invalid/expired/revoked/rotated credential",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Channel/event outside grant",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Endpoint or credential unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency content conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Publish rate or bounded receipt/credential capacity reached",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "issueRealtimePublisherCredential",
        "summary": "Issue a channel-scoped publisher credential",
        "description": "Issue a channel-scoped publisher credential. Account/app-scoped publisher credential administration. Issuance/rotation/revocation require admin scope and MFA. Plaintext returned once; generic response caching is excluded. Revocation remains available when the endpoint or history preview is disabled.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for issue a channel-scoped publisher credential."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for issue a channel-scoped publisher credential."
          }
        ],
        "responses": {
          "201": {
            "description": "Issue a channel-scoped publisher credential. Operation result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimePublisherCredentialIssued"
                }
              }
            }
          },
          "400": {
            "description": "Issue a channel-scoped publisher credential. Invalid payload or policy",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Issue a channel-scoped publisher credential. Invalid/expired/revoked/rotated credential",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Issue a channel-scoped publisher credential. Channel/event outside grant",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Issue a channel-scoped publisher credential. Endpoint or credential unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Issue a channel-scoped publisher credential. Idempotency content conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Issue a channel-scoped publisher credential. Publish rate or bounded receipt/credential capacity reached",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimePublisherCredentialRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/publish-credentials/{credential_id}/rotate": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "rotateRealtimePublisherCredential",
        "summary": "Rotate publisher secret while preserving scopes, quota and receipts",
        "description": "Rotate publisher secret while preserving scopes, quota and receipts. Account/app-scoped publisher credential administration. Issuance/rotation/revocation require admin scope and MFA. Plaintext returned once; generic response caching is excluded. Revocation remains available when the endpoint or history preview is disabled.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for rotate publisher secret while preserving scopes, quota and receipts."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for rotate publisher secret while preserving scopes, quota and receipts."
          },
          {
            "name": "credential_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Credential ID for rotate publisher secret while preserving scopes, quota and receipts."
          }
        ],
        "responses": {
          "200": {
            "description": "Rotate publisher secret while preserving scopes, quota and receipts. Operation result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimePublisherCredentialIssued"
                }
              }
            }
          },
          "400": {
            "description": "Rotate publisher secret while preserving scopes, quota and receipts. Invalid payload or policy",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Rotate publisher secret while preserving scopes, quota and receipts. Invalid/expired/revoked/rotated credential",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Rotate publisher secret while preserving scopes, quota and receipts. Channel/event outside grant",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Rotate publisher secret while preserving scopes, quota and receipts. Endpoint or credential unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Rotate publisher secret while preserving scopes, quota and receipts. Idempotency content conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rotate publisher secret while preserving scopes, quota and receipts. Publish rate or bounded receipt/credential capacity reached",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeWorkerCredentialRotationRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/publish-credentials/{credential_id}/revoke": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "revokeRealtimePublisherCredential",
        "summary": "Revoke a publisher credential",
        "description": "Revoke a publisher credential. Account/app-scoped publisher credential administration. Issuance/rotation/revocation require admin scope and MFA. Plaintext returned once; generic response caching is excluded. Revocation remains available when the endpoint or history preview is disabled.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for revoke a publisher credential."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for revoke a publisher credential."
          },
          {
            "name": "credential_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Credential ID for revoke a publisher credential."
          }
        ],
        "responses": {
          "204": {
            "description": "Revoke a publisher credential. Credential revoked"
          },
          "400": {
            "description": "Revoke a publisher credential. Invalid payload or policy",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Revoke a publisher credential. Invalid/expired/revoked/rotated credential",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Revoke a publisher credential. Channel/event outside grant",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Revoke a publisher credential. Endpoint or credential unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Revoke a publisher credential. Idempotency content conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Revoke a publisher credential. Publish rate or bounded receipt/credential capacity reached",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/realtime/publishers/endpoints/{endpoint_id}/channels/{channel}/publish": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "publishWithRealtimePublisherCredential",
        "summary": "Publish a retained channel event with a scoped credential",
        "description": "Accepts only an endpoint-bound grp_ credential. Retained publication only; exact channel/event grants, decoded payload size, fixed-minute accepted-publish quota and idempotency receipt commit atomically. Matching retries within 24 hours return the original sequence without re-emitting or consuming quota; rotated credentials retain their receipt namespace. Requires history preview and live realtime plan access.",
        "security": [
          {
            "realtimePublisherCredential": []
          }
        ],
        "parameters": [
          {
            "name": "endpoint_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Endpoint id for publish a retained channel event with a scoped credential."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for publish a retained channel event with a scoped credential."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "description": "Stable key reused for retries of this operation for publish a retained channel event with a scoped credential."
          }
        ],
        "responses": {
          "200": {
            "description": "Publish a retained channel event with a scoped credential. Operation result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimePublisherPublishResponse"
                }
              }
            }
          },
          "400": {
            "description": "Publish a retained channel event with a scoped credential. Invalid payload or policy",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Publish a retained channel event with a scoped credential. Invalid/expired/revoked/rotated credential",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Publish a retained channel event with a scoped credential. Channel/event outside grant",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Publish a retained channel event with a scoped credential. Endpoint or credential unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Publish a retained channel event with a scoped credential. Idempotency content conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Publish a retained channel event with a scoped credential. Publish rate or bounded receipt/credential capacity reached",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimePublisherMessageRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/credentials": {
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "listRealtimeWorkerCredentials",
        "summary": "List worker credential metadata",
        "description": "Account/app-scoped credential administration. Issuance, rotation and revocation require admin scope and MFA. Plaintext secrets are excluded from generic idempotency response caching.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for list worker credential metadata."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for list worker credential metadata."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for list worker credential metadata."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for list worker credential metadata."
          }
        ],
        "responses": {
          "200": {
            "description": "List worker credential metadata. Operation result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RealtimeWorkerCredential"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Credential invalid, expired, rotated or revoked",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Credential lacks permission",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Group or credential not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Lease lost or group conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Admission or authentication limit reached",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "issueRealtimeWorkerCredential",
        "summary": "Issue a credential bound to one consumer group",
        "description": "Issue a credential bound to one consumer group. Account/app-scoped credential administration. Issuance, rotation and revocation require admin scope and MFA. Plaintext secrets are excluded from generic idempotency response caching.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for issue a credential bound to one consumer group."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for issue a credential bound to one consumer group."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for issue a credential bound to one consumer group."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for issue a credential bound to one consumer group."
          }
        ],
        "responses": {
          "201": {
            "description": "Issue a credential bound to one consumer group. Operation result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeWorkerCredentialIssued"
                }
              }
            }
          },
          "401": {
            "description": "Issue a credential bound to one consumer group. Credential invalid, expired, rotated or revoked",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Issue a credential bound to one consumer group. Credential lacks permission",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Issue a credential bound to one consumer group. Group or credential not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Issue a credential bound to one consumer group. Lease lost or group conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Issue a credential bound to one consumer group. Admission or authentication limit reached",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeWorkerCredentialRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/credentials/{credential_id}/rotate": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "rotateRealtimeWorkerCredential",
        "summary": "Rotate a worker credential and immediately invalidate the old secret",
        "description": "Rotate a worker credential and immediately invalidate the old secret. Account/app-scoped credential administration. Issuance, rotation and revocation require admin scope and MFA. Plaintext secrets are excluded from generic idempotency response caching.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for rotate a worker credential and immediately invalidate the old secret."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for rotate a worker credential and immediately invalidate the old secret."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for rotate a worker credential and immediately invalidate the old secret."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for rotate a worker credential and immediately invalidate the old secret."
          },
          {
            "name": "credential_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Credential ID for rotate a worker credential and immediately invalidate the old secret."
          }
        ],
        "responses": {
          "200": {
            "description": "Rotate a worker credential and immediately invalidate the old secret. Operation result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeWorkerCredentialIssued"
                }
              }
            }
          },
          "401": {
            "description": "Rotate a worker credential and immediately invalidate the old secret. Credential invalid, expired, rotated or revoked",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Rotate a worker credential and immediately invalidate the old secret. Credential lacks permission",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Rotate a worker credential and immediately invalidate the old secret. Group or credential not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Rotate a worker credential and immediately invalidate the old secret. Lease lost or group conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rotate a worker credential and immediately invalidate the old secret. Admission or authentication limit reached",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeWorkerCredentialRotationRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/credentials/{credential_id}/revoke": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "revokeRealtimeWorkerCredential",
        "summary": "Revoke a worker credential",
        "description": "Revocation is available even when the endpoint or history preview is disabled. Once committed, later operations fail; already-authorized transactions can finish before revocation obtains the group lock. Revoked credentials cannot be rotated.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for revoke a worker credential."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for revoke a worker credential."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for revoke a worker credential."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for revoke a worker credential."
          },
          {
            "name": "credential_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Credential ID for revoke a worker credential."
          }
        ],
        "responses": {
          "204": {
            "description": "Operation completed without a body, or no claim ready"
          },
          "401": {
            "description": "Revoke a worker credential. Credential invalid, expired, rotated or revoked",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Revoke a worker credential. Credential lacks permission",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Revoke a worker credential. Group or credential not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Revoke a worker credential. Lease lost or group conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Revoke a worker credential. Admission or authentication limit reached",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/realtime/workers/groups/{group_id}": {
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "getRealtimeWorkerGroup",
        "summary": "Read status using the status permission",
        "description": "Accepts only a group-bound grw_ worker credential. Exact permission is checked in the group transaction; group recreation does not restore access.",
        "security": [
          {
            "realtimeWorkerCredential": []
          }
        ],
        "parameters": [
          {
            "name": "group_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group ID for read status using the status permission."
          }
        ],
        "responses": {
          "200": {
            "description": "Read status using the status permission. Operation result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroup"
                }
              }
            }
          },
          "401": {
            "description": "Read status using the status permission. Credential invalid, expired, rotated or revoked",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Read status using the status permission. Credential lacks permission",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Read status using the status permission. Group or credential not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Read status using the status permission. Lease lost or group conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Read status using the status permission. Admission or authentication limit reached",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "realtime"
        ],
        "operationId": "deleteRealtimeWorkerGroup",
        "summary": "Delete group using the separate delete permission",
        "description": "Delete group using the separate delete permission. Accepts only a group-bound grw_ worker credential. Exact permission is checked in the group transaction; group recreation does not restore access.",
        "security": [
          {
            "realtimeWorkerCredential": []
          }
        ],
        "parameters": [
          {
            "name": "group_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group ID for delete group using the separate delete permission."
          }
        ],
        "responses": {
          "204": {
            "description": "Delete group using the separate delete permission. Operation completed without a body, or no claim ready"
          },
          "401": {
            "description": "Delete group using the separate delete permission. Credential invalid, expired, rotated or revoked",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Delete group using the separate delete permission. Credential lacks permission",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Delete group using the separate delete permission. Group or credential not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Delete group using the separate delete permission. Lease lost or group conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Delete group using the separate delete permission. Admission or authentication limit reached",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/claims/batch": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "claimRealtimeConsumerGroupBatch",
        "summary": "Claim a bounded batch with independent leases",
        "description": "Claim 1–16 messages in one transaction, bounded by the group-wide 32 active leases and 128 outstanding snapshots. Each message has its own token and settlement. Always returns 200 with a possibly empty claims array. Partial batches may report history_unavailable or capacity_blocked; process returned claims before resolving the blocker. Empty claims can mean caught up, delayed retries or full lease slots. Requires the existing claim permission. Tokens are returned once; no response caching or automatic claim retries.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for claim a bounded batch with independent leases."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for claim a bounded batch with independent leases."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for claim a bounded batch with independent leases."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for claim a bounded batch with independent leases."
          }
        ],
        "responses": {
          "200": {
            "description": "Committed batch and optional blockers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroupBatch"
                }
              }
            }
          },
          "400": {
            "description": "Invalid worker or limit",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Endpoint or group not found"
          },
          "409": {
            "description": "Group conflict, lost claim lease, or retention gap"
          },
          "429": {
            "description": "Admission capacity or event ID capacity reached; realtime_group_deduplication_full includes Retry-After and retry_after_seconds Group rate uses code realtime_group_rate_limited, Retry-After and retry_after_seconds.",
            "headers": {
              "Retry-After": {
                "description": "Rounded-up seconds for group claim-rate throttling.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeConsumerGroupBatchRequest"
              }
            }
          }
        }
      }
    },
    "/v1/realtime/workers/groups/{group_id}/claims/batch": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "claimRealtimeWorkerGroupBatch",
        "summary": "Claim a bounded batch with independent leases using scoped worker credentials",
        "description": "Claim a bounded batch with independent leases. Claim 1–16 messages in one transaction, bounded by the group-wide 32 active leases and 128 outstanding snapshots. Each message has its own token and settlement. Always returns 200 with a possibly empty claims array. Partial batches may report history_unavailable or capacity_blocked; process returned claims before resolving the blocker. Empty claims can mean caught up, delayed retries or full lease slots. Requires the existing claim permission. Tokens are returned once; no response caching or automatic claim retries.",
        "security": [
          {
            "realtimeWorkerCredential": []
          }
        ],
        "parameters": [
          {
            "name": "group_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group ID for claim a bounded batch with independent leases. Claim a bounded batch with independent leases. Claim a bounded batch with independent leases. Claim a bounded batch with independent leases."
          }
        ],
        "responses": {
          "200": {
            "description": "Claim a bounded batch with independent leases. Committed batch and optional blockers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroupBatch"
                }
              }
            }
          },
          "400": {
            "description": "Claim a bounded batch with independent leases. Invalid worker or limit",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Claim a bounded batch with independent leases. Credential invalid, expired, rotated or revoked",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Claim a bounded batch with independent leases. Credential lacks permission",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Claim a bounded batch with independent leases. Group or credential not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Claim a bounded batch with independent leases. Lease lost or group conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Claim a bounded batch with independent leases. Admission capacity or event ID capacity reached; realtime_group_deduplication_full includes Retry-After and retry_after_seconds Group rate uses code realtime_group_rate_limited, Retry-After and retry_after_seconds.",
            "headers": {
              "Retry-After": {
                "description": "Claim a bounded batch with independent leases. Rounded-up seconds for group claim-rate throttling.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeWorkerBatchClaimRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/pause": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "pauseRealtimeConsumerGroup",
        "summary": "Pause new consumer-group claims",
        "description": "Requires app ownership, admin scope and MFA. Idempotent group control. Existing leases may renew, complete or retry. Resume preserves cursor, attempt counts and retry delays. Pause does not stop lease clocks or channel retention. Returns paused state and nullable pause timestamp.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for pause new consumer-group claims."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for pause new consumer-group claims."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for pause new consumer-group claims."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for pause new consumer-group claims."
          }
        ],
        "responses": {
          "200": {
            "description": "Current pause state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroupPauseState"
                }
              }
            }
          },
          "404": {
            "description": "Pause new consumer-group claims. Endpoint or group not found"
          },
          "409": {
            "description": "Pause new consumer-group claims. Group conflict, lost claim lease, or retention gap"
          },
          "429": {
            "description": "Endpoint or group admission capacity reached"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/resume": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "resumeRealtimeConsumerGroup",
        "summary": "Resume new consumer-group claims",
        "description": "Resume new consumer-group claims. Requires app ownership, admin scope and MFA. Idempotent group control. Existing leases may renew, complete or retry. Resume preserves cursor, attempt counts and retry delays. Pause does not stop lease clocks or channel retention. Returns paused state and nullable pause timestamp.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for resume new consumer-group claims."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for resume new consumer-group claims."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for resume new consumer-group claims."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for resume new consumer-group claims."
          }
        ],
        "responses": {
          "200": {
            "description": "Resume new consumer-group claims. Current pause state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroupPauseState"
                }
              }
            }
          },
          "404": {
            "description": "Resume new consumer-group claims. Endpoint or group not found"
          },
          "409": {
            "description": "Resume new consumer-group claims. Group conflict, lost claim lease, or retention gap"
          },
          "429": {
            "description": "Resume new consumer-group claims. Endpoint or group admission capacity reached"
          }
        }
      }
    },
    "/v1/realtime/workers/groups/{group_id}/pause": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "pauseRealtimeWorkerGroup",
        "summary": "Pause new consumer-group claims using scoped worker credentials",
        "description": "Requires the explicit pause worker permission, rechecked in the group transaction. Idempotent group control. Existing leases may renew, complete or retry. Resume preserves cursor, attempt counts and retry delays. Pause does not stop lease clocks or channel retention. Returns paused state and nullable pause timestamp.",
        "security": [
          {
            "realtimeWorkerCredential": []
          }
        ],
        "parameters": [
          {
            "name": "group_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group ID for pause new consumer-group claims. Pause new consumer-group claims. Pause new consumer-group claims. Pause new consumer-group claims."
          }
        ],
        "responses": {
          "200": {
            "description": "Pause new consumer-group claims. Current pause state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroupPauseState"
                }
              }
            }
          },
          "401": {
            "description": "Pause new consumer-group claims. Credential invalid, expired, rotated or revoked",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Pause new consumer-group claims. Credential lacks permission",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Pause new consumer-group claims. Group or credential not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Pause new consumer-group claims. Lease lost or group conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Pause new consumer-group claims. Admission or authentication limit reached",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/realtime/workers/groups/{group_id}/resume": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "resumeRealtimeWorkerGroup",
        "summary": "Resume new consumer-group claims using scoped worker credentials",
        "description": "Requires the explicit resume worker permission, rechecked in the group transaction. Idempotent group control. Existing leases may renew, complete or retry. Resume preserves cursor, attempt counts and retry delays. Pause does not stop lease clocks or channel retention. Returns paused state and nullable pause timestamp.",
        "security": [
          {
            "realtimeWorkerCredential": []
          }
        ],
        "parameters": [
          {
            "name": "group_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group ID for resume new consumer-group claims. Resume new consumer-group claims. Resume new consumer-group claims. Resume new consumer-group claims."
          }
        ],
        "responses": {
          "200": {
            "description": "The group pause state after resuming claims with the scoped worker credential.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroupPauseState"
                }
              }
            }
          },
          "401": {
            "description": "Resume new consumer-group claims. Credential invalid, expired, rotated or revoked",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Resume new consumer-group claims. Credential lacks permission",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Resume new consumer-group claims. Group or credential not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Resume new consumer-group claims. Lease lost or group conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Resume new consumer-group claims. Admission or authentication limit reached",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/drain": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "drainRealtimeConsumerGroup",
        "summary": "Drain active consumer-group leases",
        "description": "Idempotently stop new claims and enter persistent drain mode. Requires account admin scope and MFA, or the explicit drain worker permission. Existing leases may renew or settle. Drained means no unexpired leases remain; it does not prove handler side effects have stopped. Retry/dead/unassigned work is preserved. Resume explicitly after deployment; pause switches to ordinary paused mode.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for drain active consumer-group leases."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for drain active consumer-group leases."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for drain active consumer-group leases."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for drain active consumer-group leases."
          }
        ],
        "responses": {
          "200": {
            "description": "Drain active consumer-group leases. Current pause state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroupDrainState"
                }
              }
            }
          },
          "404": {
            "description": "Drain active consumer-group leases. Endpoint or group not found"
          },
          "409": {
            "description": "Drain active consumer-group leases. Group conflict, lost claim lease, or retention gap"
          },
          "429": {
            "description": "Drain active consumer-group leases. Endpoint or group admission capacity reached"
          }
        }
      }
    },
    "/v1/realtime/workers/groups/{group_id}/drain": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "drainRealtimeWorkerGroup",
        "summary": "Drain active consumer-group leases using scoped worker credentials",
        "description": "Drain active consumer-group leases. Idempotently stop new claims and enter persistent drain mode. Requires account admin scope and MFA, or the explicit drain worker permission. Existing leases may renew or settle. Drained means no unexpired leases remain; it does not prove handler side effects have stopped. Retry/dead/unassigned work is preserved. Resume explicitly after deployment; pause switches to ordinary paused mode.",
        "security": [
          {
            "realtimeWorkerCredential": []
          }
        ],
        "parameters": [
          {
            "name": "group_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group ID for drain active consumer-group leases. Drain active consumer-group leases. Drain active consumer-group leases. Drain active consumer-group leases."
          }
        ],
        "responses": {
          "200": {
            "description": "The drain state after the scoped worker stops new claims and waits for active leases.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroupDrainState"
                }
              }
            }
          },
          "401": {
            "description": "Drain active consumer-group leases. Credential invalid, expired, rotated or revoked",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Drain active consumer-group leases. Credential lacks permission",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Drain active consumer-group leases. Group or credential not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Drain active consumer-group leases. Lease lost or group conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Drain active consumer-group leases. Admission or authentication limit reached",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/claims/settle/batch": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "settleRealtimeConsumerGroupBatch",
        "summary": "Settle a batch of consumer group claims",
        "description": "Validate all 1 to 32 items before mutation; duplicate numeric sequences are invalid. Results preserve request order. Each valid current lease is completed, retried, released or renewed; expired, missing or differently owned leases return lease_lost without blocking other items. Scoped credentials require every action in the request, rechecked under the group lock; no additional grant. Account writes require ownership, deploy-write scope and MFA. Known lease failures commit alongside valid settlements; database errors roll back the batch. Optional idempotency_key saves the entire result for 24 hours; repeat the same request with the same key to recover a lost response. Different contents return 409 realtime_settlement_key_conflict. Without a key, a lost response may have committed.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for settle a batch of consumer group claims."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for settle a batch of consumer group claims."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for settle a batch of consumer group claims."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for settle a batch of consumer group claims."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeConsumerGroupBatchSettlementRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Per-item settlement results",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroupBatchSettlementResult"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or duplicate settlement"
          },
          "401": {
            "description": "Invalid credentials"
          },
          "403": {
            "description": "Action permission denied"
          },
          "404": {
            "description": "Endpoint or group unavailable"
          },
          "409": {
            "description": "Idempotency key reused with different contents (realtime_settlement_key_conflict)"
          },
          "429": {
            "description": "Admission or authentication or settlement receipt capacity reached"
          }
        }
      }
    },
    "/v1/realtime/workers/groups/{group_id}/claims/settle/batch": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "settleRealtimeWorkerGroupBatch",
        "summary": "Settle a batch of consumer group claims using scoped worker credentials",
        "description": "Settle a batch of consumer group claims. Validate all 1 to 32 items before mutation; duplicate numeric sequences are invalid. Results preserve request order. Each valid current lease is completed, retried, released or renewed; expired, missing or differently owned leases return lease_lost without blocking other items. Scoped credentials require every action in the request, rechecked under the group lock; no additional grant. Account writes require ownership, deploy-write scope and MFA. Known lease failures commit alongside valid settlements; database errors roll back the batch. Optional idempotency_key saves the entire result for 24 hours; repeat the same request with the same key to recover a lost response. Different contents return 409 realtime_settlement_key_conflict. Without a key, a lost response may have committed.",
        "security": [
          {
            "realtimeWorkerCredential": []
          }
        ],
        "parameters": [
          {
            "name": "group_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group ID for settle a batch of consumer group claims. Settle a batch of consumer group claims. Settle a batch of consumer group claims. Settle a batch of consumer group claims."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeConsumerGroupBatchSettlementRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Settle a batch of consumer group claims. Per-item settlement results",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroupBatchSettlementResult"
                }
              }
            }
          },
          "400": {
            "description": "Settle a batch of consumer group claims. Invalid or duplicate settlement"
          },
          "401": {
            "description": "Settle a batch of consumer group claims. Invalid credentials"
          },
          "403": {
            "description": "Settle a batch of consumer group claims. Action permission denied"
          },
          "404": {
            "description": "Settle a batch of consumer group claims. Endpoint or group unavailable"
          },
          "409": {
            "description": "Settle a batch of consumer group claims. Idempotency key reused with different contents (realtime_settlement_key_conflict)"
          },
          "429": {
            "description": "Settle a batch of consumer group claims. Admission or authentication or settlement receipt capacity reached"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/messages/{sequence}/history": {
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "getRealtimeConsumerGroupDeliveryHistory",
        "summary": "Read a message's observed consumer-group delivery timeline",
        "description": "Account ownership, read scope and MFA required. Bounded 24-hour history, at most 1024 events per group shared across messages. No pre-migration backfill or renewals. Completions remain after snapshot deletion. Empty results do not distinguish unprocessed, completed before migration, filtered or pruned messages. group_pruned_events counts expired/capacity-pruned observations across the whole group, not solely this message. Reads prune expired history under the group lock. Events are ordered by ID; observation timestamps can lag actual lease/deadline expiry. No payload, lease/credential token, token hash or worker identity is returned.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for read a message's observed consumer-group delivery timeline."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for read a message's observed consumer-group delivery timeline."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for read a message's observed consumer-group delivery timeline."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for read a message's observed consumer-group delivery timeline."
          },
          {
            "name": "sequence",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "description": "Message sequence for read a message's observed consumer-group delivery timeline."
          },
          {
            "name": "after_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$",
              "default": "0"
            },
            "description": "After id for read a message's observed consumer-group delivery timeline."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 32
            },
            "description": "Maximum number of records for read a message's observed consumer-group delivery timeline."
          }
        ],
        "responses": {
          "200": {
            "description": "Ordered retained history, possibly empty",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroupDeliveryHistory"
                }
              }
            }
          },
          "400": {
            "description": "Invalid group, sequence, cursor or limit"
          },
          "401": {
            "description": "Read a message's observed consumer-group delivery timeline. Invalid credentials"
          },
          "403": {
            "description": "Permission denied"
          },
          "404": {
            "description": "Read a message's observed consumer-group delivery timeline. Endpoint or group unavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/circuit": {
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "getRealtimeConsumerGroupCircuit",
        "summary": "Read consumer group circuit breaker",
        "description": "Opt-in consecutive processing-failure breaker; default disabled, threshold 5 and cooldown 30 seconds. Reported retries/dead failures and lease expiries count; normal delivery-deadline expiry does not. Manual pause/drain retain precedence. Cooldown transitions on claims to one fenced probe at a time; only its success restores admission. Existing leases may settle. Identical policy writes preserve state; changed policy resets closed. Status is observational; reads do not advance cooldown. Account ownership and MFA required; reads need read scope, writes admin scope. Scoped worker claims already obey the gate with no new grant.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for read consumer group circuit breaker."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for read consumer group circuit breaker."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for read consumer group circuit breaker."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for read consumer group circuit breaker."
          }
        ],
        "responses": {
          "200": {
            "description": "Current policy and circuit state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroupCircuitStatus"
                }
              }
            }
          },
          "400": {
            "description": "Invalid policy or group"
          },
          "401": {
            "description": "Read consumer group circuit breaker. Invalid credentials"
          },
          "403": {
            "description": "Read consumer group circuit breaker. Permission denied"
          },
          "404": {
            "description": "Read consumer group circuit breaker. Endpoint or group unavailable"
          }
        }
      },
      "put": {
        "tags": [
          "realtime"
        ],
        "operationId": "configureRealtimeConsumerGroupCircuit",
        "summary": "Configure consumer group circuit breaker",
        "description": "Configure consumer group circuit breaker. Opt-in consecutive processing-failure breaker; default disabled, threshold 5 and cooldown 30 seconds. Reported retries/dead failures and lease expiries count; normal delivery-deadline expiry does not. Manual pause/drain retain precedence. Cooldown transitions on claims to one fenced probe at a time; only its success restores admission. Existing leases may settle. Identical policy writes preserve state; changed policy resets closed. Status is observational; reads do not advance cooldown. Account ownership and MFA required; reads need read scope, writes admin scope. Scoped worker claims already obey the gate with no new grant.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for configure consumer group circuit breaker."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for configure consumer group circuit breaker."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for configure consumer group circuit breaker."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for configure consumer group circuit breaker."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeConsumerGroupCircuitPolicy"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Configure consumer group circuit breaker. Current policy and circuit state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroupCircuitStatus"
                }
              }
            }
          },
          "400": {
            "description": "Configure consumer group circuit breaker. Invalid policy or group"
          },
          "401": {
            "description": "Configure consumer group circuit breaker. Invalid credentials"
          },
          "403": {
            "description": "Configure consumer group circuit breaker. Permission denied"
          },
          "404": {
            "description": "Configure consumer group circuit breaker. Endpoint or group unavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/priority": {
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "getRealtimeConsumerGroupPriority",
        "summary": "Read priority policy and materialized backlog",
        "description": "Account ownership, read scope and MFA required. Policy is immutable at group creation. Backlog covers retained outstanding snapshots only, including delayed and blocked ready rows and unmaintained expired leases. The next-claim hint is observational and can change before a claim.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for read priority policy and materialized backlog."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for read priority policy and materialized backlog."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for read priority policy and materialized backlog."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for read priority policy and materialized backlog."
          }
        ],
        "responses": {
          "200": {
            "description": "Current priority policy and backlog",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroupPriorityStatus"
                }
              }
            }
          },
          "400": {
            "description": "Read priority policy and materialized backlog. Invalid group"
          },
          "401": {
            "description": "Read priority policy and materialized backlog. Invalid credentials"
          },
          "403": {
            "description": "Read priority policy and materialized backlog. Permission denied"
          },
          "404": {
            "description": "Read priority policy and materialized backlog. Endpoint or group unavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/metrics": {
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "getRealtimeConsumerGroupMetrics",
        "summary": "Read consumer group processing trends",
        "description": "Account-owned read with MFA. Returns 60 UTC minute buckets including the partial current minute. Queue wait averages publication to first claim, excluding pre-migration attempted snapshots. Processing averages successful attempts with an observed lease start, includes renewals, and excludes previous failed attempts. Counts are decimal strings. Zero averages with zero samples mean no observations. Retries count leased-to-ready transitions including expiry; dead letters count entries into dead including deadlines. Replays can add further transitions. Events are bucketed when observed, not when an unobserved lease expired. Empty minutes are zero-filled. No per-message telemetry is retained.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for read consumer group processing trends."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for read consumer group processing trends."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for read consumer group processing trends."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for read consumer group processing trends."
          }
        ],
        "responses": {
          "200": {
            "description": "Recent processing metrics",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroupMetrics"
                }
              }
            }
          },
          "400": {
            "description": "Read consumer group processing trends. Invalid group"
          },
          "401": {
            "description": "Read consumer group processing trends. Invalid credentials"
          },
          "403": {
            "description": "Read consumer group processing trends. Permission denied"
          },
          "404": {
            "description": "Read consumer group processing trends. Endpoint or group unavailable"
          },
          "429": {
            "description": "Admission capacity reached"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/heartbeats": {
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "getRealtimeConsumerGroupWorkerHealth",
        "summary": "Read observed worker liveness",
        "description": "Heartbeat monitoring is opt-in. Fixed timeout 60 seconds; report every 15 seconds. Account routes require ownership and MFA, writes deploy-write scope. Scoped POST requires heartbeat permission and fixes worker identity to credential name. Readiness is self-reported, separate from liveness. No lease is renewed.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for read observed worker liveness."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for read observed worker liveness."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for read observed worker liveness."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for read observed worker liveness."
          }
        ],
        "responses": {
          "200": {
            "description": "Current worker health",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeWorkerHealth"
                }
              }
            }
          },
          "400": {
            "description": "Invalid worker, readiness or diagnostic code"
          },
          "401": {
            "description": "Read observed worker liveness. Invalid credentials"
          },
          "403": {
            "description": "Read observed worker liveness. Permission denied"
          },
          "404": {
            "description": "Read observed worker liveness. Endpoint or group unavailable"
          },
          "429": {
            "description": "Worker heartbeat tracking or credential admission capacity reached"
          }
        }
      },
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "heartbeatRealtimeConsumerGroup",
        "summary": "Report worker readiness and liveness",
        "description": "Report worker readiness and liveness. Heartbeat monitoring is opt-in. Fixed timeout 60 seconds; report every 15 seconds. Account routes require ownership and MFA, writes deploy-write scope. Scoped POST requires heartbeat permission and fixes worker identity to credential name. Readiness is self-reported, separate from liveness. No lease is renewed.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for report worker readiness and liveness."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for report worker readiness and liveness."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for report worker readiness and liveness."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for report worker readiness and liveness."
          }
        ],
        "responses": {
          "200": {
            "description": "Report worker readiness and liveness. Current worker health",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeWorkerHeartbeat"
                }
              }
            }
          },
          "400": {
            "description": "Report worker readiness and liveness. Invalid worker, readiness or diagnostic code"
          },
          "401": {
            "description": "Report worker readiness and liveness. Invalid credentials"
          },
          "403": {
            "description": "Report worker readiness and liveness. Permission denied"
          },
          "404": {
            "description": "Report worker readiness and liveness. Endpoint or group unavailable"
          },
          "429": {
            "description": "Report worker readiness and liveness. Worker heartbeat tracking or credential admission capacity reached"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeWorkerHeartbeatRequest"
              }
            }
          }
        }
      }
    },
    "/v1/realtime/workers/groups/{group_id}/heartbeats": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "heartbeatRealtimeWorkerGroup",
        "summary": "Report liveness using a scoped worker credential",
        "description": "Report liveness using a scoped worker credential. Heartbeat monitoring is opt-in. Fixed timeout 60 seconds; report every 15 seconds. Account routes require ownership and MFA, writes deploy-write scope. Scoped POST requires heartbeat permission and fixes worker identity to credential name. Readiness is self-reported, separate from liveness. No lease is renewed.",
        "security": [
          {
            "realtimeWorkerCredential": []
          }
        ],
        "parameters": [
          {
            "name": "group_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group ID for report liveness using a scoped worker credential."
          }
        ],
        "responses": {
          "200": {
            "description": "Report liveness using a scoped worker credential. Current worker health",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeWorkerHeartbeat"
                }
              }
            }
          },
          "400": {
            "description": "Report liveness using a scoped worker credential. Invalid worker, readiness or diagnostic code"
          },
          "401": {
            "description": "Report liveness using a scoped worker credential. Invalid credentials"
          },
          "403": {
            "description": "Report liveness using a scoped worker credential. Permission denied"
          },
          "404": {
            "description": "Report liveness using a scoped worker credential. Endpoint or group unavailable"
          },
          "429": {
            "description": "Report liveness using a scoped worker credential. Worker heartbeat tracking or credential admission capacity reached"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeWorkerHeartbeatRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/claim-rate": {
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "getRealtimeConsumerGroupClaimRate",
        "summary": "Read shared consumer-group claim rate",
        "description": "Requires app ownership and MFA; writes require admin scope. Zero rate disables throttling. Otherwise configure 1 to 1000 claims per second and a burst of 1 to 32. Admission is shared across every worker and replica through persisted group-locked state. Renewals, settlements and replay do not consume rate credit. Identical writes preserve credit and counters; changed policies clamp existing debt to the new burst window. The observed retry hint is not a reservation; concurrent workers can consume the next allowance.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for read shared consumer-group claim rate."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for read shared consumer-group claim rate."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for read shared consumer-group claim rate."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for read shared consumer-group claim rate."
          }
        ],
        "responses": {
          "200": {
            "description": "Policy and current throttle observation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroupClaimRateStatus"
                }
              }
            }
          },
          "400": {
            "description": "Invalid rate or burst",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Read shared consumer-group claim rate. Endpoint or group not found"
          },
          "409": {
            "description": "Read shared consumer-group claim rate. Group conflict, lost claim lease, or retention gap"
          },
          "429": {
            "description": "Read shared consumer-group claim rate. Endpoint or group admission capacity reached"
          }
        }
      },
      "put": {
        "tags": [
          "realtime"
        ],
        "operationId": "configureRealtimeConsumerGroupClaimRate",
        "summary": "Configure shared consumer-group claim rate",
        "description": "Configure shared consumer-group claim rate. Requires app ownership and MFA; writes require admin scope. Zero rate disables throttling. Otherwise configure 1 to 1000 claims per second and a burst of 1 to 32. Admission is shared across every worker and replica through persisted group-locked state. Renewals, settlements and replay do not consume rate credit. Identical writes preserve credit and counters; changed policies clamp existing debt to the new burst window. The observed retry hint is not a reservation; concurrent workers can consume the next allowance.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for configure shared consumer-group claim rate."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for configure shared consumer-group claim rate."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for configure shared consumer-group claim rate."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for configure shared consumer-group claim rate."
          }
        ],
        "responses": {
          "200": {
            "description": "Configure shared consumer-group claim rate. Policy and current throttle observation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroupClaimRateStatus"
                }
              }
            }
          },
          "400": {
            "description": "Configure shared consumer-group claim rate. Invalid rate or burst",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Configure shared consumer-group claim rate. Endpoint or group not found"
          },
          "409": {
            "description": "Configure shared consumer-group claim rate. Group conflict, lost claim lease, or retention gap"
          },
          "429": {
            "description": "Configure shared consumer-group claim rate. Endpoint or group admission capacity reached"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeConsumerGroupClaimRatePolicy"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/retry-policy": {
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "getRealtimeConsumerGroupRetryPolicy",
        "summary": "Read consumer-group retry policy",
        "description": "Requires app ownership and MFA; writes require admin scope. Policies are disabled by default. Enabled policies apply capped exponential backoff to reported failures with omitted retry_after_seconds. Explicit delays, including zero, override backoff. Exact permanent failure codes dead-letter immediately even with an explicit delay. Jitter samples uniformly from half the capped delay through the capped delay, in integer seconds. Attempt budgets still apply. Changes affect future settlements, not already scheduled retries or expired leases. next_retry_at is the earliest delayed ready snapshot; ordering, pause and capacity can delay its claim further.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for read consumer-group retry policy."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for read consumer-group retry policy."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for read consumer-group retry policy."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for read consumer-group retry policy."
          }
        ],
        "responses": {
          "200": {
            "description": "Policy and earliest delayed retry observation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroupRetryStatus"
                }
              }
            }
          },
          "400": {
            "description": "Invalid delay range or permanent failure codes",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Read consumer-group retry policy. Endpoint or group not found"
          },
          "409": {
            "description": "Read consumer-group retry policy. Group conflict, lost claim lease, or retention gap"
          },
          "429": {
            "description": "Read consumer-group retry policy. Endpoint or group admission capacity reached"
          }
        }
      },
      "put": {
        "tags": [
          "realtime"
        ],
        "operationId": "configureRealtimeConsumerGroupRetryPolicy",
        "summary": "Configure consumer-group retries",
        "description": "Configure consumer-group retries. Requires app ownership and MFA; writes require admin scope. Policies are disabled by default. Enabled policies apply capped exponential backoff to reported failures with omitted retry_after_seconds. Explicit delays, including zero, override backoff. Exact permanent failure codes dead-letter immediately even with an explicit delay. Jitter samples uniformly from half the capped delay through the capped delay, in integer seconds. Attempt budgets still apply. Changes affect future settlements, not already scheduled retries or expired leases. next_retry_at is the earliest delayed ready snapshot; ordering, pause and capacity can delay its claim further.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for configure consumer-group retries."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for configure consumer-group retries."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for configure consumer-group retries."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for configure consumer-group retries."
          }
        ],
        "responses": {
          "200": {
            "description": "Configure consumer-group retries. Policy and earliest delayed retry observation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroupRetryStatus"
                }
              }
            }
          },
          "400": {
            "description": "Configure consumer-group retries. Invalid delay range or permanent failure codes",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Configure consumer-group retries. Endpoint or group not found"
          },
          "409": {
            "description": "Configure consumer-group retries. Group conflict, lost claim lease, or retention gap"
          },
          "429": {
            "description": "Configure consumer-group retries. Endpoint or group admission capacity reached"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeConsumerGroupRetryPolicyRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/dead-letter-retention": {
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "getRealtimeConsumerGroupDeadLetterRetention",
        "summary": "Read dead-letter retention policy",
        "description": "Requires app ownership and MFA; writes require admin scope. Zero keeps dead letters indefinitely. Otherwise choose 3600 to 2592000 seconds. Ordered groups require skip policy. Cleanup follows a persisted warning decision by at least 300 seconds; webhook delivery does not gate cleanup. Replay protects the snapshot when it commits before cleanup. Changed policies rearm warnings.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for read dead-letter retention policy."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for read dead-letter retention policy."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for read dead-letter retention policy."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for read dead-letter retention policy."
          }
        ],
        "responses": {
          "200": {
            "description": "Retention policy and cumulative expired count",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroupRetentionPolicy"
                }
              }
            }
          },
          "400": {
            "description": "Invalid retention period or incompatible ordered block policy",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Read dead-letter retention policy. Endpoint or group not found"
          },
          "409": {
            "description": "Read dead-letter retention policy. Group conflict, lost claim lease, or retention gap"
          },
          "429": {
            "description": "Read dead-letter retention policy. Endpoint or group admission capacity reached"
          }
        }
      },
      "put": {
        "tags": [
          "realtime"
        ],
        "operationId": "configureRealtimeConsumerGroupDeadLetterRetention",
        "summary": "Configure dead-letter retention",
        "description": "Configure dead-letter retention. Requires app ownership and MFA; writes require admin scope. Zero keeps dead letters indefinitely. Otherwise choose 3600 to 2592000 seconds. Ordered groups require skip policy. Cleanup follows a persisted warning decision by at least 300 seconds; webhook delivery does not gate cleanup. Replay protects the snapshot when it commits before cleanup. Changed policies rearm warnings.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for configure dead-letter retention."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for configure dead-letter retention."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for configure dead-letter retention."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for configure dead-letter retention."
          }
        ],
        "responses": {
          "200": {
            "description": "Configure dead-letter retention. Retention policy and cumulative expired count",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroupRetentionPolicy"
                }
              }
            }
          },
          "400": {
            "description": "Configure dead-letter retention. Invalid retention period or incompatible ordered block policy",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Configure dead-letter retention. Endpoint or group not found"
          },
          "409": {
            "description": "Configure dead-letter retention. Group conflict, lost claim lease, or retention gap"
          },
          "429": {
            "description": "Configure dead-letter retention. Endpoint or group admission capacity reached"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeConsumerGroupRetentionRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/lag-alert": {
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "getRealtimeConsumerGroupLagAlert",
        "summary": "Read lag alert status",
        "description": "Requires app ownership and MFA; writes require admin scope. One policy per group. Zero thresholds disable that metric. Enabled policies require at least one nonzero threshold. Observations and signed webhooks are sampled, including paused/draining groups. Cooldown limits ongoing breach reminders; transitions alert promptly. Identical PUTs preserve observations; changed policies rearm without a recovery backfill. Disabled policies do not evaluate.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for read lag alert status."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for read lag alert status."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for read lag alert status."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for read lag alert status."
          }
        ],
        "responses": {
          "200": {
            "description": "Policy and latest nullable observation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroupLagAlert"
                }
              }
            }
          },
          "400": {
            "description": "Invalid thresholds or cooldown",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Read lag alert status. Endpoint or group not found"
          },
          "409": {
            "description": "Read lag alert status. Group conflict, lost claim lease, or retention gap"
          },
          "429": {
            "description": "Read lag alert status. Endpoint or group admission capacity reached"
          }
        }
      },
      "put": {
        "tags": [
          "realtime"
        ],
        "operationId": "configureRealtimeConsumerGroupLagAlert",
        "summary": "Configure consumer-group lag thresholds",
        "description": "Configure consumer-group lag thresholds. Requires app ownership and MFA; writes require admin scope. One policy per group. Zero thresholds disable that metric. Enabled policies require at least one nonzero threshold. Observations and signed webhooks are sampled, including paused/draining groups. Cooldown limits ongoing breach reminders; transitions alert promptly. Identical PUTs preserve observations; changed policies rearm without a recovery backfill. Disabled policies do not evaluate.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for configure consumer-group lag thresholds."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for configure consumer-group lag thresholds."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for configure consumer-group lag thresholds."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for configure consumer-group lag thresholds."
          }
        ],
        "responses": {
          "200": {
            "description": "Configure consumer-group lag thresholds. Policy and latest nullable observation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroupLagAlert"
                }
              }
            }
          },
          "400": {
            "description": "Configure consumer-group lag thresholds. Invalid thresholds or cooldown",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Configure consumer-group lag thresholds. Endpoint or group not found"
          },
          "409": {
            "description": "Configure consumer-group lag thresholds. Group conflict, lost claim lease, or retention gap"
          },
          "429": {
            "description": "Configure consumer-group lag thresholds. Endpoint or group admission capacity reached"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeConsumerGroupLagAlertConfig"
              }
            }
          }
        }
      }
    },
    "/v1/realtime/workers/groups/{group_id}/claims": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "claimRealtimeWorkerGroup",
        "summary": "Claim work using the claim permission",
        "description": "Claim work using the claim permission. Accepts only a group-bound grw_ worker credential. Exact permission is checked in the group transaction; group recreation does not restore access.",
        "security": [
          {
            "realtimeWorkerCredential": []
          }
        ],
        "parameters": [
          {
            "name": "group_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group ID for claim work using the claim permission."
          }
        ],
        "responses": {
          "200": {
            "description": "Claim work using the claim permission. Operation result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroupClaim"
                }
              }
            }
          },
          "204": {
            "description": "Claim work using the claim permission. Operation completed without a body, or no claim ready"
          },
          "401": {
            "description": "Claim work using the claim permission. Credential invalid, expired, rotated or revoked",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Claim work using the claim permission. Credential lacks permission",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Claim work using the claim permission. Group or credential not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Claim work using the claim permission. Lease lost or group conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Claim work using the claim permission. Admission capacity or event ID capacity reached; realtime_group_deduplication_full includes Retry-After and retry_after_seconds Group rate uses code realtime_group_rate_limited, Retry-After and retry_after_seconds.",
            "headers": {
              "Retry-After": {
                "description": "Claim work using the claim permission. Rounded-up seconds for group claim-rate throttling.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeWorkerClaimRequest"
              }
            }
          }
        }
      }
    },
    "/v1/realtime/workers/groups/{group_id}/claims/settle": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "settleRealtimeWorkerGroupClaim",
        "summary": "Settle or renew only this credential’s own lease",
        "description": "Requires the exact action permission: complete, retry, renew or release. The credential can settle only leases issued to its stable credential ID. Rotation preserves that ID and claim ownership. New settlements require unexpired claim tokens. Matching receipts return the original result after current authorization, even when the original lease has ended. Expired/revoked credentials cannot settle or replay work.",
        "security": [
          {
            "realtimeWorkerCredential": []
          }
        ],
        "parameters": [
          {
            "name": "group_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group ID for settle or renew only this credential’s own lease."
          }
        ],
        "responses": {
          "200": {
            "description": "Settle or renew only this credential’s own lease. Operation result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroupSettlementResult"
                }
              }
            }
          },
          "401": {
            "description": "Settle or renew only this credential’s own lease. Credential invalid, expired, rotated or revoked",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Settle or renew only this credential’s own lease. Credential lacks permission",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Settle or renew only this credential’s own lease. Group or credential not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Claim lease lost, or idempotency key reused with different contents (realtime_settlement_key_conflict)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Admission, authentication or settlement receipt capacity reached",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeConsumerGroupSettlement"
              }
            }
          }
        }
      }
    },
    "/v1/realtime/workers/groups/{group_id}/dead-letters": {
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "listRealtimeWorkerGroupDeadLetters",
        "summary": "Read failed payloads using the separate dead_letters permission",
        "description": "Read failed payloads using the separate dead_letters permission. Accepts only a group-bound grw_ worker credential. Exact permission is checked in the group transaction; group recreation does not restore access.",
        "security": [
          {
            "realtimeWorkerCredential": []
          }
        ],
        "parameters": [
          {
            "name": "group_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group ID for read failed payloads using the separate dead_letters permission."
          }
        ],
        "responses": {
          "200": {
            "description": "Read failed payloads using the separate dead_letters permission. Operation result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RealtimeConsumerGroupDeadLetter"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Read failed payloads using the separate dead_letters permission. Credential invalid, expired, rotated or revoked",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Read failed payloads using the separate dead_letters permission. Credential lacks permission",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Read failed payloads using the separate dead_letters permission. Group or credential not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Read failed payloads using the separate dead_letters permission. Lease lost or group conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Read failed payloads using the separate dead_letters permission. Admission or authentication limit reached",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/realtime/workers/groups/{group_id}/dead-letters/{sequence}/replay": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "replayRealtimeWorkerGroupDeadLetter",
        "summary": "Replay failed work using the separate replay permission",
        "description": "Replay failed work using the separate replay permission. Accepts only a group-bound grw_ worker credential. Exact permission is checked in the group transaction; group recreation does not restore access.",
        "security": [
          {
            "realtimeWorkerCredential": []
          }
        ],
        "parameters": [
          {
            "name": "group_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group ID for replay failed work using the separate replay permission."
          },
          {
            "name": "sequence",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Message sequence for replay failed work using the separate replay permission."
          }
        ],
        "responses": {
          "204": {
            "description": "Replay failed work using the separate replay permission. Operation completed without a body, or no claim ready"
          },
          "401": {
            "description": "Replay failed work using the separate replay permission. Credential invalid, expired, rotated or revoked",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Replay failed work using the separate replay permission. Credential lacks permission",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Replay failed work using the separate replay permission. Group or credential not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Replay failed work using the separate replay permission. Lease lost or group conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Replay failed work using the separate replay permission. Admission or authentication limit reached",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/realtime/workers/groups/{group_id}/resync": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "resyncRealtimeWorkerGroup",
        "summary": "Recover a gap using the separate resync permission",
        "description": "Recover a gap using the separate resync permission. Accepts only a group-bound grw_ worker credential. Exact permission is checked in the group transaction; group recreation does not restore access.",
        "security": [
          {
            "realtimeWorkerCredential": []
          }
        ],
        "parameters": [
          {
            "name": "group_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group ID for recover a gap using the separate resync permission."
          }
        ],
        "responses": {
          "204": {
            "description": "Recover a gap using the separate resync permission. Operation completed without a body, or no claim ready"
          },
          "401": {
            "description": "Recover a gap using the separate resync permission. Credential invalid, expired, rotated or revoked",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Recover a gap using the separate resync permission. Credential lacks permission",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Recover a gap using the separate resync permission. Group or credential not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Recover a gap using the separate resync permission. Lease lost or group conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Recover a gap using the separate resync permission. Admission or authentication limit reached",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeConsumerGroupResyncRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups": {
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "listRealtimeConsumerGroups",
        "summary": "List consumer group lag and worker status",
        "description": "Backend-only. Requires history preview, account API credentials, app permissions and MFA. Write operations require write scope. Delivery is at least once.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for list consumer group lag and worker status."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for list consumer group lag and worker status."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for list consumer group lag and worker status."
          }
        ],
        "responses": {
          "200": {
            "description": "Consumer group operation result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RealtimeConsumerGroup"
                  }
                }
              }
            }
          },
          "404": {
            "description": "List consumer group lag and worker status. Endpoint or group not found"
          },
          "409": {
            "description": "List consumer group lag and worker status. Group conflict, lost claim lease, or retention gap"
          },
          "429": {
            "description": "List consumer group lag and worker status. Endpoint or group admission capacity reached"
          }
        }
      },
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "createRealtimeConsumerGroup",
        "summary": "Create a shared backend-worker subscription",
        "description": "Create a shared backend-worker subscription. Backend-only. Requires history preview, account API credentials, app permissions and MFA. Write operations require write scope. Delivery is at least once.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for create a shared backend-worker subscription."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for create a shared backend-worker subscription."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for create a shared backend-worker subscription."
          }
        ],
        "responses": {
          "201": {
            "description": "Create a shared backend-worker subscription. Consumer group operation result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroup"
                }
              }
            }
          },
          "404": {
            "description": "Create a shared backend-worker subscription. Endpoint or group not found"
          },
          "409": {
            "description": "Create a shared backend-worker subscription. Group conflict, lost claim lease, or retention gap"
          },
          "429": {
            "description": "Create a shared backend-worker subscription. Endpoint or group admission capacity reached"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeConsumerGroupCreateRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}": {
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "getRealtimeConsumerGroup",
        "summary": "Read consumer group lag and worker status",
        "description": "Read consumer group lag and worker status. Backend-only. Requires history preview, account API credentials, app permissions and MFA. Write operations require write scope. Delivery is at least once.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for read consumer group lag and worker status."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for read consumer group lag and worker status."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for read consumer group lag and worker status."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for read consumer group lag and worker status."
          }
        ],
        "responses": {
          "200": {
            "description": "Read consumer group lag and worker status. Consumer group operation result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroup"
                }
              }
            }
          },
          "404": {
            "description": "Read consumer group lag and worker status. Endpoint or group not found"
          },
          "409": {
            "description": "Read consumer group lag and worker status. Group conflict, lost claim lease, or retention gap"
          },
          "429": {
            "description": "Read consumer group lag and worker status. Endpoint or group admission capacity reached"
          }
        }
      },
      "delete": {
        "tags": [
          "realtime"
        ],
        "operationId": "deleteRealtimeConsumerGroup",
        "summary": "Delete a consumer group and its outstanding payload snapshots",
        "description": "Delete a consumer group and its outstanding payload snapshots. Backend-only. Requires history preview, account API credentials, app permissions and MFA. Write operations require write scope. Delivery is at least once.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for delete a consumer group and its outstanding payload snapshots."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for delete a consumer group and its outstanding payload snapshots."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for delete a consumer group and its outstanding payload snapshots."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for delete a consumer group and its outstanding payload snapshots."
          }
        ],
        "responses": {
          "204": {
            "description": "No claim available or operation completed without a body"
          },
          "404": {
            "description": "Delete a consumer group and its outstanding payload snapshots. Endpoint or group not found"
          },
          "409": {
            "description": "Delete a consumer group and its outstanding payload snapshots. Group conflict, lost claim lease, or retention gap"
          },
          "429": {
            "description": "Delete a consumer group and its outstanding payload snapshots. Endpoint or group admission capacity reached"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/claims": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "claimRealtimeConsumerGroup",
        "summary": "Claim one retained message with an exclusive short lease",
        "description": "Returns 204 when paused, caught up, retry-delayed, or all active lease slots are occupied. Returns 429 when the outstanding snapshot cap prevents assignment, and 409 on a retention gap. Claim tokens are returned once and hashed at rest; this operation is excluded from generic response caching. Lease expiry may permit duplicate processing; use idempotent handlers. Does not accept subscription tickets or WebSocket credentials.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for claim one retained message with an exclusive short lease."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for claim one retained message with an exclusive short lease."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for claim one retained message with an exclusive short lease."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for claim one retained message with an exclusive short lease."
          }
        ],
        "responses": {
          "200": {
            "description": "Claim one retained message with an exclusive short lease. Consumer group operation result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroupClaim"
                }
              }
            }
          },
          "204": {
            "description": "Claim one retained message with an exclusive short lease. No claim available or operation completed without a body"
          },
          "404": {
            "description": "Claim one retained message with an exclusive short lease. Endpoint or group not found"
          },
          "409": {
            "description": "Claim one retained message with an exclusive short lease. Group conflict, lost claim lease, or retention gap"
          },
          "429": {
            "description": "Claim one retained message with an exclusive short lease. Admission capacity or event ID capacity reached; realtime_group_deduplication_full includes Retry-After and retry_after_seconds Group rate uses code realtime_group_rate_limited, Retry-After and retry_after_seconds.",
            "headers": {
              "Retry-After": {
                "description": "Claim one retained message with an exclusive short lease. Rounded-up seconds for group claim-rate throttling.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeConsumerGroupClaimRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/claims/settle": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "settleRealtimeConsumerGroupClaim",
        "summary": "Complete, retry or renew an unexpired claim",
        "description": "The sequence and opaque token must identify the current unexpired lease. Completion deletes its payload snapshot and increments the group completion count. Retries reaching max_attempts become dead letters. Duplicate settlement or a replaced/expired token returns 409; no exactly-once execution guarantee.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for complete, retry or renew an unexpired claim."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for complete, retry or renew an unexpired claim."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for complete, retry or renew an unexpired claim."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for complete, retry or renew an unexpired claim."
          }
        ],
        "responses": {
          "200": {
            "description": "Complete, retry or renew an unexpired claim. Consumer group operation result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeConsumerGroupSettlementResult"
                }
              }
            }
          },
          "404": {
            "description": "Complete, retry or renew an unexpired claim. Endpoint or group not found"
          },
          "409": {
            "description": "Complete, retry or renew an unexpired claim. Claim lease lost, or idempotency key reused with different contents (realtime_settlement_key_conflict)"
          },
          "429": {
            "description": "Complete, retry or renew an unexpired claim. Endpoint or group admission capacity reached"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeConsumerGroupSettlement"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/dead-letters": {
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "listRealtimeConsumerGroupDeadLetters",
        "summary": "List bounded failed message snapshots",
        "description": "List bounded failed message snapshots. Backend-only. Requires history preview, account API credentials, app permissions and MFA. Write operations require write scope. Delivery is at least once.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for list bounded failed message snapshots."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for list bounded failed message snapshots."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for list bounded failed message snapshots."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for list bounded failed message snapshots."
          }
        ],
        "responses": {
          "200": {
            "description": "List bounded failed message snapshots. Consumer group operation result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RealtimeConsumerGroupDeadLetter"
                  }
                }
              }
            }
          },
          "404": {
            "description": "List bounded failed message snapshots. Endpoint or group not found"
          },
          "409": {
            "description": "List bounded failed message snapshots. Group conflict, lost claim lease, or retention gap"
          },
          "429": {
            "description": "List bounded failed message snapshots. Endpoint or group admission capacity reached"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/dead-letters/export": {
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "exportRealtimeConsumerGroupDeadLetters",
        "summary": "Download a read-only dead-letter JSONL page",
        "description": "Account ownership, read scope, completed MFA and realtime history preview required. Returns one manifest line followed by zero to 128 dead_letter lines, ordered by numeric sequence. Payload is the retained snapshot with base64 data and metadata. No claim or credential tokens. Every page uses a repeatable-read read-only transaction; export never claims, replays, cleans up or extends retention. First page captures group_id, through_sequence and snapshot_at. Resume with those three values and next_after_sequence; keep failure_code filters unchanged. Later dead-letter transitions are excluded by the snapshot cutoff. Replay, deletion and retention cleanup can remove records between pages; this is a live export, not an immutable server archive. A recreated group or rewound assignment boundary returns 409 realtime_dead_letter_export_changed. Verify the manifest count and complete transfer before advancing the cursor. Link headers provide the next page. Empty exports still contain a manifest. At most 2 MiB per page. Persist downloads externally for archival.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for download a read-only dead-letter JSONL page."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for download a read-only dead-letter JSONL page."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for download a read-only dead-letter JSONL page."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for download a read-only dead-letter JSONL page."
          },
          {
            "name": "after_sequence",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$",
              "default": "0"
            },
            "description": "Exclusive numeric cursor. Resume using next_after_sequence from the last complete page."
          },
          {
            "name": "group_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid",
              "minLength": 36,
              "maxLength": 36
            },
            "description": "Immutable group identity. Supply together with through_sequence and snapshot_at when resuming."
          },
          {
            "name": "through_sequence",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "description": "Inclusive captured assignment boundary. Supply together with group_id and snapshot_at."
          },
          {
            "name": "snapshot_at",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Original manifest snapshot cutoff. Supply together with group_id and through_sequence."
          },
          {
            "name": "failure_code",
            "in": "query",
            "style": "form",
            "explode": true,
            "schema": {
              "type": "array",
              "maxItems": 32,
              "uniqueItems": true,
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64
              }
            },
            "description": "Repeat for exact safe failure-code matches; omitted includes all retained failures."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 128,
              "default": 32
            },
            "description": "Maximum records after the manifest."
          }
        ],
        "responses": {
          "200": {
            "description": "JSONL attachment. First line matches RealtimeDeadLetterExportManifest; subsequent lines match RealtimeDeadLetterExportRecord.",
            "content": {
              "application/x-ndjson": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "headers": {
              "Content-Disposition": {
                "schema": {
                  "type": "string"
                },
                "description": "Attachment filename ending in .jsonl"
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Relative next-page URL when has_more is true"
              },
              "X-Realtime-Export-Group-ID": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "X-Realtime-Export-Through-Sequence": {
                "schema": {
                  "type": "string"
                }
              },
              "X-Realtime-Export-Next-After-Sequence": {
                "schema": {
                  "type": "string"
                }
              },
              "X-Realtime-Export-Has-More": {
                "schema": {
                  "type": "boolean"
                }
              },
              "X-Realtime-Export-Snapshot-At": {
                "schema": {
                  "type": "string",
                  "format": "date-time"
                }
              }
            }
          },
          "400": {
            "description": "Invalid cursor or filters"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Read access or MFA required"
          },
          "404": {
            "description": "Preview or owned endpoint or group unavailable"
          },
          "409": {
            "description": "Group identity or export boundary changed (realtime_dead_letter_export_changed)"
          },
          "429": {
            "description": "Admission or export page capacity reached"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/dead-letters/preview": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "previewRealtimeConsumerGroupDeadLetters",
        "summary": "Preview filtered dead letters",
        "description": "Read scope, app ownership and MFA required. Read-only selection of materialized dead snapshots. Filters use exact failure codes, exclusive after_sequence and inclusive through_sequence. Default and maximum limit 32. has_more allows keyset pagination using the last returned sequence. Expired exhausted leases are excluded until materialized as dead. No replay or expiry grace is reserved; candidates can change after preview.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for preview filtered dead letters."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for preview filtered dead letters."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for preview filtered dead letters."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for preview filtered dead letters."
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded recovery result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeDeadLetterPreview"
                }
              }
            }
          },
          "400": {
            "description": "Invalid filters or selection",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Preview filtered dead letters. Endpoint or group not found"
          },
          "409": {
            "description": "Preview filtered dead letters. Group conflict, lost claim lease, or retention gap"
          },
          "429": {
            "description": "Preview filtered dead letters. Endpoint or group admission capacity reached"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeDeadLetterPreviewRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/replay-jobs": {
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "listRealtimeReplayJobs",
        "summary": "List replay jobs",
        "description": "Account ownership and MFA required. Read scope for listing; deploy-write scope for creation. Creation freezes up to 128 current failure identities matching the filters. Rate is an upper limit with no catch-up burst. Four running or paused jobs per group; recent terminal jobs retained in bounded history. Disabled endpoints and inactive owners suspend processing. Skips are terminal per item. Database failures roll back progress and retry on subsequent passes. Creation is not idempotent: inspect the job list after an uncertain response before retrying.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for list replay jobs."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for list replay jobs."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for list replay jobs."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for list replay jobs."
          }
        ],
        "responses": {
          "200": {
            "description": "Replay job result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RealtimeReplayJob"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid filters, empty selection or rate"
          },
          "404": {
            "description": "Group not found"
          },
          "409": {
            "description": "Active job quota reached"
          }
        }
      },
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "createRealtimeReplayJob",
        "summary": "Create a background dead-letter replay job",
        "description": "Create a background dead-letter replay job. Account ownership and MFA required. Read scope for listing; deploy-write scope for creation. Creation freezes up to 128 current failure identities matching the filters. Rate is an upper limit with no catch-up burst. Four running or paused jobs per group; recent terminal jobs retained in bounded history. Disabled endpoints and inactive owners suspend processing. Skips are terminal per item. Database failures roll back progress and retry on subsequent passes. Creation is not idempotent: inspect the job list after an uncertain response before retrying.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for create a background dead-letter replay job."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for create a background dead-letter replay job."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for create a background dead-letter replay job."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for create a background dead-letter replay job."
          }
        ],
        "responses": {
          "201": {
            "description": "Create a background dead-letter replay job. Replay job result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeReplayJob"
                }
              }
            }
          },
          "400": {
            "description": "Create a background dead-letter replay job. Invalid filters, empty selection or rate"
          },
          "404": {
            "description": "Create a background dead-letter replay job. Group not found"
          },
          "409": {
            "description": "Create a background dead-letter replay job. Active job quota reached"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeReplayJobRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/replay-jobs/dry-run": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "createRealtimeReplayDryRun",
        "summary": "Create a background replay eligibility report",
        "description": "Account ownership, MFA and deploy-write scope required. Captures current failure identities and checks each at the configured rate without expiring leases, replaying messages or changing the queue. Uses checking/check_paused states. Dry runs share the four-active-job quota and bounded history with real jobs. Results are observations at individual check times, not reservations. No replay lifecycle webhooks are emitted for dry runs. Start a real job from a completed report using the start control action; only reviewed eligible identities are copied and rechecked during actual replay. Empty selections are invalid. Creation is not idempotent; inspect recent jobs after an uncertain response before retrying.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for create a background replay eligibility report."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for create a background replay eligibility report."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for create a background replay eligibility report."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for create a background replay eligibility report."
          }
        ],
        "responses": {
          "201": {
            "description": "Create a background replay eligibility report. Replay job result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeReplayJob"
                }
              }
            }
          },
          "400": {
            "description": "Create a background replay eligibility report. Invalid filters, empty selection or rate"
          },
          "404": {
            "description": "Create a background replay eligibility report. Group not found"
          },
          "409": {
            "description": "Create a background replay eligibility report. Active job quota reached"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeReplayJobRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/replay-jobs/{job}/{action}": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "controlRealtimeReplayJob",
        "summary": "Pause, resume, cancel or start a reviewed replay",
        "description": "Account deploy-write scope, ownership and MFA required. Pause/resume/cancel apply to active real or dry-run jobs. Start requires a completed dry run with eligible failures, and creates a real replay at the report rate from only those exact reviewed identities. Rechecks identity, deadlines and ordering before each real replay. Repeated start returns the same job while retained; if that job was pruned it returns 409 and never starts another. If the report itself was pruned it returns 404. Promotion and the report link commit together. Both modes share the four-active-job quota. Terminal jobs reject pause/resume/cancel. Cancellation preserves committed replays.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for pause, resume, cancel or start a reviewed replay."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for pause, resume, cancel or start a reviewed replay."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for pause, resume, cancel or start a reviewed replay."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for pause, resume, cancel or start a reviewed replay."
          },
          {
            "name": "job",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Job for pause, resume, cancel or start a reviewed replay."
          },
          {
            "name": "action",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "pause",
                "resume",
                "cancel",
                "start"
              ]
            },
            "description": "Action for pause, resume, cancel or start a reviewed replay."
          }
        ],
        "responses": {
          "200": {
            "description": "Pause, resume, cancel or start a reviewed replay. Replay job result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeReplayJob"
                }
              }
            }
          },
          "400": {
            "description": "Invalid job or action"
          },
          "404": {
            "description": "Job not found"
          },
          "409": {
            "description": "Job is terminal, report not completed or not a dry run, no eligible failures, active quota reached, or previously started job pruned"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/dead-letters/replay": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "bulkReplayRealtimeConsumerGroupDeadLetters",
        "summary": "Replay selected dead letters",
        "description": "Deploy-write scope, app ownership and MFA required. Select 1 to 32 unique sequences with exact dead_since timestamps from preview and the immutable group UUID. Preserves ordering checks and resets attempts for successful replays. Outcomes are replayed, ordering_blocked, stale, not_dead, missing, deadline_expired or invalid_deadline. Missing may mean retention cleanup; no cause is inferred. Recognized per-item conflicts do not prevent other selected replays. Unexpected failures roll back the whole transaction. Group UUID mismatch returns 409. A replayed item gets a fresh fencing token on its next claim. Do not automatically retry an uncertain response.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for replay selected dead letters."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for replay selected dead letters."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for replay selected dead letters."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for replay selected dead letters."
          }
        ],
        "responses": {
          "200": {
            "description": "Replay selected dead letters. Bounded recovery result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeDeadLetterBulkReplayResult"
                }
              }
            }
          },
          "400": {
            "description": "Replay selected dead letters. Invalid filters or selection",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Replay selected dead letters. Endpoint or group not found"
          },
          "409": {
            "description": "Replay selected dead letters. Group conflict, lost claim lease, or retention gap"
          },
          "429": {
            "description": "Replay selected dead letters. Endpoint or group admission capacity reached"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeDeadLetterBulkReplayRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/dead-letters/{sequence}/replay": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "replayRealtimeConsumerGroupDeadLetter",
        "summary": "Replay one dead letter with a fresh retry budget",
        "description": "Replay one dead letter with a fresh retry budget. Backend-only. Requires history preview, account API credentials, app permissions and MFA. Write operations require write scope. Delivery is at least once.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for replay one dead letter with a fresh retry budget."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for replay one dead letter with a fresh retry budget."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for replay one dead letter with a fresh retry budget."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for replay one dead letter with a fresh retry budget."
          },
          {
            "name": "sequence",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Message sequence for replay one dead letter with a fresh retry budget."
          }
        ],
        "responses": {
          "204": {
            "description": "Replay one dead letter with a fresh retry budget. No claim available or operation completed without a body"
          },
          "404": {
            "description": "Replay one dead letter with a fresh retry budget. Endpoint or group not found"
          },
          "409": {
            "description": "Replay one dead letter with a fresh retry budget. Group conflict, lost claim lease, or retention gap"
          },
          "429": {
            "description": "Replay one dead letter with a fresh retry budget. Endpoint or group admission capacity reached"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/groups/{group}/resync": {
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "resyncRealtimeConsumerGroup",
        "summary": "Explicitly recover an unassigned retention gap",
        "description": "Requires expected_sequence to equal the assignment cursor, no ready/leased messages, and after_sequence to equal oldest_sequence minus one and advance the cursor. Recover missing work from application state first. Preserves dead letters and completed count; does not claim skipped work was processed.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for explicitly recover an unassigned retention gap."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for explicitly recover an unassigned retention gap."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for explicitly recover an unassigned retention gap."
          },
          {
            "name": "group",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Consumer group name for explicitly recover an unassigned retention gap."
          }
        ],
        "responses": {
          "204": {
            "description": "Explicitly recover an unassigned retention gap. No claim available or operation completed without a body"
          },
          "404": {
            "description": "Explicitly recover an unassigned retention gap. Endpoint or group not found"
          },
          "409": {
            "description": "Explicitly recover an unassigned retention gap. Group conflict, lost claim lease, or retention gap"
          },
          "429": {
            "description": "Explicitly recover an unassigned retention gap. Endpoint or group admission capacity reached"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeConsumerGroupResyncRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/acknowledgement": {
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "getRealtimeChannelAcknowledgement",
        "summary": "Read the latest actual ACK for a named durable consumer",
        "description": "Read-only and does not create or refresh a checkpoint. Requires history preview.\nACKs are consumer assertions; baselines and resets are not processing receipts.\nOnly the most recent advancing ACK is retained, not an individual-message ledger.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for read the latest actual ACK for a named durable consumer."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for read the latest actual ACK for a named durable consumer."
          },
          {
            "name": "channel",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Channel name for read the latest actual ACK for a named durable consumer."
          },
          {
            "name": "principal",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Principal for read the latest actual ACK for a named durable consumer."
          },
          {
            "name": "subscription",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Subscription for read the latest actual ACK for a named durable consumer."
          }
        ],
        "responses": {
          "200": {
            "description": "Current checkpoint and latest actual advancing ACK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeAcknowledgement"
                }
              }
            }
          },
          "404": {
            "description": "Consumer checkpoint missing or expired"
          }
        }
      }
    },
    "/v1/outbound/integrations/{integration}/probe-policy": {
      "parameters": [
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "Customer-owned outbound integration identifier.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "getOutboundBindingProbePolicy",
        "summary": "Read an explicitly configured outbound probe policy",
        "description": "Read a customer-owned integration's safe-method probe configuration. This does not send traffic to a provider.",
        "responses": {
          "200": {
            "description": "Probe policy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundBindingProbePolicy"
                }
              }
            }
          },
          "default": {
            "description": "Probe policy lookup was rejected or the catalog is unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "outbound"
        ],
        "operationId": "setOutboundBindingProbePolicy",
        "summary": "Configure an outbound binding probe",
        "description": "Declare a GET or HEAD path safe to probe and its expected 2xx status. The path must fit the customer-owned integration's route policy. Configuration sends no provider requests. Requires deploy-write access and MFA.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OutboundBindingProbePolicy"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Confirmed probe policy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundBindingProbePolicy"
                }
              }
            }
          },
          "default": {
            "description": "Probe policy update was rejected or could not be persisted",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "outbound"
        ],
        "operationId": "deleteOutboundBindingProbePolicy",
        "summary": "Remove an outbound binding probe configuration",
        "description": "Remove a customer-owned integration's probe policy, invalidating prior evidence. Requires deploy-write access and MFA. This does not revoke provider credentials.",
        "responses": {
          "204": {
            "description": "Probe configuration removed"
          },
          "default": {
            "description": "Probe policy removal was rejected or could not be persisted",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/outbound/integrations": {
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "listOutboundIntegrationOffers",
        "summary": "List managed outbound integrations available to this account.",
        "description": "Provider credentials and gateway tokens are never returned.",
        "responses": {
          "200": {
            "description": "Available managed integrations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundIntegrationOfferList"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "post": {
        "tags": [
          "outbound"
        ],
        "operationId": "createOutboundIntegration",
        "summary": "Create a customer-owned managed outbound integration.",
        "description": "Requires MFA and deploy-write scope. The origin must resolve only to globally reachable addresses. Provider Authorization is uploaded separately and sealed at rest.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOutboundIntegrationRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Customer integration created without credential material.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundIntegrationOffer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "409": {
            "description": "The account already has an integration with this name."
          },
          "429": {
            "description": "The account has reached its customer integration limit."
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/integrations/{integration}/credential": {
      "parameters": [
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of an account-owned customer-sealed integration.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "put": {
        "tags": [
          "outbound"
        ],
        "operationId": "putOutboundCredential",
        "summary": "Set or rotate a customer-held outbound provider credential.",
        "description": "The Authorization value is sealed at rest and never returned. Requires MFA and deploy-write scope.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutOutboundCredentialRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Credential saved; no secret is returned."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "outbound"
        ],
        "operationId": "deleteOutboundCredential",
        "summary": "Revoke a customer-held outbound provider credential.",
        "description": "Idempotent for an existing integration; subsequent gateway calls fail closed.",
        "responses": {
          "204": {
            "description": "Credential absent."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/integrations/{integration}/budget": {
      "parameters": [
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of the integration whose daily budget is being changed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "put": {
        "tags": [
          "outbound"
        ],
        "operationId": "setOutboundIntegrationDailyBudget",
        "summary": "Set or clear a customer-owned integration's daily request limit.",
        "description": "Requires MFA and deploy-write scope. The configured value cannot exceed the account plan's per-integration ceiling. Set daily_request_limit to null to clear the customer-selected limit.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutOutboundDailyRequestBudgetRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Daily request limit updated; no body returned."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/integrations/{integration}/request-policy": {
      "parameters": [
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of the customer-owned integration whose request policy is being changed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "put": {
        "tags": [
          "outbound"
        ],
        "operationId": "setOutboundIntegrationRequestPolicy",
        "summary": "Replace a customer-owned integration's rate, burst, concurrency, and timeout policy.",
        "description": "Requires MFA and deploy-write scope. Every value must fit the account plan ceiling. Changes are enforced on subsequent admissions without an outbound gateway restart; already-admitted calls keep their existing deadline.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutOutboundRequestPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Request policy updated; no body returned."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/integrations/{integration}/ai": {
      "parameters": [
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of the customer-owned integration whose AI gateway settings are being changed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "put": {
        "tags": [
          "outbound"
        ],
        "operationId": "setOutboundIntegrationAIPolicy",
        "summary": "Set or clear a customer-owned integration's AI provider and daily token limit.",
        "description": "Requires MFA and deploy-write scope. The gateway extracts token usage from responses in the selected provider's format and stops new calls once the UTC day's settled input plus output tokens reach the limit; calls already in flight may finish above it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutOutboundAIPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "AI gateway settings updated; no body returned."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/integrations/{integration}/ai-usage": {
      "parameters": [
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of the integration whose AI usage is being read.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "getOutboundIntegrationAIUsage",
        "summary": "Read one UTC day of AI gateway token usage by caller and model.",
        "description": "Requires MFA and read scope. Rollups are kept for 90 days.",
        "parameters": [
          {
            "name": "date",
            "in": "query",
            "required": false,
            "description": "UTC day as YYYY-MM-DD within the last 90 days; defaults to today.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "AI usage for the selected day.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAIUsageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/integrations/{integration}/ai-usage/users": {
      "parameters": [
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of the integration whose per-end-user AI usage is being read.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "getOutboundIntegrationAIUserUsage",
        "summary": "Read one UTC day of AI gateway usage by end user.",
        "description": "Requires MFA and read scope. End users are the X-Gregale-AI-User values apps send; rows are kept for 31 days and listed by cost, then tokens.",
        "parameters": [
          {
            "name": "date",
            "in": "query",
            "required": false,
            "description": "UTC day as YYYY-MM-DD within the last 31 days; defaults to today.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "end_user",
            "in": "query",
            "required": false,
            "description": "Read only this end user's row (\"~other\" reads the overflow row).",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Rows to return, 1 to 1000; defaults to 1000.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Per-end-user AI usage for the selected day.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAIUserUsageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/integrations/{integration}/ai-usage/users/export": {
      "parameters": [
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of the integration whose per-end-user AI usage is exported.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "exportOutboundIntegrationAIUserUsage",
        "summary": "Export per-end-user AI gateway usage for a range of UTC days.",
        "description": "Requires MFA and read scope. Streams every per-end-user row of the days from through to, ordered by day and end user. CSV columns are usage_date, end_user, requests, error_requests, input_tokens, output_tokens, tokens and cost_millicents; NDJSON lines carry the same fields.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "First UTC day as YYYY-MM-DD within the last 31 days; defaults to today.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Last UTC day as YYYY-MM-DD, not before from; defaults to today.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "description": "NDJSON lines (the default) or CSV rows with a header.",
            "schema": {
              "type": "string",
              "enum": [
                "ndjson",
                "csv"
              ],
              "default": "ndjson"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Per-end-user usage rows.",
            "content": {
              "application/x-ndjson": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "text/csv": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/ai-price-catalog": {
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "getOutboundAIPriceCatalog",
        "summary": "Read the built-in AI price catalog of one provider.",
        "description": "Requires MFA and read scope. The catalog prices the models an integration's own price list does not name. Prices are the providers' list prices in US dollars, rounded up.",
        "parameters": [
          {
            "name": "provider",
            "in": "query",
            "required": true,
            "description": "AI provider whose catalog is listed.",
            "schema": {
              "type": "string",
              "enum": [
                "openai",
                "anthropic",
                "gemini",
                "azure_openai",
                "bedrock",
                "vertex"
              ]
            }
          },
          {
            "name": "model",
            "in": "query",
            "required": false,
            "description": "Return only the catalog entry that would price this model.",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The provider's catalog, or the one entry that prices the model.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAIPriceCatalogResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          }
        }
      }
    },
    "/v1/outbound/integrations/{integration}/ai-prices": {
      "parameters": [
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of the AI integration whose price list is read or replaced.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "getOutboundIntegrationAIPrices",
        "summary": "Read the AI price list in effect.",
        "description": "Requires MFA and read scope. Returns the prices the integration's calls are costed at.",
        "responses": {
          "200": {
            "description": "The price list in effect.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAIPriceListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "outbound"
        ],
        "operationId": "setOutboundIntegrationAIPrices",
        "summary": "Replace a customer AI integration's price list.",
        "description": "Requires MFA and deploy-write scope. The new list prices calls settled from now on; earlier lists stay for costs already recorded.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutOutboundAIPricesRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Price list replaced; no body returned."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/integrations/{integration}/credential-keys": {
      "parameters": [
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of the integration whose extra provider keys are listed or added.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "listOutboundCredentialKeys",
        "summary": "List an integration's extra provider keys.",
        "description": "Requires MFA and read scope. Values are write-only and never returned.",
        "responses": {
          "200": {
            "description": "Extra keys, oldest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundCredentialKeyList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "post": {
        "tags": [
          "outbound"
        ],
        "operationId": "createOutboundCredentialKey",
        "summary": "Add an extra provider key to a customer-sealed integration.",
        "description": "Requires MFA and deploy-write scope. The outbound gateway picks keys round-robin and moves a call to the next key when one returns 429. At most 8 extra keys.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOutboundCredentialKeyRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Key sealed and stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundCredentialKey"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "A key with this label already exists."
          },
          "429": {
            "description": "The integration has reached its extra key limit."
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/integrations/{integration}/credential-keys/{key}": {
      "parameters": [
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of the integration that holds the extra key.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "key",
          "in": "path",
          "required": true,
          "description": "UUID of the extra key.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "delete": {
        "tags": [
          "outbound"
        ],
        "operationId": "deleteOutboundCredentialKey",
        "summary": "Remove an extra provider key.",
        "description": "Requires MFA and deploy-write scope. The outbound gateway stops using it on its next call.",
        "responses": {
          "204": {
            "description": "Key removed."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/integrations/{integration}/ai-usage/tags": {
      "parameters": [
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of the integration whose AI usage by tag is being read.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "getOutboundAITagUsage",
        "summary": "Read one UTC day of AI gateway usage by tag.",
        "description": "Requires MFA and read scope. Tags are the key=value pairs apps send in X-Gregale-AI-Tags; rows are kept for 31 days and listed by cost, then tokens, with each tag's daily cost limit.",
        "parameters": [
          {
            "name": "date",
            "in": "query",
            "required": false,
            "description": "UTC day of the tag rows as YYYY-MM-DD within the last 31 days; defaults to today.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": false,
            "description": "Read only this tag key's tags, its overflow row included.",
            "schema": {
              "type": "string",
              "maxLength": 32
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Tag rows to return, 1 to 1000; defaults to 1000.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "AI usage by tag for the selected day.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAITagUsageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/integrations/{integration}/ai-usage/tags/export": {
      "parameters": [
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of the integration whose AI usage by tag is exported.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "exportOutboundAITagUsage",
        "summary": "Export a day range of AI gateway usage by tag.",
        "description": "Requires MFA and read scope. Streams every tag row of the UTC days from through to, optionally of one key, ordered by day and tag, as NDJSON (the default) or CSV with the columns of OutboundAITagUsageExportRow.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "First UTC day of the export as YYYY-MM-DD within the last 31 days; defaults to today.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Last UTC day of the export as YYYY-MM-DD, not before from; defaults to today.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": false,
            "description": "Export only this tag key's rows, its overflow row included.",
            "schema": {
              "type": "string",
              "maxLength": 32
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "description": "ndjson (the default) or csv.",
            "schema": {
              "type": "string",
              "enum": [
                "ndjson",
                "csv"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The tag rows of the range.",
            "content": {
              "application/x-ndjson": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAITagUsageExportRow"
                }
              },
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/integrations/{integration}/ai-tag-limits": {
      "parameters": [
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of the managed AI integration.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "getOutboundAITagLimits",
        "summary": "Read an AI integration's per-tag daily cost limits.",
        "description": "Requires MFA and read scope. Returns each tag's daily cost limit.",
        "responses": {
          "200": {
            "description": "The integration's tag limits, ordered by tag.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAITagLimits"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "outbound"
        ],
        "operationId": "setOutboundAITagLimits",
        "summary": "Replace an AI integration's per-tag daily cost limits.",
        "description": "Requires MFA and deploy-write scope. A call carrying a limited tag is refused with 429 outbound_budget_exhausted (X-Gregale-Outbound-Rejection tag_daily_cost_limit) when the tag's settled UTC-day cost, live reservations and the call's reservation would pass the limit. An empty list removes every limit.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutOutboundAITagLimitsRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "The limits were replaced."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/integrations/{integration}/ai-alerts": {
      "parameters": [
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of the integration whose AI budget alerts are listed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "listOutboundAIBudgetAlerts",
        "summary": "List AI budget alerts recorded at 80% and 100%.",
        "description": "Requires MFA and read scope. Newest first; kept for 90 days.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size, 1 to 100 (default 100).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Budget alerts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAIBudgetAlertList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/integrations/{integration}/ai-requests": {
      "parameters": [
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of the integration whose AI request log is read.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "listOutboundAIRequestLog",
        "summary": "Page the opt-in AI request log.",
        "description": "Requires MFA and read scope. Newest first; rows are kept for 7 days and hold metadata. content_captured marks calls whose bodies were captured.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size, 1 to 200 (default 200).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "description": "The previous page's next_before.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of logged calls.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAIRequestLogList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/integrations/{integration}/ai-traces": {
      "parameters": [
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of the integration whose AI traces are read.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "listOutboundAITraces",
        "summary": "Page an integration's AI traces.",
        "description": "Requires MFA and read scope. A trace groups the calls of one agent task, named by X-Gregale-AI-Trace or the trace ID of a W3C traceparent header. Traces are recorded while the integration keeps a request log or has trace limits, and are kept for 7 days. Newest last call first.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Traces per page, 1 to 200 (default 200).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "description": "The previous page's next_before, to read traces last called earlier.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "app_id",
            "in": "query",
            "required": false,
            "description": "Only traces whose first call came from this app.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "end_user",
            "in": "query",
            "required": false,
            "description": "Only traces whose first call named this X-Gregale-AI-User.",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of traces.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAITraceList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/integrations/{integration}/ai-traces/{trace}": {
      "parameters": [
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of the integration that recorded the trace.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "trace",
          "in": "path",
          "required": true,
          "description": "The trace ID, path-escaped.",
          "schema": {
            "type": "string",
            "maxLength": 64
          }
        }
      ],
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "getOutboundAITrace",
        "summary": "Read an AI trace with its logged calls.",
        "description": "Requires MFA and read scope. Calls are the trace's request-log entries, oldest first, at most 500; calls_truncated marks a longer trace.",
        "responses": {
          "200": {
            "description": "The trace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAITraceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/integrations/{integration}/ai-quality-alerts": {
      "parameters": [
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of the integration whose alerts are listed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "listOutboundAIQualityAlerts",
        "summary": "List an integration's AI quality drift alerts.",
        "description": "Requires MFA and read scope. Alerts are newest first and kept for 31 days; each fires once per model, metric and UTC day.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Alerts to return, 1 to 100 (default 50).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The alerts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAIQualityAlertList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/integrations/{integration}/ai-requests/{request}/feedback": {
      "parameters": [
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of the integration that logged the call.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "request",
          "in": "path",
          "required": true,
          "description": "ID of the request-log entry, the value X-Gregale-AI-Call returned.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "put": {
        "tags": [
          "outbound"
        ],
        "operationId": "putOutboundAIRequestFeedback",
        "summary": "Rate a logged AI call.",
        "description": "Requires MFA and deploy-write scope. Apps rate their own calls through the gateway at /i/{integration}/_gregale/feedback; this rates any logged call on a person's behalf. A later rating replaces the earlier one, and the call's daily usage counts the change.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutOutboundAIFeedbackRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "The rating was stored."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/integrations/{integration}/ai-requests/{request}/replays": {
      "parameters": [
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of the integration whose captured call is replayed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "request",
          "in": "path",
          "required": true,
          "description": "ID of the request-log entry whose capture is replayed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "outbound"
        ],
        "operationId": "createOutboundAIReplay",
        "summary": "Replay a captured AI call on other integrations or models.",
        "description": "Requires MFA and deploy-write scope. The outbound gateway resends the captured request to each target without streaming; the calls count against the targets' budgets. At most 100 replays per integration per UTC day.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOutboundAIReplayRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The pending replay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAIReplay"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The call has no capture that can be resent.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "The integration reached its replays for the UTC day.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/ai-replays/{replay}": {
      "parameters": [
        {
          "name": "replay",
          "in": "path",
          "required": true,
          "description": "UUID of the replay.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "getOutboundAIReplay",
        "summary": "Read an AI replay and its results.",
        "description": "Requires MFA and read scope. Replays are kept for 3 days.",
        "responses": {
          "200": {
            "description": "The replay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAIReplay"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/integrations/{integration}/ai-content-policy": {
      "parameters": [
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of the customer AI integration.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "put": {
        "tags": [
          "outbound"
        ],
        "operationId": "putOutboundAIContentPolicy",
        "summary": "Replace an AI integration's content guardrails.",
        "description": "Requires MFA and deploy-write scope. An active policy requires an AI provider; with one, request bodies the gateway cannot read are refused.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OutboundAIContentPolicy"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "The policy was replaced."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/integrations/{integration}/ai-requests/{request}/content": {
      "parameters": [
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of the integration whose logged call is rated.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "request",
          "in": "path",
          "required": true,
          "description": "ID of the request-log entry.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "getOutboundAIRequestContent",
        "summary": "Read one logged AI call's captured bodies.",
        "description": "Requires MFA and read scope. Returns the start of the request and response bodies the gateway sent and received when request_log_content was on. Captures are kept for 3 days; a call without one is not found.",
        "responses": {
          "200": {
            "description": "The captured bodies.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAIRequestContent"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/ai-routes": {
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "listOutboundAIRoutes",
        "summary": "List the account's AI fallback routes.",
        "description": "Requires MFA and read scope. Lists every AI route the account owns.",
        "responses": {
          "200": {
            "description": "AI routes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAIRouteList"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "post": {
        "tags": [
          "outbound"
        ],
        "operationId": "createOutboundAIRoute",
        "summary": "Create an AI fallback route over managed AI integrations.",
        "description": "Requires MFA and deploy-write scope. Every target must be an enabled managed AI integration of this account; a native route needs one ai_provider, an openai route translates OpenAI chat completions for anthropic and gemini targets. Apps call $GREGALE_OUTBOUND_URL/r/{id}/{provider path}; the gateway tries targets in order and moves on after a budget or availability rejection, a provider 408, 429 or 5xx, or a transport error, before any response byte is sent.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOutboundAIRouteRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Route created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAIRoute"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "409": {
            "description": "A route with this name already exists."
          },
          "429": {
            "description": "The account has reached its AI route limit."
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/ai-routes/{route}": {
      "parameters": [
        {
          "name": "route",
          "in": "path",
          "required": true,
          "description": "UUID of the AI route.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "getOutboundAIRoute",
        "summary": "Read one AI fallback route.",
        "description": "Requires MFA and read scope.",
        "responses": {
          "200": {
            "description": "The route.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAIRoute"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "outbound"
        ],
        "operationId": "deleteOutboundAIRoute",
        "summary": "Delete an AI fallback route.",
        "description": "Requires MFA and deploy-write scope.",
        "responses": {
          "204": {
            "description": "Route deleted."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/ai-routes/{route}/targets": {
      "parameters": [
        {
          "name": "route",
          "in": "path",
          "required": true,
          "description": "UUID of the AI route whose targets are replaced.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "put": {
        "tags": [
          "outbound"
        ],
        "operationId": "setOutboundAIRouteTargets",
        "summary": "Replace an AI route's ordered targets.",
        "description": "Requires MFA and deploy-write scope. The same ownership and route-format rules as creation apply.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutOutboundAIRouteTargetsRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Targets replaced."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/ai-routes/{route}/canary": {
      "parameters": [
        {
          "name": "route",
          "in": "path",
          "required": true,
          "description": "UUID of the AI route whose model canary is read or changed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "getOutboundAIRouteCanary",
        "summary": "Read an AI route's model canary with both targets' counts.",
        "description": "Requires MFA and read scope. Returns the canary with the route's first target's and the canary target's settled attempts over the canary's window. A route without a canary is not found.",
        "responses": {
          "200": {
            "description": "The canary and its counts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAIRouteCanaryStatus"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "outbound"
        ],
        "operationId": "setOutboundAIRouteCanary",
        "summary": "Start or replace an AI route's model canary.",
        "description": "Requires MFA and deploy-write scope. The canary target receives the given share of the route's calls first and is rolled back by the outbound gateway when its error rate or time to first byte is worse than the first target's by more than the margins. Replacing a canary clears its counts.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutOutboundAIRouteCanaryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The canary, active.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAIRouteCanary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "outbound"
        ],
        "operationId": "deleteOutboundAIRouteCanary",
        "summary": "Stop an AI route's model canary.",
        "description": "Requires MFA and deploy-write scope. The route keeps its targets in order.",
        "responses": {
          "204": {
            "description": "Canary stopped."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/ai-routes/{route}/stats": {
      "parameters": [
        {
          "name": "route",
          "in": "path",
          "required": true,
          "description": "UUID of the AI route whose targets' recent attempts are read.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "getOutboundAIRouteStats",
        "summary": "Read an AI route's targets' recent attempts.",
        "description": "Requires MFA and read scope. Returns each target's settled attempts, errors, mean time to first byte and mean cost per successful attempt over the window latency and cost routes judge. Attempts are counted for latency and cost routes and during a canary; other routes report zeros.",
        "responses": {
          "200": {
            "description": "The route's targets' attempts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAIRouteStats"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/ai-routes/{route}/canary/promote": {
      "parameters": [
        {
          "name": "route",
          "in": "path",
          "required": true,
          "description": "UUID of the AI route whose canary target becomes its first target.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "outbound"
        ],
        "operationId": "promoteOutboundAIRouteCanary",
        "summary": "Promote an AI route's model canary.",
        "description": "Requires MFA and deploy-write scope. Moves the canary target to the front of the route, keeps the other targets in order, and ends the canary.",
        "responses": {
          "200": {
            "description": "The route with its new order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAIRoute"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/ai-routes/{route}/evaluations": {
      "parameters": [
        {
          "name": "route",
          "in": "path",
          "required": true,
          "description": "UUID of the AI route whose target is evaluated.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "listOutboundAIEvaluations",
        "summary": "List an AI route's latest evaluations.",
        "description": "Requires MFA and read scope. Newest first, at most 100, without their samples.",
        "responses": {
          "200": {
            "description": "The route's evaluations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAIEvaluationList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "post": {
        "tags": [
          "outbound"
        ],
        "operationId": "createOutboundAIEvaluation",
        "summary": "Evaluate an AI route target before a canary.",
        "description": "Requires MFA and deploy-write scope. The outbound gateway replays the route's first target's latest captured OpenAI chat completions and Responses calls on the target and asks the judge model which answer is better, in a random order. The evaluation passes when losses and candidate errors are at most max_loss_rate percent of the sample; a passing evaluation starts its canary, if it has one, unless the route already has an active canary or the target changed. Candidate and judge calls are metered and capped under the caller evaluation. The first target's integration needs request_log_content.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOutboundAIEvaluationRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The pending evaluation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAIEvaluation"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "description": "The route reached its evaluations for the UTC day.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/ai-evaluations/{evaluation}": {
      "parameters": [
        {
          "name": "evaluation",
          "in": "path",
          "required": true,
          "description": "UUID of the evaluation.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "getOutboundAIEvaluation",
        "summary": "Read an AI evaluation and its samples.",
        "description": "Requires MFA and read scope. Evaluations are kept for 30 days.",
        "responses": {
          "200": {
            "description": "The evaluation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAIEvaluation"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/integrations/{integration}/runs": {
      "parameters": [
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of the account-owned integration whose Runs access is changing.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "put": {
        "tags": [
          "outbound"
        ],
        "operationId": "setOutboundIntegrationRunsBinding",
        "summary": "Grant or revoke use of a managed integration by stateless Runs.",
        "description": "Requires MFA and deploy-write scope. Grants are separate from app bindings and require an enabled integration with a configured managed credential and at least one allowed route. Run tool calls are available only after the Runs broker is enabled for the deployment.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutOutboundRunsBindingRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Runs integration grant updated; no body returned."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Integration is missing a managed credential or allowed route."
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/integrations/{integration}/usage": {
      "parameters": [
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of the integration whose current usage is being read.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "getOutboundIntegrationUsage",
        "summary": "Read the integration's current UTC-day outbound request usage.",
        "description": "Requires MFA and read-surface scope. Counts requests admitted by the gateway, including provider calls that later fail. Usage resets at the returned UTC midnight timestamp.",
        "responses": {
          "200": {
            "description": "Current UTC-day request count and configured limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundIntegrationUsageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/outbound/integrations/{integration}": {
      "parameters": [
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of a customer-owned managed integration.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "delete": {
        "tags": [
          "outbound"
        ],
        "operationId": "deleteOutboundIntegration",
        "summary": "Delete a customer-owned managed outbound integration.",
        "description": "Requires MFA and deploy-write scope. Deletes the integration, its sealed credential, app bindings, and admission state. Operator-provisioned integrations cannot be deleted here.",
        "responses": {
          "204": {
            "description": "Integration deleted."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/bindings/release-policy": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "scope",
          "in": "query",
          "description": "Exact deployment scope. Omit to select default.",
          "schema": {
            "type": "string",
            "default": "default",
            "maxLength": 40,
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getBindingReleasePolicy",
        "summary": "Read a scope's stored binding release policy.",
        "description": "Requires apps:read or admin and completed MFA. Defaults to off with revision 0. No probes or provider calls occur.",
        "responses": {
          "200": {
            "description": "Stored policy, or the disabled default.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BindingReleasePolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "apps"
        ],
        "operationId": "setBindingReleasePolicy",
        "summary": "Replace a binding release policy using its current revision.",
        "description": "Requires deploy:write or admin and completed MFA. expected_revision is\nmandatory (0 initially); each accepted write increments it. Enforcement\nrequires complete fresh verification on every deployment gaining traffic,\nincluding through redistribution. Promotion, direct traffic PATCH and\ncanary advance evaluate the policy; request flags may only strengthen it.\nNew candidates must be admitted with explicit zero traffic. Automatic\ncutovers, legacy recovery and project release graph switches fail closed\nuntil they support binding fences. Policies with storage requirements must use\nrelease-policy-with-object-storage for updates, including explicit clearing.\nPolicies with queue requirements must use release-policy-with-queues and\nexplicitly retain or clear every queue and storage requirement.\nTo recover without evidence, explicitly\nset off with the current revision and a reason, then retry. Every update\nhas durable policy history. Existing traffic is not changed by this call.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetBindingReleasePolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved policy with incremented revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BindingReleasePolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/bindings/release-policy-with-object-storage": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "scope",
          "in": "query",
          "description": "Deployment scope whose object-storage release policy will be replaced. Omit for default.",
          "schema": {
            "type": "string",
            "default": "default",
            "maxLength": 40,
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
          }
        }
      ],
      "put": {
        "tags": [
          "apps"
        ],
        "operationId": "setObjectStorageBindingReleasePolicy",
        "summary": "Replace release policy including required object-storage operations.",
        "description": "Requires deploy:write or admin and completed MFA. Uses the same revision\ncompare-and-set and traffic fences as release-policy. Explicit\nobject_storage_requirements is required; an empty object clears it.\nKeys are managed environment prefixes in this scope (at most 32), values\nare read, write or read_write. Missing bindings, insufficient permissions,\nstale evidence, incomplete stages and mismatched operations block traffic.\nRead accepts the legacy listing canary; write requires upload and cleanup;\nread_write also requires byte-for-byte download. Current application ACKs\nare independently required when configured. This call only records policy;\nneither policy updates nor promotion initiate storage writes. Old servers\nreturn 404 on this route rather than silently dropping the requirements.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetObjectStorageBindingReleasePolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated object-storage release requirements and the new policy revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BindingReleasePolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/bindings/services/{service}/explanation": {
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "explainAppServiceBinding",
        "summary": "Explain service authorization for an exact caller deployment.",
        "description": "Read-only policy and routing observation using the gateway app authorizer,\nmanaged environment binding resolver and project release resolver. Requires\napps:read or admin and completed MFA. The deployment must belong to the\nselected app. Its environment is inferred; scope, when supplied, asserts\nthat environment. Managed deployments never fall back to global app names.\nTarget identities are returned only within the selected account. Policy\ndenials and incomplete contexts return 200 with result denied or\nindeterminate. Missing or foreign caller deployments return 404. Previews,\nqualification guests and development bridges are not evaluated. No tasks,\nguest requests, writes or provider calls occur. Separate metadata reads\nare not an atomic snapshot, caller authentication, runtime adoption or\nconnectivity evidence. Unpinned routes do not select a target deployment.\nResponses use Cache-Control: no-store.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "service",
            "in": "path",
            "required": true,
            "description": "Logical service workload for managed deployments, otherwise target app slug.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "deployment_id",
            "in": "query",
            "required": true,
            "description": "Exact app-owned caller deployment UUID. This selector does not establish live caller identity.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "description": "Optional assertion of the selected deployment environment. A mismatch produces a denied explanation.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "method",
            "in": "query",
            "description": "HTTP method to evaluate against the target scope.",
            "schema": {
              "type": "string",
              "default": "GET"
            }
          },
          {
            "name": "path",
            "in": "query",
            "description": "Origin-form request path. Ambiguous paths are rejected; query values are omitted from the report.",
            "schema": {
              "type": "string",
              "default": "/"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sanitized policy and routing explanation, without connectivity claims.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceBindingExplanation"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/bindings": {
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppBindingInventory",
        "summary": "Inspect all runtime resource bindings attached to an app.",
        "description": "Service entries use the selected deployment's frozen environment graph\nwhen managed; without deployment_id the current live deployment is selected.\nLogical service names remain distinct from physical target app identities.\nservice_context reports the reviewed route and a context revision, never\nconnectivity evidence. Ordinary task-probe verification of managed services\nis unsupported and app-scoped receipts are excluded. Managed target routes\ncannot be overridden through service_targets. Invalid frozen context or\nunreadable routes make complete=false without falling back to app settings.\nRead-only, best-effort metadata for service, PostgreSQL, object-storage,\nqueue and outbound bindings. Requires apps:read or admin. PostgreSQL\nsections additionally require managed-postgres:read or admin; object\nstorage sections require storage:manage or admin, matching the existing\ncompute-binding read surface. MFA-pending sessions are rejected.\nMissing permissions and failed sections appear as structured issues in\na 200 response with complete=false; successfully read sections remain.\nAn unconfigured managed PostgreSQL feature is a warning. Other issues\nhave error severity. No provider calls, workload probes or writes occur.\nState describes configuration/provisioning, not applied runtime health.\nRuntime status is unknown unless a scheduler queue observation exists;\nverification status includes durable service, PostgreSQL and object-storage task-guest canary results. GeneratedAt is collection time, not a\npromise of an atomic snapshot. Credential material and raw errors are\nexcluded. Responses use Cache-Control: no-store.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "deployment_id",
            "in": "query",
            "description": "Select the service namespace and evidence for this exact app-owned, materialized live deployment, including zero-traffic candidates. No fallback to evidence from another deployment. Omit to use the manual-task selection.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "service_targets",
            "in": "query",
            "description": "JSON object mapping declared service names to exact live deployment UUIDs in the caller scope. Requires deployment_id. Target evidence is isolated from ordinary any-replica evidence. Does not change routes or grant access.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "description": "Filter database and bucket binding scopes. Omit to include all scopes. App-wide service, queue and outbound bindings always remain included.",
            "schema": {
              "type": "string",
              "minLength": 3,
              "maxLength": 40,
              "pattern": "^[a-z0-9]([a-z0-9-]{1,38})[a-z0-9]$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Complete or partial binding inventory, without credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppBindingInventory"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/ai-deployments": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "The app whose deployments to list.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "listAIDeployments",
        "summary": "List an app's AI gateway calls by deployment.",
        "description": "Requires MFA and read scope. Each deployment with AI gateway calls in the last 14 days, latest call first, at most 50: its calls, provider errors, flagged answers, cost, tokens and mean time to first byte. Only calls made from the app's instances count; access tokens, Runs, replays and cached responses do not.",
        "responses": {
          "200": {
            "description": "The app's deployments.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AIDeploymentUsageList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/ai-access-tokens": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "The app the tokens act as.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "listOutboundAIAccessTokens",
        "summary": "List an app's AI gateway access tokens.",
        "description": "Requires MFA and read scope. Newest first, without their secrets.",
        "responses": {
          "200": {
            "description": "The app's tokens.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAIAccessTokenList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "post": {
        "tags": [
          "outbound"
        ],
        "operationId": "createOutboundAIAccessToken",
        "summary": "Issue an AI gateway access token for an app.",
        "description": "Requires MFA and deploy-write scope. A caller outside Gregale, such as local development, CI or a notebook, sets its SDK's base URL to the AI gateway's public host and puts the token where the SDK puts its API key (Authorization Bearer, x-api-key, x-goog-api-key or api-key). Its calls are the app's: the app's bindings, guardrails, caps and content policy apply. The secret is returned only in this response. An app holds at most 20 live tokens.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOutboundAIAccessTokenRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The token and its secret.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedOutboundAIAccessToken"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The app already has a live token with this name, or holds its most live tokens.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/ai-access-tokens/{token}": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "The app the token acts as.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "UUID of the access token.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "delete": {
        "tags": [
          "outbound"
        ],
        "operationId": "revokeOutboundAIAccessToken",
        "summary": "Revoke an AI gateway access token.",
        "description": "Requires MFA and deploy-write scope. The outbound gateway may accept the token for up to 30 seconds more.",
        "responses": {
          "204": {
            "description": "Access token revoked."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/outbound-bindings": {
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "listOutboundAppBindings",
        "summary": "List an app's managed outbound bindings.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          }
        ],
        "responses": {
          "200": {
            "description": "Current app bindings, without credential material.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAppBindingList"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/outbound-bindings/{integration}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of an account-owned managed integration.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "put": {
        "tags": [
          "outbound"
        ],
        "operationId": "bindOutboundIntegration",
        "summary": "Bind an app to an existing managed outbound integration.",
        "description": "Idempotent. The integration is operator-provisioned; this request never carries a provider key.",
        "responses": {
          "200": {
            "description": "Binding stored; a customer-sealed integration also needs a configured credential to serve traffic.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundAppBinding"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "patch": {
        "tags": [
          "outbound"
        ],
        "operationId": "updateOutboundBindingPolicy",
        "summary": "Narrow an app's managed outbound route policy.",
        "description": "Methods and paths must remain within the operator-approved integration policy. Requires MFA and deploy-write scope.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateOutboundBindingPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Binding route policy updated."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "outbound"
        ],
        "operationId": "unbindOutboundIntegration",
        "summary": "Remove an app's managed outbound binding.",
        "description": "Idempotent; returns 204 even when the binding is already absent.",
        "responses": {
          "204": {
            "description": "Binding absent."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/outbound-bindings/{integration}/budget": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of the app's attached integration whose limit is being configured.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "put": {
        "tags": [
          "outbound"
        ],
        "operationId": "setOutboundBindingDailyBudget",
        "summary": "Set or clear an app binding's daily outbound request limit.",
        "description": "Requires MFA and deploy-write scope. The configured limit cannot exceed the account plan ceiling. Send null to clear the app-specific limit.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutOutboundBindingDailyRequestBudgetRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Binding budget updated; no body returned."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/outbound-bindings/{integration}/ai-budget": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of the app's bound AI integration.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "put": {
        "tags": [
          "outbound"
        ],
        "operationId": "setOutboundBindingAIBudget",
        "summary": "Set or clear an app's own daily AI token limit on an AI integration.",
        "description": "Requires MFA and deploy-write scope. Admission stops the app's new calls once its settled input plus output tokens reach the limit; other apps are unaffected.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutOutboundBindingAIBudgetRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "App AI token limit updated; no body returned."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/outbound-bindings/{integration}/ai-guardrails": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of the app's bound AI integration whose guardrails are replaced.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "put": {
        "tags": [
          "outbound"
        ],
        "operationId": "setOutboundBindingAIGuardrails",
        "summary": "Replace an app's AI guardrails on an AI integration.",
        "description": "Requires MFA and deploy-write scope. Sets per-minute request and token limits, a model allow-list and a per-request output-token ceiling; the gateway adds the ceiling to requests that name none.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutOutboundBindingAIGuardrailsRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Guardrails replaced; no body returned."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AIGatewayPlanGated"
          },
          "403": {
            "$ref": "#/components/responses/AIGatewayUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/outbound-bindings/{integration}/usage": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "integration",
          "in": "path",
          "required": true,
          "description": "UUID of the app's attached integration whose usage is requested.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "outbound"
        ],
        "operationId": "getOutboundBindingUsage",
        "summary": "Read an app binding's current UTC-day outbound request usage.",
        "description": "Requires MFA and read-surface scope. Reports UTC-day admissions for this app-to-integration binding, including provider calls that later fail; the returned timestamp marks its reset.",
        "responses": {
          "200": {
            "description": "Current UTC-day request count and effective binding limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundBindingUsageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/service-caller-keys": {
      "get": {
        "tags": [
          "networking"
        ],
        "operationId": "getServiceCallerKeys",
        "summary": "Read the public keys used to verify service-caller assertions.",
        "description": "Unauthenticated, rate-limited JWKS containing only public Ed25519 keys.\nKeys retired during node rotation remain listed for the 30-second\nassertion lifetime. Cache responses only briefly and refresh on an\nunknown `kid` before rejecting an otherwise valid assertion.\n",
        "security": [],
        "responses": {
          "200": {
            "description": "Current and rotation-grace verification keys.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "Public max-age 5 seconds; stale responses must be revalidated."
              }
            },
            "content": {
              "application/jwk-set+json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceCallerJWKSet"
                }
              }
            }
          },
          "429": {
            "description": "Source-IP request limit exceeded.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "The public verification key set could not be read safely.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/status": {
      "get": {
        "tags": [
          "status"
        ],
        "operationId": "getPublicStatus",
        "summary": "Read the current public platform status.",
        "description": "Unauthenticated single-region snapshot. Includes five public\ncapabilities, exactly 30 UTC daily observations per capability,\ncurrent error-budget indicators, active events, maintenance in the\nnext 30 days, and up to 20 resolved incidents from the last 90 days.\nData older than 90 seconds is marked stale; missing telemetry is never\nrepresented as operational.\n",
        "security": [],
        "responses": {
          "200": {
            "description": "Current status snapshot, including degraded-source responses.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "Uses public max-age 15 and stale-while-revalidate 45 caching."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicStatusOverview"
                }
              }
            }
          }
        }
      }
    },
    "/v1/consumer-billing/{slug}": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "The app whose consumer key authenticates the request.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "consumers"
        ],
        "operationId": "getConsumerBillingSummary",
        "summary": "Read your own month-to-date usage and spend with your consumer key.",
        "description": "For an app's customers, not operators. Authenticate with a consumer\nkey that carries the billing scope. The amount is priced like the\nnext statement, but late usage can still change it.\n",
        "security": [
          {
            "consumerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "The consumer's month to date.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsumerBillingSummaryResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The consumer key lacks the billing scope.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "The key exceeded 60 billing requests per minute (`consumer_billing_rate_limited`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/consumer-billing/{slug}/usage": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "The app whose usage is read.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "consumers"
        ],
        "operationId": "getConsumerBillingUsage",
        "summary": "Read your own daily usage with your consumer key.",
        "security": [
          {
            "consumerKey": []
          }
        ],
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "required": false,
            "description": "RFC 3339 start (default the start of the current UTC month).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "description": "RFC 3339 end, at most 31 days after since (default now).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Requests and billable units per UTC day.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsumerBillingUsageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "This consumer key has no billing scope.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many billing requests for this key.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/consumer-billing/{slug}/statements": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "The app whose statements are read.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "consumers"
        ],
        "operationId": "listConsumerBillingStatements",
        "summary": "Read your own finalized statements and invoice status with your consumer key.",
        "security": [
          {
            "consumerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "The latest 24 finalized statements, newest first, each with its invoice's payment status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsumerBillingStatementsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "A consumer key without the billing scope cannot list statements.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Statement reads for this key are rate limited.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/consumer-billing/{slug}/plans": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "The app whose plans the consumer reads.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "consumers"
        ],
        "operationId": "listConsumerBillingPlans",
        "summary": "List the plans you can switch to with your consumer key.",
        "security": [
          {
            "consumerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Your current plan, the offered plans and what you may do on your own.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsumerBillingPlansResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The consumer key lacks the billing scope to list plans.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Plan reads for this key are rate limited.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/consumer-billing/{slug}/plan": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "The app whose plan the consumer changes.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "put": {
        "tags": [
          "consumers"
        ],
        "operationId": "changeConsumerBillingPlan",
        "summary": "Switch to another offered plan from the next minute with your consumer key.",
        "description": "Only when the app owner lets customers change plans. The app owner\ngets a consumer.plan_changed webhook.\n",
        "security": [
          {
            "consumerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChangeConsumerBillingPlanRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The scheduled plan change.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsumerBillingPlanChangeResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The consumer key lacks the billing scope to change plans.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Plan changes are not offered (`consumer_self_service_unavailable`), you are already on the plan, or a change is pending.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The plan is not one of the offered plans.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Plan changes for this key are rate limited.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/consumer-billing/{slug}/portal": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "The app whose billing portal the consumer opens.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "tags": [
          "consumers"
        ],
        "operationId": "createConsumerBillingPortalSession",
        "summary": "Open Stripe's customer portal to update your card and see invoices.",
        "description": "For consumers billed through the app owner's Stripe (external_ref\ncus_...). The URL is short-lived; return_url defaults to the app's\nsign-up return URL.\n",
        "security": [
          {
            "consumerKey": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateConsumerBillingPortalRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The portal URL to send the customer to.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsumerBillingPortalResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The consumer key lacks the billing scope to open the portal.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The account is not billed through Stripe, or the owner's Stripe portal is not set up (`consumer_self_service_unavailable`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "return_url is not an https URL.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Portal sessions for this key are rate limited.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "502": {
            "description": "Stripe could not be reached for the portal (`billing_provider_unavailable`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Stripe could not be reached for the portal (`billing_provider_unavailable`). Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/consumer-billing/{slug}/close": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "The app whose account the consumer closes.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "tags": [
          "consumers"
        ],
        "operationId": "closeConsumerBillingAccount",
        "summary": "Close your account with your consumer key.",
        "description": "Only when the app owner lets customers close their account. Your\nkeys stop working at once; usage until then is still billed. The app\nowner gets a consumer.closed webhook.\n",
        "security": [
          {
            "consumerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "The closed account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsumerBillingCloseResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The consumer key lacks the billing scope to close the account.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Closing is not offered (`consumer_self_service_unavailable`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Account closing for this key is rate limited.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/consumer-signup/{slug}": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "The app customers sign up for.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "consumers"
        ],
        "operationId": "getConsumerSignupForm",
        "summary": "Read an app's public sign-up form.",
        "description": "For an app's prospective customers; needs no credential.",
        "security": [],
        "responses": {
          "200": {
            "description": "The app's display name, offered plans and their current prices.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsumerSignupFormResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "description": "Too many requests from this address (`consumer_signup_rate_limited`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "consumers"
        ],
        "operationId": "createConsumerSignup",
        "summary": "Start a sign-up and get a Stripe Checkout URL to save a card.",
        "description": "Needs no credential. Creates a Stripe customer in the app owner's\nStripe account and a setup-mode Checkout Session; nothing is charged.\nThe claim token is returned only here and completes the sign-up\nwithin 24 hours.\n",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateConsumerSignupRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The sign-up, its Checkout URL and claim token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateConsumerSignupResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "description": "An invalid email or name, or a plan that is not offered.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many sign-ups from this address (`consumer_signup_rate_limited`) or for the app today (`consumer_signup_daily_limit`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "502": {
            "description": "Stripe could not be reached (`billing_provider_unavailable`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The app's billing setup cannot take sign-ups (`consumer_signup_unavailable`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/consumer-signup/{slug}/signups/{signup}/complete": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "The app the sign-up is for.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "signup",
          "in": "path",
          "required": true,
          "description": "The sign-up to complete.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "consumers"
        ],
        "operationId": "completeConsumerSignup",
        "summary": "Complete a sign-up once the card is saved and get a consumer key.",
        "description": "Needs no credential: the claim token proves the sign-up. Each call\nreturns a new key and revokes the one the sign-up issued before.\n",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompleteConsumerSignupRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The customer's consumer and its new key, shown only here.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompleteConsumerSignupResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "403": {
            "description": "The app owner revoked this customer.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The card is not saved yet (`consumer_signup_checkout_incomplete`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "The sign-up is more than 24 hours old (`consumer_signup_expired`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many completions from this address (`consumer_signup_rate_limited`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "502": {
            "description": "Stripe could not be reached to confirm the card (`billing_provider_unavailable`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The app's billing setup cannot complete sign-ups (`consumer_signup_unavailable`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/preflight": {
      "get": {
        "tags": [
          "status"
        ],
        "operationId": "getMigrationPreflight",
        "summary": "Check whether a public GitHub repository would run on Gregale.",
        "description": "Unauthenticated static analysis of a public repository. Nothing is\nbuilt, deployed, or executed: the source is inspected for a detectable\nframework and for hard disqualifiers from the container compatibility\ncontract.\n\nThe verdict is deliberately conservative. `green` means the source\nalready satisfies the contract, `amber` means it runs once a declared\nchange is supplied, and `red` means a disqualifier applies and the app\ncannot run as written.\n\nOnly public github.com repositories are accepted. A private or missing\nrepository returns the same `preflight_repo_not_found` response so the\nendpoint cannot be used to probe for private repositories.\n",
        "security": [],
        "parameters": [
          {
            "name": "source",
            "in": "query",
            "required": true,
            "description": "A github.com repository URL, or an `owner/repo` pair.",
            "schema": {
              "type": "string",
              "maxLength": 512
            }
          },
          {
            "name": "ref",
            "in": "query",
            "required": false,
            "description": "Branch, tag, or commit SHA. A full commit SHA pins the verdict and\nmakes the result permanently reproducible.\n",
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The preflight verdict for the resolved commit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreflightReport"
                }
              }
            }
          },
          "404": {
            "description": "Repository not found, or private.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Not a public github.com repository, or the source is too large.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many checks from this client.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The upstream repository host is rate limiting Gregale.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/status/incidents/{public_id}": {
      "get": {
        "tags": [
          "status"
        ],
        "operationId": "getPublicStatusIncident",
        "summary": "Read one public incident or maintenance timeline.",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicStatusEventID"
          }
        ],
        "responses": {
          "200": {
            "description": "Public event and chronological update timeline.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "public, max-age=15, stale-while-revalidate=45"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicStatusEvent"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/status/slo.json": {
      "get": {
        "tags": [
          "status"
        ],
        "operationId": "getLegacyStatusSLO",
        "summary": "Read the backwards-compatible status indicator projection.",
        "description": "Always returns valid JSON, including when the evaluator source is degraded.",
        "security": [],
        "responses": {
          "200": {
            "description": "Legacy status projection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusPage"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/status/incidents": {
      "get": {
        "tags": [
          "admin",
          "status"
        ],
        "operationId": "listAdminStatusEvents",
        "summary": "List public status events (admin-only).",
        "description": "Requires admin scope, operator allowlist membership, and MFA.",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/CookieSession"
          },
          {
            "name": "kind",
            "in": "query",
            "description": "Restrict results to incidents or maintenance.",
            "schema": {
              "type": "string",
              "enum": [
                "incident",
                "maintenance"
              ]
            }
          },
          {
            "name": "active",
            "in": "query",
            "description": "Return only events that have not reached a terminal lifecycle state.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Status events, newest update first.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "maxItems": 200,
                  "items": {
                    "$ref": "#/components/schemas/PublicStatusEvent"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "admin",
          "status"
        ],
        "operationId": "createAdminStatusEvent",
        "summary": "Publish a public incident or maintenance event (admin-only).",
        "description": "Requires admin scope, operator allowlist membership, MFA, recent step-up authentication, and an Idempotency-Key.",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/CookieSession"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Stable caller-generated key used to replay this create safely.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminStatusEventCreateRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Published event. Replays return the same public UUID.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicStatusEvent"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/admin/status/incidents/{public_id}/updates": {
      "post": {
        "tags": [
          "admin",
          "status"
        ],
        "operationId": "updateAdminStatusEvent",
        "summary": "Append a public timeline update and lifecycle transition (admin-only).",
        "description": "Updates are append-only. Terminal incidents and maintenance cannot reopen.",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicStatusEventID"
          },
          {
            "$ref": "#/components/parameters/CookieSession"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Stable caller-generated key used to replay this timeline update safely.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminStatusEventUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated event with its complete chronological timeline.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicStatusEvent"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/admin/status/incidents/{public_id}": {
      "patch": {
        "tags": [
          "admin",
          "status"
        ],
        "operationId": "editAdminStatusEvent",
        "summary": "Correct a published event title without changing its timeline order.",
        "description": "Requires an operator session. The event remains published and exposes edited_at; deletion is unsupported.",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicStatusEventID"
          },
          {
            "$ref": "#/components/parameters/CookieSession"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminStatusEventEditRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Corrected event with stable updated_at ordering and visible edited_at.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicStatusEvent"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/admin/status/incidents/{public_id}/updates/{update_id}": {
      "patch": {
        "tags": [
          "admin",
          "status"
        ],
        "operationId": "editAdminStatusUpdate",
        "summary": "Correct a published timeline message without changing its posted time.",
        "description": "Requires an operator session. The entry remains in place and exposes edited_at; deletion is unsupported.",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicStatusEventID"
          },
          {
            "name": "update_id",
            "in": "path",
            "required": true,
            "description": "Public UUID of the timeline entry being corrected.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/CookieSession"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminStatusUpdateEditRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Corrected timeline with stable posted_at and visible edited_at.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicStatusEvent"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/postgres/capabilities": {
      "get": {
        "operationId": "getManagedPostgresCapabilities",
        "summary": "Show plan and region PostgreSQL feature support",
        "description": "Returns configured provider-neutral support after plan limits without provider calls. provisioning_enabled includes qualification and canary gates. Current usage, budget, and quota admission are checked separately at reservation. Existing databases remain pinned to their original backend.",
        "tags": [
          "managed_postgres"
        ],
        "parameters": [
          {
            "name": "region",
            "in": "query",
            "required": false,
            "description": "Portable region name; defaults to the configured region.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Effective regional capability contract",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresCapabilities"
                }
              }
            }
          },
          "default": {
            "description": "Authentication or capability lookup error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/postgres/overage": {
      "get": {
        "operationId": "getManagedPostgresOverage",
        "summary": "Show whether compute overage is on",
        "description": "With overage on, a paid account's managed PostgreSQL databases keep running past the plan's monthly compute allowance until the ceiling, twice the allowance, and are then suspended. Off is the default; the databases are then suspended at the allowance. A cap never deletes a database.",
        "tags": [
          "managed_postgres"
        ],
        "responses": {
          "200": {
            "description": "The account's overage setting and compute ceiling",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresOverage"
                }
              }
            }
          },
          "default": {
            "description": "Authentication, plan or capability error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "setManagedPostgresOverage",
        "summary": "Turn compute overage on or off",
        "description": "Paid plans only; Free stops at its allowance and answers 403 managed_postgres_not_in_plan. Turning overage off while past the allowance suspends the databases at the next cap sweep. Compute above the allowance is not billed until managed PostgreSQL has invoicing.",
        "tags": [
          "managed_postgres"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedPostgresOverageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The new overage setting and compute ceiling",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresOverage"
                }
              }
            }
          },
          "default": {
            "description": "Validation, authentication, plan or capability error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/postgres/databases": {
      "get": {
        "operationId": "listManagedPostgresDatabases",
        "summary": "List managed PostgreSQL databases",
        "tags": [
          "managed_postgres"
        ],
        "responses": {
          "200": {
            "description": "Account databases",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresDatabaseList"
                }
              }
            }
          },
          "default": {
            "description": "Authentication or database listing error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createManagedPostgresDatabase",
        "summary": "Create a managed PostgreSQL database",
        "tags": [
          "managed_postgres"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateManagedPostgresDatabaseRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Database accepted or ready",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresDatabase"
                }
              }
            }
          },
          "default": {
            "description": "Invalid request, plan limit, or provider unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/postgres/databases/{id}/labels": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedPostgresID"
        }
      ],
      "patch": {
        "tags": [
          "managed_postgres"
        ],
        "operationId": "updateManagedPostgresDatabaseLabels",
        "summary": "Set and remove a database's labels.",
        "description": "Preview (resource-labels capability). Sets and removes labels in one\natomic write and returns every label the database carries after it, with\nthe same rules, codes and audit event as PATCH /v1/apps/{slug}/labels.\nRequires postgres:manage or admin scope and MFA. While the capability is on,\nGET /v1/postgres/databases and GET /v1/postgres/databases/{id} include labels, and GET /v1/postgres/databases\ntakes ?selector=, a Kubernetes label selector.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LabelChange"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The database's labels after the write.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LabelsResponse"
                }
              }
            }
          },
          "default": {
            "description": "An invalid change, missing sign-in, scope or MFA, a database this account does not own, the capability turned off, or the rate limit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/postgres/databases/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedPostgresID"
        }
      ],
      "get": {
        "operationId": "getManagedPostgresDatabase",
        "summary": "Get managed PostgreSQL database status",
        "tags": [
          "managed_postgres"
        ],
        "responses": {
          "200": {
            "description": "Database status without provider credentials",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresDatabase"
                }
              }
            }
          },
          "default": {
            "description": "Authentication or database status error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteManagedPostgresDatabase",
        "summary": "Delete a managed PostgreSQL database",
        "description": "A ready database is kept for 7 days with its compute stopped and its connections refused, and can be undeleted until restorable_until. It still counts toward the plan's database limit and keeps its name until it is purged. Any other database, or a delete with purge=true, is deleted at once. Bindings and restore dependencies must be removed first.",
        "tags": [
          "managed_postgres"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "name": "purge",
            "in": "query",
            "required": false,
            "description": "true deletes the database at once, including one already scheduled for deletion. It cannot be undone.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Database deletion status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresDatabase"
                }
              }
            }
          },
          "default": {
            "description": "Authentication or database deletion error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/postgres/databases/{id}/status": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedPostgresID"
        }
      ],
      "get": {
        "tags": [
          "managed_postgres"
        ],
        "operationId": "getManagedPostgresDatabaseStatus",
        "summary": "Read a managed database's conditions.",
        "description": "Preview (resource-conditions capability). The database's Ready,\nProgressing and Degraded conditions, mapped from the response\nGET /v1/postgres/databases/{id} returns, cached health included, and\nnever stored. Ready follows the lifecycle state; a database whose\ncompute scaled to zero is Ready=True with reason suspended. Failed,\ndeleting and deleted databases report terminal conditions.\nCache-Control no-store.\n",
        "responses": {
          "200": {
            "description": "The managed database's conditions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResourceStatus"
                }
              }
            }
          },
          "default": {
            "description": "Missing sign-in, database read scope or MFA, a database this account does not own, managed databases not configured, the capability turned off, or the rate limit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/postgres/databases/{id}/undelete": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedPostgresID"
        }
      ],
      "post": {
        "operationId": "undeleteManagedPostgresDatabase",
        "summary": "Undelete a managed PostgreSQL database",
        "description": "Returns a database whose delete is scheduled to ready, with its data, spec and restore history, while restorable_until is in the future. The plan must still allow the database's spec. After the window the database is gone and the request returns 404.",
        "tags": [
          "managed_postgres"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Database returned to ready",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresDatabase"
                }
              }
            }
          },
          "default": {
            "description": "Window ended, database not scheduled for deletion, plan limit, or provider error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/postgres/cutovers": {
      "post": {
        "operationId": "prepareManagedPostgresCutover",
        "summary": "Stage a managed PostgreSQL restore cutover",
        "description": "Requires managed PostgreSQL manage scope and a verified email. Stages all\nsource bindings for one app and scope on a ready restore target. Pins both\ndatabases and the source bindings. Credentials remain unpublished;\nworkloads continue using the source. No activation is performed.\n",
        "tags": [
          "managed_postgres"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PrepareManagedPostgresCutoverRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Durable preparation status; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresCutover"
                }
              }
            }
          },
          "default": {
            "description": "Authentication, invalid restore target, conflict, or provider unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/postgres/cutovers/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedPostgresCutoverID"
        }
      ],
      "get": {
        "operationId": "getManagedPostgresCutover",
        "summary": "Read managed PostgreSQL cutover status",
        "description": "Requires managed PostgreSQL read scope. Verification freshness expires after five minutes and does not authorize activation.",
        "tags": [
          "managed_postgres"
        ],
        "responses": {
          "200": {
            "description": "Safe cutover metadata; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresCutover"
                }
              }
            }
          },
          "default": {
            "description": "Authentication or cutover status error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/postgres/cutovers/{id}/verify": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedPostgresCutoverID"
        }
      ],
      "post": {
        "operationId": "verifyManagedPostgresCutover",
        "summary": "Verify a managed PostgreSQL cutover",
        "description": "Requires managed PostgreSQL manage scope. Queue read-only SQL authentication and ACL checks from the control plane against each staged target credential. Repeating after verification starts a fresh batch. This does not test application VM reachability or change bindings.",
        "tags": [
          "managed_postgres"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "202": {
            "description": "Durable verify status; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresCutover"
                }
              }
            }
          },
          "default": {
            "description": "Authentication, state conflict, or cutover error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/postgres/cutovers/{id}/preflight": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedPostgresCutoverID"
        }
      ],
      "post": {
        "operationId": "requestManagedPostgresCutoverPreflight",
        "summary": "Queue a restore activation preflight",
        "description": "Requires managed PostgreSQL manage scope and verified email. Durably\nqueues catalog inspection, including while provider provisioning is\ndisabled. Concurrent pending requests keep the revision; requesting a\ncompleted check starts a new revision. Does not fence admissions, call\na provider, publish bindings or resume workloads. Activation remains\ndisabled. Idempotency replay returns the original response; poll GET\nfor latest progress. Cancelling or cancelled cutovers conflict.\n",
        "tags": [
          "managed_postgres"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "202": {
            "description": "Durable preflight request; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresCutoverPreflight"
                }
              }
            }
          },
          "default": {
            "description": "Authentication, state conflict or cutover error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getManagedPostgresCutoverPreflight",
        "summary": "Read restore activation preflight findings",
        "description": "Requires managed PostgreSQL read scope. Findings describe a historical\ncatalog snapshot. Positive fields remain historical when stale is true.\nStaleness is recomputed for expiry, cutover changes and cancellation.\nEven fresh findings never authorize activation or prove writer isolation.\nReturns 404 if no preflight has been requested.\n",
        "tags": [
          "managed_postgres"
        ],
        "responses": {
          "200": {
            "description": "Durable preflight findings; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresCutoverPreflight"
                }
              }
            }
          },
          "default": {
            "description": "Authentication or preflight status error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/postgres/cutovers/{id}/cancel": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedPostgresCutoverID"
        }
      ],
      "post": {
        "operationId": "cancelManagedPostgresCutover",
        "summary": "Cancel a managed PostgreSQL cutover",
        "description": "Requires managed PostgreSQL manage scope. Queue revocation of all staged target credentials. Cleanup remains available with provisioning disabled. Source bindings and app secrets remain unchanged.",
        "tags": [
          "managed_postgres"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "202": {
            "description": "Durable cancel status; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresCutover"
                }
              }
            }
          },
          "default": {
            "description": "Authentication, unknown cutover, or cancellation conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account/managed-postgres-usage": {
      "get": {
        "operationId": "getManagedPostgresUsage",
        "summary": "Read managed PostgreSQL usage and guardrail state",
        "description": "Requires usage read scope. Returns normalized current-month meters,\nplan headroom, and freshness state. Provider IDs, rates, credentials,\nand internal cost line items are never returned.\n",
        "tags": [
          "managed_postgres"
        ],
        "responses": {
          "200": {
            "description": "Current managed PostgreSQL usage; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresUsageResponse"
                }
              }
            }
          },
          "default": {
            "description": "Authentication or managed PostgreSQL accounting error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account/realtime-history-usage": {
      "get": {
        "operationId": "getManagedRealtimeHistoryUsage",
        "summary": "Read the account's retained realtime history snapshot",
        "description": "Preview only; requires usage read scope and MFA for interactive sessions.\nCounts current retained message rows and payload bytes for this account,\nincluding expired rows awaiting cleanup. Replayable counts apply the\nchannel's contiguous retention floor. These values are informational\nsnapshots, not billed usage or physical database allocation.\n",
        "tags": [
          "realtime"
        ],
        "responses": {
          "200": {
            "description": "Account-scoped retained history snapshot; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeHistoryUsageResponse"
                }
              }
            }
          },
          "default": {
            "description": "Authentication or history usage error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account/usage": {
      "get": {
        "operationId": "getAccountUsage",
        "summary": "Read the account-wide usage projection",
        "description": "Requires usage read scope. Returns the compute usage summary together\nwith optional object-storage and managed-PostgreSQL usage views when\nthose services are configured for the account. Each service keeps its\nexisting freshness and guardrail semantics; omitted optional fields\nmean that service is not enabled for the account. The optional service\nviews are included only for the current UTC month; historical requests\nreturn the compute projection alone.\n",
        "tags": [
          "usage"
        ],
        "parameters": [
          {
            "name": "month",
            "in": "query",
            "required": false,
            "description": "UTC calendar month for compute usage, in YYYY-MM form. Defaults to the current month.",
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Account-wide usage projection; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountUsageResponse"
                }
              }
            }
          },
          "default": {
            "description": "Authentication or usage accounting error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/postgres/databases/{id}/compute-policy": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedPostgresID"
        }
      ],
      "post": {
        "operationId": "changeManagedPostgresComputePolicy",
        "summary": "Change managed PostgreSQL scale-to-zero policy",
        "description": "Durably reserves a scale-to-zero policy change on the pinned dataset. Clients may disconnect during the policy change. The request_id UUID is the durable idempotency key; repeat the same UUID and target to recover progress. Another resize, deletion, binding change, restore or cutover conflicts while updating. Existing accepted requests remain replayable after admission closes. Only compute idle policy changes; ready confirms provider observation, not uninterrupted connections. Published environment-clone targets and databases without a pinned data identity are currently unsupported.",
        "tags": [
          "managed_postgres"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChangeManagedPostgresComputePolicyRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted policy change or current progress for an existing request",
            "headers": {
              "Location": {
                "description": "Progress URL for the compute policy request",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresComputePolicyChange"
                }
              }
            }
          },
          "default": {
            "description": "Compute policy validation, concurrency, entitlement or provider admission failure",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/postgres/databases/{id}/compute-policy-changes/{change_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedPostgresID"
        },
        {
          "name": "change_id",
          "in": "path",
          "required": true,
          "description": "Canonical UUID supplied as request_id when reserving this policy change.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getManagedPostgresComputePolicyChange",
        "summary": "Get managed PostgreSQL compute policy progress",
        "description": "Reads a durable compute policy request for the authenticated account and database. Responses are not cached and omit private provider identity.",
        "tags": [
          "managed_postgres"
        ],
        "responses": {
          "200": {
            "description": "Account and database scoped compute policy progress",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresComputePolicyChange"
                }
              }
            }
          },
          "default": {
            "description": "Authentication or policy lookup error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/postgres/databases/{id}/resize": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedPostgresID"
        }
      ],
      "post": {
        "operationId": "resizeManagedPostgresDatabase",
        "summary": "Resize managed PostgreSQL compute",
        "description": "Durably reserves a service-class change on the pinned dataset. Clients may disconnect during resizing. The request_id UUID is the durable idempotency key; repeat the same UUID and target to recover progress. Another resize, deletion, binding change, restore or cutover conflicts while updating. Existing accepted requests remain replayable after admission closes. Only compute class changes; ready confirms provider observation, not uninterrupted connections. Published environment-clone targets and databases without a pinned data identity are currently unsupported.",
        "tags": [
          "managed_postgres"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResizeManagedPostgresDatabaseRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted resize or current progress for an existing request",
            "headers": {
              "Location": {
                "description": "Progress URL",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresResize"
                }
              }
            }
          },
          "default": {
            "description": "Invalid request, conflict, plan limit or backend unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/postgres/databases/{id}/resizes/{resize_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedPostgresID"
        },
        {
          "name": "resize_id",
          "in": "path",
          "required": true,
          "description": "Canonical UUID supplied as request_id when reserving this resize.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getManagedPostgresResize",
        "summary": "Get managed PostgreSQL resize progress",
        "description": "Reads a durable resize request for the authenticated account and database. Responses are not cached and omit private provider identity.",
        "tags": [
          "managed_postgres"
        ],
        "responses": {
          "200": {
            "description": "Account and database scoped resize progress",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresResize"
                }
              }
            }
          },
          "default": {
            "description": "Authentication or resize lookup error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/postgres/databases/{id}/restore": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedPostgresID"
        }
      ],
      "post": {
        "operationId": "restoreManagedPostgresDatabase",
        "summary": "Restore a database into a new managed PostgreSQL database",
        "description": "The restored database counts toward the plan's database limit. A restore may go one database past the limit: that copy reports restore_slot_until, 7 days out, and becomes an ordinary database once the account has room; otherwise its delete is scheduled then. A second restore past the limit while a copy holds the slot answers 403 managed_postgres_restore_slot_in_use.",
        "tags": [
          "managed_postgres"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RestoreManagedPostgresDatabaseRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Restore accepted or ready",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresDatabase"
                }
              }
            }
          },
          "default": {
            "description": "Invalid point in time, plan limit, or provider error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/postgres/databases/{id}/connection-budget": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedPostgresID"
        }
      ],
      "get": {
        "operationId": "getManagedPostgresConnectionBudget",
        "summary": "Inspect read-only database connection planning",
        "description": "Account-scoped metadata only; requires managed PostgreSQL read permission. Does not wake SQL, reserve connections or change admission. Current adapters have no verified usable-capacity observation and return unknown with canonical pool estimates. Database snapshots are independent.",
        "tags": [
          "managed_postgres"
        ],
        "responses": {
          "200": {
            "description": "Bounded credential-free planning and explicit unknown coverage",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "Always no-store"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresConnectionBudget"
                }
              }
            }
          },
          "default": {
            "description": "Authentication, ownership or metadata read error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/data-api/connection-budget": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "App whose managed Data API bindings select the shared database reports.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "operationId": "getAppDataAPIConnectionBudgets",
        "summary": "Inspect shared database budgets for Data API bindings",
        "description": "Lists independently sampled planning reports for the app's shared managed Data API databases, including other bindings in the same account. Requires managed PostgreSQL read permission. Reads metadata without waking SQL or changing admission; current adapters retain unknown capacity.",
        "tags": [
          "managed_postgres"
        ],
        "responses": {
          "200": {
            "description": "Per-database estimates and unknown coverage for this app's managed Data API bindings",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "Prevents caching the app's independently sampled database reports."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataAPIConnectionBudgets"
                }
              }
            }
          },
          "default": {
            "description": "Data API app lookup, permission or budget inventory failure",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/data-api/runtime": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "operationId": "getDataAPIRuntime",
        "summary": "Download the current Data API runtime",
        "description": "Returns the Data API runtime this control plane serves: its version,\nand a gzipped tar of the runtime under one `data-api/` directory with\nits SHA-256. `gregale data-api create` and `gregale data-api deploy`\ndeploy this archive, so an older CLI release does not redeploy an older\nruntime. A running Data API reports the version it was built from as\n`runtime_version` on `/healthz`; a different version is not the\nplatform's current runtime.\n",
        "tags": [
          "managed_postgres"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The current runtime",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "Prevents caching across control-plane releases."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataAPIRuntime"
                }
              }
            }
          },
          "default": {
            "description": "App lookup, permission or runtime failure",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/data-api/status": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "operationId": "getDataAPIStatus",
        "summary": "Read a Data API's platform status",
        "description": "Returns what the platform knows about the app's Data API without\nwaking it: the runtime version this control plane serves, whether\nthis installation accepts runtime reports, and the change hook\ndelivery the app's runtime last reported. Without runtime reports,\nusage reports, monthly caps, keyless live reads and change hooks do\nnot reach the platform. `change_hooks` is absent until a runtime with\nchange hooks on has reported.\n",
        "tags": [
          "managed_postgres"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The Data API's status",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "Prevents caching; runtimes report while awake."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataAPIStatus"
                }
              }
            }
          },
          "default": {
            "description": "App lookup, permission or status read failure",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/data-api/contract-tasks": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "operationId": "createDataAPIContractTask",
        "summary": "Inspect a Data API app's database contract",
        "description": "Runs one fixed schema inspection inside a fresh task VM from the app's\nlive deployment: `types` renders the TypeScript contract, `validators`\nthe table and RPC input validators, and `schema` the JSON contract\nsnapshot. The receipt is an ordinary app task receipt and the output\narrives in `stdout_tail`. Belongs to the Data API, so it works without\nthe general app-task API.\n",
        "tags": [
          "managed_postgres"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateDataAPIContractTaskRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Contract inspection admitted and queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppTaskResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      }
    },
    "/v1/apps/{slug}/data-api/contract-tasks/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/AppTaskID"
        }
      ],
      "get": {
        "operationId": "getDataAPIContractTask",
        "summary": "Get one Data API contract inspection",
        "description": "Current or terminal receipt of a contract inspection. Any other app task is not found here.",
        "tags": [
          "managed_postgres"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Current or terminal contract inspection receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppTaskResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      }
    },
    "/v1/apps/{slug}/data-api/usage": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Data API app whose reported usage to read.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "operationId": "getAppDataAPIUsage",
        "summary": "Read Data API usage",
        "description": "Usage that the app's Data API runtime reported, per hour or UTC day, with month-to-date totals that owner caps compare against. Counts come from the app's own runtime and are owner telemetry, not billing records. Apps created before usage reporting, or with it off, have no rows.",
        "tags": [
          "managed_postgres"
        ],
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "required": false,
            "description": "Lookback in whole hours or days, such as 24h, 7d or 30d (default 7d, at most 90d).",
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]*[hd]$"
            }
          },
          {
            "name": "granularity",
            "in": "query",
            "required": false,
            "description": "Bucket size; hour covers at most 48h. Defaults to hour up to 48h, else day.",
            "schema": {
              "type": "string",
              "enum": [
                "hour",
                "day"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Zero-filled usage buckets, window totals and month-to-date totals",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "Always no-store: runtime reports keep arriving."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataAPIUsage"
                }
              }
            }
          },
          "default": {
            "description": "App lookup, window validation or usage storage failure",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/postgres-bindings": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "operationId": "listAppPostgresBindings",
        "summary": "List an app's managed PostgreSQL bindings",
        "description": "Lists the app's live managed PostgreSQL bindings on every database it\nis bound to, including organization databases and project environment\ncopies. Deleting the app is refused while a binding listed here is not\nbeing deleted. Bindings on an environment copy are removed by tearing\ndown that environment.\n",
        "tags": [
          "managed_postgres"
        ],
        "responses": {
          "200": {
            "description": "The app's bindings on every database, without credential material",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppPostgresBindingList"
                }
              }
            }
          },
          "default": {
            "description": "App lookup, permission or binding listing error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/postgres/databases/{id}/bindings": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedPostgresID"
        }
      ],
      "get": {
        "operationId": "listManagedPostgresBindings",
        "summary": "List workload bindings for a database",
        "tags": [
          "managed_postgres"
        ],
        "responses": {
          "200": {
            "description": "Bindings without credential material",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresBindingList"
                }
              }
            }
          },
          "default": {
            "description": "Authentication or binding listing error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createManagedPostgresBinding",
        "summary": "Bind a workload app to a database",
        "description": "The selected database backend must advertise the requested credential access. Unsupported access is rejected before a durable binding is reserved or provider credentials are requested.",
        "tags": [
          "managed_postgres"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateManagedPostgresBindingRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Binding accepted or ready; credentials are delivered through the app secret",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresBinding"
                }
              }
            }
          },
          "default": {
            "description": "Invalid request, conflict, or provider error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/postgres/bindings/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedPostgresID"
        }
      ],
      "get": {
        "operationId": "getManagedPostgresBinding",
        "summary": "Get a workload database binding",
        "tags": [
          "managed_postgres"
        ],
        "responses": {
          "200": {
            "description": "Binding metadata without credential material",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresBinding"
                }
              }
            }
          },
          "default": {
            "description": "Authentication or binding status error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteManagedPostgresBinding",
        "summary": "Remove a workload database binding",
        "tags": [
          "managed_postgres"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Binding deletion status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresBinding"
                }
              }
            }
          },
          "default": {
            "description": "Authentication or binding deletion error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/postgres/bindings/{id}/rotate": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedPostgresID"
        }
      ],
      "post": {
        "operationId": "rotateManagedPostgresBinding",
        "summary": "Rotate a workload database credential",
        "description": "Creates a replacement credential, refreshes the app runtime, and retains the previous provider identity until the rolling refresh completes.",
        "tags": [
          "managed_postgres"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Binding credential generation and rotation status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresBinding"
                }
              }
            }
          },
          "default": {
            "description": "Authentication or binding rotation error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets": {
      "parameters": [
        {
          "name": "slug",
          "description": "App whose bucket catalog is being managed.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "operationId": "listObjectBuckets",
        "summary": "List private object buckets and configured creation capabilities",
        "description": "storage:manage lists every bucket. storage:read/storage:write keys see only buckets with an explicit grant. Admin and dashboard sessions list every bucket.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Buckets across this app's environment scopes; backend credentials are never exposed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectBucketList"
                }
              }
            }
          },
          "default": {
            "description": "Authentication, authorization, or storage error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createObjectBucket",
        "summary": "Create a bucket on the region's current default backend",
        "description": "Requires storage:manage or admin. Idempotent by app, scope and name, not\nby Idempotency-Key. Retry provisioning by submitting the same name and\nscope. Existing buckets retain their backend when the default changes.\n",
        "tags": [
          "storage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9-]{0,62}$"
                  },
                  "scope": {
                    "type": "string",
                    "default": "default"
                  },
                  "region": {
                    "type": "string",
                    "description": "Gregale region, not upstream signing region. Omit to use the configured default."
                  },
                  "public": {
                    "type": "boolean",
                    "default": false,
                    "description": "Serve objects anonymously on the app hostname."
                  },
                  "serve_at": {
                    "type": "string",
                    "pattern": "^/[A-Za-z0-9][A-Za-z0-9._~/-]*$",
                    "description": "Immutable app path mounted when public is true."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Existing ready bucket",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectBucket"
                }
              }
            }
          },
          "201": {
            "description": "Bucket created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectBucket"
                }
              }
            }
          },
          "default": {
            "description": "Invalid request, access denied, bucket limit/conflict, or provider unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/upload-routes": {
      "parameters": [
        {
          "name": "slug",
          "description": "App whose edge upload routes are being managed.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "operationId": "listObjectUploadRoutes",
        "summary": "List policy-controlled upload routes",
        "description": "Routes are served by Gregale's public edge and do not wake the application. Requires storage:read, storage:write, storage:manage, or admin.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Upload route policies without provider credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectUploadRouteList"
                }
              }
            }
          },
          "default": {
            "description": "Unable to list upload routes because of an authentication, authorization, or storage failure.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createObjectUploadRoute",
        "summary": "Create or update an authenticated upload route",
        "description": "Declares POST /uploads/{name}. Gregale authenticates an API key, generates an owner-scoped object key, enforces the byte/content-type policy, streams directly to the selected provider, and records a completion receipt. The public upload endpoint accepts an optional Idempotency-Key header (up to 128 bytes) to replay a completed or failed attempt without repeating provider work; conflicting request metadata returns 409.",
        "tags": [
          "storage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateObjectUploadRouteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Existing upload route updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectUploadRoute"
                }
              }
            }
          },
          "201": {
            "description": "Upload route created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectUploadRoute"
                }
              }
            }
          },
          "default": {
            "description": "Invalid policy, bucket unavailable, access denied, or provider unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/upload-routes/{route}": {
      "parameters": [
        {
          "name": "slug",
          "description": "App owning the edge upload route.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "route",
          "description": "Stable upload route name used at /uploads/{route}.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          }
        }
      ],
      "delete": {
        "operationId": "deleteObjectUploadRoute",
        "summary": "Delete an authenticated upload route",
        "description": "Stops new uploads immediately. Existing objects are not deleted.",
        "tags": [
          "storage"
        ],
        "responses": {
          "204": {
            "description": "Upload route deleted"
          },
          "default": {
            "description": "Route missing, access denied, or storage unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}": {
      "parameters": [
        {
          "name": "slug",
          "description": "App that owns the bucket to remove.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Identifier of the empty bucket to delete.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "delete": {
        "operationId": "deleteObjectBucket",
        "summary": "Delete an empty bucket",
        "description": "Requires storage:manage or admin. Never recursively deletes data. Nonempty buckets return 409. Repeat after successful deletion returns 404.",
        "tags": [
          "storage"
        ],
        "responses": {
          "204": {
            "description": "Bucket deleted"
          },
          "default": {
            "description": "Access denied, bucket missing/nonempty/busy, or provider unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/access-grants": {
      "parameters": [
        {
          "name": "slug",
          "description": "App containing the bucket access binding.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Bucket whose API-key grants are being managed.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "listObjectBucketAccessGrants",
        "summary": "List API-key access grants for a bucket",
        "description": "Requires storage:manage or admin. Revoked keys remain visible until their key row is deleted.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Logical grants; provider credentials are never exposed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectBucketAccessGrantList"
                }
              }
            }
          },
          "default": {
            "description": "Access denied or bucket unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/access-grants/{key}": {
      "parameters": [
        {
          "name": "slug",
          "description": "App whose API-key bucket grant is being managed.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Bucket whose API-key grant is being managed.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "key",
          "description": "Account API-key identifier.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "put": {
        "operationId": "setObjectBucketAccessGrant",
        "summary": "Create or replace an API-key grant for a bucket",
        "description": "Requires storage:manage or admin. The target key must be active or in grace and carry the storage scopes needed by the requested permission. Admin keys do not need and cannot receive grants.",
        "tags": [
          "storage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetObjectBucketAccessGrantRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Grant created or replaced",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectBucketAccessGrant"
                }
              }
            }
          },
          "default": {
            "description": "Invalid request, missing key/bucket, scope mismatch, or access denied",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteObjectBucketAccessGrant",
        "summary": "Revoke an API-key grant for a bucket",
        "description": "Requires storage:manage or admin. Revocation takes effect before this response returns; already-signed provider URLs remain valid until their short expiry.",
        "tags": [
          "storage"
        ],
        "responses": {
          "204": {
            "description": "Grant deleted"
          },
          "default": {
            "description": "Grant or bucket missing, or access denied",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/s3-credentials": {
      "parameters": [
        {
          "name": "slug",
          "description": "App whose new S3 credential will be bucket-scoped.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Bucket receiving the S3 credential.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "listObjectS3Credentials",
        "summary": "List active Gregale S3 credentials for a bucket",
        "description": "Requires storage:manage or admin. Secret access keys are never returned by this endpoint.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Active bucket-scoped S3 credentials; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectS3CredentialList"
                }
              }
            }
          },
          "default": {
            "description": "S3 credential listing denied or its bucket is unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createObjectS3Credential",
        "summary": "Create a bucket-scoped credential for s3.gregale.dev",
        "description": "The secret access key is returned exactly once, sealed at rest, and never recoverable through the control-plane API. At most ten active credentials may exist per bucket.",
        "tags": [
          "storage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateObjectS3CredentialRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "One-time S3 credential response; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectS3CredentialSecret"
                }
              }
            }
          },
          "default": {
            "description": "Invalid request, credential limit, unavailable sealing key, or access denied",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/s3-credentials/{credential}": {
      "parameters": [
        {
          "name": "slug",
          "description": "App whose S3 credential is being revoked.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Bucket whose credential is being revoked.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "credential",
          "description": "Gregale S3 credential identifier.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "delete": {
        "operationId": "revokeObjectS3Credential",
        "summary": "Revoke a Gregale S3 credential",
        "description": "Revocation is immediate for new requests at s3.gregale.dev. Existing provider-signed internal requests are never exposed to the customer.",
        "tags": [
          "storage"
        ],
        "responses": {
          "204": {
            "description": "Credential revoked"
          },
          "default": {
            "description": "Credential or bucket missing, or access denied",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/s3-credentials/{credential}/copy-sources": {
      "parameters": [
        {
          "name": "slug",
          "description": "Destination app slug.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Destination bucket UUID.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "credential",
          "description": "Owned destination writer credential UUID.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "listObjectS3CopySources",
        "summary": "List copy-only source grants",
        "description": "Requires storage:manage and destination write authority. Grants never permit ordinary source reads or listing with the destination S3 key. At most 32 source buckets may be granted per credential.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Owned source grants without private grant identities",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectS3CopySourceList"
                }
              }
            }
          },
          "default": {
            "description": "Copy source listing unavailable or access denied",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/s3-credentials/{credential}/copy-sources/{source}": {
      "parameters": [
        {
          "name": "slug",
          "description": "App containing the destination bucket.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Bucket receiving copied objects.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "credential",
          "description": "Destination S3 credential receiving source authority.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "source",
          "description": "Owned source bucket UUID, including across apps.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "put": {
        "operationId": "setObjectS3CopySource",
        "summary": "Grant an owned bucket as a copy source",
        "description": "Requires storage:manage, destination write and source read authority. Both buckets must be ready on the same native S3 placement. The prefix is literal and at most 1024 UTF-8 bytes. Identical retries preserve authority; changing or recreating a grant invalidates prepared copies. Signed URL credentials and rotation stages cannot acquire grants. CopySource uses the source bucket UUID followed by the encoded object key.",
        "tags": [
          "storage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetObjectS3CopySourceRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Persisted copy source grant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectS3CopySource"
                }
              }
            }
          },
          "default": {
            "description": "Copy source grant invalid, unsupported, at limit, or denied",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteObjectS3CopySource",
        "summary": "Revoke a copy-only source grant",
        "description": "Requires storage:manage and destination write authority. Prevents new copy dispatch while preserving already dispatched completion and recovery. Cleanup remains available for revoked destination credentials and disabled S3 ingress.",
        "tags": [
          "storage"
        ],
        "responses": {
          "204": {
            "description": "Copy source grant revoked"
          },
          "default": {
            "description": "Copy source revocation denied or grant missing",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/compute-bindings": {
      "parameters": [
        {
          "name": "slug",
          "description": "App receiving the sealed storage connection settings.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Bucket exposed to the compute workload.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "listObjectStorageComputeBindings",
        "summary": "List compute bindings for a bucket",
        "description": "Requires storage:read, storage:manage or admin. Secret values are never returned; only the sealed app-secret names are listed.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Active compute bindings; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectStorageComputeBindingList"
                }
              }
            }
          },
          "default": {
            "description": "Binding listing denied or its bucket is unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createObjectStorageComputeBinding",
        "summary": "Bind a bucket to an app's compute environment",
        "description": "Creates a bucket-scoped Gregale S3 credential and injects endpoint, region, bucket, access-key, secret-key, and addressing settings as sealed app secrets. The secret values are never returned.",
        "tags": [
          "storage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateObjectStorageComputeBindingRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Compute binding created; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectStorageComputeBinding"
                }
              }
            }
          },
          "default": {
            "description": "Invalid request, secret quota/conflict, unavailable sealing key, or access denied",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/compute-bindings/{binding}": {
      "parameters": [
        {
          "name": "slug",
          "description": "App owning the compute binding.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Bucket attached to the compute binding.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "binding",
          "description": "Opaque compute binding identifier.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "delete": {
        "operationId": "deleteObjectStorageComputeBinding",
        "summary": "Revoke a compute binding",
        "description": "Revokes the bucket-scoped S3 credential before removing its sealed app secrets. The operation is idempotent after revocation.",
        "tags": [
          "storage"
        ],
        "responses": {
          "204": {
            "description": "Binding revoked and its managed secrets removed"
          },
          "default": {
            "description": "Binding or bucket missing, or access denied",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/compute-bindings/{binding}/rotate": {
      "parameters": [
        {
          "name": "slug",
          "description": "App whose workload receives the rotated credential.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Logical bucket whose access key is being rotated.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "binding",
          "description": "Binding identifier retained across credential rotations.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "operationId": "rotateObjectStorageComputeBinding",
        "summary": "Rotate a compute binding credential",
        "description": "Atomically replaces the bucket-scoped access key and two sealed app secrets while keeping the binding and environment variable names stable. For a live app, the previous key remains valid until the rolling runtime refresh drains old instances; rotation_pending is true in the response. Retrying during a pending rotation requeues the same refresh. Secret values are never returned.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Binding rotated; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectStorageComputeBinding"
                }
              }
            }
          },
          "default": {
            "description": "Binding unavailable, sealing key unavailable, or access denied",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/objects": {
      "parameters": [
        {
          "name": "slug",
          "description": "App containing the objects being managed.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Identifier of the bucket whose objects are being managed.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "listBucketObjects",
        "summary": "List objects with opaque cursor pagination",
        "description": "Requires storage:read or admin. Non-admin keys also require a read or read_write grant on this bucket.",
        "tags": [
          "storage"
        ],
        "parameters": [
          {
            "name": "prefix",
            "description": "Only return keys starting with this prefix.",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 1024
            }
          },
          {
            "name": "cursor",
            "description": "Opaque next_cursor from the preceding page.",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 8192
            }
          },
          {
            "name": "limit",
            "description": "Maximum objects in this page.",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page, not a bucket-wide usage or billing total",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "items"
                  ],
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "key",
                          "size_bytes",
                          "last_modified"
                        ],
                        "properties": {
                          "key": {
                            "type": "string"
                          },
                          "size_bytes": {
                            "type": "integer",
                            "format": "int64"
                          },
                          "last_modified": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "next_cursor": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Invalid request, access denied, bucket unavailable, or provider error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteBucketObject",
        "summary": "Delete one object by exact key",
        "description": "Requires storage:write or admin and a bucket write grant. Current-object deletion is declined when retained versions, native inventories or a versioning transition require marker admission. Use permanent immutable version deletion for retained data or markers.",
        "tags": [
          "storage"
        ],
        "parameters": [
          {
            "name": "key",
            "description": "Exact object key to delete; URL-encode it.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Object deleted"
          },
          "default": {
            "description": "Invalid request, access denied, or provider error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/objects/tags": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Application containing the object whose tags are requested.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "in": "path",
          "required": true,
          "description": "Logical bucket used for this object tag operation.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "key",
          "in": "query",
          "required": true,
          "description": "Exact object key; URL-encode it.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          }
        },
        {
          "name": "version_id",
          "in": "query",
          "required": false,
          "description": "Omit for the current object; use null or an owned public version UUID for a selected version.",
          "schema": {
            "type": "string",
            "pattern": "^(null|[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$"
          }
        }
      ],
      "get": {
        "operationId": "getObjectBucketTags",
        "summary": "Read the tags of a current or selected object",
        "description": "Requires storage read scope and a bucket read grant. Public version IDs remain stable after restart. Native provider version IDs are never exposed.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Stored object tags and public version identity; response is never cached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectTaggingResult"
                }
              }
            }
          },
          "default": {
            "description": "Tag read rejected for invalid ownership, permission, capability, input, budget or provider response",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "putObjectBucketTags",
        "summary": "Replace the complete tag set of a current or selected object",
        "description": "Requires storage write scope and a bucket write grant. Tags change in place and preserve private write-completion metadata. S3 dispatches once per request; after an uncertain acknowledgment, read the selected version or explicitly retry the desired tag set. No data version or storage reservation is created.",
        "tags": [
          "storage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ObjectTaggingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Replacement tag set acknowledged by the provider; public identity is retained",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectTaggingResult"
                }
              }
            }
          },
          "default": {
            "description": "Tag replacement failed validation, authorization or admission, or has an uncertain provider acknowledgment",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteObjectBucketTags",
        "summary": "Remove all tags from a current or selected object",
        "description": "Requires storage write scope and a bucket write grant. Returns an empty tag set after acknowledgment. An uncertain response does not trigger automatic mutation replay. Tags change in place; storage capacity is unchanged.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Empty tag set after acknowledged removal; public version identity is retained",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectTaggingResult"
                }
              }
            }
          },
          "default": {
            "description": "Tag removal denied or unsupported, safety budget exhausted, or provider acknowledgment unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/objects/versions": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "App owning the logical bucket.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "in": "path",
          "required": true,
          "description": "Logical bucket owning the selected version.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "listObjectBucketVersions",
        "summary": "List retained object versions and delete markers",
        "description": "Requires storage read scope and a bucket read grant. Returns owned public version selectors, never native generations or physical placement. Both continuation markers belong to this bucket and exact key. Each provider page consumes the existing request safety budget.",
        "tags": [
          "storage"
        ],
        "parameters": [
          {
            "name": "prefix",
            "in": "query",
            "description": "Restrict returned versions to matching logical keys.",
            "schema": {
              "type": "string",
              "maxLength": 1024
            }
          },
          {
            "name": "delimiter",
            "in": "query",
            "description": "Optional single Unicode character grouping matching keys.",
            "schema": {
              "type": "string",
              "maxLength": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum versions and common prefixes in this page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 1000
            }
          },
          {
            "name": "key_marker",
            "in": "query",
            "description": "Exact continuation key returned by the previous page.",
            "schema": {
              "type": "string",
              "maxLength": 1024
            }
          },
          {
            "name": "version_id_marker",
            "in": "query",
            "description": "Public continuation version; requires its matching key_marker.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of versions and common prefixes; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectVersionList"
                }
              }
            }
          },
          "default": {
            "description": "Invalid continuation, access denied, unsupported provider, stale accounting or exhausted safety budget",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteObjectBucketVersion",
        "summary": "Permanently delete an immutable object version or delete marker",
        "description": "Requires storage write scope and the bucket write grant. The public version ID must belong to this bucket and exact key. Retries address the same immutable version, including after restart or an uncertain provider acknowledgment. Deleting a marker can reveal older data. Mutable null deletion uses a durable single-attempt intent; retry with X-Gregale-Delete-Id or use the deletion receipt API. Quota is reclaimed only through verified capacity inventory.",
        "tags": [
          "storage"
        ],
        "parameters": [
          {
            "name": "key",
            "in": "query",
            "required": true,
            "description": "Exact key owning the selected version.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            }
          },
          {
            "name": "version_id",
            "in": "query",
            "required": true,
            "description": "Owned public version UUID or the mutable null selector; native provider IDs are not accepted.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted or already removed immutable version; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectVersionDeleteResult"
                }
              }
            }
          },
          "default": {
            "description": "Invalid or unowned version, unsupported provider, access denied or uncertain provider response",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/objects/deletions": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Application whose object deletion will be journaled.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "in": "path",
          "required": true,
          "description": "Logical bucket owning the deletion.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "operationId": "createObjectDeletion",
        "summary": "Delete the current object or an owned version with a durable receipt",
        "description": "Requires storage write scope and the bucket write grant. Reuse the request ID with the same key and selector for retries. Mutable intents dispatch at most once; recovery may retry only the exact owned immutable version. Ordinary deletes in Enabled buckets create an accounted marker. Pending attempts fence writes, configuration and inventories until positive acknowledgment or unique completion proof; elapsed time and absence never settle a dispatched mutation.",
        "tags": [
          "storage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ObjectDeletionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Completed or failed receipt replay",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectDeletion"
                }
              }
            }
          },
          "202": {
            "description": "Persisted deletion awaiting positive completion proof",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectDeletion"
                }
              }
            }
          },
          "default": {
            "description": "Invalid request, access denied, unavailable accounting or conflicting mutation",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/objects/deletions/{deletion}": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Application associated with the requested deletion receipt.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "in": "path",
          "required": true,
          "description": "Bucket to which the durable deletion receipt belongs.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "deletion",
          "in": "path",
          "required": true,
          "description": "Durable deletion request ID.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getObjectDeletion",
        "summary": "Read a durable deletion receipt",
        "description": "Requires storage write scope and the bucket write grant. Returns only the bucket-owned receipt and public identities. Cache-Control no-store.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Persisted deletion state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectDeletion"
                }
              }
            }
          },
          "default": {
            "description": "Access denied or receipt does not belong to this bucket",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/encryption-capabilities": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "App whose bucket encryption enrollment is being discovered.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "in": "path",
          "required": true,
          "description": "Logical bucket whose enrolled encryption options are listed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getObjectBucketEncryptionCapabilities",
        "summary": "List enrolled encryption algorithms and owned key references",
        "description": "Requires storage write scope and the bucket write grant. Returns only the bucket owner's enrolled Gregale key references for explicit S3 PUT, copy and multipart initialization. Discovery makes no provider requests and does not establish key health or effective native permissions. Cache-Control no-store. Available while new storage ingress is disabled.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Enrolled algorithms and owned key references",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectEncryptionCapabilities"
                }
              }
            }
          },
          "default": {
            "description": "Access denied or unavailable bucket placement",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/encryption": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "App whose bucket default encryption is managed.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "in": "path",
          "required": true,
          "description": "Logical bucket whose default is configured.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getObjectBucketEncryption",
        "summary": "Read bucket default encryption and reconciliation progress",
        "description": "Requires storage manage scope and the bucket write grant. Returns owned desired and verified selections without native key identities. Native readback detects policy drift and schedules reconciliation. Available while new ingress is disabled. An absent owned policy allows the provider baseline encryption.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Owned policy and durable progress",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectBucketEncryption"
                }
              }
            }
          },
          "default": {
            "description": "Bucket default policy access denied or placement unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "putObjectBucketEncryption",
        "summary": "Request a verified bucket default encryption policy",
        "description": "Requires storage manage scope and the bucket write grant. Supports enrolled S3 AES256 and owned KMS or DSSE keys, with supported bucket key settings. Per-object contexts are rejected. Each new implicit write captures the verified default atomically; explicit write and route selections override it. Accepted receipts, URLs and multipart sessions retain their snapshots through changes and restart. New implicit admissions wait while configuration is pending. Exact native readback is required; unrelated native blocking settings are preserved.",
        "tags": [
          "storage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ObjectBucketEncryptionRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Durable configuration request accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectBucketEncryption"
                }
              }
            }
          },
          "default": {
            "description": "Invalid selection, busy bucket or unsupported provider",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteObjectBucketEncryption",
        "summary": "Clear the owned bucket default encryption policy",
        "description": "Requires storage manage scope and the bucket write grant. Records durable removal and retains the policy revision. Available with ingress disabled. Accepted operations keep their captured encryption. Clearing permits the provider baseline encryption and retains unrelated native encryption blocking settings.",
        "tags": [
          "storage"
        ],
        "responses": {
          "202": {
            "description": "Durable clear request accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectBucketEncryption"
                }
              }
            }
          },
          "default": {
            "description": "Busy configuration or unsupported provider",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/cors": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "App whose bucket CORS rules are managed.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "in": "path",
          "required": true,
          "description": "Logical bucket whose CORS rules are managed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getObjectBucketCORS",
        "summary": "Read a bucket's CORS rules",
        "description": "Requires storage manage scope and the bucket write grant. Returns an empty rule list at revision 0 when none are set. The branded S3 endpoint applies the rules to browser requests that carry the bucket's presigned URLs or upload grants.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "The bucket's CORS rules",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectBucketCORS"
                }
              }
            }
          },
          "default": {
            "description": "Bucket not found or access denied",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "putObjectBucketCORS",
        "summary": "Replace a bucket's CORS rules",
        "description": "Requires storage manage scope and the bucket write grant. Replaces every rule and advances the revision. Up to 100 rules, as in S3 PutBucketCors; the first rule matching a request's origin, method and requested headers applies. CORS is not authorization; requests still need a valid signature or upload grant.",
        "tags": [
          "storage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ObjectBucketCORSRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The stored rules",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectBucketCORS"
                }
              }
            }
          },
          "default": {
            "description": "Invalid rules, bucket not ready or access denied",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteObjectBucketCORS",
        "summary": "Remove a bucket's CORS rules",
        "description": "Requires storage manage scope and the bucket write grant. Afterwards only the console's origins are allowed. Removing absent rules succeeds.",
        "tags": [
          "storage"
        ],
        "responses": {
          "204": {
            "description": "Rules removed"
          },
          "default": {
            "description": "Bucket not found, or its CORS rules are not yours to remove",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/objects/protection/retention": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Application owning this retention target.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "in": "path",
          "required": true,
          "description": "Owned logical bucket for retention management.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "key",
          "in": "query",
          "required": true,
          "description": "Logical object key whose retention is selected.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          }
        },
        {
          "name": "version_id",
          "in": "query",
          "required": true,
          "description": "Exact owned version for retention; current selection is unsupported.",
          "schema": {
            "type": "string",
            "minLength": 1
          }
        }
      ],
      "get": {
        "operationId": "getObjectVersionRetention",
        "summary": "Read exact version retention",
        "description": "Read fresh native retention for an explicit owned version with storage manage scope and a bucket read grant. Available with enrollment disabled.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Verified native version retention policy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectVersionRetentionResult"
                }
              }
            }
          },
          "default": {
            "description": "Retention read rejected by validation, capability, ownership or mutation fencing",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "putObjectVersionRetention",
        "summary": "Request a durable exact version retention change",
        "description": "Accept durable retention intent with storage manage scope, a bucket write grant and backend enrollment. Recovery verifies readback without repeating a dispatched PUT. Fixed dates round upward to milliseconds. Separately enrolled event holds support ON with one days or years duration and OFF without a duration. Releasing an active hold preserves its observed retention bound and verifies the provider-calculated final date. Governance bypass is unsupported.",
        "tags": [
          "storage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ObjectVersionRetentionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Existing retention operation receipt",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectVersionProtection"
                }
              }
            }
          },
          "202": {
            "description": "Durable retention intent accepted for operation inspection",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectVersionProtection"
                }
              }
            }
          },
          "default": {
            "description": "Retention mutation rejected by validation, capability, ownership or mutation fencing",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/objects/protection/legal-hold": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Application owning this legal hold target.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "in": "path",
          "required": true,
          "description": "Owned logical bucket for legal hold management.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "key",
          "in": "query",
          "required": true,
          "description": "Logical object key whose legal hold is selected.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          }
        },
        {
          "name": "version_id",
          "in": "query",
          "required": true,
          "description": "Exact owned version for legal hold; current selection is unsupported.",
          "schema": {
            "type": "string",
            "minLength": 1
          }
        }
      ],
      "get": {
        "operationId": "getObjectVersionLegalHold",
        "summary": "Read exact version legal hold",
        "description": "Read fresh native legal hold for an explicit owned version with storage manage scope and a bucket read grant. Available with enrollment disabled.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Verified native version legal hold policy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectVersionLegalHoldResult"
                }
              }
            }
          },
          "default": {
            "description": "Legal hold read rejected by validation, capability, ownership or mutation fencing",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "putObjectVersionLegalHold",
        "summary": "Request a durable exact version legal hold change",
        "description": "Accept durable independent ON or OFF legal hold intent with storage manage scope, a bucket write grant and backend enrollment. Recovery verifies exact-version readback without repeating a dispatched PUT. Retention and event hold policies remain independent.",
        "tags": [
          "storage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ObjectVersionLegalHoldRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Existing legal hold operation receipt",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectVersionProtection"
                }
              }
            }
          },
          "202": {
            "description": "Durable legal hold intent accepted for operation inspection",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectVersionProtection"
                }
              }
            }
          },
          "default": {
            "description": "Legal hold mutation rejected by validation, capability, ownership or mutation fencing",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/protection-operations/{operation}": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Application owning this protection operation target.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "in": "path",
          "required": true,
          "description": "Owned logical bucket for protection operation management.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "operation",
          "in": "path",
          "required": true,
          "description": "Durable protection operation identity.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getObjectVersionProtection",
        "summary": "Inspect an owned version protection operation",
        "description": "Requires storage manage scope and a bucket read grant. Available with ingress or enrollment disabled. Provider identities and worker leases are private.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Durable operation status and accepted policy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectVersionProtection"
                }
              }
            }
          },
          "default": {
            "description": "Protection operation inspection rejected by validation, capability, ownership or mutation fencing",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/object-lock-capabilities": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "App whose enrolled Object Lock capabilities are being discovered.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "in": "path",
          "required": true,
          "description": "Logical bucket whose enrolled configuration and event hold capabilities are listed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getObjectBucketObjectLockCapabilities",
        "summary": "Discover enrolled bucket Object Lock capabilities",
        "description": "Requires storage manage scope, MFA where required and the bucket write grant. Makes no native requests. Available while ingress is disabled. Capability enrollment does not verify native permissions or health.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Enrolled bucket configuration and default event hold capabilities",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectLockCapabilities"
                }
              }
            }
          },
          "default": {
            "description": "Access denied or placement unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/object-lock": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "App whose bucket Object Lock configuration is managed.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "in": "path",
          "required": true,
          "description": "Logical bucket whose permanent enablement and retention defaults are managed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getObjectBucketObjectLock",
        "summary": "Read owned Object Lock intent and native observation",
        "description": "Requires storage manage scope, MFA where required and the bucket write grant. Native readback detects drift and permanently records observed enablement. Unknown native settings fence new writes and never become a default clear. Available while ingress is disabled; disabled capability enrollment returns existing persisted progress without a native call. Cache-Control no-store.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Durable progress with separate desired and observed configurations",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectBucketObjectLock"
                }
              }
            }
          },
          "default": {
            "description": "Access denied, unsupported backend or unavailable native observation",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "putObjectBucketObjectLock",
        "summary": "Request permanent Object Lock enablement or a default retention change",
        "description": "Requires storage manage scope, MFA where required and the bucket write grant. Enabled must be true. Omit default_retention to clear defaults for future versions while retaining permanent enablement and existing protection. GOVERNANCE and COMPLIANCE support a fixed duration, an enrolled event hold duration or both. New writes remain fenced until accepted transfers drain, versioning is Enabled, propagation and a fresh all-version inventory finish, and native configuration is verified. Identical pending requests are idempotent; opposite pending requests conflict. Accepted recovery continues after ingress or capability enrollment is disabled. Per-version lock management is a separate capability.",
        "tags": [
          "storage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ObjectBucketObjectLockRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Durable request accepted; GET reports progress",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectBucketObjectLock"
                }
              }
            }
          },
          "default": {
            "description": "Invalid configuration, busy transition or unsupported capability",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/versioning": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "App whose bucket configuration is being read or changed.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "in": "path",
          "required": true,
          "description": "Logical bucket whose versioning is configured.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getObjectBucketVersioning",
        "summary": "Read bucket versioning configuration and cutover progress",
        "description": "Requires storage manage scope and the bucket write grant. Observes provider truth; discovering native versioning fences writes until a propagated, verified inventory accounts for all versions. Cache-Control no-store.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Observed configuration and persisted progress",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectBucketVersioning"
                }
              }
            }
          },
          "default": {
            "description": "Access denied, unavailable bucket or unsupported provider",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "putObjectBucketVersioning",
        "summary": "Request durable bucket versioning configuration",
        "description": "Requires storage manage scope and the bucket write grant. Enabled and Suspended are supported on capable S3 backends. Opposite targets conflict until the current transition is ready. New writes and bucket deletion remain fenced while existing work drains, configuration propagates for at least fifteen minutes and a complete all-version inventory commits. Unresolved legacy write grants reject the request. Cancellation cannot reopen writes. Suspension retains all-version accounting. MFA Delete changes are unsupported.",
        "tags": [
          "storage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ObjectBucketVersioningRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Durable intent recorded; inspect GET for progress",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectBucketVersioning"
                }
              }
            }
          },
          "default": {
            "description": "Invalid status, busy bucket, unresolved legacy writes or unsupported provider",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/compute-triggers": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "App owning the bucket and trigger destination.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "in": "path",
          "required": true,
          "description": "Bucket whose managed triggers are reconciled.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "put": {
        "tags": [
          "storage"
        ],
        "operationId": "reconcileObjectStorageComputeTriggers",
        "summary": "Reconcile managed ObjectCreated triggers for the bucket's owning app",
        "description": "Requires MFA, storage manage scope and bucket write access. The destination\nis always this bucket's owning app in its region. expected_revision is\nmandatory and stale revisions return 409, including unchanged requests.\nReplaces only managed rules, preserving manual notification rules.\nExplicit triggers: [] clears managed ownership. Manual ID collisions\nreturn 409; overlapping filters return 400. Nonempty configuration\nrequires object storage enabled and an async-invocation eligible plan.\nAccepted deliveries retain their original destination snapshots.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReconcileObjectStorageComputeTriggersRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Complete notification configuration including managed rule identities; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectBucketNotifications"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "default": {
            "description": "Missing owned bucket, storage disabled, or invalid request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/notifications": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "App whose notification policy is inspected.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "in": "path",
          "required": true,
          "description": "Bucket whose notification configuration is managed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getObjectBucketNotifications",
        "summary": "Read durable bucket notification rules",
        "description": "Requires storage manage scope and bucket write access. Reads owned notification intent without a provider call, including when ingress is disabled. Initial configuration has revision zero and no notification rules.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Persisted notification configuration; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectBucketNotifications"
                }
              }
            }
          },
          "default": {
            "description": "Notification policy access denied or the owned bucket was not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "putObjectBucketNotifications",
        "summary": "Replace durable bucket notification rules",
        "description": "Requires storage manage scope and the bucket write grant. Atomically replaces notification rules and validates Gregale-owned function or queue ARNs in this account and region. Empty rules clear intent. Full replacement clears managed compute-trigger ownership, including identical rules. Accepted events retain captured destinations. Nonempty configuration requires storage ingress to be enabled.",
        "tags": [
          "storage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ObjectBucketNotificationsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Normalized notification destinations, filters and configuration revision",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectBucketNotifications"
                }
              }
            }
          },
          "default": {
            "description": "Invalid rule replacement, unavailable destination or unsupported event",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteObjectBucketNotifications",
        "summary": "Remove bucket notification rules",
        "description": "Requires storage manage scope and the bucket write grant. Clears future routing while accepted events retain captured destinations. Available while storage ingress is disabled.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Cleared notification intent with its retained revision",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectBucketNotifications"
                }
              }
            }
          },
          "default": {
            "description": "Policy removal denied or invalid ownership",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/lifecycle": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "App whose lifecycle policy is inspected.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "in": "path",
          "required": true,
          "description": "Bucket whose lifecycle configuration is managed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getObjectBucketLifecycle",
        "summary": "Read durable bucket lifecycle rules",
        "description": "Requires storage manage scope and the bucket write grant. Reads durable policy without contacting the provider; available while storage ingress is disabled. An absent policy has revision zero and empty rules.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Persisted lifecycle configuration; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectBucketLifecycle"
                }
              }
            }
          },
          "default": {
            "description": "Policy access denied or owned bucket missing",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "putObjectBucketLifecycle",
        "summary": "Replace durable bucket lifecycle rules",
        "description": "Requires storage manage scope and the bucket write grant. Replaces the entire policy with one to one thousand validated rules on a capable backend. Expiration, noncurrent expiration and abandoned multipart cleanup use Gregale journals and verified accounting. Transitions and object size predicates are unsupported. A live discovery lease returns conflict. New storage ingress must be enabled.",
        "tags": [
          "storage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ObjectBucketLifecycleRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Normalized replacement rules and revision",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectBucketLifecycle"
                }
              }
            }
          },
          "default": {
            "description": "Invalid rule replacement, live scan conflict or unsupported backend",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteObjectBucketLifecycle",
        "summary": "Remove bucket lifecycle rules",
        "description": "Requires storage manage scope and the bucket write grant. Clears rules and cancels unclaimed discovery. Already admitted deletions and multipart aborts continue to verified completion. Available while ingress is disabled. A live discovery lease returns conflict.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Empty rules with retained policy revision",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectBucketLifecycle"
                }
              }
            }
          },
          "default": {
            "description": "Policy removal denied or blocked by a live scan lease",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/lifecycle/scans": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "App requesting lifecycle discovery.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "in": "path",
          "required": true,
          "description": "Bucket requesting due lifecycle discovery.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "operationId": "createObjectLifecycleScan",
        "summary": "Start or resume due lifecycle discovery",
        "description": "Requires storage manage scope and the bucket write grant. Creates a due scan or returns existing active discovery. Requires ingress enabled and an enabled policy; the hourly scan interval still applies. Conflict means the next scan is not due. Completed discovery does not prove that admitted deletions or aborts have finished.",
        "tags": [
          "storage"
        ],
        "responses": {
          "202": {
            "description": "Accepted active discovery scan; inspect its progress",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectLifecycleScan"
                }
              }
            }
          },
          "default": {
            "description": "Discovery disabled, active policy missing or next scan not due",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/lifecycle/scans/{scan}": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "App owning the recorded lifecycle scan.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "in": "path",
          "required": true,
          "description": "Bucket associated with this lifecycle scan.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "scan",
          "in": "path",
          "required": true,
          "description": "Owned lifecycle discovery identifier.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getObjectLifecycleScan",
        "summary": "Read lifecycle discovery progress",
        "description": "Requires storage manage scope and the bucket write grant. Returns owned persisted progress without provider credentials, native identifiers, cursors or lease tokens. Available while ingress is disabled.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Recorded discovery phase and counters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectLifecycleScan"
                }
              }
            }
          },
          "default": {
            "description": "Scan access denied or owned scan not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/capacity-reconciliations": {
      "parameters": [
        {
          "name": "slug",
          "description": "App requesting a fenced bucket inventory.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Bucket whose reserved capacity should be reconciled.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "operationId": "createObjectCapacityReconciliation",
        "summary": "Request safe capacity reconciliation",
        "description": "Requires storage write scope and the bucket write grant. Returns the existing active job on repeat requests. Pauses new bucket writes until cancellation or a terminal outcome. Pending or untracked writes cannot be force-refunded; only a complete fenced inventory can reclaim capacity. Available with storage disabled or spent budgets.",
        "tags": [
          "storage"
        ],
        "responses": {
          "202": {
            "description": "Durable reconciliation requested; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectCapacityReconciliation"
                }
              }
            }
          },
          "default": {
            "description": "Missing bucket, live multipart sessions, or access denied",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/capacity-reconciliations/{reconciliation}": {
      "parameters": [
        {
          "name": "slug",
          "description": "App owning the reconciliation job.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Bucket associated with the reconciliation.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "reconciliation",
          "description": "Durable capacity reconciliation identifier.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getObjectCapacityReconciliation",
        "summary": "Inspect capacity reconciliation",
        "description": "Returns progress, pending-write count and reclaimed capacity under storage write scope and the bucket write grant. Reads remain available with storage disabled or spent budgets. Billing and monthly authorization counts are unchanged.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Reconciliation status; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectCapacityReconciliation"
                }
              }
            }
          },
          "default": {
            "description": "Reconciliation missing or access denied",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "cancelObjectCapacityReconciliation",
        "summary": "Cancel capacity reconciliation",
        "description": "Requires storage write scope and the bucket write grant. Immediately releases the active job's write pause without changing reserved capacity. Returns the job, including an existing terminal outcome. Cleanup remains available with storage disabled or spent budgets.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Cancelled or previously terminal reconciliation; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectCapacityReconciliation"
                }
              }
            }
          },
          "default": {
            "description": "Reconciliation missing or cancellation denied",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/write-receipts": {
      "parameters": [
        {
          "name": "slug",
          "description": "App owning the bucket.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Gregale bucket identifier.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "listObjectWriteReceipts",
        "summary": "List tracked write receipts for a bucket",
        "description": "Requires storage write scope and the bucket write grant. Defaults to pending writes, newest first; pages are live views and receipts settling between reads may disappear from the pending filter. Reads remain available while storage is disabled or budgets are spent, without provider calls or quota admission. Direct signed uploads, legacy writes and multipart sessions are outside this receipt list.",
        "tags": [
          "storage"
        ],
        "parameters": [
          {
            "name": "status",
            "description": "Receipt status to include.",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "completed",
                "failed",
                "all"
              ],
              "default": "pending"
            }
          },
          {
            "name": "limit",
            "description": "Maximum receipts per page.",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "description": "Opaque next cursor from a page using the same bucket and status filter.",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of tracked write receipts; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectWriteReceiptList"
                }
              }
            }
          },
          "default": {
            "description": "Invalid pagination, missing bucket, or access denied",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/write-receipts/{receipt}": {
      "parameters": [
        {
          "name": "slug",
          "description": "App whose tracked write is being inspected.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Bucket containing the requested write receipt.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "receipt",
          "description": "Receipt ID returned as X-Gregale-Upload-ID.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getObjectWriteReceipt",
        "summary": "Read a tracked write receipt",
        "description": "Requires storage write scope and the bucket write grant. Completed proves this attempt committed, not that the object still has this value. Pending has no confirmed outcome; do not assume failure or refund capacity. Reads remain available with storage disabled or spent budgets.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Receipt projection; Cache-Control no-store; pending responses include Retry-After",
            "headers": {
              "Retry-After": {
                "description": "Suggested delay in seconds before polling a pending receipt.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectWriteReceipt"
                }
              }
            }
          },
          "default": {
            "description": "Receipt or bucket missing, or access denied",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/signed-url": {
      "parameters": [
        {
          "name": "slug",
          "description": "App authorizing the requested object capability.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Identifier of the bucket containing the authorized object.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "operationId": "signBucketObject",
        "summary": "Issue a short-lived direct upload or download URL",
        "description": "GET requires storage:read or admin; PUT requires storage:write or admin.\nNon-admin keys also require a matching per-bucket grant.\nPUT must declare size_bytes, enforced by signed length (or an empty-body\ndigest for zero bytes). These reusable bearer URLs expire within 15\nminutes and are not retained by the API idempotency cache. Send only\nreturned headers to the URL, never Gregale credentials. In browsers,\nContent-Length is set by fetch from the File body, not manually.\n",
        "tags": [
          "storage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ObjectSignRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Temporary capability; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectSignedRequest"
                }
              }
            }
          },
          "default": {
            "description": "Invalid request, access denied, or provider unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/multipart-uploads": {
      "parameters": [
        {
          "name": "slug",
          "description": "App containing the multipart upload target.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Identifier of the bucket receiving the multipart object.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "listObjectMultipartUploads",
        "summary": "List durable resumable upload sessions",
        "description": "Requires storage:write or admin and a matching bucket grant. The provider upload ID is never returned. Use cursor to recover sessions after a client loses its local session identifier.",
        "tags": [
          "storage"
        ],
        "parameters": [
          {
            "name": "limit",
            "description": "Maximum number of sessions to return.",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          },
          {
            "name": "cursor",
            "description": "UUID cursor returned by the previous page.",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Durable upload sessions; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectMultipartUploadList"
                }
              }
            }
          },
          "default": {
            "description": "Invalid cursor, access denial, or backend placement unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createObjectMultipartUpload",
        "summary": "Start or recover a resumable multipart upload",
        "description": "Requires storage:write or admin and a matching bucket grant. Gregale\nreserves the complete declared size before creating billable provider\nparts. A retry with the same live bucket/key, size, and content type\nreturns the existing session; conflicting parameters return 409. The\nprovider upload ID remains private. Sessions expire after 24 hours.\n",
        "tags": [
          "storage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateObjectMultipartUploadRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Existing compatible live session returned",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectMultipartUpload"
                }
              }
            }
          },
          "201": {
            "description": "Multipart upload initiated; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectMultipartUpload"
                }
              }
            }
          },
          "default": {
            "description": "Invalid request, stale accounting, capacity limit, access denial, or provider failure",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/multipart-uploads/{upload}/parts": {
      "parameters": [
        {
          "name": "slug",
          "description": "App authorizing multipart recovery.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Bucket containing the provider-confirmed parts.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "upload",
          "description": "Gregale session whose provider parts are being recovered.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "listObjectMultipartParts",
        "summary": "List parts confirmed by the storage provider",
        "description": "Requires storage:write or admin and a matching bucket grant. Returns provider-confirmed ETags so an interrupted client can resume completion without exposing provider credentials or upload IDs.",
        "tags": [
          "storage"
        ],
        "parameters": [
          {
            "name": "part_number_marker",
            "description": "Return parts after this part number.",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000,
              "default": 0
            }
          },
          {
            "name": "limit",
            "description": "Maximum number of provider parts to return.",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 1000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Provider-confirmed uploaded parts; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectMultipartPartList"
                }
              }
            }
          },
          "default": {
            "description": "Session missing, not recoverable, access denial, or provider failure",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/multipart-uploads/{upload}": {
      "parameters": [
        {
          "name": "slug",
          "description": "App containing the durable upload session.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Bucket containing the multipart session.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "upload",
          "description": "Gregale multipart session identifier; this is not the provider upload ID.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getObjectMultipartUpload",
        "summary": "Read resumable upload state and part layout",
        "description": "Requires storage:write or admin and a matching bucket grant. Provider credentials and upload IDs are never returned.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Durable session state; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectMultipartUpload"
                }
              }
            }
          },
          "default": {
            "description": "Session missing, access denied, or backend placement unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "abortObjectMultipartUpload",
        "summary": "Abort a multipart upload and release provider-side parts",
        "description": "Requires storage:write or admin and a matching bucket grant. Repeating an already-finished abort is safe. Failed aborts are retried by the recovery worker.",
        "tags": [
          "storage"
        ],
        "responses": {
          "204": {
            "description": "Upload aborted or was already aborted"
          },
          "default": {
            "description": "Session busy/completed, access denied, or provider failure",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/multipart-uploads/{upload}/parts/{part}/signed-url": {
      "parameters": [
        {
          "name": "slug",
          "description": "App authorizing the multipart part capability.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Bucket receiving this upload part.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "upload",
          "description": "Gregale multipart session identifier.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "part",
          "description": "One-based part number from the session layout.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000
          }
        }
      ],
      "post": {
        "operationId": "signObjectMultipartPart",
        "summary": "Issue a branded upload URL for one exact-length part",
        "description": "Requires storage:write or admin and a matching bucket grant. The URL\nuses the branded S3 endpoint and binds the owned session, part and exact\nbyte length. It expires within 15 minutes and before the session deadline.\nUpload without Gregale credentials and retain the ETag response header.\nCurrent issuer grants and the active session are checked at dispatch.\nSequential retries may replace a settled part; overlapping or uncertain\nnative attempts remain fenced. Issuance and redemption consume the\nauthorization safety budget.\n",
        "tags": [
          "storage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ObjectMultipartPartSignRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Temporary provider capability; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectSignedRequest"
                }
              }
            }
          },
          "default": {
            "description": "Invalid part, expired session, stale accounting, access denial, or provider failure",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/buckets/{bucket}/multipart-uploads/{upload}/complete": {
      "parameters": [
        {
          "name": "slug",
          "description": "App finalizing the multipart upload.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Bucket receiving the completed object.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "upload",
          "description": "Gregale multipart session identifier to complete.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "operationId": "completeObjectMultipartUpload",
        "summary": "Assemble all uploaded parts into the final object",
        "description": "Requires storage:write or admin and a matching bucket grant. Supply one\nETag for every part in ascending order. Completion intent is persisted\nbefore contacting the provider and recovered after crashes. An identical\nretry after completion returns the completed session without repeating\nthe provider operation.\n",
        "tags": [
          "storage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompleteObjectMultipartUploadRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Object completed; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectMultipartUpload"
                }
              }
            }
          },
          "default": {
            "description": "Invalid/missing parts, expired or conflicting session, access denial, or provider failure",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account/object-storage-usage": {
      "get": {
        "operationId": "getObjectStorageUsage",
        "summary": "Read object storage accounting and safety limits",
        "description": "Requires usage read scope. Reservations are capacity commitments, not billed usage. Fresh false blocks new signed URLs.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Current account usage; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectStorageUsageResponse"
                }
              }
            }
          },
          "default": {
            "description": "Access denied or accounting unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/managed-postgres/usage/{account_id}": {
      "get": {
        "operationId": "getManagedPostgresUsageOperator",
        "summary": "Read normalized managed PostgreSQL usage for an account",
        "description": "Operator-only view with effective guardrail ceilings and internal COGS line items. Provider IDs and credentials are never returned.",
        "tags": [
          "operator"
        ],
        "parameters": [
          {
            "name": "account_id",
            "in": "path",
            "required": true,
            "description": "Account whose normalized PostgreSQL usage is requested.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Account usage and internal normalized ledger lines; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresUsageOperatorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Access denied, account not found, or accounting unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/managed-postgres/accounting/{account_id}": {
      "get": {
        "operationId": "listManagedPostgresAccountingDiagnostics",
        "summary": "Explain managed PostgreSQL accounting blockers",
        "description": "Operator allowlist and admin scope required, with the existing session MFA gate (bearer API keys follow IAM policy). Reads local catalog and ledger evidence only. Each page is one database snapshot; pages are live views, not a frozen account snapshot. No provider requests, opaque provider IDs, or credentials.",
        "tags": [
          "operator"
        ],
        "parameters": [
          {
            "name": "account_id",
            "in": "path",
            "required": true,
            "description": "Account whose local accounting evidence is requested.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "after",
            "in": "query",
            "description": "Resume after the database ID returned as next_cursor.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum databases returned in this page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded per-database accounting evidence; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresAccountingDiagnosticsResponse"
                }
              }
            }
          },
          "default": {
            "description": "Access denied, invalid pagination, account not found, or accounting unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/managed-postgres/accounting/{account_id}/usage-imports/preview": {
      "post": {
        "operationId": "previewManagedPostgresUsageImport",
        "summary": "Preview retained managed PostgreSQL usage evidence",
        "description": "Operator allowlist and admin scope required, with the existing session MFA gate. Validates normalized complete windows against local catalog and ledger evidence. Makes no provider calls or writes. Returns the revision required for apply; concurrent ledger or lifecycle changes invalidate it.",
        "tags": [
          "operator"
        ],
        "parameters": [
          {
            "name": "account_id",
            "in": "path",
            "required": true,
            "description": "Account whose retained usage evidence will be previewed.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "description": "Normalized retained readings and source attestation for preview.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedPostgresUsageImportRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Validated preview, without accounting changes; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresUsageImportResult"
                }
              }
            }
          },
          "default": {
            "description": "Access denied, invalid evidence, conflicting ledger, or unavailable backend",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/managed-postgres/accounting/{account_id}/usage-imports": {
      "post": {
        "operationId": "applyManagedPostgresUsageImport",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "summary": "Apply retained managed PostgreSQL usage evidence",
        "description": "Allowlisted operator session with recent MFA step-up, same-origin checks, and Idempotency-Key required. Bearer API keys cannot apply imports. Requires expected_revision from preview. Commits normalized ledger windows, contiguous coverage, and immutable before/after evidence atomically. import_id durably deduplicates an identical request by the same actor; conflicting reuse is rejected. Evidence observation times are preserved. This neither establishes missing identities or shutdown nor reconciles a final provider invoice.",
        "tags": [
          "operator"
        ],
        "parameters": [
          {
            "name": "account_id",
            "in": "path",
            "required": true,
            "description": "Account owning the reviewed database and imported usage.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Request replay key; import_id additionally provides permanent receipt deduplication.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          }
        ],
        "requestBody": {
          "description": "Reviewed retained readings with the revision returned by preview.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedPostgresUsageImportRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Applied import or original committed response on identical durable replay; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresUsageImportResult"
                }
              }
            }
          },
          "default": {
            "description": "Access denied, invalid evidence, expired preview, conflicting replay, or unavailable backend",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/managed-postgres/accounting/{account_id}/reconciliations/preview": {
      "post": {
        "operationId": "previewManagedPostgresAccountingReconciliation",
        "summary": "Preview legacy PostgreSQL identity and shutdown reconciliation",
        "description": "Operator allowlist and admin scope with existing MFA read policy required. Validates retained evidence against local catalog and ledger state without provider calls or writes. Only deleted accountable resources with unknown identities are eligible. Returns the revision required for apply.",
        "tags": [
          "operator"
        ],
        "parameters": [
          {
            "name": "account_id",
            "in": "path",
            "required": true,
            "description": "Account owning the legacy database being reconciled.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "description": "Operator-verified identity and actual shutdown evidence; maximum 32 KiB.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedPostgresAccountingReconciliationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Reconciliation preview with no catalog or accounting changes; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresAccountingReconciliationResult"
                }
              }
            }
          },
          "default": {
            "description": "Access denied, invalid evidence, incompatible ledger, conflicting identity, or unavailable backend",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/managed-postgres/accounting/{account_id}/reconciliations": {
      "post": {
        "operationId": "applyManagedPostgresAccountingReconciliation",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "summary": "Reconcile a legacy PostgreSQL identity and confirmed shutdown",
        "description": "Allowlisted operator session with recent MFA step-up, same-origin checks and Idempotency-Key required. Bearer keys cannot apply. Requires a current expected_revision. Atomically attaches the evidence-backed identity and actual shutdown boundary, resets derived coverage and retains immutable before/after evidence. Existing usage quantities and accounting obligations remain intact. Recovery and final corrections remain required; this does not settle an invoice. reconciliation_id permanently deduplicates identical requests by the same actor.",
        "tags": [
          "operator"
        ],
        "parameters": [
          {
            "name": "account_id",
            "in": "path",
            "required": true,
            "description": "Account owning the reviewed legacy database.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Request replay key; reconciliation_id also provides permanent deduplication.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          }
        ],
        "requestBody": {
          "description": "Reviewed identity and shutdown evidence with preview revision; maximum 32 KiB.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedPostgresAccountingReconciliationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Committed reconciliation or original durable response; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresAccountingReconciliationResult"
                }
              }
            }
          },
          "default": {
            "description": "Access denied, invalid evidence, stale preview, conflicting identity/replay, or unavailable backend",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/object-storage/usage-reports": {
      "post": {
        "operationId": "recordObjectStorageUsage",
        "summary": "Import a cumulative provider object storage usage report",
        "description": "Operator session with recent step-up and Idempotency-Key required. Identical reports are idempotent; conflicting or regressing reports are rejected. Automated exporters use the operator-owned usage_reports_path backend setting.",
        "tags": [
          "operator"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Unique operation identifier.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ObjectStorageUsageReport"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Report persisted or identical report already present"
          },
          "default": {
            "description": "Access denied, invalid or conflicting report, or accounting unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/config": {
      "get": {
        "tags": [
          "operator"
        ],
        "operationId": "listOperatorRuntimeConfig",
        "summary": "List operator runtime configuration",
        "description": "Returns the closed configuration catalog together with desired and\neffective values. Sensitive bootstrap settings are redacted. This is\nan operator-only route and is not part of the customer API.\n",
        "responses": {
          "200": {
            "description": "Runtime configuration catalog",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "items",
                    "generated_at"
                  ],
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/OperatorRuntimeConfig"
                      }
                    },
                    "generated_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/v1/admin/config/{key}": {
      "patch": {
        "tags": [
          "operator"
        ],
        "operationId": "updateOperatorRuntimeConfig",
        "summary": "Update an operator runtime setting",
        "description": "Updates a catalogued setting without an SSH session. Hot settings are\napplied immediately; graceful settings return a durable asynchronous\noperation. The write is versioned, audited, persisted in PostgreSQL,\nand propagated over pg_notify. Bootstrap, rolling, and break-glass\nsettings remain deployment-managed until their corresponding\ncontroller is available.\n",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Catalog key to update."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "value",
                  "reason"
                ],
                "properties": {
                  "value": {},
                  "reason": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 500
                  },
                  "expected_version": {
                    "type": "integer",
                    "format": "int64",
                    "minimum": 0
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Applied configuration entry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperatorRuntimeConfig"
                }
              }
            }
          },
          "202": {
            "description": "Graceful apply operation queued or blocked",
            "headers": {
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Polling URL for the durable apply operation."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperatorRuntimeConfigOperation"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/admin/config-operations/{id}": {
      "get": {
        "tags": [
          "operator"
        ],
        "operationId": "getOperatorRuntimeConfigOperation",
        "summary": "Read a runtime configuration apply operation",
        "description": "Polls the durable operation created for a graceful, rolling, or\nbreak-glass configuration change. A terminal status always includes\nthe controller phase and any failure/block reason.\n",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Durable configuration operation id."
          }
        ],
        "responses": {
          "200": {
            "description": "Runtime configuration apply operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperatorRuntimeConfigOperation"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/admin/config/{key}/rollback": {
      "post": {
        "tags": [
          "operator"
        ],
        "operationId": "rollbackOperatorRuntimeConfig",
        "summary": "Roll back a hot runtime setting to a previous revision",
        "description": "Applies the selected historical value as a new revision through the\nsame zero-downtime hot-apply path as PATCH. Only mutable hot settings\nare eligible. The request is optimistic-concurrency protected and\nthe rollback itself is appended to the audit and revision history.\n",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Catalog key to roll back."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RollbackOperatorRuntimeConfigRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Rolled-back and applied configuration entry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperatorRuntimeConfig"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/admin/config/{key}/revisions": {
      "get": {
        "tags": [
          "operator"
        ],
        "operationId": "listOperatorRuntimeConfigRevisions",
        "summary": "List runtime configuration revisions",
        "description": "Read-only append-only version history for one catalogued setting.",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Catalog key whose history should be returned."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            },
            "description": "Maximum number of revisions to return."
          }
        ],
        "responses": {
          "200": {
            "description": "Configuration revision history",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "items"
                  ],
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/OperatorRuntimeConfigRevision"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/admin/flags": {
      "get": {
        "tags": [
          "operator"
        ],
        "operationId": "listOperatorPlatformFlags",
        "summary": "List platform flags",
        "description": "Returns every catalogued platform flag with the API's live\ndefinition, the per-daemon apply receipts and convergence, and the\nshared account groups. Change a flag with\nPATCH /v1/admin/config/{config_key}. Operator-only.\n",
        "responses": {
          "200": {
            "description": "Platform flags and groups",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperatorPlatformFlagList"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/v1/admin/flags/{key}": {
      "get": {
        "tags": [
          "operator"
        ],
        "operationId": "getOperatorPlatformFlag",
        "summary": "Get a platform flag",
        "description": "One platform flag with its live definition, apply receipts and convergence. Operator-only.",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Platform flag key, for example ai_gateway."
          }
        ],
        "responses": {
          "200": {
            "description": "Platform flag",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperatorPlatformFlag"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/admin/flags/{key}/decision": {
      "get": {
        "tags": [
          "operator"
        ],
        "operationId": "inspectOperatorPlatformFlag",
        "summary": "Explain a platform flag for an account",
        "description": "Evaluates the flag for one account against the API's live definition\nand reports the matching rule, the reason, and whether the account's\nplan is entitled to the capability the flag releases. Records\nnothing. Operator-only.\n",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Platform flag key."
          },
          {
            "name": "account_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Account to evaluate."
          },
          {
            "name": "org_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Organization the request would act under; omit to evaluate outside any organization."
          },
          {
            "name": "at",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Decide as of this moment instead of now, to check scheduled rules."
          }
        ],
        "responses": {
          "200": {
            "description": "Decision",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperatorPlatformFlagDecision"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/admin/accounts/{id}/flags": {
      "get": {
        "tags": [
          "operator"
        ],
        "operationId": "listOperatorAccountPlatformFlags",
        "summary": "List platform flags for an account",
        "description": "Every platform flag decided for one account, with plan entitlement. Operator-only.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Account ID."
          }
        ],
        "responses": {
          "200": {
            "description": "Decisions for the account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperatorAccountPlatformFlags"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/capabilities": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "getCapabilities",
        "summary": "Return feature maturity and plan availability.",
        "description": "Returns the canonical, account-scoped capability registry. `maturity`\ndescribes the product lifecycle state; `plans` lists entitled plans\nand `enabled` resolves that list for the caller. The registry is read-only and\nis suitable for CLIs, dashboards, and deployment preflight checks.\n",
        "responses": {
          "200": {
            "description": "Customer-visible capability registry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CapabilitiesResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Capability registry unavailable; retry with backoff.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/events:preview": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "previewEvent",
        "summary": "Preview event routing without publishing.",
        "description": "Evaluates an event against the authenticated account's enabled\nsubscriptions using the same matcher as asynchronous fanout. The\npreview is read-only: it does not persist the event or enqueue work.\nCounts cover every source/type candidate; response lists are bounded\nsamples and `truncated` is true when either sample omits candidates.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreviewEventRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Routing preview completed without publishing the event.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreviewEventResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "description": "The router could not read the current subscription set.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/events/verify-publication": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "verifyAppEventPublication",
        "summary": "Compare intended publication content with retained acceptance.",
        "description": "Read-only despite POST: requires an owned app, apps:read/admin, MFA and rate limits.\nAccepts the original app publish body within its existing 1 MiB limit and\nderives the same stable app/key identity. Compares normalized type, schema\nversion and semantic JSON data using the ordinary publication identity rules.\nOccurrence time and trace metadata are excluded. Current schema admission\nrules do not invalidate verification of previously accepted content.\nReturns match, conflict or unavailable with HTTP 200. Match and conflict\ninclude the retained original receipt from the same comparison snapshot.\nConflict is an observation, not a publish rejection. Unavailable cannot\ndistinguish never accepted, pruning or concurrent acceptance not yet visible.\nNo append, fanout, lease, replay, retention refresh or idempotency response\ncache occurs. Neither match nor conflict establishes consumer execution.\nRequest and stored payloads and raw producer keys are not returned.\nRead errors remain errors rather than being reported as unavailable.\nAn optional expected_accepted_at returns acceptance=same_acceptance,\nreplacement_acceptance or unavailable independently of content status.\nReturned receipts describe the currently observed acceptance even on mismatch.\nOnly expected_accepted_at is accepted as a query parameter; use the status read for consumer evidence.\nAn optional expected_app_id in the body returns 409 before comparison if\nthe resolved application UUID differs.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Owned application for the exact producer-key content comparison.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "expected_accepted_at",
            "in": "query",
            "description": "Exact saved acceptance instant, with original fractional precision; offsets compare by UTC instant.",
            "schema": {
              "type": "string",
              "minLength": 20,
              "maxLength": 35,
              "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,9})?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Original application producer-key publication intent.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AppPublishEventRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Content comparison observation with retained acceptance when available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppEventPublicationVerification"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/events/publish-status": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getAppEventPublishStatus",
        "summary": "Reconcile an app producer key without publishing another event.",
        "description": "Requires an owned app, apps:read/admin scopes, MFA and existing rate limits.\nDerives exactly the same source and event ID as app key publication.\nRead-only five-second receipt snapshot; no append, claim, replay or retention refresh.\nReturns processing while retained routing is unsettled, accepted after routing\nsettles, or unavailable when no retained receipt is visible. Both processing\nand accepted prove durable acceptance. Accepted does not prove delivery or\nhandler success; consult independent recipient execution and workflow evidence.\nUnavailable cannot distinguish never accepted, concurrent acceptance not yet\nvisible, or pruning. It must not automatically trigger a replacement publish.\nEvidence includes full routing summaries and a bounded recipient page.\nFollow evidence.next_after using after; pages are live snapshots and cursors\nbind account, source, event ID and acceptance identity. Stale cursors fail 400.\nWith expected_accepted_at, acceptance is same_acceptance, replacement_acceptance\nor unavailable separately from routing status. Evidence describes the currently\nobserved acceptance, which can be a replacement. Never treat its outcomes as\nproof for the expected acceptance. Raw keys and event payloads are not returned. App renames preserve\nidentity; replacement apps have a different UUID namespace. Matching legacy\naccount/source/ID publication addresses the same identity.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Owned application whose producer-key namespace is inspected.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": true,
            "description": "Exact original printable ASCII producer key, without spaces.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256,
              "pattern": "^[!-~]+$"
            }
          },
          {
            "name": "after",
            "in": "query",
            "description": "Bound receipt recipient continuation cursor from evidence.next_after.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 8192
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Number of consumer evidence rows in this page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          },
          {
            "name": "expected_accepted_at",
            "in": "query",
            "description": "Saved acceptance timestamp for routing and consumer evidence; preserve its exact precision.",
            "schema": {
              "type": "string",
              "minLength": 20,
              "maxLength": 35,
              "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,9})?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retained acceptance evidence or explicitly unavailable observation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppEventPublishStatusResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/events:publish": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "publishAppEvent",
        "summary": "Publish with an application-scoped stable producer key.",
        "description": "Requires an owned app, MFA and events:publish, deploy:write or admin.\nSource is app.<canonical-app-UUID>; event ID is key.<SHA-256 hex of key>.\nThe key is exact, case-sensitive printable ASCII without spaces, 1..256 bytes.\nIdentical type, schema version and JSON data return the original retained\nacceptance with duplicate=true, without extra fanout or storage charge.\nChanged content for the same app/key returns 409, including concurrent\nrequests. Retained duplicate lookup precedes current schema admission.\nOccurrence time and trace context are first-publication metadata and do\nnot change duplicate identity. Fanout uses normal account subscriptions\nmatching the generated source; the publishing app is not the only consumer.\nDeduplication lasts while the normal receipt is retained: settled receipts\nbecome eligible for pruning after the plan's settled-receipt window (Free\n1 day, Hobby 3, Pro 7, Scale 14); holds can extend this window.\nAfter pruning the same key may be accepted again. App renames preserve\nidentity; replacement apps have a new UUID and a new key namespace.\nOptional expected_app_id must match the resolved canonical app UUID;\nmismatches return 409 before accepting any publication.\nNo request-wide Idempotency-Key middleware is used. Retry uncertain outcomes\nwith the same app, key and content. Acceptance does not mean delivery success.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Owned producer application slug.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AppPublishEventRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Original or new durable event acceptance.",
            "headers": {
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Relative receipt URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppPublishEventResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/events:publish": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "publishEvent",
        "summary": "Publish one tenant-scoped internal event.",
        "description": "Persists a canonical CloudEvents-shaped envelope for later content\nmatching and delivery. The authenticated account owns the event;\naccountid is server-stamped and a supplied value must match it.\nEvent identity is unique per account and source; reusing an id with\ndifferent type, schema version, or data returns 409. Older snake_case input attribute\nnames remain accepted during migration. API keys require\n`events:publish`, `deploy:write`, or `admin`.\nMatching and delivery are asynchronous follow-up work. The Location header\nand receipt_url point to GET /v1/events/receipt for delivery evidence.\nIdentical identity retries return the original accepted_at timestamp,\nincluding when retained customer event storage is full. New identities\nexceeding the account count or byte budget return 429 with code\nevent_storage_capacity_exhausted, limit/observed and Retry-After. No ledger\nor receipt is committed on rejection. Storage is released by receipt\nretention pruning, not by delivery completion. GET /v1/events/storage\nreports current usage and plan limits.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublishEventRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Event accepted for durable processing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublishEventResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/events/retention": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventRetentionHealth",
        "summary": "Inspect receipt pruning eligibility, retention holds and account storage.",
        "description": "Read-only account snapshot under apps:read/admin scopes and MFA.\nReceipt retention is the plan's settled-receipt window after routing\nsettles (Free 1 day, Hobby 3, Pro 7, Scale 14); unsettled receipts\nhave no pruning deadline. Reports current eligible, upcoming expiring\nand held receipts using the pruning worker's shared hold predicate.\nRunning backfills pin their acceptance ranges; retained completed\nbackfills pin retryable failed items. Opted-in active recovery jobs hold\npending items until admission or job expiry. Backfill reasons take\nprecedence over recovery_pending in primary hold counts. Eligible\nmeans the nominal deadline has passed without a current hold, not\nthat pruning will occur immediately.\nSource/app filters affect receipt counts and samples only. Storage\nusage and utilization always cover the entire account; utilization\nis the maximum of count and byte percentages and can exceed 100 after\na plan downgrade. Samples are bounded and ordered by nominal deadline,\nsource and id. No payloads, work keys, mutations or reservations.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "source",
            "in": "query",
            "description": "Exact event source filter.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "app",
            "in": "query",
            "description": "Owned application slug; matches captured or backfilled recipients.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "window",
            "in": "query",
            "description": "Expiry lookahead as a Go duration, in whole seconds from 1s to 720h.",
            "schema": {
              "type": "string",
              "default": "24h"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum sampled receipts; aggregate counts include every match.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current retention and account storage health.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventRetentionHealth"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Snapshot exceeded its bounded read budget. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Snapshot exceeded its bounded read budget.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/events:publish-batch": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "publishEventBatch",
        "summary": "Publish up to 100 independent events in input order.",
        "description": "Accepts a nonempty batch of at most 100 events in a body of at most\n1 MiB. Authentication, MFA and events:publish/deploy:write/admin scopes\nmatch single-event publication. Invalid outer JSON, size or count\nrejects the entire request before acceptance. Each item otherwise has\nits own transaction, schema validation, identity and storage charge.\nResults use zero-based input indexes in input order. accepted and\nduplicate include a receipt with the original acceptance timestamp.\nrejected includes a problem; unknown means acceptance could not be\nconfirmed, including an interrupted commit. Retry retryable items or\nan unanswered request with exactly the original source/id/content.\nStable per-event identities provide deduplication; there is no batch\ntransaction or request-wide Idempotency-Key replay. Processing is\nsequential with a 30-second budget; unattempted items are rejected\nwith retryable=true and code event_publish_not_attempted.\nNewly accepted items preserve their input acceptance order. Duplicates\nretain their original position; rejections create none. Concurrent\nrequests may interleave. Execution ordering remains opt-in per keyed\nlane, and delivery remains at least once.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublishEventBatchRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Per-event results, including partial or complete rejection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublishEventBatchResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "413": {
            "description": "Batch request exceeds 1 MiB; no events accepted.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/platform-tenant-self/apps/{slug}/events:publish": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "publishPlatformTenantSelfEvent",
        "summary": "Publish an event for a stored workflow linked to this tenant.",
        "description": "Requires platform_tenant:events:manage. The tenant identity comes from\nthe bearer token, and the app must be actively linked to that tenant.\nThe platform scopes the event to that app's published event-triggered\nworkflows; it does not fan out to other apps' subscriptions. The caller's\nid is scoped by tenant, app, and source, so repeating the same identity\nand content returns the original durable receipt. The response exposes\nboth the canonical platform id and the caller's client_event_id.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublishEventRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Event accepted for tenant-scoped workflow routing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantPublishEventResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/platform-tenant-self/apps/{slug}/events/receipts/{event_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "event_id",
          "in": "path",
          "required": true,
          "description": "Canonical event id returned by tenant event publication.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        }
      ],
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getPlatformTenantSelfEventReceipt",
        "summary": "Read routing and workflow-start evidence for a tenant event.",
        "description": "Requires platform_tenant:events:read. Receipts are visible only to the authenticated tenant that published the event for this linked app. Account-operator recovery actions are omitted.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "source",
            "in": "query",
            "required": true,
            "description": "Event source used with event_id to identify the receipt.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum captured workflow recipients to return in this page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "description": "Opaque continuation cursor returned in next_after.",
            "schema": {
              "type": "string",
              "maxLength": 8192
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tenant-scoped event receipt and captured workflow recipients.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventReceiptResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/platform-tenant-self/apps/{slug}/workflows/schedules": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "listPlatformTenantSelfWorkflowSchedules",
        "summary": "List schedules this tenant may customize for a linked app.",
        "description": "Requires platform_tenant:stored_workflows:read. Results include only live published schedule triggers that the app owner marked tenant_configurable. Version zero means the tenant still uses the published defaults.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Tenant-visible schedules and their current versions.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListTenantWorkflowSchedulesResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/platform-tenant-self/apps/{slug}/workflows/schedules/{name}/preview": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "Tenant-configurable schedule workflow from the live deployment.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "getPlatformTenantSelfWorkflowSchedulePreview",
        "summary": "Preview fire times and catch-up for this tenant's schedule.",
        "description": "Read-only simulation using this tenant's effective schedule and durable cursor. Fire times follow Gregale daylight-saving rules. No run is admitted or cursor changed.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "at",
            "in": "query",
            "description": "Hypothetical evaluator time in RFC3339; defaults to now and is bounded to five years in either direction.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "since",
            "in": "query",
            "description": "Simulated prior evaluation time, useful for reviewing missed-fire catch-up. Defaults to the durable tenant cursor.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "count",
            "in": "query",
            "description": "Upcoming occurrences to return.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 20,
              "default": 5
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Read-only schedule simulation.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowSchedulePreviewResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/platform-tenant-self/apps/{slug}/workflows/schedules/{name}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "Name of an opted-in schedule workflow from the live deployment.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      ],
      "put": {
        "tags": [
          "workflows"
        ],
        "operationId": "updatePlatformTenantSelfWorkflowSchedule",
        "summary": "Set this tenant's cadence for an opted-in workflow.",
        "description": "Requires platform_tenant:stored_workflows:manage. expected_version is zero\nto create a tenant override and otherwise must match the current version.\nA stale version returns 409. Omitting timezone or overlap keeps the\npublished defaults; enabled defaults to true. The tenant controls only\nits own cadence, timezone, overlap behavior, and enabled state. Input,\nworkflow steps, credentials, and app concurrency remain app-owned.\nExisting runs keep their admitted definition.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "description": "The tenant's complete schedule settings and the version currently observed by the caller.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateTenantWorkflowScheduleRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated tenant schedule and its new version.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantWorkflowScheduleResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/events/recipient-blockers": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "getEventRecipientBlockers",
        "summary": "Read an ordered batch of exact recipient routing diagnostics.",
        "description": "Read-only. One independent snapshot per item, up to 50 items and 65536 body bytes. Duplicate queries are processed independently. All guards validate before reads. Results preserve request order and echo each query. Per-item read failures contain no evidence. A shared five second deadline bounds work; remaining items return read_timeout. No atomic batch snapshot or handler completion guarantee.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventRecipientBlockerBatchRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Independent ordered results and errors, with Cache-Control no-store.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventRecipientBlockerBatchResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/events/recipient-blocker": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventRecipientBlocker",
        "summary": "Inspect routing blockers for one exact retained recipient.",
        "description": "Requires apps:read or admin. Reads only the authenticated account, in\none repeatable read snapshot. Matches source, ID, precise acceptance and\nrecipient before inspecting current routing controls. No backlog pagination\nor consumer aggregation. Returns available for current routing evidence,\nnot_waiting only when the retained recipient has left pending/processing,\nunavailable for missing or inconsistent retained evidence, or\nacceptance_replaced when the retained identity has a different timestamp.\nNot_waiting never implies handler completion or replay attribution.\nForeign and missing receipts both return unavailable with receipt_unavailable.\nRead-only; never follows links, claims work or submits recovery.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "source",
            "description": "Original event source for the exact recipient lookup.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          {
            "name": "id",
            "description": "Original event identifier within the source.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          {
            "name": "subscription_id",
            "description": "Consumer subscription captured by the original event acceptance.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          {
            "name": "expected_accepted_at",
            "in": "query",
            "required": true,
            "description": "Exact original acceptance instant, preserving fractional precision.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Exact recipient routing observation, including unavailable evidence.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventRecipientBlockerResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Read timeout or storage unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/events/backlog": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventBacklog",
        "summary": "Discover waiting event consumers and recipient counts.",
        "description": "Requires apps:read or admin. Reads only the authenticated account's\ncaptured application and workflow recipients plus added backfill\nrecipients in pending or processing routing state, in both whole-event\nand independent-recipient routing modes. Includes capacity waits before\nan invocation exists; excludes settled routing and handler execution\nqueues. Returns consumer kind, origin, wait metadata and receipt/history links,\nnever envelope data. Consumers count all matching recipients, independently\nof either bounded page. Age is measured from durable event acceptance.\nRecipient pages are oldest accepted first, then receipt and subscription\nidentity; consumer pages use app, subscription and consumer kind. Pass each\ncontinuation cursor with the same filters; page sizes may change. Cursors\nanchor window_at and its age cutoff, while membership and counts remain\nlive on every request. Recovered rows disappear, including cursor rows.\nReplay behind a cursor requires restarting discovery. This inspection\nordering does not guarantee delivery FIFO. A repeatable read keeps each\nresponse consistent. Aggregation has a five-second deadline; narrow\nfilters if event_backlog_read_timeout is returned. Responses use\nCache-Control no-store. unattributed_receipts counts pending legacy\nreceipts without captured recipients across the account; only the\nacceptance/age window applies to that count, including with other filters.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "app",
            "description": "Owned app slug; an unknown or foreign app returns 404.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "in": "query",
            "name": "subscription_id",
            "description": "Captured or backfilled recipient identifier.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "in": "query",
            "name": "consumer_kind",
            "description": "Restrict to application subscriptions or workflow starts.",
            "schema": {
              "type": "string",
              "enum": [
                "application",
                "workflow"
              ]
            }
          },
          {
            "in": "query",
            "name": "origin",
            "description": "Restrict to recipients captured at acceptance or added by historical backfill.",
            "schema": {
              "type": "string",
              "enum": [
                "acceptance",
                "backfill"
              ]
            }
          },
          {
            "in": "query",
            "name": "state",
            "description": "Restrict current routing state.",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "processing"
              ]
            }
          },
          {
            "in": "query",
            "name": "waiting_reason",
            "description": "Restrict to the currently observed waiting reason before pagination and aggregation.",
            "schema": {
              "type": "string",
              "enum": [
                "circuit_open",
                "circuit_probe_wait",
                "circuit_recovery_rate_limited",
                "subscription_paused",
                "subscription_rate_limited",
                "ordering_blocked",
                "capacity_consumer",
                "capacity_app",
                "capacity_account",
                "routing_in_progress",
                "receipt_processing",
                "retry_backoff",
                "workflow_routing",
                "ready"
              ]
            }
          },
          {
            "in": "query",
            "name": "capacity_scope",
            "description": "Restrict currently pending waits by the last recorded capacity scope.",
            "schema": {
              "type": "string",
              "enum": [
                "consumer",
                "app",
                "account"
              ]
            }
          },
          {
            "in": "query",
            "name": "min_age_seconds",
            "description": "Minimum whole seconds since acceptance, relative to window_at.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0,
              "maximum": 31536000,
              "default": 0
            }
          },
          {
            "in": "query",
            "name": "after",
            "description": "Opaque next_after recipient cursor, bound to account and filters.",
            "schema": {
              "type": "string",
              "maxLength": 8192
            }
          },
          {
            "in": "query",
            "name": "consumers_after",
            "description": "Opaque next_consumers_after cursor, bound to account and filters. Both cursors must share window_at.",
            "schema": {
              "type": "string",
              "maxLength": 8192
            }
          },
          {
            "in": "query",
            "name": "limit",
            "description": "Maximum waiting recipients in this page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          },
          {
            "in": "query",
            "name": "consumer_limit",
            "description": "Maximum consumer summaries in this page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matching live backlog metadata and independently paginated consumer counts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventBacklogResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/events/storage": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventStorageUsage",
        "summary": "Inspect retained customer event storage and account limits.",
        "description": "Requires apps:read or admin. Returns usage only for the authenticated\naccount. Logical UTF-8 JSON bytes include envelope, duplicated event data,\nand immutable recipient snapshots. Pending and settled receipts remain\ncharged until retention pruning. Reserved gregale.* platform events are\nexempt. Indexes, TOAST compression, ledger and attempt history are outside\nthis budget. A null oldest_pending_at means no customer routing is pending.\nResponses use Cache-Control no-store.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Current retained storage and plan limits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventStorageUsageResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/events/receipt": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventReceipt",
        "summary": "Inspect acceptance, routing, and execution for one event.",
        "description": "Requires apps:read or admin. Reads the retained account/source/id receipt\nand a bounded page of captured and backfilled recipients. recipient_count\nand routing_summary cover the immutable acceptance snapshot; separate\nbackfill counts cover added consumers, including those without invocations.\nEnqueued routing does not imply handler success: keyed cancellation can\nproduce a cancellation receipt instead. The original deterministic\ninvocation is shown when retained; trusted generic replay lineage adds\nthe latest replay and a paginated history URL without replacing the\noriginal failure. Recovery actions target the latest retained replay\nwhen present. Recovery actions require their existing\nwrite scopes and are revalidated when called. Legacy receipts without\nsnapshots report snapshot_captured=false and cannot reconstruct recipients.\nPages follow acceptance order then append-only backfill positions, which\nsurvive job pruning. Inspection order does not imply delivery order;\noutcomes may change between requests.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "expected_accepted_at",
            "in": "query",
            "required": false,
            "description": "Optional original acceptance time. Returns 409 if the retained event belongs to a replacement acceptance.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "source",
            "in": "query",
            "required": true,
            "description": "Published event source paired with the required ID for this receipt lookup.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "description": "Published event ID paired with the required source for this receipt lookup.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          {
            "name": "after",
            "in": "query",
            "description": "Opaque next_after cursor bound to account, source, ID, and retained receipt. Mismatched or stale cursors return 400.",
            "schema": {
              "type": "string",
              "maxLength": 8192
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum recipients in this page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current receipt evidence and recipient page.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventReceiptResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/events/receipt/replays": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventReceiptReplays",
        "summary": "Inspect retained handler replay history for one captured or backfilled recipient.",
        "description": "Requires apps:read or admin. Returns generic invocation replays linked by\nledger-owned parent/root identity, newest first by created_at and ID.\nOriginal and intermediate execution records may expire independently;\nsurviving descendants remain visible. Legacy replays without trusted\nlineage cannot be reconstructed from guest headers. Unknown or foreign\nreceipts, recipients and current app owners return 404. Cursors bind the\naccount, source, event ID, subscription and retained receipt identity;\nmismatched or stale cursors return 400. Cursor anchors remain usable after\ntheir execution record expires. Outcomes may change between requests.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "source",
            "in": "query",
            "required": true,
            "description": "Published event source.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "description": "Published event ID.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          {
            "name": "subscription_id",
            "in": "query",
            "required": true,
            "description": "Captured consumer identifier whose retained handler replay history is requested.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          {
            "name": "after",
            "in": "query",
            "description": "Opaque next_after cursor for this replay history.",
            "schema": {
              "type": "string",
              "maxLength": 8192
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum retained replays in this page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retained replay execution evidence and pagination cursor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventReceiptReplayHistoryResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/events/receipt/attempts": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventReceiptAttempts",
        "summary": "Inspect retained handler delivery attempts for one captured or backfilled recipient.",
        "description": "Requires apps:read or admin. Includes the original async invocation and\ntrusted child replays, ordered by descending attempt history ID. Each\nclaim records its attempt and replay generation atomically with dispatch.\nA claim does not prove handler execution. Recovered expired leases have\noutcome unknown; external side effects still require idempotency.\nOnly attempts recorded after rollout and still retained are available.\nClosed attempts expire after at most 30 days, earlier when result retention\nexpires or their invocation is deleted. Running attempts are not pruned.\nMissing history does not establish that no delivery occurred. Unknown or\nforeign receipts, recipients and current app owners return 404.\nCursors bind account, source, event ID, recipient and retained receipt;\nstale or mismatched cursors return 400. New claims do not reorder older\npages; a running outcome may settle between reads.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "source",
            "in": "query",
            "required": true,
            "description": "Source of the published event whose dispatch attempts are requested.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "description": "Identity within the published source for this dispatch-attempt history.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          {
            "name": "subscription_id",
            "in": "query",
            "required": true,
            "description": "Captured consumer identifier.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          {
            "name": "after",
            "in": "query",
            "description": "Opaque next_after cursor for this attempt history.",
            "schema": {
              "type": "string",
              "maxLength": 8192
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum retained attempts per page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retained dispatch evidence and pagination cursor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventReceiptAttemptHistoryResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/event-schemas:preview-rollout": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "previewEventSchemaRollout",
        "summary": "Preview schema version consumer coverage and payload validation.",
        "description": "Read-only. Requires apps:read or admin. Supply a proposed Draft 2020-12 schema, or omit schema to check a registered version. Reports enabled application consumers whose source/type patterns match; version acceptance does not evaluate content filters or guarantee delivery. Optional retained checks scan the newest 1000 account receipts within the acceptance-time range, validate at most 100 matching payloads and at most 4 MiB, and never certify schema compatibility or complete history. No schema is registered and no events or deliveries are created.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventSchemaRolloutRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Observed consumer coverage and bounded payload validation results.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventSchemaRolloutResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid schema, oversized request, or invalid sample or range.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Version is not registered and no proposed schema was supplied.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Bounded rollout observation timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Bounded rollout observation timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/event-schemas": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "registerEventSchema",
        "summary": "Register an immutable event JSON Schema version.",
        "description": "Requires deploy:write or admin. The first schema registered for a\nsource/type pair makes schemaversion mandatory on future publishes.\nRepeating an identical version is safe; changing a version returns 409.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterEventSchemaRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Identical schema version already registered.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegisterEventSchemaResponse"
                }
              }
            }
          },
          "201": {
            "description": "Schema version registered.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegisterEventSchemaResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      },
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "listEventSchemas",
        "summary": "List registered versions for one event source and type.",
        "description": "Requires apps:read or admin.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "source",
            "in": "query",
            "required": true,
            "description": "Event producer source.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": true,
            "description": "Event type within the source.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Immutable schema versions ordered by version.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/EventSchema"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/executions/capabilities": {
      "get": {
        "tags": [
          "runs"
        ],
        "operationId": "getExecutionCapabilities",
        "summary": "Get Runs capabilities and account limits.",
        "description": "Returns the authenticated account's Runs admission state, accepted\nruntimes and profiles, and plan-specific request limits. This describes\nthe control-plane admission contract only; it does not guarantee that\na scheduler dispatcher or a profile image is currently available.\nRequires `apps:read`, `runs:read`, `runs:write`, or `admin`.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Runs admission contract and limits for the authenticated account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionCapabilitiesResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/v1/executions": {
      "get": {
        "tags": [
          "runs"
        ],
        "operationId": "listExecutions",
        "summary": "List disposable executions.",
        "description": "Returns the caller's newest disposable execution receipts, ordered by\ncreation time descending. Runs-only API keys see runs created by their\nown key family; `admin`, `apps:read`, and `deploy:write` credentials\nretain account-wide access. Use `status`\nto narrow the page before applying offset pagination; source and input\nare never returned. Requires `apps:read`, `runs:read`, `runs:write`, or\n`admin`.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            },
            "description": "Maximum number of execution receipts to return."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "Number of matching receipts to skip."
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "queued",
                "restoring",
                "running",
                "succeeded",
                "failed",
                "timed_out",
                "out_of_memory",
                "cancelled"
              ]
            },
            "description": "Return only executions in this lifecycle state."
          },
          {
            "name": "workflow_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 96,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,95}$"
            },
            "description": "Return only executions carrying this workflow identifier, within the caller's visible key family or account scope."
          }
        ],
        "responses": {
          "200": {
            "description": "Execution page visible to the authenticated principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      },
      "post": {
        "tags": [
          "runs"
        ],
        "operationId": "createExecution",
        "summary": "Execute source in an isolated disposable microVM.",
        "description": "Queues one bounded Node.js or Python source execution. Source and\ninput are sealed by the control plane before dispatch; the guest has\nloopback-only networking and an internal ephemeral scratch filesystem.\nThe VM is always destroyed before a terminal result is persisted.\nThis endpoint is an explicit opt-in on the control plane and may return\n501 while the host isolation gate is disabled. Requires `deploy:write`,\n`runs:write`, or `admin`. A Runs-only key owns the resulting receipt\nunder its stable key-family identity, which is preserved during key\nrotation. Agent workflow step labels beginning with `gwf:` are unique\nwithin the same workflow and key family; retry clients should reload\nthe existing workflow receipt after a 409.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateExecutionRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Execution admitted and queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "description": "An agent workflow step with this workflow ID and step label already has a Run receipt."
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      }
    },
    "/v1/execution-workflows": {
      "post": {
        "tags": [
          "runs"
        ],
        "operationId": "createManagedExecutionWorkflow",
        "summary": "Submit a server-managed Runs DAG.",
        "description": "Stores a bounded dependency graph encrypted with the host age identity\nand admits each step as a separate disposable Run after its dependencies\nsucceed. Independent steps may run in parallel up to the submitted\nworkflow limit and the account's concurrent Run limit. Continuation is\nowned by the control plane and survives CLI disconnects and the API\nrestarts. Source and input are never returned; the encrypted plan is\nerased when the workflow reaches a terminal state. Requires\n`runs:write`, `deploy:write`, or `admin` and an enabled Runs control\nplane with the host age recipient and identity configured. Each account\nmay have at most 16 active managed workflows; terminal workflows\nrelease their encrypted plan and queue slot.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateManagedExecutionWorkflowRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Encrypted DAG accepted for control-plane continuation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedExecutionWorkflowResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "description": "This workflow identifier already has a different managed plan for the caller's Runs principal."
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/execution-workflows/{workflow_id}": {
      "get": {
        "tags": [
          "runs"
        ],
        "operationId": "getExecutionWorkflow",
        "summary": "Get workflow status and usage totals.",
        "description": "Aggregates run counts by lifecycle state and host-measured usage for\none caller-generated workflow identifier. Runs-only keys see only\nruns created by their own stable key family; broad credentials retain\naccount-wide visibility. Importing an artifact from another key family\ndoes not grant access to that family's run metadata. A server-managed\nworkflow includes its continuation status and admitted step count; a\nplan can be visible before its first Run is admitted. Requires\n`apps:read`, `runs:read`, `runs:write`, or `admin`.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "workflow_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 96,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,95}$"
            },
            "description": "Caller-generated identifier shared by runs in one workflow."
          }
        ],
        "responses": {
          "200": {
            "description": "Workflow counts and terminal-run usage visible to the authenticated principal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionWorkflowResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      }
    },
    "/v1/executions/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ExecutionID"
        }
      ],
      "get": {
        "tags": [
          "runs"
        ],
        "operationId": "getExecution",
        "summary": "Get one disposable execution.",
        "description": "Runs-only keys can read receipts created by their own key family. `admin` and broad legacy scopes retain account-wide access. Requires `apps:read`, `runs:read`, `runs:write`, or `admin`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Current or terminal execution receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      },
      "delete": {
        "tags": [
          "runs"
        ],
        "operationId": "cancelExecution",
        "summary": "Cancel one disposable execution.",
        "description": "Cancellation is idempotent and destroys a claimed VM during teardown. Runs-only keys can cancel only receipts created by their own key family. Requires `deploy:write`, `runs:write`, or `admin`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "202": {
            "description": "Execution cancellation requested, or its existing terminal receipt returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      }
    },
    "/v1/executions/{id}/events": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ExecutionID"
        }
      ],
      "get": {
        "tags": [
          "runs"
        ],
        "operationId": "streamExecutionEvents",
        "summary": "Stream disposable execution events.",
        "description": "Opens a resumable Server-Sent Events stream for one execution. Event\nids are monotonically increasing control-plane cursors; reconnect with\n`after` or `Last-Event-ID`. The stream emits bounded status, stdout,\nstderr, and terminal events and closes after the terminal event.\nWhen the cursor predates retained events, a gap event with\n`execution_id` and `through_sequence` precedes the retained events.\nComplete bounded stdout/stderr remain available in the terminal receipt;\n`output_truncated` describes the output byte limit, not replay retention.\nSource, input, host paths, and VM internals are never included.\nRuns-only keys can stream only receipts created by their own key family.\nRequires `apps:read`, `runs:read`, `runs:write`, or `admin`.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0,
              "default": 0
            },
            "description": "Resume after this event id (exclusive)."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 100
            },
            "description": "Maximum number of events returned per replay batch."
          },
          {
            "name": "Last-Event-ID",
            "in": "header",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            },
            "description": "Standard SSE reconnect cursor; `after` takes precedence."
          }
        ],
        "responses": {
          "200": {
            "description": "Resumable execution event stream.",
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      }
    },
    "/v1/executions/{id}/artifact-grants": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ExecutionID"
        }
      ],
      "post": {
        "tags": [
          "runs"
        ],
        "operationId": "createExecutionArtifactGrant",
        "summary": "Share one output artifact with another agent.",
        "description": "Creates a single-use, short-lived capability for one named artifact on\na successful execution. The creating Runs key must own the source run;\naccount-wide principals may grant any account run. The bearer token is\nreturned once and only its hash is stored. The recipient can stage only\nthese bytes using `artifact_inputs.grant_token`; this does not grant\naccess to the source receipt, events, cancellation, or other artifacts.\nRequires `runs:write`, `deploy:write`, or `admin`.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateExecutionArtifactGrantRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Capability created. Store the token securely; it is shown only once.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionArtifactGrantResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      }
    },
    "/v1/execution-artifact-grants/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ExecutionArtifactGrantID"
        }
      ],
      "delete": {
        "tags": [
          "runs"
        ],
        "operationId": "revokeExecutionArtifactGrant",
        "summary": "Revoke an unredeemed artifact grant.",
        "description": "Revokes future use of one artifact capability. A Runs-only key may\nrevoke grants it created; account-wide principals may revoke any\naccount grant. A grant already redeemed cannot be undone, but the\nrecipient's new run retains its own encrypted copy. Revocation remains\navailable when new Runs admission is disabled.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Grant revoked or was already revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevokeExecutionArtifactGrantResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/crash-snapshots/settings": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getCrashSnapshotSettings",
        "summary": "Read whether 5xx crash snapshots are on for an app.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The app's crash snapshot setting.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrashSnapshotSettingsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      },
      "put": {
        "tags": [
          "apps"
        ],
        "operationId": "putCrashSnapshotSettings",
        "summary": "Turn 5xx crash snapshots on or off for an app.",
        "description": "When on, the first 5xx answered by one of the app's instances\ncaptures that instance's memory, at most one in flight and\nnone within 10 minutes of the last. Pro and Scale only. Answers 501\n`crash_snapshots_not_enabled` until the operator enables the feature.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CrashSnapshotSettingsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The saved setting.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrashSnapshotSettingsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      }
    },
    "/v1/apps/{slug}/crash-snapshots": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listCrashSnapshots",
        "summary": "List an app's crash snapshots, newest first.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The app's crash snapshots.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrashCaptureListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      },
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "createCrashSnapshot",
        "summary": "Capture the app's newest running instance now.",
        "description": "Requests a crash snapshot of the app's newest running instance,\nwhether or not 5xx captures are on. Refused with 409\n`crash_capture_refused` while another capture is in flight, within\n10 minutes of the last, or when no instance is running.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "202": {
            "description": "Capture requested.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrashCaptureResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      }
    },
    "/v1/apps/{slug}/crash-snapshots/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/CrashCaptureID"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getCrashSnapshot",
        "summary": "Read one crash snapshot.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The crash snapshot.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrashCaptureResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      }
    },
    "/v1/apps/{slug}/crash-snapshots/{id}/fork": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/CrashCaptureID"
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "forkCrashSnapshot",
        "summary": "Open a ready crash snapshot as a production fork.",
        "description": "Creates an fork restored from this capture instead of the\ndeployment's newest snapshot. Same rules as `POST /v1/apps/{slug}/forks`:\nthe key needs `deploy:write` and `secrets:read`, the response carries\nthe one-time `access_token`, and the fork counts against the fork\nlimits. 409 `crash_capture_not_ready` unless the capture is ready and\nunexpired.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAppForkRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Fork of the crash snapshot admitted and queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppForkResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      }
    },
    "/v1/apps/{slug}/forks": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listAppForks",
        "summary": "List production forks for an app.",
        "description": "Returns the app's production forks, newest first. Answers\n501 `app_forks_not_enabled` until the operator enables forks.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            },
            "description": "Maximum number of forks to return."
          }
        ],
        "responses": {
          "200": {
            "description": "The app's forks, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppForkListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      },
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "createAppFork",
        "summary": "Fork the app's live deployment into a quarantined debug copy.",
        "description": "Queues a production fork: a restore of the app's newest\ncapture of its live deployment into an instance that never serves\ntraffic, cannot reach the network, and is destroyed at its TTL.\nThe fork holds a copy of production memory, secrets included, so\nthe key needs `secrets:read` as well as `deploy:write`, and every\ncreate is audited. Pro and Scale only; one active fork per app and\ntwo per account. Answers 501 `app_forks_not_enabled` until the\noperator enables forks.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAppForkRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Fork admitted and queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppForkResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "An active-fork limit is full (`app_fork_limit`, with `limit` and `observed`), or the app has no live deployment (`app_fork_unavailable`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      }
    },
    "/v1/apps/{slug}/forks/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/AppForkID"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppFork",
        "summary": "Read one production fork.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The fork.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppForkResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      },
      "delete": {
        "tags": [
          "apps"
        ],
        "operationId": "cancelAppFork",
        "summary": "Cancel a production fork.",
        "description": "Cancels a queued fork immediately. For a restoring or running fork\nit records the request; the scheduler destroys the instance. A fork\nthat has already ended is returned unchanged.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "202": {
            "description": "Cancellation recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppForkResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      }
    },
    "/v1/apps/{slug}/forks/{id}/execs": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/AppForkID"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listAppForkExecs",
        "summary": "List the commands run in a production fork.",
        "description": "Newest first. Output can contain production data, so this needs `secrets:read` as well as `deploy:write`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of commands to return (default 100).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The fork's commands.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppForkExecListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      },
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "createAppForkExec",
        "summary": "Run a command inside a running production fork.",
        "description": "Queues one command to run inside the running fork, in the\napp's working directory and user, with its manifest environment and\nno secrets. The fork cannot reach the network. Poll the returned\ncommand for its exit code and the tail of its output. A command never\nruns in a serving instance. Needs `secrets:read` as well as\n`deploy:write`; every request is audited (without its arguments).\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAppForkExecRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Command queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppForkExecResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The fork is not running, or already has 4 commands pending (`app_fork_exec_refused`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      }
    },
    "/v1/apps/{slug}/forks/{id}/execs/{exec_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/AppForkID"
        },
        {
          "name": "exec_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Canonical UUID for a fork command."
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppForkExec",
        "summary": "Read one command run in a production fork, with its result.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The command.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppForkExecResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      }
    },
    "/v1/apps/{slug}/tasks": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "runs"
        ],
        "operationId": "listAppTasks",
        "summary": "List deployment-attached tasks for an app.",
        "description": "Returns newest-first one-off command receipts for the app. Task rows\nremain pinned to the immutable deployment selected at admission.\nScheduler leases and artifact storage identifiers are never returned.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            },
            "description": "Maximum number of task receipts to return."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "Number of task receipts to skip."
          }
        ],
        "responses": {
          "200": {
            "description": "App-scoped task page.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppTaskListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      },
      "post": {
        "tags": [
          "runs"
        ],
        "operationId": "createAppTask",
        "summary": "Run a one-off command against an app deployment.",
        "description": "Queues one manual command in a fresh task VM using the app's current\nlive deployment, scoped configuration, bindings, and network policy.\nThe selected deployment is pinned at admission and the VM is destroyed\nbefore terminal completion. Release tasks cannot be created here.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAppTaskRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Manual app task admitted and queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppTaskResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      }
    },
    "/v1/apps/{slug}/tasks/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/AppTaskID"
        }
      ],
      "get": {
        "tags": [
          "runs"
        ],
        "operationId": "getAppTask",
        "summary": "Get one deployment-attached app task.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Current or terminal app-task receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppTaskResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      },
      "delete": {
        "tags": [
          "runs"
        ],
        "operationId": "cancelAppTask",
        "summary": "Cancel one deployment-attached app task.",
        "description": "Cancellation is idempotent; claimed work is torn down before terminal acknowledgement.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "202": {
            "description": "App-task cancellation recorded, or its existing terminal receipt returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppTaskResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      }
    },
    "/v1/apps/{slug}/tasks/{id}/attach": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/AppTaskID"
        }
      ],
      "get": {
        "tags": [
          "runs"
        ],
        "operationId": "attachAppTask",
        "summary": "Attach to an interactive app task (WebSocket).",
        "description": "Served by the compute gateway, not the API. Requires the account\ncredential, deploy-write scope, the `X-Gregale-Attach-Token` from the\ntask's create response, and the `gregale-app-task-attach-v1`\nWebSocket subprotocol. Optional `rows`/`cols` set the initial terminal\nsize. The token is consumed by the first successful attach. Binary\nmessages start with a type byte: client 0x01 stdin, 0x02 resize\n(rows, cols as big-endian uint16), 0x03 stdin close; server 0x10\nattached, 0x11 stdout, 0x12 stderr, 0x13 terminal JSON\n(`status`, `exit_code`, `failure`).\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "rows",
            "in": "query",
            "required": false,
            "description": "Initial terminal height for TTY sessions; defaults to 24.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            }
          },
          {
            "name": "cols",
            "in": "query",
            "required": false,
            "description": "Initial terminal width for TTY sessions; defaults to 80.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            }
          }
        ],
        "responses": {
          "101": {
            "description": "Switching to the attach WebSocket."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The task VM is still starting; retry after the Retry-After interval.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "The session ended, already has a client, or its attach window closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "getAccount",
        "summary": "Whoami.",
        "description": "Returns the calling account, its plan, and quota limits.",
        "responses": {
          "200": {
            "description": "The calling account: id, plan, limits snapshot, current-month usage, and total app count.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountResponse",
                  "example": {
                    "id": "0123456789abcdef0123456789abcdef",
                    "email": "ops@example.com",
                    "email_verified": true,
                    "plan": "hobby",
                    "status": "active",
                    "limits": {
                      "plan": "hobby",
                      "ram_mb": 256,
                      "max_concurrency": 2,
                      "deployed_apps": 3,
                      "developer_apps": 2,
                      "included_gb_hours": 50,
                      "app_layer_max_mb": 512
                    },
                    "usage_gb_hours": 1.234,
                    "app_count": 3,
                    "developer_app_count": 1,
                    "github_install_id": null
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "account"
        ],
        "operationId": "deleteAccount",
        "summary": "Stage account deletion (30-day grace).",
        "description": "Stages deletion. The account becomes `deleted_pending` for 30 days\nduring which the customer can call `POST /v1/account/restore`. After\nthe grace period, all rows are GC'd.\nAn account serving as an organization's billing contact while it has\na billing customer must move that contact first (409\n`billing_contact_member`). If the billing-contact check cannot\ncomplete, returns retryable 503 without staging deletion.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Staged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountDeletionResponse",
                  "example": {
                    "status": "deleted_pending",
                    "scheduled_at": "2026-07-23T11:25:00Z",
                    "restore_until": "2026-08-22T11:25:00Z"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "$ref": "#/components/responses/ConflictDelete"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "patch": {
        "tags": [
          "account"
        ],
        "operationId": "updateAccountProfile",
        "summary": "Set the account display name.",
        "description": "Sets the optional display name shown to org members and in the\ndashboard. Leading and trailing spaces are removed; an empty string\nclears it. At most 80 characters, no control characters.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountProfileUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountProfileUpdate"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/email": {
      "post": {
        "tags": [
          "account"
        ],
        "operationId": "requestAccountEmailChange",
        "summary": "Start a sign-in email change.",
        "description": "Browser sessions only; an API key gets 403. Accounts with two-factor\nauthentication need a recent authenticator verification\n(`step_up_required` otherwise); accounts with a password send\n`current_password`. A single-use link valid for 1 hour is emailed to\nthe new address; opening it and confirming moves the account and\nsigns out every browser. The previous address gets a notice. A new\naddress that already belongs to an account gets the same response\nand no email. CSRF: action `account_email_change`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountEmailChangeRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Confirmation sent to the new address.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "status",
                    "email"
                  ],
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "confirmation_sent"
                      ]
                    },
                    "email": {
                      "type": "string",
                      "format": "email"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "An API key was used, a recent authenticator verification is required (`step_up_required`), or, on an account with neither a password nor an authenticator, the browser session signed in more than 15 minutes ago (`recent_sign_in_required`): sign in again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/sign-in-methods": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "listAccountSignInMethods",
        "summary": "List the ways to sign in to the account.",
        "description": "Whether a password and two-factor authentication are set, and the linked Google or GitHub identities.",
        "responses": {
          "200": {
            "description": "Sign-in methods.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignInMethodsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/security-activity": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "getAccountSecurityActivity",
        "summary": "List the account's sign-ins and security changes.",
        "description": "Sign-ins, API keys and CLI sign-ins, password, email, two-factor\nand sign-in method changes of the last 90 days, newest first, at\nmost 100. Each event carries a fixed summary, and the client address\nand sign-in method when they were recorded. Needs a full-access\ncredential.\n",
        "responses": {
          "200": {
            "description": "Security events, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SecurityActivityResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/sign-in-methods/{provider}": {
      "parameters": [
        {
          "name": "provider",
          "in": "path",
          "required": true,
          "description": "Linked sign-in provider to remove.",
          "schema": {
            "type": "string",
            "enum": [
              "google",
              "github"
            ]
          }
        }
      ],
      "delete": {
        "tags": [
          "account"
        ],
        "operationId": "unlinkAccountSignInMethod",
        "summary": "Remove a linked Google or GitHub sign-in.",
        "description": "Browser sessions need a recent authenticator verification when\ntwo-factor authentication is on. Refused with 409 when it is the\nlast way to sign in; set a password or link another provider first.\nThe provider stays removed: signing in with it no longer links it by\nmatching email, until it is linked again from a browser signed in to\nthe account. CSRF: action `sign_in_method_unlink` (browser sessions\nonly; API keys need no token).\n",
        "responses": {
          "204": {
            "description": "Sign-in method unlinked."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "A recent authenticator verification is required (`step_up_required`), or, without an authenticator, the browser session signed in more than 15 minutes ago (`recent_sign_in_required`): sign in again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The provider is not linked to this account.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The provider is the last way to sign in.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/dlq": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "listAccountDeadLetterEvents",
        "summary": "List dead-letter events for the account.",
        "parameters": [
          {
            "$ref": "#/components/parameters/QueueCursorLimit"
          },
          {
            "$ref": "#/components/parameters/QueueCursorBefore"
          }
        ],
        "responses": {
          "200": {
            "description": "Account-wide unified dead-letter events, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountDeadLetterEventsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "account"
        ],
        "operationId": "purgeAccountDeadLetterEvents",
        "summary": "Purge dead-letter events from the account ledger.",
        "parameters": [
          {
            "$ref": "#/components/parameters/QueueCursorLimit"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Number of account-wide ledger events purged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountDeadLetterPurgeResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/dlq:replay_all": {
      "post": {
        "tags": [
          "account"
        ],
        "operationId": "replayAllAccountDeadLetterEvents",
        "summary": "Replay pending dead-letter events for the account.",
        "parameters": [
          {
            "$ref": "#/components/parameters/QueueCursorLimit"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "202": {
            "description": "Number of account-wide events accepted for replay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountDeadLetterReplayAllResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/dlq/{id}": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "getAccountDeadLetterEvent",
        "summary": "Get one dead-letter event for the account.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id32"
          }
        ],
        "responses": {
          "200": {
            "description": "The account-owned dead-letter event.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeadLetterEvent"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "account"
        ],
        "operationId": "deleteAccountDeadLetterEvent",
        "summary": "Purge one account-owned dead-letter event.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id32"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "204": {
            "description": "Account dead-letter event removed from the ledger."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/dlq/{id}/replay": {
      "post": {
        "tags": [
          "account"
        ],
        "operationId": "replayAccountDeadLetterEvent",
        "summary": "Replay one account-owned dead-letter event atomically.",
        "description": "An event_route entry (a routing failure whose receipt was pruned) has\nnothing to redrive and answers 409 dead_letter_not_replayable.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id32"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "202": {
            "description": "Account dead-letter replay accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeadLetterEvent"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/rate-limits": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "getAccountRateLimits",
        "summary": "Read the account's current deploy rate window.",
        "description": "Returns the durable account-wide deploy count, plan limit, remaining admissions, and fixed-window reset time.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Current account rate limits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountRateLimitsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/traces/{trace_id}/selected-apps": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "getSelectedAppTrace",
        "summary": "Look up trace metadata for explicitly selected app IDs.",
        "description": "Requires one to five distinct canonical app IDs owned by the authenticated\naccount. Both request and invocation SQL queries filter account and selected\napp IDs before ordering and limiting. No account-wide fallback, log reads,\nspans, payloads, arbitrary headers or queue names. Request metadata is\noldest-first within plan telemetry retention; durable invocation lifecycle\nhistory has an independent oldest-first bound and no request-window filter.\nReturns per-source status and truncation, including empty or unavailable\nsources. No pagination, automatic follow-up or causal-edge inference.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "trace_id",
            "in": "path",
            "required": true,
            "description": "Exact nonzero W3C trace identifier.",
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{32}$"
            }
          },
          {
            "name": "app_id",
            "in": "query",
            "required": true,
            "style": "form",
            "explode": true,
            "description": "Explicit app IDs, repeated as app_id parameters. All must belong to the account; an empty selection never widens to the account.",
            "schema": {
              "type": "array",
              "minItems": 1,
              "maxItems": 5,
              "uniqueItems": true,
              "items": {
                "type": "string",
                "format": "uuid"
              }
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Independent oldest-first row limit for each source, after app filtering. A one-row sentinel detects truncation.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 20,
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Selected-app metadata, including explicit per-source partial or empty results.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SelectedTraceLookupResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/account/traces/{trace_id}": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "getAccountTrace",
        "summary": "Look up one distributed trace across the account.",
        "description": "Returns retained request telemetry, bounded span evidence, and\ndurable invocation lifecycle rows linked by the platform trace id. Request\npayloads and arbitrary invocation headers are never returned.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "trace_id",
            "in": "path",
            "required": true,
            "description": "Canonical 32-character lowercase W3C trace identifier.",
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{32}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum durable invocation rows to include in the lookup.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Account-scoped trace correlation result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountTraceLookupResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/plan": {
      "patch": {
        "tags": [
          "account"
        ],
        "operationId": "changePlan",
        "summary": "Change billing plan after provider confirmation.",
        "description": "Switch the account between `free`, `hobby`, `pro`, and `scale`. The\nlocal account moves to a paid tier only after the configured billing\nprovider confirms payment. If a new subscription is required, the\n`payment_required` response includes `checkout_url`. An existing\nsubscription changes in place: an upgrade is charged the prorated\ndifference now and answers 202 until the provider confirms it; a\ndeclined charge answers 402 with `billing_portal_url` to update the\npayment method, and the plan stays. A downgrade answers 202 and takes\neffect at the end of the billing period. A billing email that already\npays for another account or organization answers 409\n`billing_email_in_use`.\n\nThe optional `salesperson_code` requires a verified browser session and\napplies only before the first paid personal-account purchase. Invalid or\nunavailable codes return 400; an existing different referral or prior\npaid purchase returns 409. A saved referral survives checkout retries\nand provider failures. Only a confirmed invoice payment earns credit.\n\nAsking for the plan the account already pays for keeps its\nsubscription: a scheduled cancellation or downgrade is undone and the\n200 carries `plan_change_status: scheduled_change_undone`. A\nsubscription scheduled to end changes no plan, so an upgrade or\ndowngrade then answers 409 `billing_subscription_ending` until it is\nkept. An upgrade whose charge the bank asks to confirm (3-D Secure)\nanswers 402 `payment_authentication_required` with\n`billing_portal_url`; nothing is charged and the plan stays.\n",
        "requestBody": {
          "required": true,
          "description": "Plan change payload.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChangePlanRequest",
                "example": {
                  "plan": "pro"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated account profile after the plan change.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountResponse",
                  "example": {
                    "id": "0123456789abcdef0123456789abcdef",
                    "email": "ops@example.com",
                    "email_verified": true,
                    "plan": "hobby",
                    "status": "active",
                    "limits": {
                      "plan": "hobby",
                      "ram_mb": 256,
                      "max_concurrency": 2,
                      "deployed_apps": 3,
                      "developer_apps": 2,
                      "included_gb_hours": 50,
                      "app_layer_max_mb": 512
                    },
                    "usage_gb_hours": 1.234,
                    "app_count": 3,
                    "developer_app_count": 1,
                    "github_install_id": null
                  }
                }
              }
            }
          },
          "202": {
            "description": "The provider accepted a deferred plan change; the current local entitlement remains active until the provider webhook confirms it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/EmailVerificationRequired"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/billing": {
      "patch": {
        "tags": [
          "account"
        ],
        "operationId": "updateAccountBillingInfo",
        "summary": "Update the account's invoice billing identity.",
        "description": "Updates the legal business name, billing address, and tax identifier\nused for future provider-issued invoices. Omitted fields are kept;\nan explicitly empty string clears a field. The audit event records\nonly changed field names, never the submitted values.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAccountBillingInfoRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated account profile.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/slo": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "getAccountSLO",
        "summary": "Account-wide SLO rollup.",
        "description": "Flat scalar SLO rollup for the authenticated account. The\nsame wire shape as the per-app endpoint without the\n`app_id` / `app_slug` fields — the rollup is sum-based\nacross every app the account owns. `instance_hours` and\n`gb_hours` are summed from `usage_minutes` over the\nwindow; the per-app equivalent is the explicit\n`/v1/apps/{slug}/slo` endpoint.\n\n`window` is the same closed vocabulary as the per-app\nendpoint: `1h` | `24h` (default) | `7d`. Auth chain:\n`usage:read` scope + MFA. The SLO rollup is a Hobby+\nobservability surface; Free accounts receive 402.\n\nOn Prometheus failure the endpoint returns 200 with\nzeroed fields and `source: \"degraded: <reason>\"`. When\nPostgres is down but the PromQL pass succeeded, only\n`instance_hours` / `gb_hours` are zeroed and `source` is\n`\"degraded: postgres unavailable\"`.\n",
        "parameters": [
          {
            "name": "window",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "1h",
                "24h",
                "7d"
              ],
              "default": "24h"
            },
            "description": "Window for the account-wide SLO rollup. Default `24h`."
          }
        ],
        "responses": {
          "200": {
            "description": "The account-wide SLO rollup.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountSLOResponse"
                },
                "example": {
                  "window": "24h",
                  "source": "prometheus",
                  "as_of": "2026-08-07T15:30:00Z",
                  "request_duration": {
                    "p50_ms": 22.1,
                    "p95_ms": 91,
                    "p99_ms": 410
                  },
                  "error_rate_pct": 0.55,
                  "cold_boot_rate_pct": 4.2,
                  "instance_hours": 12,
                  "gb_hours": 3,
                  "wake_queue_p95_ms": null,
                  "wake_queue_sample_status": "unavailable",
                  "requests_total": 12000,
                  "throttled_total": 23
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanPerAppMetricsNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/export": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "exportAccount",
        "summary": "Export full account data (GDPR).",
        "description": "Returns a JSON bundle containing every resource the account owns\n(apps, deployments, builds, instances, usage, domains, crons, API\nkeys, app secrets) plus the GDPR audit trail. Available to\n`deleted_pending` accounts so the customer can take a final export\nduring the 30-day grace window.\n",
        "parameters": [
          {
            "name": "include_secrets",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": true
            },
            "description": "If true (default), include the sealed-secret envelopes."
          }
        ],
        "responses": {
          "200": {
            "description": "A bundled JSON document: the account itself plus every owned app, deployment, build, instance, usage record, domain, cron, API key, sealed-secret envelope, and the audit trail.",
            "headers": {
              "Content-Disposition": {
                "schema": {
                  "type": "string"
                },
                "description": "attachment; filename=\"faas-account-<id>-<yyyymmdd>.json\""
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountExportResponse",
                  "example": {
                    "exported_at": "2026-07-23T11:25:00Z",
                    "account": {
                      "...": null
                    },
                    "apps": [],
                    "deployments": [],
                    "builds": [],
                    "instances": [],
                    "usage": [],
                    "domains": [],
                    "crons": [],
                    "api_keys": [],
                    "app_secrets": [],
                    "audit_trail": []
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/account/restore": {
      "post": {
        "tags": [
          "account"
        ],
        "operationId": "restoreAccount",
        "summary": "Restore a `deleted_pending` account.",
        "description": "Cancels a staged deletion and emails the account. Needs a full-access (`admin`) key or a browser session, and two-factor authentication when it is required. Returns 409 `account_not_restorable` if the 30-day grace has elapsed.",
        "responses": {
          "200": {
            "description": "Restored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountResponse",
                  "example": {
                    "id": "0123456789abcdef0123456789abcdef",
                    "email": "ops@example.com",
                    "plan": "hobby",
                    "status": "active",
                    "limits": {
                      "plan": "hobby",
                      "ram_mb": 256,
                      "max_concurrency": 2,
                      "deployed_apps": 3,
                      "developer_apps": 2,
                      "included_gb_hours": 50,
                      "app_layer_max_mb": 512
                    },
                    "usage_gb_hours": 1.234,
                    "app_count": 3,
                    "developer_app_count": 1,
                    "github_install_id": null
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "$ref": "#/components/responses/ConflictDelete"
          }
        }
      }
    },
    "/v1/account/mfa/enroll": {
      "post": {
        "tags": [
          "mfa"
        ],
        "operationId": "mfaEnroll",
        "summary": "Start MFA enrollment.",
        "description": "Returns the TOTP secret, QR PNG, otpauth URL, and 10\nrecovery codes exactly once. The plaintext secret is\nshown only here; the server stores a sealed copy. Call\n`/v1/account/mfa/confirm` with the customer's first\n6-digit code to commit the enrollment.\n",
        "responses": {
          "200": {
            "description": "Enrollment ready. Render the QR + recovery codes to the customer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MFAEnrollResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "An API key was used, or the account has no password and the browser session signed in more than 15 minutes ago (`recent_sign_in_required`): sign in again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Already enrolled. Call /v1/account/mfa/disable first.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "MFA unavailable — host age key not loaded.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account/mfa/confirm": {
      "post": {
        "tags": [
          "mfa"
        ],
        "operationId": "mfaConfirm",
        "summary": "Finish MFA enrollment with the first TOTP code.",
        "description": "Verifies the 6-digit code against the sealed secret\nand stamps mfa_enrolled_at. Re-issues the current session\ncookie without the mfa_pending flag; future dashboard logins\nwill require a TOTP verification because enrollment is the\ncustomer's explicit opt-in.\nIf the account has a password, current_password is also required\nto authorize this new factor. An unconfirmed setup secret cannot\nbe used for session verification or recovery.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MFAConfirmRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Enrolled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MFAConfirmResponse"
                }
              }
            }
          },
          "401": {
            "description": "Invalid TOTP code or missing/incorrect current password.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No in-flight enrollment. Call /enroll first."
          },
          "409": {
            "description": "MFA is already enrolled; use /verify for a subsequent challenge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account/mfa/verify": {
      "post": {
        "tags": [
          "mfa"
        ],
        "operationId": "mfaVerify",
        "summary": "Step up an mfa_pending session.",
        "description": "For already-enrolled customers whose session cookie is\nmfa_pending. Same TOTP check as /confirm, but does NOT\nstamp mfa_enrolled_at. Re-issues the cookie without\nmfa_pending so subsequent requests pass requireMFA.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MFAVerifyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Stepped up.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MFAVerifyResponse"
                }
              }
            }
          },
          "401": {
            "description": "Invalid code.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "MFA setup is incomplete; finish /confirm first.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account/mfa/recover": {
      "post": {
        "tags": [
          "mfa"
        ],
        "operationId": "mfaRecover",
        "summary": "Burn a recovery code to regain access.",
        "description": "Use when an enrolled customer's TOTP device is lost. Removes\none matching recovery-code hash from the stored set. The last\ncode is reserved for disabling MFA via recovery_code instead.\nPending setup material does not authorize recovery.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MFARecoverRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Recovered.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MFARecoverResponse"
                }
              }
            }
          },
          "401": {
            "description": "No matching recovery code.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "MFA setup is incomplete, or only the last recovery code remains.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account/mfa/recovery-codes": {
      "post": {
        "tags": [
          "mfa"
        ],
        "operationId": "mfaRegenerateRecoveryCodes",
        "summary": "Replace the recovery codes.",
        "description": "Browser sessions with a recent authenticator verification only.\nCreates a new set of recovery codes, shown once; the previous codes\nstop working and the account gets an email notice. CSRF: action\n`mfa_recovery_codes`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "csrf_token"
                ],
                "properties": {
                  "csrf_token": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "New recovery codes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecoveryCodesResponse"
                }
              }
            }
          },
          "400": {
            "description": "CSRF token missing or wrong for a browser session.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Recovery codes need a browser session with a recent authenticator verification (`step_up_required`); API keys are refused.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Two-factor authentication is not set up.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/mfa/disable": {
      "post": {
        "tags": [
          "mfa"
        ],
        "operationId": "mfaDisable",
        "summary": "Opt out of MFA.",
        "description": "Clears the TOTP secret, recovery codes, and\nmfa_enrolled_at. Body must include exactly one of\n`password` (re-verified against account_passwords)\nor `recovery_code` (consumed). Leaves mfa_required\nuntouched so an explicit operator/workspace policy remains\nin force after disable.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MFADisableRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Disabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MFADisableResponse"
                }
              }
            }
          },
          "400": {
            "description": "Both or neither of password/recovery_code set.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Invalid credentials or recovery code.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account/mfa/disable-email": {
      "post": {
        "tags": [
          "mfa"
        ],
        "operationId": "mfaDisableEmail",
        "summary": "Request email-assisted MFA disable.",
        "description": "Sends a one-time confirmation link to the account email and\nstarts a mandatory 24-hour server-side cooldown. A newer\nrequest invalidates any earlier link.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MFADisableEmailRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Confirmation email queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MFADisableEmailResponse"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/v1/account/mfa/disable-email/confirm": {
      "post": {
        "tags": [
          "mfa"
        ],
        "operationId": "mfaDisableEmailConfirm",
        "summary": "Confirm email-assisted MFA disable.",
        "description": "Consumes the emailed one-time token after the mandatory\n24-hour cooldown and clears the account's MFA state.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MFADisableEmailConfirmRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "MFA disabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MFADisableEmailConfirmResponse"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or already-consumed email token.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "425": {
            "description": "The 24-hour cooldown has not elapsed.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/login": {
      "post": {
        "tags": [
          "auth"
        ],
        "operationId": "passwordLogin",
        "summary": "Email + password sign-in.",
        "description": "Verifies the email + password against the `account_passwords`\nrow (Argon2id, PHC string). Sets the `faas_sid` session\ncookie on success. The response body carries only\n`{account_id, plan}` — no API key. The SDK's device-code\nflow is the programmatic-auth path; the dashboard cookie is\nthe only auth artifact on the browser side.\n\nAnti-enumeration: unbound email, wrong password, and\npasswordless (OAuth-only) accounts all return 401\n`invalid_credentials` with the same body. Every code path\nruns one Argon2id verify under identical parameters so the\ntiming oracle stays closed.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PasswordLoginRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PasswordLoginRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Signed in. The `Set-Cookie: faas_sid=…` header carries\nthe session cookie.\n",
            "headers": {
              "Set-Cookie": {
                "schema": {
                  "type": "string"
                },
                "description": "`faas_sid=<sealed-session>; HttpOnly; Secure;\nSameSite=Lax`. 7-day fixed lifetime.\n"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PasswordLoginResponse",
                  "example": {
                    "account_id": "0123456789abcdef0123456789abcdef",
                    "plan": "hobby"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/InvalidCredentials"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/signup": {
      "post": {
        "tags": [
          "auth"
        ],
        "operationId": "passwordSignup",
        "summary": "Create account with email + password.",
        "description": "Creates an account and signs the caller in. On a colliding\nemail + matching password, the call is idempotent and signs\nin. On a colliding email + different password, the response\nis 401 `invalid_credentials` (never 409 — the surface\nforbids account enumeration).\n\nPassword floor: 12 characters (NIST-style; no complexity\nrules).\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PasswordSignupRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PasswordSignupRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Account created (or reused) and signed in.",
            "headers": {
              "Set-Cookie": {
                "schema": {
                  "type": "string"
                },
                "description": "`faas_sid=<sealed-session>; HttpOnly; SameSite=Lax`.\n"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PasswordLoginResponse"
                }
              }
            }
          },
          "400": {
            "description": "Password too weak (≥12 chars required).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/InvalidCredentials"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/login/forgot": {
      "post": {
        "tags": [
          "auth"
        ],
        "operationId": "passwordForgot",
        "summary": "Request a password-reset email.",
        "description": "Always returns 200 with the same body regardless of\nwhether the email is bound to an account. The reset URL\nis mailed via the platform's outbound mailer; the response\nnever leaks account presence.\n",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PasswordResetRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PasswordResetRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Request accepted. The reset email is sent if the address is registered.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "status"
                  ],
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "ok"
                      ]
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/auth/signup": {
      "post": {
        "tags": [
          "auth"
        ],
        "operationId": "programmaticSignup",
        "summary": "Programmatic signup (JSON-only, bearer-key CLI path).",
        "description": "`gregale signup` — JSON-only endpoint that\ncreates an account (or signs the caller in idempotently),\nmints a fresh programmatic API key, and returns the\n`ProgrammaticAuthResponse` payload. The CLI persists the\nplaintext via `saveToken` without a dashboard round-trip.\n\nAnti-enumeration posture mirrors `/signup`:\n  - email unbound: create + set password + mint key.\n  - email bound + same password: idempotent sign-in + mint key.\n  - email bound + different password: 401 `invalid_credentials`.\nNo Set-Cookie header; bearer-key only.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PasswordSignupRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Account created (or reused) + freshly minted API key.\nThe plaintext is returned ONCE; the caller persists it.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProgrammaticAuthResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/InvalidCredentials"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/auth/login": {
      "post": {
        "tags": [
          "auth"
        ],
        "operationId": "programmaticLogin",
        "summary": "Programmatic login (JSON-only, bearer-key CLI path).",
        "description": "`gregale login` mirror — JSON-only endpoint\nthat authenticates an email + password and returns a\n`ProgrammaticAuthResponse` payload. Same response shape as\n`/v1/auth/signup` so the CLI can reuse its unmarshaler.\n\nAnti-enumeration posture mirrors `/login`: Argon2id pad\non the no-row branch, identical 401 on wrong-password vs\nunbound email.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PasswordLoginRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authenticated + freshly minted API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProgrammaticAuthResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/InvalidCredentials"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/referrals/selection": {
      "post": {
        "tags": [
          "auth"
        ],
        "x-internal": true,
        "operationId": "selectReferralCode",
        "summary": "Preserve an explicitly entered referral code for OAuth signup.",
        "description": "Rate limited pre-signup request. An empty code clears the pending selection; no customer identity is returned. The host-only selection expires in 15 minutes.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "referral_code"
                ],
                "properties": {
                  "referral_code": {
                    "type": "string",
                    "pattern": "^([A-Za-z0-9]{6})?$"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Selection accepted; it grants no account access.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "accepted"
                  ],
                  "properties": {
                    "accepted": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/auth/signup/magic-link": {
      "post": {
        "tags": [
          "auth"
        ],
        "operationId": "programmaticSignupMagicLink",
        "summary": "Magic-link signup (JSON-only, no password).",
        "description": "`gregale signup --email-only EMAIL` — emails\na one-time signup link to the given address. Always\nreturns 200 with the same body regardless of whether the\nemail is bound, unbound, malformed, or missing in the\nrequest — the response cannot be used to enumerate\naccounts.\n\nOn a real-account hit, the handler creates the account if\nunbound, mints a 32-byte token, persists its SHA-256 via\n`IssueLoginToken` (15-minute TTL), and emails the\n`/auth/verify?token=...` link through the platform mailer.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MagicLinkSignupRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Request accepted. The signup link is mailed if the address\nis recognised (or could be registered).\n",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "status"
                  ],
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "ok"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/auth/verify-email": {
      "get": {
        "tags": [
          "auth"
        ],
        "operationId": "verifyEmail",
        "summary": "Verify a password-signup email address.",
        "description": "A browser (Accept text/html) gets an HTML page whose button posts the\ntoken back, and nothing is consumed, so a mail scanner that prefetches\nthe link cannot use up the token. Any other client consumes the\n24-hour, single-use token here and the account email is marked\nverified. No session is created.\n",
        "parameters": [
          {
            "in": "query",
            "name": "token",
            "required": true,
            "description": "The raw 24-hour verification token delivered by email.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The confirmation page, or for a non-browser client the verified-email page.",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "410": {
            "description": "Verification link expired, invalid, or already used."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "auth"
        ],
        "operationId": "confirmEmailVerification",
        "summary": "Confirm an email verification from its confirmation page.",
        "description": "The confirmation page's form posts the token here. It is consumed and\nthe account email marked verified; the HTML answer asks the customer\nto sign in again rather than creating a session.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "token"
                ],
                "properties": {
                  "token": {
                    "type": "string",
                    "description": "The verification token from the confirmation page's form."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Email verified; HTML sign-in prompt.",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "410": {
            "description": "The posted token is expired, unknown, or was already used."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/auth/reset": {
      "get": {
        "tags": [
          "auth"
        ],
        "operationId": "passwordResetForm",
        "summary": "Render the password-reset form.",
        "description": "Validates the token shape; renders the\n`password_reset_form.html` template on a valid token.\nInvalid / expired / consumed tokens return 410 Gone.\n",
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{43}$"
            },
            "description": "Base64url-encoded 32-byte token from the reset email.\n"
          }
        ],
        "responses": {
          "200": {
            "description": "Token is valid; renders the form.",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "410": {
            "$ref": "#/components/responses/ResetTokenInvalid"
          }
        }
      },
      "post": {
        "tags": [
          "auth"
        ],
        "operationId": "passwordResetConfirm",
        "summary": "Submit a new password against a reset token.",
        "description": "Atomically consumes the token (one-shot, replay returns\n410), Argon2id-encodes the new password, sets it on the\naccount, and signs the caller in.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PasswordResetConfirm"
              }
            }
          }
        },
        "responses": {
          "302": {
            "description": "Password set. Redirects to `/dashboard/`. `Set-Cookie:\nfaas_sid=…` is set.\n",
            "headers": {
              "Location": {
                "schema": {
                  "type": "string",
                  "example": "/dashboard/"
                }
              }
            }
          },
          "400": {
            "description": "New password is too weak (≥12 chars required).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "$ref": "#/components/responses/ResetTokenInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/auth/google": {
      "get": {
        "tags": [
          "auth"
        ],
        "operationId": "googleAuthRedirect",
        "summary": "GitHub-style Google OAuth 2.0 consent redirect.",
        "description": "Sets a 16-byte CSRF state cookie scoped to\n`/v1/auth/google/callback` and 302s to the Google consent\nscreen with an RFC 7636 `S256` PKCE challenge. The callback consumes\nthe state and verifier cookies, exchanges\nthe code at `oauth2.googleapis.com/token`, fetches the\nuserinfo, and verifies `email_verified=true` before\nminting a session.\n\nReturns 503 `oauth_provider_unavailable` when the operator\ndid not configure Google sign-in on this host (both\n`GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET` unset at\nboot). The same shape is returned\nfor the half-set case, which fails to boot.\n",
        "responses": {
          "302": {
            "description": "Redirect to Google consent.",
            "headers": {
              "Location": {
                "schema": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          },
          "500": {
            "description": "Google OAuth misconfigured at runtime. Defensive\ncatch — boot validation should make this\nunreachable in production.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Google sign-in not configured on this host. Operator\nmust set both `GOOGLE_CLIENT_ID` and\n`GOOGLE_CLIENT_SECRET` and restart the API.\nSurfaces as `oauth_provider_unavailable`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/auth/google/callback": {
      "get": {
        "tags": [
          "auth"
        ],
        "operationId": "googleAuthCallback",
        "summary": "Google OAuth 2.0 callback.",
        "description": "Verifies state, exchanges the code, fetches the profile,\nenforces RFC 7636 `S256` PKCE and `email_verified=true`, and signs the user in.\nSub-first lookup against `oauth_links` enforces the anti-takeover invariant.\n",
        "parameters": [
          {
            "name": "code",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Authorization code returned by Google on the consent\nredirect. Single-use; exchanged at\n`oauth2.googleapis.com/token`.\n"
          },
          {
            "name": "state",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "CSRF state token. Must match the `faas_google_state`\ncookie set on the consent redirect. Mismatch returns\n401 `csrf_mismatch`.\n"
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect to `WEBSITE_URL` or `/`. `Set-Cookie:\nfaas_sid=…` is set.\n"
          },
          "401": {
            "description": "Google email not verified at the upstream.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "OAuth provider not configured on this host (stale\ncookie or direct callback hit before operator wired\n`GOOGLE_CLIENT_ID`/`GOOGLE_CLIENT_SECRET`).\nSurfaces as `oauth_provider_unavailable`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/auth/github": {
      "get": {
        "tags": [
          "auth"
        ],
        "operationId": "githubAuthRedirect",
        "summary": "GitHub OAuth 2.0 consent redirect.",
        "description": "Sets a 16-byte CSRF state cookie scoped to\n`/v1/auth/github/callback` and 302s to the GitHub consent\nwith `scope=read:user user:email` and an RFC 7636 `S256` PKCE\nchallenge. The callback requires\na primary && verified email before minting a session.\n\nReturns 503 `oauth_provider_unavailable` when the operator\ndid not configure GitHub sign-in on this host (both\n`GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET` unset at\nboot).\n",
        "responses": {
          "302": {
            "description": "Redirect to GitHub consent.",
            "headers": {
              "Location": {
                "schema": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          },
          "500": {
            "description": "GitHub OAuth misconfigured at runtime. Defensive\ncatch — boot validation should make this\nunreachable in production.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "GitHub sign-in not configured on this host. Operator\nmust set both `GITHUB_CLIENT_ID` and\n`GITHUB_CLIENT_SECRET` and restart the API.\nSurfaces as `oauth_provider_unavailable`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/auth/github/callback": {
      "get": {
        "tags": [
          "auth"
        ],
        "operationId": "githubAuthCallback",
        "summary": "GitHub OAuth 2.0 callback.",
        "description": "Verifies state, exchanges the code, fetches `/user` and\n`/user/emails`, filters the primary && verified email,\nenforces RFC 7636 `S256` PKCE, and signs the user in. Sub-first lookup against\n`oauth_links` enforces the anti-takeover invariant.\n\nOn success, `auth.login` is appended to the events table with `method=github`, `email=<verified email>`,\nand `login=<GitHub username>` so the audit dashboard and\nthe corroborating slog line reference one identifier.\n",
        "parameters": [
          {
            "name": "code",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Authorization code returned by GitHub on the consent\nredirect. Single-use; exchanged at\n`github.com/login/oauth/access_token`.\n"
          },
          {
            "name": "state",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "CSRF state token. Must match the `faas_github_state`\ncookie set on the consent redirect. Mismatch returns\n400 `csrf_mismatch`.\n"
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect to `WEBSITE_URL` or `/` after a successful\nGitHub OAuth handshake. `Set-Cookie: faas_sid=…` is set.\n"
          },
          "400": {
            "description": "Malformed callback. The `code` field maps to\n`invalid_state` (no CSRF cookie), `csrf_mismatch`\n(query `state` does not match the cookie), or\n`missing_code` (no `code` query param). The\n`oauth_exchange_failed` code signals the upstream\nGitHub token exchange returned a non-JSON body\n(rarely seen post-2024; the handler sends\n`Accept: application/json`).\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "GitHub account has no primary && verified email.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "description": "OAuth misconfigured server-side (`GITHUB_CLIENT_ID`\nor `GITHUB_CLIENT_SECRET` unset). Surfaces as\n`github_oauth_misconfigured`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "502": {
            "description": "`github.com/login/oauth/access_token`,\n`api.github.com/user`, or `api.github.com/user/emails`\nunreachable. Surfaces as `github_unreachable`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "OAuth provider not configured on this host (stale\ncookie or direct callback hit before operator wired\n`GITHUB_CLIENT_ID`/`GITHUB_CLIENT_SECRET`).\nSurfaces as `oauth_provider_unavailable`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/auth/capabilities": {
      "get": {
        "tags": [
          "auth"
        ],
        "operationId": "getAuthCapabilities",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "summary": "Sign-in OAuth capability signal for the dashboard.",
        "description": "Returns the boot-resolved OAuth provider state for this API\nhost. The dashboard reads this on\n`/login` to decide whether to render the \"Sign in with\nGoogle\" / \"Sign in with GitHub\" buttons.\n\nMounted behind the dashboard's session-cookie auth — a\nscanner without a session gets 302 to `/login` first, so\nthis is not a brute-force amplification surface even though\nit surfaces provider enablement. The set of provider names\nis closed (`google`, `github`); future providers land as\nnew keys, not by adding a list.\n\n`enabled=true` means the provider's `/v1/auth/<provider>`\nconsent route will issue a 302 to the upstream consent\nscreen on a fresh request. `enabled=false` means it will\nreturn 503 `oauth_provider_unavailable`.\n",
        "responses": {
          "200": {
            "description": "Per-provider enabled signal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthCapabilities"
                }
              }
            }
          },
          "302": {
            "description": "No valid session cookie; redirected to /login."
          }
        }
      }
    },
    "/v1/auth/logout": {
      "post": {
        "tags": [
          "auth"
        ],
        "operationId": "postAccountLogout",
        "summary": "Log the current dashboard session out.",
        "description": "Revokes the calling session row in the `sessions` table\n(one row per dashboard login) and\nclears the `faas_sid` cookie. Always 204 on success,\neven if the row was already revoked (idempotent — the\ncookie is cleared either way). Other sessions on the\nsame account are NOT touched; use\n`POST /v1/auth/sessions/revoke_all` for that.\n\nCSRF: action `logout` (verify via the\n`faas_csrf` cookie + body `csrf_token` field or\n`X-CSRF-Token` header).\n\nEmits `auth.session.revoke` with\n`reason: \"logout\"`.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/CookieSession"
          }
        ],
        "responses": {
          "204": {
            "description": "Logout successful. `Set-Cookie: faas_sid=…` clears\nthe session cookie.\n"
          },
          "400": {
            "description": "CSRF check failed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Cookie missing, expired, tampered, or its `sid` is\nnot backed by an active sessions row. The cookie\nis cleared on the wire. Surfaces as\n`session_expired` (pre-IAM-3 cookie / missing /\nrevoked) or `session_invalid` (account-mismatch\ndefensive path; AEAD-bound envelopes should not\nproduce this).\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/auth/csrf": {
      "get": {
        "tags": [
          "auth"
        ],
        "operationId": "issueBrowserCSRFToken",
        "summary": "Issue an action-bound CSRF token for the dashboard.",
        "description": "Returns a short-lived CSRF token bound to the authenticated\naccount and the requested browser mutation. The matching\n`faas_csrf` cookie is HttpOnly; clients send the returned\n`csrf_token` in the mutation's JSON body. For `connect_github`,\nthe cookie is `faas_csrf_github_connect` and clients send the\ntoken as a form field in a native browser POST to\n`/dashboard/install/connect`, which redirects to GitHub.\nFor `bind_app_to_repo`, the cookie is `faas_csrf_github_bind`;\nsend the token in the JSON body of `POST /v1/apps/{slug}/install/bind`.\nThis route remains reachable while the session is `mfa_pending` so the dashboard\ncan complete MFA enrollment or recovery.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/CookieSession"
          },
          {
            "name": "action",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "auth.logout",
                "auth.session.revoke",
                "auth.sessions.revoke_all",
                "mfa_confirm",
                "mfa_recover",
                "mfa_disable",
                "mfa_disable_email",
                "mfa_disable_email_confirm",
                "set_password",
                "connect_github",
                "bind_app_to_repo"
              ]
            },
            "description": "Exact mutation action the token will authorize."
          }
        ],
        "responses": {
          "200": {
            "description": "Action-bound CSRF token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CSRFTokenResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or missing action.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/auth/sessions": {
      "get": {
        "tags": [
          "auth"
        ],
        "operationId": "getAccountSessions",
        "summary": "List active sessions for the calling account.",
        "description": "Returns one `SessionInfo` row per active login (one row\nper dashboard login). Newest first. The\nrow whose `id` matches the calling cookie's `sid` is\nflagged `current_session: true`. Revoked rows are NOT\nreturned; the `audit-events` endpoint is the timeline\nfor those.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/CookieSession"
          }
        ],
        "responses": {
          "200": {
            "description": "Active sessions for the calling account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionListResponse"
                }
              }
            }
          },
          "401": {
            "description": "See `/v1/auth/logout` — same 401 surface.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/auth/sessions/{id}": {
      "delete": {
        "tags": [
          "auth"
        ],
        "operationId": "deleteAccountSession",
        "summary": "Revoke a single session by id.",
        "description": "Revokes the `sessions` row whose `id` is `{id}` and\nwhose `account_id` matches the calling envelope. Cross-\naccount DELETE returns 404 (not 403) — the handler\nnever confirms a row exists in another account. Revoking\nthe current session is allowed: the calling cookie is\ncleared on the wire (same as `/v1/auth/logout`).\n\nCSRF: action `session_revoke`.\n\nEmits `auth.session.revoke` with\n`reason: \"explicit\"`.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/CookieSession"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Session id (UUID v4) from `SessionInfo.id`."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "csrf_token"
                ],
                "properties": {
                  "csrf_token": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Session revoked. `Set-Cookie: faas_sid=…` clears the cookie if the path id matched the current session."
          },
          "400": {
            "description": "CSRF check failed (`csrf_mismatch`) or the path id\nis not a valid UUID (`validation_failed`).\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "See `/v1/auth/logout`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No active session matches the id on this account\n(does not exist, already revoked, or belongs to\nanother account). The 404 is the same shape\nregardless — we never leak existence across\naccounts.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/auth/verify-email/resend": {
      "post": {
        "tags": [
          "auth"
        ],
        "operationId": "resendEmailVerification",
        "summary": "Send a new email verification link.",
        "description": "Mails a new 24-hour verification link when the account's address is\nunverified, at most once a minute and five times an hour. Returns\n`already_verified` when there is nothing to send. Available after the\n30-day verification period ends, when other routes answer\n`email_verification_required`.\n",
        "responses": {
          "200": {
            "description": "The address is already verified.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailVerificationResendResponse"
                }
              }
            }
          },
          "202": {
            "description": "A link was sent, or held back by the per-account limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailVerificationResendResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/auth/sessions/revoke_all": {
      "post": {
        "tags": [
          "auth"
        ],
        "operationId": "postAccountSessionsRevokeAll",
        "summary": "Revoke every session except the calling one.",
        "description": "From a browser session: revokes every other browser session of the\ncalling account and keeps the caller's. CSRF: action\n`sessions_revoke_all`.\n\nWith an API key: revokes every browser session. API keys keep\nworking, and no CSRF token is needed.\n\nReturns the count of sessions revoked.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/CookieSession"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "csrf_token"
                ],
                "properties": {
                  "csrf_token": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bulk revocation succeeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionsRevokeAllResponse"
                }
              }
            }
          },
          "400": {
            "description": "CSRF check failed on the bulk-revoke request.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Cookie missing, expired, tampered, or its `sid` is not backed by an active sessions row. Same 401 surface as `/v1/auth/logout`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/auth/oidc/exchange": {
      "post": {
        "summary": "Exchange an IdP-issued JWT for a short-lived deploy bearer",
        "description": "CI runners that have an IdP-issued OIDC\nJWT (e.g. GitHub Actions `ACTIONS_ID_TOKEN_REQUEST_TOKEN`,\nGitLab CI, CircleCI) call this endpoint to exchange it for a\nshort-lived opaque bearer (5 min TTL, `fp_oidc_<48 hex>` prefix).\nThe bearer is then used in `Authorization: Bearer …` on the\nexisting deploy routes.\n\nGregale publishes the supported OAuth capability metadata at\n`/.well-known/oauth-authorization-server` (RFC 8414). That document\nadvertises this token-exchange grant and intentionally omits\nunsupported authorization-code, refresh-token, and client-registration\ncapabilities.\n\nThe endpoint is anonymous — the JWT is the auth — so it does\nnot require a session or a previous bearer. The first-use\nauto-create flow bootstraps a permissive trust policy on the\n`(account_id, issuer_url)` pair so customers do not have to\nconfigure the dashboard before their first CI deploy.\n\nThe AuthLimit surface is the shared per-IP bucket\n(10/min/IP) — high-volume CI runners may hit the cap; long-lived\ndeploy tokens remain the escape hatch.\n\nThe endpoint also accepts the RFC 8693 OAuth 2.0 Token Exchange\nprofile as `application/x-www-form-urlencoded`. That profile uses\n`subject_token` (a JWT), `subject_token_type` set to the registered\nJWT identifier, and one `audience`; it returns an opaque deploy bearer\nas an OAuth `access_token`. The legacy JSON shape remains supported.\n",
        "operationId": "oidcExchange",
        "tags": [
          "auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OIDCExchangeRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/OAuthTokenExchangeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Exchanged. The bearer is in the response body.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/OIDCExchangeResponse"
                    },
                    {
                      "$ref": "#/components/schemas/OAuthTokenExchangeResponse"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request body, empty fields, or an invalid RFC 8693 token-exchange request.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthTokenExchangeError"
                }
              }
            }
          },
          "401": {
            "description": "JWT signature / issuer / audience / subject failed verification, OR no account is bound to the (issuer, subject) pair.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/dashboard/account/set-password": {
      "post": {
        "tags": [
          "auth"
        ],
        "operationId": "setPassword",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "summary": "Set or replace the password on the authenticated account.",
        "description": "Authenticated. Lets OAuth-only customers opt into password\nlogin and lets customers who already have a password replace\nit. The same Argon2id path as `/auth/reset`, anchored to the\nsession's account rather than a reset token.\n\nThe form must carry a `csrf_token` minted by\n`GET /v1/auth/csrf?action=set_password` (double-submit with\nthe `faas_csrf` cookie); a missing or mismatched token is 400\n`validation_failed`. The route is a same-site form POST, so\n`SameSite=Lax` alone does not protect it from a customer app\nhosted under `*.gregale.dev`.\n\nProof of presence, decided by what the account has:\n\n- A step-up verified within the last 5 minutes\n  (`POST /v1/account/mfa/verify`) is accepted as-is.\n- Otherwise, if an explicit `mfa_required` policy is armed\n  while the account has not enrolled, 403 `mfa_required`.\n  This is a policy hook; MFA remains opt-in for ordinary\n  accounts.\n- Otherwise, if the account has MFA enrolled, 403\n  `step_up_required` — verify TOTP first, whether or not the\n  account also has a password.\n- Otherwise, if the account already has a password,\n  `current_password` is required and verified. Missing and\n  wrong both answer 401 `invalid_credentials`.\n- Otherwise (OAuth-only, no MFA) the request is accepted; the\n  session is the only proof the account has.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/CookieSession"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/SetPasswordRequest"
              }
            }
          }
        },
        "responses": {
          "302": {
            "description": "Password set. Redirects to `/dashboard/account/`.",
            "headers": {
              "Location": {
                "schema": {
                  "type": "string",
                  "example": "/dashboard/account/"
                }
              }
            }
          },
          "400": {
            "description": "Chosen password is too weak (`password_too_weak`, ≥12\nchars required), or the `csrf_token` is missing or does\nnot match the `faas_csrf` cookie (`validation_failed`).\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No session, or the account has a password and\n`current_password` is missing or wrong\n(`invalid_credentials`).\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The account has MFA enrolled and the session carries no\nstep-up from the last 5 minutes (`step_up_required`), or\nan explicit `mfa_required` policy is pending enrollment\n(`mfa_required`). MFA is opt-in for ordinary accounts.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps": {
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listApps",
        "summary": "List apps on the account.",
        "responses": {
          "200": {
            "description": "Apps on the account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AppResponse"
                  }
                },
                "example": [
                  {
                    "id": "0123456789abcdef0123456789abcdef",
                    "slug": "hello-world",
                    "type": "app",
                    "ram_mb": 256,
                    "max_concurrency": 2,
                    "concurrency_per_vm": 5,
                    "min_instances": 0,
                    "status": "active",
                    "url": "https://hello-world.example.com",
                    "manifest": {
                      "entrypoint": [
                        "node",
                        "server.js"
                      ]
                    },
                    "created_at": "2026-07-01T08:00:00Z",
                    "updated_at": "2026-07-23T11:25:00Z",
                    "require_authn": false
                  }
                ]
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "createApp",
        "summary": "Create an app.",
        "requestBody": {
          "required": true,
          "description": "App creation payload (slug, type, runtime, RAM, …). See CreateAppRequest schema.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAppRequest",
                "example": {
                  "slug": "hello-world",
                  "type": "app",
                  "runtime": "",
                  "ram_mb": 256,
                  "max_concurrency": 2,
                  "concurrency_per_vm": 5,
                  "idle_timeout_s": 60,
                  "manifest": null,
                  "require_authn": false
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "201": {
            "description": "The new app.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppResponse",
                  "example": {
                    "id": "0123456789abcdef0123456789abcdef",
                    "slug": "hello-world",
                    "type": "app",
                    "runtime": "",
                    "ram_mb": 256,
                    "max_concurrency": 2,
                    "concurrency_per_vm": 5,
                    "idle_timeout_s": 60,
                    "min_instances": 0,
                    "state": "running",
                    "last_deployment_id": "0123456789abcdef0123456789abcdef",
                    "created_at": "2026-07-01T08:00:00Z",
                    "updated_at": "2026-07-23T11:25:00Z",
                    "require_authn": false
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/AppCreateForbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/InvalidCPURAMPair"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getApp",
        "summary": "Fetch one app.",
        "parameters": [
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "description": "Read or edit desired settings in this project environment. New deployments pin the revision; existing deployments keep their settings. Omit for legacy app settings.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The app.",
            "headers": {
              "X-Gregale-Workload-Revision": {
                "description": "Desired workload settings revision for an environment-scoped request.",
                "schema": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 0
                }
              },
              "X-Gregale-Workload-Config-Hash": {
                "description": "SHA-256 of the immutable desired configuration, present when a revision exists.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppResponse",
                  "example": {
                    "id": "0123456789abcdef0123456789abcdef",
                    "slug": "hello-world",
                    "type": "app",
                    "runtime": "",
                    "ram_mb": 256,
                    "max_concurrency": 2,
                    "concurrency_per_vm": 5,
                    "idle_timeout_s": 60,
                    "min_instances": 0,
                    "state": "running",
                    "last_deployment_id": "0123456789abcdef0123456789abcdef",
                    "created_at": "2026-07-01T08:00:00Z",
                    "updated_at": "2026-07-23T11:25:00Z",
                    "require_authn": false
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "tags": [
          "apps"
        ],
        "operationId": "updateApp",
        "summary": "Partial-update an app.",
        "parameters": [
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "description": "Edit desired workload settings in a registered project environment; deploy again to test the revision. Omit to update legacy app settings.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "If-Workload-Revision",
            "in": "header",
            "required": false,
            "description": "Optional expected desired revision when editing an environment; zero means no revision exists. Protected environments require an approved plan or promotion.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Patch payload — every field is optional; omitted fields are unchanged. See UpdateAppRequest.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAppRequest",
                "example": {
                  "ram_mb": 512,
                  "max_concurrency": 3,
                  "idle_timeout_s": 120,
                  "min_instances": 1,
                  "egress_allowlist": [
                    "1.2.3.0/24",
                    "8.8.8.0/24"
                  ]
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated app.",
            "headers": {
              "X-Gregale-Workload-Revision": {
                "description": "New desired revision saved by an environment-scoped edit.",
                "schema": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 0
                }
              },
              "X-Gregale-Workload-Config-Hash": {
                "description": "SHA-256 identifying the desired configuration saved by this edit.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppResponse",
                  "example": {
                    "id": "0123456789abcdef0123456789abcdef",
                    "slug": "hello-world",
                    "type": "app",
                    "runtime": "",
                    "ram_mb": 256,
                    "max_concurrency": 2,
                    "concurrency_per_vm": 5,
                    "idle_timeout_s": 60,
                    "min_instances": 0,
                    "state": "running",
                    "last_deployment_id": "0123456789abcdef0123456789abcdef",
                    "created_at": "2026-07-01T08:00:00Z",
                    "updated_at": "2026-07-23T11:25:00Z",
                    "require_authn": false
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Conflict; deploy_settings_conflict means the guarded app, deployment or targeted settings changed and no settings were updated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/InvalidMinInstances"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "apps"
        ],
        "operationId": "deleteApp",
        "summary": "Delete an app.",
        "responses": {
          "204": {
            "description": "No body. The resource was removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/policy/status": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getRuntimePolicyStatus",
        "summary": "Check whether runtime policy changes have reached their serving consumers.",
        "description": "Reports desired/applied positions for the gateway request envelope,\ngateway app-cache and traffic policy, edge rules, account CORS presets,\nexplicit response-cache purges, app egress allowlists on nodes hosting\nlive instances, and scheduler scaling-policy observation. The\n`request_policy` component covers app-row request settings such as\nrequest timeout and concurrency, and excludes deployment-traffic\nrevisions. A response-cache purge is active only after every serving\ngateway has invalidated its local cache and optional shared tier. The\ntop-level state and gateway counts remain the app-cache/traffic\nprojection; use each named component for its own convergence state.\n`active` requires fresh observations from every relevant serving\nconsumer. The egress allowlist is replayed from current app state by\nthe scheduler if a notification is missed. Scheduler scaling `active` means\nthe owning scheduler loaded the policy, not that the replica target was\nreached. This does not attest host-level firewall policy or guest\nconfiguration.\n`unverified` means no revision or no relevant serving fleet can be observed.\nGateway policy acknowledgements belong to the current process generation\nand require a fresh serving report. Replacement clears convergence until\nthe new consumers replay. `traffic_runtime` reports compute gateway wiring\nseparately; fresh wiring does not prove request enforcement. The optional\n`wait` applies to policy convergence only.\n",
        "parameters": [
          {
            "name": "wait",
            "in": "query",
            "description": "Optional bounded wait for active state, up to 10s.",
            "schema": {
              "type": "string",
              "example": "5s"
            }
          },
          {
            "name": "edge_rules_scope",
            "in": "query",
            "description": "Account scope covers all owned app rules, including wildcards and a conservative revision floor for unknown historical owners. Fleet scope includes all mutations.",
            "schema": {
              "type": "string",
              "enum": [
                "app",
                "account",
                "fleet"
              ],
              "default": "app"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current application state; pending remains possible after wait expires.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimePolicyStatusResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/platform-tenants": {
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "listPlatformTenants",
        "summary": "List account-level platform customers.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum number of platform tenants in this page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Zero-based offset for the account's tenant list.",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "page_token",
            "in": "query",
            "description": "Opaque cursor returned as next_page_token. Cannot be combined with offset; use it for stable traversal while tenants are being created.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of platform customers.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      },
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "createPlatformTenant",
        "summary": "Register an account-level end customer idempotently by external_ref.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePlatformTenantRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Existing customer with the same external_ref and name.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantResponse"
                }
              }
            }
          },
          "201": {
            "description": "New platform customer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantResponse"
                }
              }
            }
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/account/platform-tenants/apply": {
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "applyPlatformTenant",
        "summary": "Atomically reconcile an additive customer onboarding bundle.",
        "description": "Atomically creates or reuses a platform tenant, app consumers, tenant surfaces, and hostname intent, or previews the same checks with dry_run. Existing surface IDs may also be linked. Omitted resources are not detached; keys are separate and DNS verification and certificate issuance remain asynchronous.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplyPlatformTenantRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Applied or previewed onboarding plan and current surface states.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplyPlatformTenantResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/reconciliation-plan": {
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "planPlatformTenantReconciliation",
        "summary": "Preview desired platform-tenant resource changes without applying them.",
        "description": "Validates a desired bundle and returns deterministic create, link, keep, removal-candidate, and unmanaged-retention entries. This endpoint is read-only; omitted managed resources are only candidates and are never detached, revoked, or deleted.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Existing tenant UUID whose desired resource bundle is being previewed.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlanPlatformTenantReconciliationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Stable, read-only reconciliation plan for this tenant's desired consumer and surface bundle.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantReconciliationPlanResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/offboarding-plan": {
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "planPlatformTenantOffboarding",
        "summary": "Preview a safe platform-tenant offboarding operation.",
        "description": "Returns the tenant status, a stable plan hash, and counts of the\nproposed access and ownership changes. The plan describes suspending\nthe tenant, revoking linked consumer keys and tenant-bound access\ntokens, disabling delegated provisioning policies, detaching only\nplatform-managed consumers and surfaces, and removing only\nplatform-managed hostnames. Unmanaged resources are retained. Usage,\nbilling statements, reconciliation receipts, and webhook subscriptions\nare preserved. This endpoint is read-only; it does not reserve or\napply the plan.\n",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Existing platform tenant UUID to preview for offboarding.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Read-only summary of proposed offboarding actions and stable plan hash.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantOffboardingPlanResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/offboarding-plan/apply": {
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "applyPlatformTenantOffboarding",
        "summary": "Apply a current, explicitly confirmed platform-tenant offboarding plan.",
        "description": "Recomputes the read-only plan while locking the tenant and affected\nresources, then applies all actions and persists a secret-free receipt\nin one transaction only when `expected_plan_hash` matches. The request\nrequires an `Idempotency-Key`. Unmanaged resources and usage, billing,\nreconciliation history, and webhook subscriptions are preserved. A\nstale plan returns 409 and makes no changes.\n",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Existing tenant UUID whose confirmed offboarding is being applied.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "description": "Stable retry key for this offboarding operation."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplyPlatformTenantOffboardingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Applied actions and durable receipt identifier.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantOffboardingApplyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/offboardings": {
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "listPlatformTenantOffboardingReceipts",
        "summary": "List durable platform-tenant offboarding receipts.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Platform tenant UUID whose durable offboarding history is being listed.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "Maximum number of durable offboarding receipts in this page, from 1 to 100.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "page_token",
            "in": "query",
            "description": "Opaque cursor returned by the preceding page.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of immutable offboarding receipts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantOffboardingReceiptListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/offboardings/{receipt_id}": {
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "getPlatformTenantOffboardingReceipt",
        "summary": "Read one durable platform-tenant offboarding receipt.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Platform tenant UUID that owns the requested receipt.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "receipt_id",
            "in": "path",
            "required": true,
            "description": "Offboarding receipt UUID returned by the apply operation.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Exact secret-free offboarding outcome.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantOffboardingReceiptResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/reconciliation-plan/apply": {
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "applyPlatformTenantReconciliation",
        "summary": "Apply a current, explicitly confirmed tenant reconciliation plan.",
        "description": "Recomputes the ownership-aware plan inside the write transaction and\napplies it only when `expected_plan_hash` matches the current preview.\nThe request requires an `Idempotency-Key`. Managed consumers and\nsurfaces are detached rather than deleted; omitted managed hostnames\ndeclared through `surfaces` are removed. Unmanaged resources are never\nchanged. A stale plan returns 409 and makes no changes.\n",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Existing tenant UUID whose confirmed plan is being applied.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "description": "Stable retry key for this apply operation."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplyPlatformTenantReconciliationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The confirmed reconciliation changes, applied atomically.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantReconciliationApplyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/reconciliations": {
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "listPlatformTenantReconciliationReceipts",
        "summary": "List durable receipts for successful reconciliation applies.",
        "description": "Returns compact summaries newest first. Use a receipt_id to fetch the complete secret-free applied change list.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Existing tenant UUID whose reconciliation history is being read.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "Maximum number of receipt summaries to return, from 1 to 100.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "page_token",
            "in": "query",
            "description": "Opaque cursor returned by the preceding page; omit it for the newest receipts.",
            "schema": {
              "type": "string",
              "description": "Opaque cursor returned as next_page_token by the preceding page."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Reconciliation receipt summaries.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantReconciliationReceiptListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/reconciliations/{receipt_id}": {
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "getPlatformTenantReconciliationReceipt",
        "summary": "Read one immutable reconciliation receipt.",
        "description": "Returns the exact applied plan hash, timestamp, and change list. Desired request bodies and hostname challenge tokens are never persisted in receipts.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Existing tenant UUID that owns the receipt.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "receipt_id",
            "in": "path",
            "required": true,
            "description": "Receipt UUID returned by the apply response or history listing.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Immutable successful apply result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantReconciliationReceiptResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Platform tenant UUID in the authenticated account.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "getPlatformTenant",
        "summary": "Read one customer and its linked app consumers and tenant surfaces.",
        "responses": {
          "200": {
            "description": "Customer with current resource links.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantDetailResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "patch": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "setPlatformTenantStatus",
        "summary": "Suspend or resume linked consumer credentials and hostnames.",
        "description": "Anonymous traffic, independent JWT auth, and unrelated app domains keep their own access policy.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetPlatformTenantStatusRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated platform customer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/consumers": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Customer receiving the app-consumer link.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "linkPlatformTenantConsumer",
        "summary": "Link an existing same-account app consumer to this customer.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LinkPlatformTenantConsumerRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Linked consumer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/surfaces": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Customer receiving the hostname-surface link.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "linkPlatformTenantSurface",
        "summary": "Link an existing same-account tenant surface to this customer.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LinkPlatformTenantSurfaceRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Linked surface.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantSurfaceResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/activation": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Customer whose domain activation is requested.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "getPlatformTenantActivation",
        "summary": "Read customer DNS, certificate, and routing readiness.",
        "description": "A read-only snapshot. Ready requires the tenant and every linked surface to be active, every hostname verified, a valid issued certificate, and tenant-surface routing enabled.",
        "responses": {
          "200": {
            "description": "Observed activation state and DNS TXT challenges.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantActivationResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/hostname-policy": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Customer whose delegated hostname policy is managed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "getPlatformTenantHostnamePolicy",
        "summary": "Read the downstream customer's hostname delegation policy.",
        "description": "Empty suffixes and a zero limit mean self-service hostname creation is disabled. Tenant-surface feature and plan gates still apply.",
        "responses": {
          "200": {
            "description": "Current hostname delegation policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantHostnamePolicyResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "setPlatformTenantHostnamePolicy",
        "summary": "Replace a downstream customer's hostname delegation policy.",
        "description": "Requires deploy:write and recent MFA. Suffixes are canonical DNS names; delegation is disabled with an empty array and a zero limit. Tenant-bound access tokens do not gain these account-owner permissions.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetPlatformTenantHostnamePolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated hostname delegation policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantHostnamePolicyResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "description": "Invalid suffixes or hostname limit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/credential-policy": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Platform tenant whose downstream credential delegation policy is managed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "getPlatformTenantCredentialPolicy",
        "summary": "Read a customer's delegated credential policy.",
        "description": "An empty scope list and zero per-consumer limit leave tenant self-service credential management disabled.",
        "responses": {
          "200": {
            "description": "Current credential delegation policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantCredentialPolicyResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "setPlatformTenantCredentialPolicy",
        "summary": "Replace a customer's delegated credential policy.",
        "description": "Requires deploy:write and recent MFA. Delegated scopes are limited to read, write, and admin; zero keys per consumer is only valid with an empty scope list.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetPlatformTenantCredentialPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated credential delegation policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantCredentialPolicyResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "description": "Invalid scope set or per-consumer limit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/consumer-provisioning-policy": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Platform tenant whose downstream customer-provisioning policy is managed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "getPlatformTenantConsumerProvisioningPolicy",
        "summary": "Read a customer's self-service customer-provisioning policy.",
        "responses": {
          "200": {
            "description": "Current customer-provisioning policy; absent policies are disabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantConsumerProvisioningPolicyResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "setPlatformTenantConsumerProvisioningPolicy",
        "summary": "Replace a customer's self-service customer-provisioning policy.",
        "description": "Requires deploy:write and recent MFA. Provisioning is disabled with enabled=false and max_consumers=0; enabled policies require a 1-100000 customer cap.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetPlatformTenantConsumerProvisioningPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated customer-provisioning policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantConsumerProvisioningPolicyResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "description": "Invalid enablement and customer-cap combination.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/request-budget": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Customer whose shared admission budget is managed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "getPlatformTenantRequestBudget",
        "summary": "Read cross-app customer request admission ceilings and counters.",
        "responses": {
          "200": {
            "description": "Current policy and UTC-window admitted-request counters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantRequestBudgetResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "setPlatformTenantRequestBudget",
        "summary": "Set cross-app customer request admission ceilings.",
        "description": "Zero disables a ceiling. The shared counter is authoritative across gateway replicas; configured admission fails closed if it is unavailable. These are admitted-request counts, not billed usage or a money cap.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetPlatformTenantRequestBudgetRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated policy and current counters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantRequestBudgetResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/rate-cards": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Customer whose cross-app commercial tariff is managed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "listPlatformTenantRateCards",
        "summary": "List immutable customer prices applied across linked apps.",
        "responses": {
          "200": {
            "description": "Tenant tariff history ordered by effective minute.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantRateCardListResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "createPlatformTenantRateCard",
        "summary": "Set an immutable cross-app customer price.",
        "description": "Appends a version that overrides app-level prices for this tenant from its effective UTC minute. Before the first tenant version takes effect, statement pricing falls back to each app's rate card. A tenant can use only one currency; finalized statement revisions are never rewritten.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePlatformTenantRateCardRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "New immutable tenant rate-card version.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantRateCardResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/trial": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Tenant whose free trial is read or changed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "getPlatformTenantTrial",
        "summary": "Read a tenant's free trial.",
        "responses": {
          "200": {
            "description": "The tenant's trial.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantTrialResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "putPlatformTenantTrial",
        "summary": "Start a tenant's one free trial, or move the end of a running one.",
        "description": "The tenant's usage in the trial is priced at zero and consumes no\nincluded units, and a month that starts during it has no base fee or\nminimum. A new trial starts at the next UTC minute; a running trial's\nend can move, never before the next minute. A tenant whose trial has\nended cannot get another (409).\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutAPIConsumerTrialRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The tenant's stored trial.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantTrialResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "description": "Invalid tenant trial length or end.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "endPlatformTenantTrial",
        "summary": "End a tenant's running trial at the next minute.",
        "responses": {
          "204": {
            "description": "The tenant's trial ends at the next minute, or was removed before it started."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/credits": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Tenant whose prepaid credit is listed or granted.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "listPlatformTenantCredits",
        "summary": "List a tenant's prepaid credit grants, newest first, with the usable balance per currency.",
        "responses": {
          "200": {
            "description": "The tenant's grants and balances.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantCreditListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "createPlatformTenantCredit",
        "summary": "Grant a tenant prepaid credit that pays its statements across all of its apps.",
        "description": "Finalized tenant statements in the credit's currency draw it down,\nthe grant that expires first before grants that never expire, in the\nsame transaction that finalizes them. The\nstatement's credit_applied_millicents records the draw and invoice\nexports bill amount_due_millicents. Credit never pays more than a\nstatement's amount. A tenant holds at most 100 grants with credit\nleft.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAPIConsumerCreditRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The tenant's new grant.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantCreditResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The tenant already holds 100 grants with credit left.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid tenant credit currency, amount, note or expiry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/credits/{credit_id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Tenant that holds the credit.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "credit_id",
          "in": "path",
          "required": true,
          "description": "Tenant credit grant to void.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "delete": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "voidPlatformTenantCredit",
        "summary": "Void what is left of a tenant credit grant; credit already applied stays applied.",
        "responses": {
          "200": {
            "description": "The voided tenant grant.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantCreditResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/spend-cap": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Tenant whose monthly spend is capped.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "getPlatformTenantSpendCap",
        "summary": "Read a tenant's monthly spend cap and its last check.",
        "responses": {
          "200": {
            "description": "The tenant's cap and whether it is reached this month.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantSpendCapResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "putPlatformTenantSpendCap",
        "summary": "Set a tenant's monthly spend cap across all of its apps.",
        "description": "Once the month's amount due passes the cap, the gateway answers every\nrequest attributed to the tenant with 402 `tenant_spend_cap_reached`\nuntil the month ends, the cap rises or credit is added. The amount\ndue is the tenant's usage for the month to date priced like a\nstatement, without monthly fees, minus usable prepaid credit. The API\nchecks it every minute and at once when the cap or credit changes, so\na tenant can overshoot by about two minutes of traffic. A zero cap\nallows prepaid usage only.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutAPIConsumerSpendCapRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The tenant's stored cap, checked at once.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantSpendCapResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "description": "Invalid tenant cap currency or amount.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "deletePlatformTenantSpendCap",
        "summary": "Remove a tenant's spend cap.",
        "responses": {
          "204": {
            "description": "The tenant's spend cap was removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/account/platform-tenant-billing-policy": {
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "getPlatformTenantBillingPolicy",
        "summary": "Read the account's overdue-invoice rule for tenants.",
        "responses": {
          "200": {
            "description": "The account's tenant overdue rule.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantBillingPolicyResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "putPlatformTenantBillingPolicy",
        "summary": "Refuse tenants whose exported invoice is unpaid some days after its due date.",
        "description": "Every 5 minutes the API places a hold on each tenant whose exported\ninvoice is open or uncollectible with an amount left at least\nblock_overdue_after_days past its due date, and lifts holds that no\nlonger apply. The gateway answers every request of a held tenant\n(its consumers, surfaces and JWT rules) with 402\n`tenant_invoice_overdue`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutAPIConsumerBillingPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The account's stored tenant rule.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantBillingPolicyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "422": {
            "description": "block_overdue_after_days is outside 0 to 365.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "deletePlatformTenantBillingPolicy",
        "summary": "Remove the account's tenant overdue rule; holds lift at the next check.",
        "responses": {
          "204": {
            "description": "The account's tenant overdue rule was removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/account/platform-tenant-overdue-holds": {
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "listPlatformTenantOverdueHolds",
        "summary": "List the tenants the gateway refuses because of an overdue invoice.",
        "responses": {
          "200": {
            "description": "The account's held tenants, oldest due date first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantOverdueHoldListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/account/platform-tenant-plans": {
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "listPlatformTenantPlans",
        "summary": "List the account's tenant plans by name.",
        "responses": {
          "200": {
            "description": "The account's tenant plans.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantPlanListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      },
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "createPlatformTenantPlan",
        "summary": "Create a reusable tenant plan of rate card terms and a request budget.",
        "description": "An account keeps at most 100 tenant plans. A plan changes no tenant until it is assigned.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformTenantPlanRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new tenant plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantPlanResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          }
        }
      }
    },
    "/v1/account/platform-tenant-plans/{plan_id}": {
      "parameters": [
        {
          "name": "plan_id",
          "in": "path",
          "required": true,
          "description": "Tenant plan to read or replace.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "getPlatformTenantPlan",
        "summary": "Read one tenant plan.",
        "responses": {
          "200": {
            "description": "The plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantPlanResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "updatePlatformTenantPlan",
        "summary": "Replace a tenant plan's name and terms.",
        "description": "Tenants already on the plan keep their rate card and budget until the plan is assigned to them again.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformTenantPlanRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated tenant plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantPlanResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/plan-assignments": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Tenant whose plan is assigned or listed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "listPlatformTenantPlanAssignments",
        "summary": "List a tenant's plan assignments, newest first.",
        "responses": {
          "200": {
            "description": "The tenant's assignments.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantPlanAssignmentListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "assignPlatformTenantPlan",
        "summary": "Move a tenant onto a plan from the next minute.",
        "description": "Creates the tenant's rate card version from the plan's terms,\neffective the next UTC minute, and sets the plan's request budget at\nonce when the plan has one. The tenant's existing currency must match\nthe plan's.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssignPlatformTenantPlanRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The assignment and the rate card it created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantPlanAssignmentResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/usage": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Customer whose linked app usage is requested.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "getPlatformTenantUsage",
        "summary": "Read durable cross-app usage for linked consumers.",
        "description": "Raw usage only; app-specific rate cards and invoices are not aggregated.",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "description": "Inclusive UTC start of the usage window, snapped to midnight.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "until",
            "in": "query",
            "description": "Exclusive UTC end of the usage window, snapped to midnight. Defaults to the next UTC midnight, so today is included.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Usage for the requested bounded UTC window.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantUsageResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/activity": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Platform tenant whose cross-app request evidence is requested.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "listPlatformTenantActivity",
        "summary": "Read retained request-debugger evidence across a platform tenant's apps.",
        "description": "This plan-gated support view returns only bounded debugger evidence carrying request-time tenant attribution. It is sampled/retained evidence, not a complete request ledger or billing source of truth. Bodies, headers, and credentials are never returned.",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "description": "Positive duration such as 30m, 24h, or 3d; defaults to 24h and is clamped to plan retention.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "app_id",
            "in": "query",
            "description": "Restrict to one app UUID; results remain scoped to this tenant's request-time attribution.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Restrict to one HTTP response status.",
            "schema": {
              "type": "integer",
              "minimum": 100,
              "maximum": 599
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum rows in this page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Opaque cursor from the previous page; it pins the time window and filters.",
            "schema": {
              "type": "string",
              "maxLength": 4096
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One bounded page of observed request telemetry; represented request counts are weighted by collapsed rows.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantActivityResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/usage-statements": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Platform tenant whose cross-app statements are requested.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "listPlatformTenantStatements",
        "summary": "List revisions of a customer's cross-app usage statement for one period.",
        "parameters": [
          {
            "name": "period_start",
            "in": "query",
            "required": true,
            "description": "Inclusive UTC-minute start of the statement period.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "period_end",
            "in": "query",
            "required": true,
            "description": "Exclusive UTC-minute end of the statement period.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Immutable statement revisions, oldest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantStatementListResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "createPlatformTenantStatement",
        "summary": "Snapshot tenant-attributed usage across apps or create a late-usage adjustment.",
        "description": "For each usage minute, an effective tenant-wide rate card takes precedence over the app's rate card; before the tenant's first effective card, app pricing remains the fallback. Public invoice lines are grouped by app, attributed source, and effective price source, while exact minute coverage remains private for additive revisions. A draft replays unchanged. After finalization, new units create the next revision; no new units replay the latest revision. Mixed effective currencies are rejected.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAPIConsumerUsageStatementRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Existing draft or latest unchanged revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantStatementResponse"
                }
              }
            }
          },
          "201": {
            "description": "New immutable statement revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantStatementResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/usage-statements/{statement_id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Platform tenant owning the statement.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "statement_id",
          "in": "path",
          "required": true,
          "description": "Immutable cross-app statement revision UUID.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "getPlatformTenantStatement",
        "summary": "Read an immutable cross-app statement revision.",
        "responses": {
          "200": {
            "description": "Statement snapshot.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantStatementResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/usage-statements/{statement_id}/finalize": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Platform tenant whose statement revision is finalized.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "statement_id",
          "in": "path",
          "required": true,
          "description": "Statement revision to finalize.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "finalizePlatformTenantStatement",
        "summary": "Finalize a fully priced, single-currency statement revision.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Finalized statement.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantStatementResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/usage-statements/{statement_id}/handoff": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Platform tenant whose external billing receipt is requested.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "statement_id",
          "in": "path",
          "required": true,
          "description": "Finalized statement revision to hand off.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "getPlatformTenantStatementHandoff",
        "summary": "Read the immutable external billing receipt.",
        "responses": {
          "200": {
            "description": "Handoff receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantStatementHandoffResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "claimPlatformTenantStatement",
        "summary": "Record one provider-neutral external billing handoff.",
        "description": "Rejects consumer windows already claimed by overlapping app-local statements. Adjustment revisions for this exact tenant and period may each be handed off once.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ClaimAPIConsumerUsageStatementRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Existing identical handoff receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantStatementHandoffResponse"
                }
              }
            }
          },
          "201": {
            "description": "New handoff receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantStatementHandoffResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/usage-statements/{statement_id}/invoice": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Platform tenant whose statement is exported.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "statement_id",
          "in": "path",
          "required": true,
          "description": "Finalized cross-app statement revision to export.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "getPlatformTenantStatementInvoice",
        "summary": "Read the platform tenant statement's invoice export.",
        "responses": {
          "200": {
            "description": "The platform tenant statement's export.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatementInvoiceExportResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "exportPlatformTenantStatementInvoice",
        "summary": "Export a finalized platform tenant statement as an invoice in Stripe, Paddle or Lago.",
        "description": "Exports one finalized platform tenant statement revision to the\nprovider in the body (default stripe; connect it with\nPUT /v1/account/billing-connections/{provider}).\nThe connection's collection mode decides whether the\nprovider keeps a draft, sends it or charges it. Items are one per rate\ncard and unit price plus a rounding item, so the invoice equals the\nstatement total rounded to the currency's minor unit; Paddle and Lago\nreceive one summary item when a line is negative. On success the\nstatement's handoff records the provider invoice ID. Retrying after a\nfailure resumes the same invoice; repeating a completed export returns\nit. A statement exports to one provider only. Another attempt still\nexporting it answers 409 `statement_invoice_export_in_progress`, and an\nexport the provider refused before creating an invoice can be retried\nwith another customer or provider. Currencies with\nup to three decimal places; Paddle allows USD, EUR\nand GBP.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateStatementInvoiceRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The completed platform tenant statement export.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatementInvoiceExportResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "description": "The platform tenant statement or customer cannot be invoiced, or the provider rejected the request.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "502": {
            "description": "The provider could not be reached (`billing_provider_unavailable`); retry to resume the platform tenant statement export.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The provider could not be reached (`billing_provider_unavailable`); retry to resume the platform tenant statement export. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account/billing-connections/{provider}": {
      "parameters": [
        {
          "name": "provider",
          "in": "path",
          "required": true,
          "description": "Billing provider statements export to.",
          "schema": {
            "$ref": "#/components/schemas/BillingProvider"
          }
        }
      ],
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "getBillingConnection",
        "summary": "Describe the account's key for one billing provider.",
        "responses": {
          "200": {
            "description": "The connection; the key itself is never returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingConnectionResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "tags": [
          "account"
        ],
        "operationId": "putBillingConnection",
        "summary": "Store or replace the account's key for one billing provider.",
        "description": "Checks the key against the provider, then seals it at rest. Stripe\ntakes a restricted key (rk_live_… or rk_test_…) with read and write\naccess to invoices and invoice items; Paddle an API key\n(pdl_live_apikey_… or pdl_sdbx_apikey_…) with transaction access and\nread access to customers; Lago\nan API key and, for the EU region or a self-hosted Lago, api_url. Only\nthe last four characters, the mode and the Lago API URL are ever\nreturned.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutBillingConnectionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The stored connection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingConnectionResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "description": "Not a key of this provider, a bad api_url, or the provider rejected the key.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "502": {
            "description": "The provider could not be reached (`billing_provider_unavailable`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The provider could not be reached (`billing_provider_unavailable`). Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "account"
        ],
        "operationId": "deleteBillingConnection",
        "summary": "Remove the account's key for one billing provider.",
        "responses": {
          "204": {
            "description": "Removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/account/statement-invoices": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "listStatementInvoices",
        "summary": "List invoices exported from usage statements, with their payment status.",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "`unpaid` (draft, open or uncollectible), `overdue` (open and past due), or one payment status.",
            "schema": {
              "type": "string",
              "enum": [
                "unpaid",
                "overdue",
                "draft",
                "open",
                "paid",
                "void",
                "uncollectible",
                "deleted"
              ]
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "The `next_cursor` of the previous invoice page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Invoices to return (1–200, default 50).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Exported invoices, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatementInvoiceListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/account/billing-runs": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "listBillingRuns",
        "summary": "List the account's month-end billing runs, newest first.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Runs to return (1–100, default 20).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Billing runs with their item counts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingRunListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      },
      "post": {
        "tags": [
          "account"
        ],
        "operationId": "createBillingRun",
        "summary": "Bill one ended month for every customer.",
        "description": "Starts a background run for one UTC calendar month that ended at least\nan hour ago. For every app consumer and platform tenant with billable\nusage, it drafts the month's statement, holds consumers whose ledger\nmisses requests telemetry saw (`hold_on_gaps`), finalizes it, and with\n`export` set to stripe, paddle or lago exports each statement to that provider. Usage attributed to a\nplatform tenant is billed on the tenant's statement. One run per\naccount can be queued or running at a time.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBillingRunRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The queued run; poll it or list its items for progress.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingRunResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "description": "Another run is in progress, or `export` names a provider without a connected key.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The month has not ended, or the options are invalid.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account/billing-runs/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Billing run ID.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "getBillingRun",
        "summary": "Get a billing run and how many customers reached each outcome.",
        "responses": {
          "200": {
            "description": "The billing run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingRunResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/account/billing-runs/{id}/items": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Billing run whose customers are listed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "listBillingRunItems",
        "summary": "List what a billing run did for each customer.",
        "parameters": [
          {
            "name": "outcome",
            "in": "query",
            "required": false,
            "description": "Only items with this outcome, such as `held` or `failed`.",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "drafted",
                "finalized",
                "exported",
                "up_to_date",
                "held",
                "skipped",
                "failed"
              ]
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "The previous page's `next_cursor`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Items to return (1–500, default 100).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of the run's items.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingRunItemListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/account/billing-run-schedule": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "getBillingRunSchedule",
        "summary": "Get the account's monthly billing run schedule.",
        "responses": {
          "200": {
            "description": "The schedule and when it next starts a run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingRunScheduleResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "tags": [
          "account"
        ],
        "operationId": "putBillingRunSchedule",
        "summary": "Start a billing run automatically after each month ends.",
        "description": "A new schedule starts with the current month: its run starts\n`delay_hours` after the month ends. Replacing a schedule keeps its\nnext month. If a run is already in progress, the scheduled run\nstarts once it completes.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutBillingRunScheduleRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The saved schedule.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingRunScheduleResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "description": "`export` names a provider without a connected key.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid schedule options or delay.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "account"
        ],
        "operationId": "deleteBillingRunSchedule",
        "summary": "Stop scheduled billing runs; a run already started continues.",
        "responses": {
          "204": {
            "description": "Schedule removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/webhooks": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Platform tenant whose billing event receiver is managed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "listPlatformTenantWebhooks",
        "summary": "List a platform tenant's statement event receivers.",
        "responses": {
          "200": {
            "description": "Tenant-scoped webhook subscriptions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantWebhookListResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "createPlatformTenantWebhook",
        "summary": "Subscribe to finalized cross-app tenant statements.",
        "description": "Creates a signed, retryable receiver scoped to this tenant. Finalization is durably enqueued with the statement transition; one delivery is created per statement revision.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePlatformTenantWebhookRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Receiver created. The plaintext secret is not returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantWebhookResponse"
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/webhooks/{webhook_id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Tenant that owns the subscription being inspected or changed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "webhook_id",
          "in": "path",
          "required": true,
          "description": "Tenant-scoped webhook subscription to inspect or change.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "getPlatformTenantWebhook",
        "summary": "Read a tenant webhook subscription.",
        "responses": {
          "200": {
            "description": "Subscription metadata; the secret remains masked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantWebhookResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "patch": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "updatePlatformTenantWebhook",
        "summary": "Update a tenant webhook destination or delivery policy.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePlatformTenantWebhookRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated subscription metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantWebhookResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      },
      "delete": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "deletePlatformTenantWebhook",
        "summary": "Delete a tenant webhook and its remaining delivery history.",
        "responses": {
          "204": {
            "description": "Subscription deleted."
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/webhooks/{webhook_id}/rotate-secret": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Tenant context used to authorize secret rotation.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "webhook_id",
          "in": "path",
          "required": true,
          "description": "Subscription whose signing secret is rotated.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "rotatePlatformTenantWebhookSecret",
        "summary": "Rotate the signing secret for a tenant webhook.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RotateAppWebhookSecretRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Secret rotated; plaintext is not returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RotateAppWebhookSecretResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/webhooks/{webhook_id}/deliveries": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Tenant context used to scope delivery history.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "webhook_id",
          "in": "path",
          "required": true,
          "description": "Subscription whose delivery attempts are listed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "page_size",
          "in": "query",
          "description": "Maximum number of delivery rows to return, from 1 to 100.",
          "schema": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 50
          }
        },
        {
          "name": "page_token",
          "in": "query",
          "description": "Opaque cursor returned by the previous page.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "listPlatformTenantWebhookDeliveries",
        "summary": "Inspect tenant statement webhook deliveries.",
        "responses": {
          "200": {
            "description": "Durable delivery history, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppWebhookDeliveryListResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/webhooks/{webhook_id}/deliveries/{did}/retry": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Tenant context used to authorize delivery replay.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "webhook_id",
          "in": "path",
          "required": true,
          "description": "Subscription that owns the delivery to replay.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "did",
          "in": "path",
          "required": true,
          "description": "Dead delivery to retry.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "retryPlatformTenantWebhookDelivery",
        "summary": "Retry one dead tenant webhook delivery.",
        "responses": {
          "200": {
            "description": "Delivery requeued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppWebhookRetryDeliveryResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/webhooks/{webhook_id}/deliveries/{did}/attempts": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Tenant context used to authorize attempt inspection.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "webhook_id",
          "in": "path",
          "required": true,
          "description": "Tenant webhook that owns this attempt history.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "did",
          "in": "path",
          "required": true,
          "description": "Tenant webhook delivery to inspect.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "page_size",
          "in": "query",
          "description": "Maximum tenant attempt records per page.",
          "schema": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 50
          }
        },
        {
          "name": "page_token",
          "in": "query",
          "description": "Cursor returned by the preceding tenant attempt page.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "listPlatformTenantWebhookDeliveryAttempts",
        "summary": "Inspect completed attempts for one tenant webhook delivery.",
        "responses": {
          "200": {
            "description": "Tenant delivery attempt history, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppWebhookDeliveryAttemptListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/webhooks/{webhook_id}/health": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Tenant whose webhook health is requested.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "webhook_id",
          "in": "path",
          "required": true,
          "description": "Tenant webhook to inspect.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "getPlatformTenantWebhookDeliveryHealth",
        "summary": "Read the tenant webhook's delivery queue health.",
        "responses": {
          "200": {
            "description": "Current tenant webhook delivery health.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppWebhookDeliveryHealthResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/credentials": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Platform tenant whose credential metadata is requested.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "listPlatformTenantCredentials",
        "summary": "List metadata for a customer's linked consumer keys across apps.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum number of keys to return.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Number of keys to skip.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Metadata only; plaintext credentials are never returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantCredentialsResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/credentials/apply": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Platform tenant whose linked consumers receive credentials.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "applyPlatformTenantCredentials",
        "summary": "Atomically issue or rotate client-generated customer credentials across apps.",
        "description": "Send only a random key's prefix and SHA-256 hash, never its plaintext. Save plaintext securely before submission. Replaying an identical bundle is safe; revocations and additions commit together. This endpoint never returns plaintext, even on creation.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplyPlatformTenantCredentialsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Planned or applied credential changes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplyPlatformTenantCredentialsResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/access-tokens": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Platform tenant receiving the downstream self-service token.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "listPlatformTenantAccessTokens",
        "summary": "List metadata for downstream tenant access tokens.",
        "responses": {
          "200": {
            "description": "Metadata only; token plaintext is never returned by listing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantAccessTokenListResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "createPlatformTenantAccessToken",
        "summary": "Mint a tenant-bound, explicitly scoped self-service credential.",
        "description": "The bearer is scoped to exactly one downstream tenant and supports only its explicit self-service scopes. Credential management additionally requires the owner to enable a scope allowlist and per-consumer key cap. It expires within 365 days and is returned once. Account-wide API-key creation cannot mint these special tenant scopes. This endpoint does not cache plaintext for Idempotency-Key retries; after a lost response, list token metadata and create a replacement under a new name.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePlatformTenantAccessTokenRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Token metadata and one-time plaintext bearer. Store the token securely; it cannot be retrieved later.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatePlatformTenantAccessTokenResponse"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{id}/access-tokens/{token_id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Platform tenant that owns the access token.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "token_id",
          "in": "path",
          "required": true,
          "description": "Access token to revoke.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "delete": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "revokePlatformTenantAccessToken",
        "summary": "Revoke a downstream tenant access token.",
        "responses": {
          "200": {
            "description": "Revoked token metadata; plaintext is never returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantAccessTokenResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/platform-tenant-self/activation": {
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "getPlatformTenantSelfActivation",
        "summary": "Read this tenant's own redacted activation snapshot.",
        "description": "Requires a tenant-bound access token with platform_tenant:activation:read. The tenant is derived from the bearer; callers cannot select another tenant. The snapshot includes only safe latest-deployment status for linked surfaces; raw DNS, certificate, and deployment errors, DNS challenge tokens, app IDs, deployment IDs, and source metadata are omitted.",
        "responses": {
          "200": {
            "description": "Current activation state for the caller's linked surfaces.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantSelfActivationResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/platform-tenant-self/consumers": {
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "listPlatformTenantSelfConsumers",
        "summary": "List this tenant's linked consumers for credential management.",
        "description": "Requires platform_tenant:credentials:read. The tenant is derived from the bearer. The response omits app IDs and account-owned details.",
        "responses": {
          "200": {
            "description": "Linked consumer identities belonging only to the caller's tenant.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantSelfConsumersResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "createPlatformTenantSelfConsumer",
        "summary": "Create or replay a customer identity on a linked surface.",
        "description": "Requires a tenant-bound token with platform_tenant:consumers:manage and an owner-enabled provisioning policy. The tenant comes from the bearer; surface_id must already be linked and active. App and tenant IDs are never accepted from the request. An identical retry returns the original identity without consuming another slot.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePlatformTenantSelfConsumerRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Identical request replayed; the existing identity is unchanged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantSelfConsumerResponse"
                }
              }
            }
          },
          "201": {
            "description": "Customer identity created and linked atomically.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantSelfConsumerResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Tenant is inactive or the same app already has a conflicting identity.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          }
        }
      }
    },
    "/v1/platform-tenant-self/consumers/apply": {
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "applyPlatformTenantSelfConsumers",
        "summary": "Onboard one customer across selected linked app surfaces.",
        "description": "Requires a tenant-bound token with platform_tenant:consumers:manage. The bearer supplies the tenant, while Gregale resolves each selected active, already-linked surface to its app. At most one surface per app may be selected. The batch is all-or-nothing, honors the owner's provisioning policy and tenant-wide cap, and safely replays existing identities. Set dry_run to validate and preview actions without mutation or consumer IDs.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplyPlatformTenantSelfConsumersRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry-run preview or exact replay with no new identities.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplyPlatformTenantSelfConsumersResponse"
                }
              }
            }
          },
          "201": {
            "description": "One or more app-local customer identities were created atomically.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplyPlatformTenantSelfConsumersResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Tenant is inactive or an app already has a conflicting customer identity.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          }
        }
      }
    },
    "/v1/platform-tenant-self/consumers/revoke": {
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "revokePlatformTenantSelfConsumers",
        "summary": "Revoke selected customers and all of their credentials atomically.",
        "description": "Requires a tenant-bound token with platform_tenant:consumers:manage. The tenant is derived from the bearer; consumer_ids must be IDs returned by this tenant's customer listing. Every ID is validated before any change. Revocation remains available when customer provisioning is disabled or the tenant is suspended. An exact retry is safe and reports zero newly revoked keys.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevokePlatformTenantSelfConsumersRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Revoked customer identities and count of keys newly revoked by this request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantSelfConsumerRevocationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          }
        }
      }
    },
    "/v1/platform-tenant-self/credentials": {
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "listPlatformTenantSelfCredentials",
        "summary": "List this tenant's linked consumer-key metadata.",
        "description": "Requires platform_tenant:credentials:read. Plaintext and hashes are never returned.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum keys in this page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Zero-based offset for the next page.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One bounded page of redacted key metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantCredentialsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/platform-tenant-self/credentials/apply": {
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "applyPlatformTenantSelfCredentials",
        "summary": "Reconcile this tenant's downstream consumer keys.",
        "description": "Requires platform_tenant:credentials:manage. New keys must use an owner-allowed scope and fit the owner's active-key cap; revocation remains available even after delegation is disabled. Submit only client-generated SHA-256 hashes, never plaintext. Changes are atomic, account/tenant identity comes from the bearer, and responses contain metadata only.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplyPlatformTenantCredentialsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Credential metadata after atomic tenant-scoped reconciliation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplyPlatformTenantCredentialsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The owner disabled delegation, a requested scope is not permitted, or the per-consumer active-key ceiling would be exceeded.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          }
        }
      }
    },
    "/v1/platform-tenant-self/hostnames": {
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "createPlatformTenantSelfHostname",
        "summary": "Request a hostname on one of the caller tenant's linked surfaces.",
        "description": "Requires platform_tenant:hostnames:manage. Hostnames must match the platform owner's delegated DNS suffix policy, remain within account/plan quotas, and pass DNS TXT ownership verification. The same request safely replays its pending challenge; the response is never cached.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePlatformTenantSelfHostnameRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Hostname intent accepted; DNS verification and certificate issuance are asynchronous.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantSelfHostnameResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "description": "Delegation may be disabled, the hostname outside policy, the tenant suspended, or the delegated cap reached.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/apps/{slug}/operations/{id}/events": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "getAccountOperationEvents",
        "summary": "Read durable operation events as bounded JSON.",
        "description": "Requires account read scope and MFA. Resync_required instructs clients to refresh status when the watermark or event retention is stale. This operator endpoint returns JSON; customer SSE authorization remains separate.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "in": "query",
            "name": "after",
            "description": "Last observed durable event sequence.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retained durable event page and the current sequence watermark.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationEventsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/operations/{id}/timeline": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "getOperationTimeline",
        "summary": "Read one chronological history of an operation.",
        "description": "Requires account read scope and MFA. Merges operation events, HTTP execution attempts, workflow step attempts and completion delivery attempts by time. Each source pages after its own position, so pages never skip or repeat a record while the operation runs. Attempt entries are snapshots at read time. HTTP attempts carry an instance log window for the archived log route; workflow step attempts do not. Platform tenants read events instead.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "in": "query",
            "name": "limit",
            "description": "Maximum timeline entries in this page.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "description": "Operation-bound continuation cursor from next_cursor.",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Chronological timeline page with a continuation cursor while records remain.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationTimelineResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/operations/{id}/executions": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "getOperationExecutions",
        "summary": "Inspect retained operation execution generations.",
        "description": "Requires account read scope and MFA. Rows are ordered by generation with attempt counts from the execution ledger. Payloads, headers and capabilities are omitted. Next_generation is the after watermark for the next page.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "in": "query",
            "name": "after",
            "description": "Last observed execution generation.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 2147483647,
              "default": 0
            }
          },
          {
            "in": "query",
            "name": "limit",
            "description": "Maximum execution generations in this page.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ordered retained execution generations with ledger attempt counts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationExecutionsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/operations/{id}/retry-delivery": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "retryOperationDelivery",
        "summary": "Retry a dead completion delivery without repeating work.",
        "description": "Requires deploy write scope and MFA. Atomically resets only a dead completion webhook delivery to pending. Pending, failed and in-flight deliveries retain their automatic retry policy and cannot be manually reset. Business state and execution generation stay unchanged; read status after an uncertain response.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationId"
          }
        ],
        "responses": {
          "200": {
            "description": "Business result with the independently reset notification projection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/operations/{id}/recovery-inspection": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "inspectOperationRecovery",
        "summary": "Inspect recovery evidence without changing execution.",
        "description": "Account read scope and MFA are required. Returns the pinned execution, confirmed steps, uncertain attempts and private file metadata from a consistent durable snapshot. No payloads, raw errors, object locations or capabilities are returned. Inspection reads never renew leases, consume quotas or publish files. Available while new admission is closed.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationId"
          }
        ],
        "responses": {
          "200": {
            "description": "Recovery inspection with durable execution and retained file metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationRecoveryInspection"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/operations/{id}/recovery-preview": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "previewOperationRecovery",
        "summary": "Preview an operation recovery decision.",
        "description": "Account read scope and MFA are required. Validates a proposed resolution without starting work, recording a receipt, consuming quotas or publishing files. Workflow retries use the native resume planner. Eligible means current platform checks pass; external effects still require operator evidence. Apply revalidates under writer locks. Expected generation rejects stale previews; the inspection revision can optionally fence the later apply request. Available while new admission is closed.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationRecoveryPreviewRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Read-only recovery proposal with current eligibility and planned reuse.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationRecoveryPreview"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/operations/{id}/recover": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "recoverOperation",
        "summary": "Reconcile an uncertain outcome or authorize safe retry.",
        "description": "Requires deploy:write and evidence. Expected generation prevents stale recovery; optional expected_inspection_revision also rejects changed execution evidence. Matching recovery receipts replay before revision validation. recovery_id makes the same recovery decision idempotent. succeeded validates result against the pinned output schema. safe_to_retry creates a new execution while retaining the logical operation identity and pinned contract. Ordinary invocation/DLQ replay cannot bypass this policy.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationRecoveryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Reconciled outcome or receipt of a newly authorized execution generation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/operations/{id}/recover-receipt": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "recoverOperationWithReceipt",
        "summary": "Record or replay an immutable recovery decision acknowledgement.",
        "description": "Account-only; requires deploy:write and MFA when enabled. Uses the same evidence, generation, optional inspection revision, output, quota and pinned execution fences as recover. The decision is committed atomically with recovery. Matching recovery_id and canonical request replay the original decision even after work advances; changed intent returns 409. The acknowledgement describes state at acceptance, not current status or completed work. expires_at is the retention deadline before this decision; later recovery cannot extend it. Old accepted recoveries without retained decision acknowledgements return 409 operation_recovery_receipt_unavailable and are never repeated. Expired receipts return 410.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationRecoveryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Immutable original decision acknowledgement; read current operation status separately.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationRecoveryDecision"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/customer-operations/{id}/artifacts/{artifact}": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "downloadPlatformTenantSelfOperationArtifact",
        "summary": "Customer download of verified operation result bytes.",
        "description": "Requires platform_tenant:operations:read. Foreign artifacts and operations return the same 404. Only succeeded operations allow downloads. The API checks the retained object size and SHA-256 before serving verified bytes. Changed or missing retained private bytes make the artifact unavailable without rewriting the business outcome. The reference expires with the operation projection. No signed URL is stored.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "$ref": "#/components/parameters/OperationArtifact"
          }
        ],
        "responses": {
          "200": {
            "description": "Verified file content authorized for this customer.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "headers": {
              "X-Gregale-Artifact-Sha256": {
                "description": "Customer result transfer: SHA-256 of the attached result bytes.",
                "schema": {
                  "type": "string",
                  "pattern": "^sha256:[0-9a-f]{64}$"
                }
              },
              "Content-Disposition": {
                "description": "Customer result transfer: Attachment filename from the verified declaration.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/operations/{id}/artifacts/{artifact}": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "downloadOperationArtifact",
        "summary": "Account download of verified operation result bytes.",
        "description": "Requires account read scope and app ownership. Only succeeded operations allow downloads. The API checks the retained object size and SHA-256 before serving verified bytes. Changed or missing retained private bytes make the artifact unavailable without rewriting the business outcome. The reference expires with the operation projection. No signed URL is stored.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "$ref": "#/components/parameters/OperationArtifact"
          }
        ],
        "responses": {
          "200": {
            "description": "Verified file content authorized for this account and app.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "headers": {
              "X-Gregale-Artifact-Sha256": {
                "description": "Account result transfer: SHA-256 of the attached result bytes.",
                "schema": {
                  "type": "string",
                  "pattern": "^sha256:[0-9a-f]{64}$"
                }
              },
              "Content-Disposition": {
                "description": "Account result transfer: Attachment filename from the verified declaration.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/runtime/data-api/connection-observations": {
      "post": {
        "tags": [
          "managed_postgres"
        ],
        "operationId": "reportDataAPIRuntimeConnections",
        "summary": "Report resident Data API pool configuration",
        "description": "Private runtime surface. Requires a short-lived gregale:data-api:connections workload assertion for the live instance. Owner API keys and application JWTs are not accepted. Reports are reconciled against current catalog identity and expire within 30 seconds. This does not reserve connections or establish complete demand coverage.",
        "x-internal": true,
        "security": [
          {
            "dataAPIConnectionsWorkloadIdentity": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DataAPIRuntimeConnectionReport"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Observation accepted."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "description": "Observation reporting is unsupported by this catalog adapter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/runtime/data-api/usage": {
      "post": {
        "tags": [
          "managed_postgres"
        ],
        "operationId": "reportDataAPIUsage",
        "summary": "Report Data API usage deltas",
        "description": "Private runtime surface. Requires a short-lived gregale:data-api:usage workload assertion from a live instance of an active app; account, app and instance come from it, never from the body. Only a production deployment reports; a stage, preview or cloned environment is refused for good with 403 workload_not_production, so its usage never counts against production's caps and its access settings never govern production's live reads. Each report id is applied once, so retried or snapshot-duplicated reports add nothing. Hours must be aligned and at most 48 hours old. Owner API keys and application JWTs are not accepted.",
        "x-internal": true,
        "security": [
          {
            "dataAPIUsageWorkloadIdentity": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DataAPIUsageReport"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Report applied, or already applied; month-to-date totals for owner caps.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataAPIUsageReportResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/runtime/data-api/budget": {
      "post": {
        "tags": [
          "managed_postgres"
        ],
        "operationId": "admitDataAPISharedBudget",
        "summary": "Spend shared Data API request credit",
        "description": "Private runtime surface. Requires a dedicated gregale:data-api:budget workload assertion. Account and app come from the assertion. The body contains a digest of a verified subject or tenant and owner deployment policy. Admission spends one credit atomically across replicas; a lost reply may spend credit without customer SQL. No automatic replay is permitted.",
        "x-internal": true,
        "security": [
          {
            "dataAPIBudgetWorkloadIdentity": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "version",
                  "key",
                  "requests",
                  "window_seconds"
                ],
                "properties": {
                  "version": {
                    "type": "integer",
                    "enum": [
                      1
                    ]
                  },
                  "key": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "requests": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000000
                  },
                  "window_seconds": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 3600
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Admission decision; a refusal does not dispatch customer SQL.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "allowed",
                    "retry_after_seconds"
                  ],
                  "properties": {
                    "allowed": {
                      "type": "boolean"
                    },
                    "retry_after_seconds": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 3600
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/runtime/data-api/events": {
      "post": {
        "tags": [
          "managed_postgres"
        ],
        "operationId": "publishDataAPIChangeEvents",
        "summary": "Publish recorded Data API row changes",
        "description": "Private runtime surface for change hooks. Requires a short-lived gregale:data-api:events workload assertion from a live instance of an active app; account and app come from it, never from the body. Only a production deployment publishes; a stage, preview or cloned environment is refused for good with 403 workload_not_production. Each event publishes as an app-scoped producer-key event under the app's own source with key data-api.change.ID, so a republished change deduplicates while its receipt is retained. Events publish in order; publication stops at the first event that may succeed later, and later events are reported as retryable without being attempted. Owner API keys and application JWTs are not accepted.",
        "x-internal": true,
        "security": [
          {
            "dataAPIEventsWorkloadIdentity": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DataAPIChangeEventBatch"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Per-event outcomes in input order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataAPIChangeEventBatchResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "413": {
            "description": "The publication exceeds 1 MiB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/runtime/data-api/change-status": {
      "post": {
        "tags": [
          "managed_postgres"
        ],
        "operationId": "reportDataAPIChangeStatus",
        "summary": "Report Data API change hook delivery",
        "description": "Private runtime surface for change hook delivery. Requires the same gregale:data-api:events workload assertion from a live instance of an active app as publication; account and app come from it, never from the body. The report carries counts the runtime read from its change event table (waiting and rejected changes, when the oldest waiting change was recorded, the latest rejection code, whether publications keep failing) and when it last published; it never carries change data. Owners read the latest report in the app's Data API status. Owner API keys and application JWTs are not accepted.",
        "x-internal": true,
        "security": [
          {
            "dataAPIEventsWorkloadIdentity": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DataAPIChangeHookReport"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "The report is stored."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/runtime/operations/{id}/control": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "getOperationExecutionControl",
        "summary": "Observe cancellation and time bounds for the current HTTP attempt.",
        "description": "Requires a fresh platform-issued workload JWT with audience gregale:operations and matching account, app and instance, plus current dispatch proof. Returns one fenced observation of cancellation intent, the admitted deadline and current lease. The read does not renew the lease, settle work, consume progress reports or authorize external effects. Expired deadlines, stale attempts and customer credentials are denied. Remains available when new operation admission is closed. Handlers cooperate with cancellation; stopping after dispatch does not prove that an external effect did not happen.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "$ref": "#/components/parameters/OperationXFaasInvocationId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationAttempt"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationCapability"
          }
        ],
        "security": [
          {
            "operationsWorkloadIdentity": []
          }
        ],
        "responses": {
          "200": {
            "description": "Read-only live claim observation. Cache-Control is no-store.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationExecutionControlResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/operations/{id}/milestones": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "getAccountOperationMilestones",
        "summary": "Read retained business milestones for an account-owned Operation.",
        "description": "Requires account read scope and MFA. The app and Operation bind ownership; customer credentials cannot access this operator feed.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneLimit"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneCursor"
          }
        ],
        "responses": {
          "200": {
            "description": "Account app Operation facts with retained page continuation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationMilestonesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/customer-operations/{id}/milestones": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "getPlatformTenantSelfOperationMilestones",
        "summary": "Read this customer's retained Operation milestones.",
        "description": "Requires platform_tenant:operations:read. The authenticated customer must own the Operation. Retention follows business results, independently of generic event history.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneLimit"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneCursor"
          }
        ],
        "responses": {
          "200": {
            "description": "Authenticated customer Operation facts and page continuation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationMilestonesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflow-outcomes": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "listAccountWorkflowOutcomes",
        "summary": "List completed workflows with explicit business outcomes.",
        "description": "Requires account read scope and MFA. Optional tenant selection remains within account ownership. Explicit app and environment are required. Only latest retained terminal snapshots with reported outcomes are included; each instance counts once. Reopened instances leave these totals. Earlier outcomes remain in retained workflow history. Terminal state alone does not imply an outcome. Totals cover all matching instances independently of group pagination; cursors are separate from the attention queue. Reports and retention may change during browsing.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneScope"
          },
          {
            "name": "workflow",
            "description": "For the account outcome queue, restrict results to this declared workflow name.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 63,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "code",
            "description": "For the account outcome queue, restrict terminal results to this explicit business outcome code.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneTenantID"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneLimit"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneCursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A bounded page ordered by latest report publication time descending.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowOutcomesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflow-performance/instances": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "listAccountWorkflowPerformanceInstances",
        "summary": "List ranked contributors to a workflow performance group.",
        "description": "Requires account read scope and MFA. Optional tenant selection stays within account ownership. Explicit app/environment/workflow and cohort/dimension selection are required. Uses the same latest 100 instances per cohort and complete-history eligibility as the performance summary. State groups require state and contract_version; blocker groups require operation/code/contract_version and exactly one of owner or unassigned=true; verification_owner groups require exactly one of owner or unassigned=true. Overall dimensions reject group selectors. An optional cohort_token binds the evaluation time and retained evidence to a prior summary; changed or expired cohorts return 409 and require refreshing the summary. Without a token this evaluates a fresh cohort. Returns every matching eligible contributor up to 100 sorted by observed duration descending with stable identity ties. No cursor is supported. Current blockers can differ from historical contributing groups; pending verification previews are bounded independently of exact counts. Decision dimensions require completed cohort and cohort_token, an exact kind/contract_version/outcome_code and decision_code/rule_id/rule_version for decision groups. Path groups additionally require group_id/path_id; the decision triple is either fully supplied or fully omitted. The exact group must be present in the bounded decision_outcomes summary. Decision dimensions reject state/blocker/owner selectors. Returns the earliest qualifying report and optional business decision fact per contributor; reports after the first terminal revision do not qualify. Condition dimensions also require completed cohort and cohort_token and an exact returned condition_outcomes group selected by contract_version and decision_code/rule_id/rule_version and condition_id/condition_description/condition_result and outcome_code. They reject kind/path/state/blocker/owner selectors. Each workflow contributes once per observed result; changed results can produce overlapping groups. The earliest qualifying fact and all results observed for that exact identity are returned. Missing conditions are not classified as unknown. Active condition dimensions require ongoing cohort and cohort_token, an exact returned active_conditions identity selected by contract_version and decision_code/rule_id/rule_version and condition_id/condition_description/condition_result. Outcome and kind/path/state/blocker/owner selectors are rejected. They use latest explicit decision snapshots in the current contract, return evidence age at the bound evaluation time and measure whole-workflow elapsed or blocked duration. Metadata-only reports preserve evidence; explicit condition omission clears prior results. The optional condition_evidence_status selector restricts active contributors to within_budget, overdue or no_budget. Status counters partition each returned group and the chosen status must have contributors. Budgets come from the reporting Operation pinned definition; deadlines measure report age, not business verification age. The condition_refresh_owner dimension requires ongoing cohort and cohort_token and an exact returned active_conditions.refresh_owners group selected by exactly one of owner or unassigned=true. It rejects contract/state/blocker/condition/result/status and decision/path/outcome selectors. Contributors are ranked by whole-workflow blocked duration and include bounded overdue condition facts with pinned refresh guidance; counts remain exact beyond the preview limit. The condition_refresh_age and condition_refresh_blocked dimensions require ongoing cohort and cohort_token and reject all group selectors. Each returns eligible workflows with at least one overdue selected condition once, across all refresh owners. The former ranks by oldest overdue report age in whole seconds, the latter by full workflow blocked duration; stable workflow identity breaks ties. These overall rankings remain available with zero contributors and are independent of condition and owner display caps. Each contributor includes refresh_priority with the oldest qualifying fact, complete assigned owner list, exact unassigned count and explanation, plus the bounded condition preview. Age ranking does not mean most past deadline or highest business severity. Conflicting snapshots and incomplete histories are excluded. The condition_missing_owner dimension requires ongoing cohort and cohort_token and an exact returned condition_coverage.missing_groups row selected by contract_version, current state and exactly one of owner or unassigned=true. All condition/result/status, decision/path/outcome and blocker selectors are rejected. Counts and eligibility use full condition coverage before previews. Each workflow appears once in its selected group and ranks by full observed workflow blocked duration with stable identity ties. Missing evidence has no report timestamp and is not failed verification; expectations come from the latest reporting Operation pinned definition. Missing condition entries and pinned guidance are previewed up to 16 with exact counts and explicit truncation. The condition_gap_owner dimension requires ongoing cohort, cohort_token and baseline_token bound to the same scope. The baseline must not be later than the current token evaluation. Select an exact returned new_missing_progress.groups row with contract_version, current state, gap_status and exactly one of owner or unassigned=true. All other selectors are rejected; dimensions outside condition_gap_owner and condition_gap_queue reject baseline_token and gap_status. Counts and grouping precede previews; each contributor includes up to 16 matching gap_progress changes with exact counts, prior evidence and pinned guidance. Current report comparisons permit contract boundaries while baseline history must be continuous within its contract; ranking uses full observed report-only blocked intervals without changing eligibility for existing duration groups. Generic duration coverage remains separate from new_missing_progress coverage. The condition_gap_queue dimension requires ongoing cohort and both cohort_token and baseline_token with the same comparison scope and baseline time rules. It returns each eligible workflow once, independent of displayed group caps. Optional gap_status and exactly one of owner or unassigned=true filter matching current gaps; both may be omitted. Contract/state/blocker/condition/decision/path/outcome selectors are rejected. Empty results are valid. Each contributor includes gap_queue_priority with all category counts, sorted assigned owners, exact unassigned count, all pinned missing expectation guidance and a ranking explanation before filters or previews. gap_progress counts and previews contain only filtered gaps. Ranking measures observed report-only blocked intervals, omitting intervals spanning contract boundaries, with stable workflow identity ties.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneScope"
          },
          {
            "name": "workflow",
            "in": "query",
            "required": true,
            "description": "Declared business workflow to investigate.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 63,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneTenantID"
          },
          {
            "name": "cohort",
            "in": "query",
            "description": "Completed or ongoing cohort.",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "completed",
                "ongoing"
              ]
            }
          },
          {
            "name": "dimension",
            "in": "query",
            "description": "Overall measure or exact breakdown dimension.",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "state_time",
                "blocked_time",
                "verification_wait",
                "state",
                "blocker",
                "verification_owner",
                "decision_completion",
                "decision_blocked",
                "condition_completion",
                "condition_blocked",
                "active_condition_elapsed",
                "active_condition_blocked",
                "condition_refresh_owner",
                "condition_refresh_age",
                "condition_refresh_blocked",
                "condition_missing_owner",
                "condition_gap_owner",
                "condition_gap_queue"
              ]
            }
          },
          {
            "name": "baseline_token",
            "in": "query",
            "description": "Saved account performance baseline; required for condition_gap_owner and condition_gap_queue; rejected by other dimensions.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "gap_status",
            "in": "query",
            "description": "Exact account returned reporting-gap category; required for condition_gap_owner, optional for condition_gap_queue.",
            "schema": {
              "type": "string",
              "enum": [
                "report_lost",
                "new_expectation",
                "still_missing",
                "expectation_changed",
                "contract_changed"
              ]
            }
          },
          {
            "name": "contract_version",
            "in": "query",
            "description": "Required for state and blocker dimensions.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000
            }
          },
          {
            "name": "state",
            "in": "query",
            "description": "Exact contributing state. Required for the state dimension.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "operation",
            "in": "query",
            "description": "Exact blocker target Operation. Required for the blocker dimension.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "code",
            "in": "query",
            "description": "Exact blocker code. Required for the blocker dimension.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "owner",
            "in": "query",
            "description": "Exact public owner. Mutually exclusive with unassigned.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "name": "unassigned",
            "in": "query",
            "description": "Select the empty owner group. Mutually exclusive with owner.",
            "schema": {
              "type": "boolean",
              "enum": [
                true
              ]
            }
          },
          {
            "name": "cohort_token",
            "in": "query",
            "description": "Opaque selector-bound cohort token from the summary or a previous contributor response.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "kind",
            "in": "query",
            "description": "Decision outcome group kind.",
            "schema": {
              "type": "string",
              "enum": [
                "decision",
                "path"
              ]
            }
          },
          {
            "name": "decision_code",
            "in": "query",
            "description": "Exact reported decision code for decision outcome dimensions.",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "rule_id",
            "in": "query",
            "description": "Exact rule ID for decision outcome dimensions.",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "rule_version",
            "in": "query",
            "description": "Exact rule version for decision outcome dimensions.",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "name": "group_id",
            "in": "query",
            "description": "Exact selected prerequisite group for path outcome dimensions.",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "path_id",
            "in": "query",
            "description": "Exact selected path for path outcome dimensions.",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "condition_id",
            "in": "query",
            "description": "Exact reported condition ID for account condition outcome dimensions.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          },
          {
            "name": "condition_description",
            "in": "query",
            "description": "Exact public condition description for the account returned condition group; UTF-8 byte bound without controls.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            }
          },
          {
            "name": "condition_evidence_status",
            "in": "query",
            "required": false,
            "description": "Account active-condition report freshness filter. Only ongoing active condition dimensions accept it; the selected status must have contributors in the returned group.",
            "schema": {
              "type": "string",
              "enum": [
                "within_budget",
                "overdue",
                "no_budget"
              ]
            }
          },
          {
            "name": "condition_result",
            "in": "query",
            "description": "Exact observed condition result for the account condition outcome group.",
            "schema": {
              "type": "string",
              "enum": [
                "pass",
                "fail",
                "unknown"
              ]
            }
          },
          {
            "name": "outcome_code",
            "in": "query",
            "description": "Exact latest reported outcome for decision outcome dimensions.",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ranked complete-history contributors and exact selected group distribution.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowPerformanceInstancesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The retained cohort changed. Refresh the summary and use its new cohort_token.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflow-performance/instances": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "listPlatformTenantSelfWorkflowPerformanceInstances",
        "summary": "List ranked performance contributors for the authenticated customer.",
        "description": "Requires platform_tenant:operations:read. Customer identity comes from credentials; tenant overrides are rejected. Explicit app/environment/workflow and cohort/dimension selection are required. Uses the same latest 100 instances per cohort and complete-history eligibility as the performance summary. State groups require state and contract_version; blocker groups require operation/code/contract_version and exactly one of owner or unassigned=true; verification_owner groups require exactly one of owner or unassigned=true. Overall dimensions reject group selectors. An optional cohort_token binds the evaluation time and retained evidence to a prior summary; changed or expired cohorts return 409 and require refreshing the summary. Without a token this evaluates a fresh cohort. Returns every matching eligible contributor up to 100 sorted by observed duration descending with stable identity ties. No cursor is supported. Current blockers can differ from historical contributing groups; pending verification previews are bounded independently of exact counts. Decision dimensions require completed cohort and cohort_token, an exact kind/contract_version/outcome_code and decision_code/rule_id/rule_version for decision groups. Path groups additionally require group_id/path_id; the decision triple is either fully supplied or fully omitted. The exact group must be present in the bounded decision_outcomes summary. Decision dimensions reject state/blocker/owner selectors. Returns the earliest qualifying report and optional business decision fact per contributor; reports after the first terminal revision do not qualify. Condition dimensions also require completed cohort and cohort_token and an exact returned condition_outcomes group selected by contract_version and decision_code/rule_id/rule_version and condition_id/condition_description/condition_result and outcome_code. They reject kind/path/state/blocker/owner selectors. Each workflow contributes once per observed result; changed results can produce overlapping groups. The earliest qualifying fact and all results observed for that exact identity are returned. Missing conditions are not classified as unknown. Active condition dimensions require ongoing cohort and cohort_token, an exact returned active_conditions identity selected by contract_version and decision_code/rule_id/rule_version and condition_id/condition_description/condition_result. Outcome and kind/path/state/blocker/owner selectors are rejected. They use latest explicit decision snapshots in the current contract, return evidence age at the bound evaluation time and measure whole-workflow elapsed or blocked duration. Metadata-only reports preserve evidence; explicit condition omission clears prior results. The optional condition_evidence_status selector restricts active contributors to within_budget, overdue or no_budget. Status counters partition each returned group and the chosen status must have contributors. Budgets come from the reporting Operation pinned definition; deadlines measure report age, not business verification age. The condition_refresh_owner dimension requires ongoing cohort and cohort_token and an exact returned active_conditions.refresh_owners group selected by exactly one of owner or unassigned=true. It rejects contract/state/blocker/condition/result/status and decision/path/outcome selectors. Contributors are ranked by whole-workflow blocked duration and include bounded overdue condition facts with pinned refresh guidance; counts remain exact beyond the preview limit. The condition_refresh_age and condition_refresh_blocked dimensions require ongoing cohort and cohort_token and reject all group selectors. Each returns eligible workflows with at least one overdue selected condition once, across all refresh owners. The former ranks by oldest overdue report age in whole seconds, the latter by full workflow blocked duration; stable workflow identity breaks ties. These overall rankings remain available with zero contributors and are independent of condition and owner display caps. Each contributor includes refresh_priority with the oldest qualifying fact, complete assigned owner list, exact unassigned count and explanation, plus the bounded condition preview. Age ranking does not mean most past deadline or highest business severity. Conflicting snapshots and incomplete histories are excluded. The condition_missing_owner dimension requires ongoing cohort and cohort_token and an exact returned condition_coverage.missing_groups row selected by contract_version, current state and exactly one of owner or unassigned=true. All condition/result/status, decision/path/outcome and blocker selectors are rejected. Counts and eligibility use full condition coverage before previews. Each workflow appears once in its selected group and ranks by full observed workflow blocked duration with stable identity ties. Missing evidence has no report timestamp and is not failed verification; expectations come from the latest reporting Operation pinned definition. Missing condition entries and pinned guidance are previewed up to 16 with exact counts and explicit truncation. The condition_gap_owner dimension requires ongoing cohort, cohort_token and baseline_token bound to the same scope. The baseline must not be later than the current token evaluation. Select an exact returned new_missing_progress.groups row with contract_version, current state, gap_status and exactly one of owner or unassigned=true. All other selectors are rejected; dimensions outside condition_gap_owner and condition_gap_queue reject baseline_token and gap_status. Counts and grouping precede previews; each contributor includes up to 16 matching gap_progress changes with exact counts, prior evidence and pinned guidance. Current report comparisons permit contract boundaries while baseline history must be continuous within its contract; ranking uses full observed report-only blocked intervals without changing eligibility for existing duration groups. Generic duration coverage remains separate from new_missing_progress coverage. The condition_gap_queue dimension requires ongoing cohort and both cohort_token and baseline_token with the same comparison scope and baseline time rules. It returns each eligible workflow once, independent of displayed group caps. Optional gap_status and exactly one of owner or unassigned=true filter matching current gaps; both may be omitted. Contract/state/blocker/condition/decision/path/outcome selectors are rejected. Empty results are valid. Each contributor includes gap_queue_priority with all category counts, sorted assigned owners, exact unassigned count, all pinned missing expectation guidance and a ranking explanation before filters or previews. gap_progress counts and previews contain only filtered gaps. Ranking measures observed report-only blocked intervals, omitting intervals spanning contract boundaries, with stable workflow identity ties.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationMilestoneAppID"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneScope"
          },
          {
            "name": "workflow",
            "in": "query",
            "required": true,
            "description": "Declared workflow to investigate for the authenticated customer.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 63,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "cohort",
            "in": "query",
            "description": "Completed or ongoing customer workflow cohort.",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "completed",
                "ongoing"
              ]
            }
          },
          {
            "name": "dimension",
            "in": "query",
            "description": "Customer cohort duration measure or exact breakdown dimension.",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "state_time",
                "blocked_time",
                "verification_wait",
                "state",
                "blocker",
                "verification_owner",
                "decision_completion",
                "decision_blocked",
                "condition_completion",
                "condition_blocked",
                "active_condition_elapsed",
                "active_condition_blocked",
                "condition_refresh_owner",
                "condition_refresh_age",
                "condition_refresh_blocked",
                "condition_missing_owner",
                "condition_gap_owner",
                "condition_gap_queue"
              ]
            }
          },
          {
            "name": "baseline_token",
            "in": "query",
            "description": "Saved authenticated customer performance baseline; required for condition_gap_owner and condition_gap_queue; rejected by other dimensions.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "gap_status",
            "in": "query",
            "description": "Exact authenticated customer returned reporting-gap category; required for condition_gap_owner, optional for condition_gap_queue.",
            "schema": {
              "type": "string",
              "enum": [
                "report_lost",
                "new_expectation",
                "still_missing",
                "expectation_changed",
                "contract_changed"
              ]
            }
          },
          {
            "name": "contract_version",
            "in": "query",
            "description": "Contract version required when selecting a customer state or blocker group.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000
            }
          },
          {
            "name": "state",
            "in": "query",
            "description": "Contributing state in the customer's state dimension.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "operation",
            "in": "query",
            "description": "Blocker target Operation in the authenticated customer's blocker dimension.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "code",
            "in": "query",
            "description": "Blocker code selecting the customer's exact blocker group.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "owner",
            "in": "query",
            "description": "Public owner of the customer's selected group; mutually exclusive with unassigned.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "name": "unassigned",
            "in": "query",
            "description": "Select an empty-owner customer group; mutually exclusive with owner.",
            "schema": {
              "type": "boolean",
              "enum": [
                true
              ]
            }
          },
          {
            "name": "cohort_token",
            "in": "query",
            "description": "Customer selector-bound cohort token from a prior summary or contributor response.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "kind",
            "in": "query",
            "description": "Decision outcome group kind. Scoped to the authenticated customer.",
            "schema": {
              "type": "string",
              "enum": [
                "decision",
                "path"
              ]
            }
          },
          {
            "name": "decision_code",
            "in": "query",
            "description": "Exact reported decision code for decision outcome dimensions. Scoped to the authenticated customer.",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "rule_id",
            "in": "query",
            "description": "Exact rule ID for decision outcome dimensions. Scoped to the authenticated customer.",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "rule_version",
            "in": "query",
            "description": "Exact rule version for decision outcome dimensions. Scoped to the authenticated customer.",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "name": "group_id",
            "in": "query",
            "description": "Exact selected prerequisite group for path outcome dimensions. Scoped to the authenticated customer.",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "path_id",
            "in": "query",
            "description": "Exact selected path for path outcome dimensions. Scoped to the authenticated customer.",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "condition_id",
            "in": "query",
            "description": "Exact reported condition ID for customer condition outcome dimensions.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          },
          {
            "name": "condition_description",
            "in": "query",
            "description": "Exact public condition description for the customer returned condition group; UTF-8 byte bound without controls.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            }
          },
          {
            "name": "condition_evidence_status",
            "in": "query",
            "required": false,
            "description": "Customer active-condition report freshness filter. Only ongoing active condition dimensions accept it; the selected status must have contributors in the returned group.",
            "schema": {
              "type": "string",
              "enum": [
                "within_budget",
                "overdue",
                "no_budget"
              ]
            }
          },
          {
            "name": "condition_result",
            "in": "query",
            "description": "Exact observed condition result for the customer condition outcome group.",
            "schema": {
              "type": "string",
              "enum": [
                "pass",
                "fail",
                "unknown"
              ]
            }
          },
          {
            "name": "outcome_code",
            "in": "query",
            "description": "Exact latest reported outcome for decision outcome dimensions. Scoped to the authenticated customer.",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ranked complete-history contributors within the authenticated customer's selected group.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowPerformanceInstancesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The customer's retained cohort changed; refresh its performance summary for a new cohort_token.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflow-performance/summary": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "summarizeAccountWorkflowPerformance",
        "summary": "Summarize business workflow performance across retained instances.",
        "description": "Requires account read scope and MFA. Optional customer selection stays within account ownership. Explicit app/environment/workflow selection is required. The latest 100 completed and 100 ongoing retained instances form separate cohorts. Matching counts include all retained instances. Incomplete histories are excluded from durations and nearest-rank p50/p95 percentiles with explicit coverage reasons. Each instance contributes one accumulated duration per reported group. At most 1024 reports per instance and 32 output groups per dimension; group truncation does not change cohort totals. Ongoing durations run through evaluation time. No cursor or time-window filter is supported. Retention and newly published reports can change results.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneScope"
          },
          {
            "name": "workflow",
            "in": "query",
            "required": true,
            "description": "Declared workflow name to compare across instances.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 63,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneTenantID"
          },
          {
            "name": "baseline_token",
            "in": "query",
            "required": false,
            "description": "Account optional saved performance token anchoring refresh progress by evaluation time and exact query scope. Changed evidence is expected; the old fingerprint is not validated. Progress reconstructs visible reports in current completed and ongoing samples, not original cohort membership. Future or malformed tokens and scope mismatches are rejected.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Separate completed and ongoing cohorts with coverage and ranked durations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowPerformanceSummary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflow-performance/summary": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "summarizePlatformTenantSelfWorkflowPerformance",
        "summary": "Summarize retained business workflow performance for the authenticated customer.",
        "description": "Customer identity comes from credentials and tenant overrides are rejected. Requires platform_tenant:operations:read. Explicit app/environment/workflow selection is required. The latest 100 completed and 100 ongoing retained instances form separate cohorts. Matching counts include all retained instances. Incomplete histories are excluded from durations and nearest-rank p50/p95 percentiles with explicit coverage reasons. Each instance contributes one accumulated duration per reported group. At most 1024 reports per instance and 32 output groups per dimension; group truncation does not change cohort totals. Ongoing durations run through evaluation time. No cursor or time-window filter is supported. Retention and newly published reports can change results.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationMilestoneAppID"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneScope"
          },
          {
            "name": "workflow",
            "in": "query",
            "required": true,
            "description": "Business workflow to compare within the authenticated customer app and environment.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 63,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "baseline_token",
            "in": "query",
            "required": false,
            "description": "Customer optional saved performance token anchoring refresh progress by evaluation time and exact query scope. Changed evidence is expected; the old fingerprint is not validated. Progress reconstructs visible reports in current completed and ongoing samples, not original cohort membership. Future or malformed tokens and scope mismatches are rejected.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Authenticated customer performance cohorts with observed durations and retained-history coverage.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowPerformanceSummary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflow-outcomes/summary": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "summarizeAccountWorkflowOutcomes",
        "summary": "Summarize completed workflows with explicit business outcomes.",
        "description": "Account outcome summary — Requires account read scope and MFA. Optional tenant selection remains within account ownership. Explicit app and environment are required. Only latest retained terminal snapshots with reported outcomes are included; each instance counts once. Reopened instances leave these totals. Earlier outcomes remain in retained workflow history. Terminal state alone does not imply an outcome. Totals cover all matching instances independently of group pagination; cursors are separate from the attention queue. Reports and retention may change during browsing.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneScope"
          },
          {
            "name": "workflow",
            "description": "For the account outcome summary, restrict results to this declared workflow name.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 63,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "code",
            "description": "For the account outcome summary, restrict terminal results to this explicit business outcome code.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneTenantID"
          },
          {
            "name": "group_by",
            "description": "For the account outcome summary, dimension used to aggregate matching workflow instances.",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "outcome",
              "enum": [
                "outcome",
                "workflow",
                "customer"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneLimit"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneCursor"
          }
        ],
        "responses": {
          "200": {
            "description": "All matching workflow count and a bounded group page ordered by value ascending.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowOutcomeSummary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflow-outcomes": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "listPlatformTenantSelfWorkflowOutcomes",
        "summary": "Customer outcome queue — List completed workflows with explicit business outcomes.",
        "description": "Requires platform_tenant:operations:read. Customer identity comes from credentials; tenant overrides are rejected. Explicit app and environment are required. Only latest retained terminal snapshots with reported outcomes are included; each instance counts once. Reopened instances leave these totals. Earlier outcomes remain in retained workflow history. Terminal state alone does not imply an outcome. Totals cover all matching instances independently of group pagination; cursors are separate from the attention queue. Reports and retention may change during browsing.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationMilestoneAppID"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneScope"
          },
          {
            "name": "workflow",
            "description": "For the customer outcome queue, restrict results to this declared workflow name.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 63,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "code",
            "description": "For the customer outcome queue, restrict terminal results to this explicit business outcome code.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneLimit"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneCursor"
          }
        ],
        "responses": {
          "200": {
            "description": "Customer outcome queue — A bounded page ordered by latest report publication time descending.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowOutcomesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflow-outcomes/summary": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "summarizePlatformTenantSelfWorkflowOutcomes",
        "summary": "Customer outcome summary — Summarize completed workflows with explicit business outcomes.",
        "description": "Customer outcome summary — Requires platform_tenant:operations:read. Customer identity comes from credentials; tenant overrides are rejected. Explicit app and environment are required. Only latest retained terminal snapshots with reported outcomes are included; each instance counts once. Reopened instances leave these totals. Earlier outcomes remain in retained workflow history. Terminal state alone does not imply an outcome. Totals cover all matching instances independently of group pagination; cursors are separate from the attention queue. Reports and retention may change during browsing.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationMilestoneAppID"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneScope"
          },
          {
            "name": "workflow",
            "description": "For the customer outcome summary, restrict results to this declared workflow name.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 63,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "code",
            "description": "For the customer outcome summary, restrict terminal results to this explicit business outcome code.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "group_by",
            "description": "For the customer outcome summary, dimension used to aggregate matching workflow instances.",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "outcome",
              "enum": [
                "outcome",
                "workflow"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneLimit"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneCursor"
          }
        ],
        "responses": {
          "200": {
            "description": "Customer outcome summary — All matching workflow count and a bounded group page ordered by value ascending.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowOutcomeSummary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflow-actions/preview": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "previewAccountWorkflowActions",
        "summary": "Preview business workflow actions",
        "description": "Read-only candidates from the retained current state, evaluated with an empty evidence plan. Does not execute, authorize, reserve, or mutate an action. At most 100 actions; optional operation filter. Application must recheck locked rows and readiness before writing.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/OperationWorkflowActionPreviewRequest"
                  },
                  {
                    "required": [
                      "tenant_id"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Observed transition readiness including reasons and advisories.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowActionPreviewResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflow-actions/preview": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "previewPlatformTenantSelfWorkflowActions",
        "summary": "Customer action preview — Preview business workflow actions",
        "description": "Customer action preview — Read-only candidates from the retained current state, evaluated with an empty evidence plan. Does not execute, authorize, reserve, or mutate an action. At most 100 actions; optional operation filter. Application must recheck locked rows and readiness before writing.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/OperationWorkflowActionPreviewRequest"
                  },
                  {
                    "required": [
                      "app_id"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Customer action preview — Observed transition readiness including reasons and advisories.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowActionPreviewResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflow-readiness": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "checkAccountWorkflowReadiness",
        "summary": "Check reported requirements for a proposed workflow transition.",
        "description": "Requires account read scope and MFA. tenant_id is mandatory and app_id must be omitted; the path selects the owned application. Evaluates a proposed declared edge against retained state, target-specific blockers, direct prerequisites and planned milestone names. Ready is observational and grants no execution authority. Planned names are not committed evidence; transaction-time business checks and report validation still apply. A denied readiness result is a successful HTTP 200 response.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/OperationWorkflowReadinessRequest"
                  },
                  {
                    "required": [
                      "tenant_id"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Account transition readiness — Observed transition readiness including reasons and advisories.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowReadinessResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflow-readiness/compare": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "compareAccountWorkflowReadiness",
        "summary": "Compare account transition readiness with a saved queue snapshot.",
        "description": "Requires account read scope and MFA; customer selectors stay within account ownership.\nThis read-only comparison accepts a caller-held snapshot emitted by the queue.\nSnapshot scope binds the account, app, environment, customer selector and role.\nBaseline data is advisory and is not authenticated historical evidence or execution authority.\nAt most 100 saved transitions are accepted in a body of at most 1048576 bytes.\nEach distinct saved workflow is reread once with readiness-only projections,\nindependent of recent queue sampling and current owner or requirement filters.\nThe exact Operation/from/to edge and declared requirements must remain comparable.\nContract changes, terminal or unavailable state, unavailable edges and older retained\nrevisions are counted separately and never classified as newly ready or newly blocked.\nComparisons provide added and resolved requirement codes plus changed blocker,\nprerequisite, pending-verification and reporting evidence categories.\nAge counters alone are excluded from evidence fingerprints; freshness expiry can change readiness.\nChange filters and the row limit apply after comparison; counts cover all saved transitions.\nThe returned snapshot includes available current edges before filtering and can be saved\nas the next baseline. It omits unavailable edges. Reads are live and not atomic.\nEmpty snapshots are valid. Snapshot rows are limited to previously returned queue rows,\nnot the complete sampled backlog. Applications retain authorization and execution.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationWorkflowReadinessComparisonRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Account readiness changes and comparison coverage over saved transitions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowReadinessComparisonResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflow-readiness": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "checkPlatformTenantSelfWorkflowReadiness",
        "summary": "Customer transition readiness — Check reported requirements for a proposed workflow transition.",
        "description": "Requires platform-tenant operations read scope. app_id is mandatory and tenant_id must be omitted; ownership comes from the authenticated customer. Evaluates a proposed declared edge against retained state, target-specific blockers, direct prerequisites and planned milestone names. Ready is observational and grants no execution authority. Planned names are not committed evidence; transaction-time business checks and report validation still apply. A denied readiness result is a successful HTTP 200 response.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/OperationWorkflowReadinessRequest"
                  },
                  {
                    "required": [
                      "app_id"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Customer transition readiness — Observed transition readiness including reasons and advisories.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowReadinessResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflow-readiness/compare": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "comparePlatformTenantSelfWorkflowReadiness",
        "summary": "Compare customer transition readiness with a saved queue snapshot.",
        "description": "Requires platform-tenant Operations read scope; ownership comes from authentication and overrides are rejected.\nThis read-only comparison accepts a caller-held snapshot emitted by the queue.\nSnapshot scope binds the account, app, environment, customer selector and role.\nBaseline data is advisory and is not authenticated historical evidence or execution authority.\nAt most 100 saved transitions are accepted in a body of at most 1048576 bytes.\nEach distinct saved workflow is reread once with readiness-only projections,\nindependent of recent queue sampling and current owner or requirement filters.\nThe exact Operation/from/to edge and declared requirements must remain comparable.\nContract changes, terminal or unavailable state, unavailable edges and older retained\nrevisions are counted separately and never classified as newly ready or newly blocked.\nComparisons provide added and resolved requirement codes plus changed blocker,\nprerequisite, pending-verification and reporting evidence categories.\nAge counters alone are excluded from evidence fingerprints; freshness expiry can change readiness.\nChange filters and the row limit apply after comparison; counts cover all saved transitions.\nThe returned snapshot includes available current edges before filtering and can be saved\nas the next baseline. It omits unavailable edges. Reads are live and not atomic.\nEmpty snapshots are valid. Snapshot rows are limited to previously returned queue rows,\nnot the complete sampled backlog. Applications retain authorization and execution.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/OperationWorkflowReadinessComparisonRequest"
                  },
                  {
                    "required": [
                      "app_id"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Customer readiness changes and comparison coverage over saved transitions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowReadinessComparisonResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflow-attention": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "listAccountWorkflowAttention",
        "summary": "List retained blocked, stale, overdue, or dependency-waiting business workflow instances.",
        "description": "Requires account read scope and MFA. Optional tenant selection remains within account ownership. Explicit app and environment selectors are required. Staleness and overdue deadlines are evaluated at the first page time carried by the cursor; current reports and retention can change during browsing. Unknown/unreported state is not enumerated. Target Operations match reported blockers or applicable selected-contract edges on stale or overdue workflows. The queue grants no execution authority.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneScope"
          },
          {
            "name": "workflow",
            "description": "For the account attention queue, restrict results to this declared workflow name.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 63,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "target_operation",
            "description": "For the account attention queue, restrict attention to blockers targeting this Operation name.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "dependency_status",
            "in": "query",
            "description": "Filter unresolved direct prerequisites by status. Both dependency filters must match the same reference.",
            "schema": {
              "type": "string",
              "enum": [
                "waiting",
                "unknown",
                "outcome_mismatch"
              ]
            }
          },
          {
            "name": "required_outcome_code",
            "description": "For the account attention queue, restrict unresolved prerequisites to this required business outcome code.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "priority",
            "in": "query",
            "description": "Exact effective blocker priority matched with owner and other blocker filters. Omitted blocker priority counts as normal.",
            "schema": {
              "type": "string",
              "enum": [
                "low",
                "normal",
                "high",
                "urgent"
              ]
            }
          },
          {
            "name": "sort",
            "in": "query",
            "description": "Queue ordering. Deadline sorts earliest business deadline first with undated workflows last. Summary groups remain in group-value order.",
            "schema": {
              "type": "string",
              "enum": [
                "updated_at",
                "deadline"
              ],
              "default": "updated_at"
            }
          },
          {
            "name": "owner",
            "in": "query",
            "description": "Exact case-sensitive public application-assigned blocker owner, limited to 128 UTF-8 bytes without control characters. Mutually exclusive with unassigned=true; owner, blocker code, and target filters must match the same blocker.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "name": "unassigned",
            "in": "query",
            "description": "Select workflows with a matching blocker whose owner is empty or absent. Mutually exclusive with owner. Explicit values must be true or false.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "blocker_code",
            "description": "For the account attention queue, restrict attention to this application-reported blocker code.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "reason",
            "description": "For the account attention queue, select the attention reason to include in the queue.",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "blocked",
                "stale",
                "overdue",
                "dependency",
                "escalated",
                "unacknowledged",
                "follow_up_overdue",
                "awaiting_verification",
                "sla_breached",
                "sla_at_risk"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneTenantID"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneLimit"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneCursor"
          }
        ],
        "responses": {
          "200": {
            "description": "One bounded page ordered by latest report publication time descending.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowAttentionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflow-readiness/queue": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "listAccountWorkflowReadinessQueue",
        "summary": "List account transition readiness across ongoing business workflows.",
        "description": "Requires account read scope and MFA. Optional customer selection stays within account ownership. Explicit app and environment required. Samples the 100 most recently updated retained ongoing workflows, ordered by update time then stable identity descending. Evaluates up to 100 sorted current-state transitions per workflow with no planned evidence. Target Operation filters before edge sampling; owner and requirement filters apply after evaluation but before row limit. Owner means an application-assigned blocker owner or pending verification owner for the target Operation; all retained pending obligations are considered before preview limits. Unassigned means one such finding has no owner. Reporting advisories never satisfy the requirement filter or change readiness. Unmet rows precede ready rows, preserving workflow sample order and Operation/from/to edge order. Sampling and row truncation are reported separately; counts cover evaluated transitions, not an account-wide backlog. Reads are live and not an atomic snapshot; changed workflow identities are excluded. No execution authority is granted. Unknown or terminal state is not enumerated. Duplicate, empty, and unsupported query parameters are rejected.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneScope"
          },
          {
            "name": "workflow",
            "description": "Account readiness queue. Optional declared workflow name within the app and environment.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 63,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "target_operation",
            "description": "Account readiness queue. Select declared transitions targeting this Operation name before edge sampling.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "owner",
            "in": "query",
            "description": "Account readiness queue. Exact case-sensitive blocker or pending verification owner for the transition Operation. Maximum 128 UTF-8 bytes without controls. Mutually exclusive with unassigned=true.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "name": "unassigned",
            "in": "query",
            "description": "Account readiness queue. Select transitions with an unassigned blocker or pending verification obligation. Mutually exclusive with owner. Explicit values must be true or false.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "tenant_id",
            "in": "query",
            "description": "Account readiness queue. Optional customer UUID within the authenticated account.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "requirement",
            "in": "query",
            "description": "Account readiness queue. Select an unmet declared readiness requirement. Reporting advisories are excluded.",
            "schema": {
              "type": "string",
              "enum": [
                "state_unknown",
                "terminal",
                "transition_undeclared",
                "from_state_mismatch",
                "revision_mismatch",
                "contract_version_mismatch",
                "application_blocked",
                "dependency_unmet",
                "milestone_required",
                "policy_evidence_required",
                "dependency_required",
                "invariant_evidence_required",
                "effect_evidence_required",
                "retained_milestone_required",
                "retained_milestone_invalidated",
                "retained_milestone_expired",
                "retained_milestone_group_unmet",
                "path_selection_invalid"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Account readiness queue. Maximum matching transitions returned after filtering. No cursor is issued for this live sample.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Account transition readiness rows with explicit live sampling counts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowReadinessQueueResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflow-attention/summary": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "summarizeAccountWorkflowAttention",
        "summary": "Summarize all matching retained workflow attention.",
        "description": "Requires account read scope and MFA. Optional tenant selection remains within account ownership. Explicit app and environment selectors are required. Staleness and overdue deadlines are evaluated at the first page time carried by the cursor; current reports and retention can change during browsing. Unknown/unreported state is not enumerated. Target Operations match reported blockers or applicable selected-contract edges on stale or overdue workflows. Totals cover all matching retained snapshots regardless of group pagination. Groups may overlap and should not be added together. Blocker statistics within code and target groups cover that code or target only. Ages derive from application-reported first_observed_at; missing ages are counted separately. Group cursors are separate from queue cursors. The summary grants no execution authority.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneScope"
          },
          {
            "name": "group_by",
            "description": "For the account attention summary, dimension used to aggregate matching workflow instances.",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "workflow",
              "enum": [
                "owner",
                "workflow",
                "blocker_code",
                "target_operation",
                "customer",
                "dependency_status",
                "required_outcome_code"
              ]
            }
          },
          {
            "name": "workflow",
            "description": "For the account attention summary, restrict results to this declared workflow name.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 63,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "target_operation",
            "description": "For the account attention summary, restrict attention to blockers targeting this Operation name.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "dependency_status",
            "in": "query",
            "description": "Account attention summary — Filter unresolved direct prerequisites by status. Both dependency filters must match the same reference.",
            "schema": {
              "type": "string",
              "enum": [
                "waiting",
                "unknown",
                "outcome_mismatch"
              ]
            }
          },
          {
            "name": "required_outcome_code",
            "description": "For the account attention summary, restrict unresolved prerequisites to this required business outcome code.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "priority",
            "in": "query",
            "description": "Account attention summary. Exact effective blocker priority matched with owner and other blocker filters. Omitted blocker priority counts as normal.",
            "schema": {
              "type": "string",
              "enum": [
                "low",
                "normal",
                "high",
                "urgent"
              ]
            }
          },
          {
            "name": "sort",
            "in": "query",
            "description": "Account attention summary. Queue ordering. Deadline sorts earliest business deadline first with undated workflows last. Summary groups remain in group-value order.",
            "schema": {
              "type": "string",
              "enum": [
                "updated_at",
                "deadline"
              ],
              "default": "updated_at"
            }
          },
          {
            "name": "owner",
            "in": "query",
            "description": "Account attention summary. Exact case-sensitive public application-assigned blocker owner, limited to 128 UTF-8 bytes without control characters. Mutually exclusive with unassigned=true; owner, blocker code, and target filters must match the same blocker.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "name": "unassigned",
            "in": "query",
            "description": "Account attention summary. Select workflows with a matching blocker whose owner is empty or absent. Mutually exclusive with owner. Explicit values must be true or false.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "blocker_code",
            "description": "For the account attention summary, restrict attention to this application-reported blocker code.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "reason",
            "description": "For the account attention summary, select the attention reason to include in the queue.",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "blocked",
                "stale",
                "overdue",
                "dependency",
                "escalated",
                "unacknowledged",
                "follow_up_overdue",
                "awaiting_verification",
                "sla_breached",
                "sla_at_risk"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneTenantID"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneLimit"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneCursor"
          }
        ],
        "responses": {
          "200": {
            "description": "Totals over all matching workflows and one bounded page of groups ordered by value ascending.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowAttentionSummary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflow-attention": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "listPlatformTenantSelfWorkflowAttention",
        "summary": "Customer attention queue — List retained blocked, stale, overdue, or dependency-waiting business workflow instances.",
        "description": "Requires platform_tenant:operations:read. Customer identity comes only from credentials; tenant overrides are rejected. Explicit app and environment selectors are required. Staleness and overdue deadlines are evaluated at the first page time carried by the cursor; current reports and retention can change during browsing. Unknown/unreported state is not enumerated. Target Operations match reported blockers or applicable selected-contract edges on stale or overdue workflows. The queue grants no execution authority.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationMilestoneAppID"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneScope"
          },
          {
            "name": "workflow",
            "description": "For the customer attention queue, restrict results to this declared workflow name.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 63,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "target_operation",
            "description": "For the customer attention queue, restrict attention to blockers targeting this Operation name.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "dependency_status",
            "in": "query",
            "description": "Customer attention queue — Filter unresolved direct prerequisites by status. Both dependency filters must match the same reference.",
            "schema": {
              "type": "string",
              "enum": [
                "waiting",
                "unknown",
                "outcome_mismatch"
              ]
            }
          },
          {
            "name": "required_outcome_code",
            "description": "For the customer attention queue, restrict unresolved prerequisites to this required business outcome code.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "priority",
            "in": "query",
            "description": "Customer attention queue. Exact effective blocker priority matched with owner and other blocker filters. Omitted blocker priority counts as normal.",
            "schema": {
              "type": "string",
              "enum": [
                "low",
                "normal",
                "high",
                "urgent"
              ]
            }
          },
          {
            "name": "sort",
            "in": "query",
            "description": "Customer attention queue. Queue ordering. Deadline sorts earliest business deadline first with undated workflows last. Summary groups remain in group-value order.",
            "schema": {
              "type": "string",
              "enum": [
                "updated_at",
                "deadline"
              ],
              "default": "updated_at"
            }
          },
          {
            "name": "owner",
            "in": "query",
            "description": "Customer attention queue. Exact case-sensitive public application-assigned blocker owner, limited to 128 UTF-8 bytes without control characters. Mutually exclusive with unassigned=true; owner, blocker code, and target filters must match the same blocker.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "name": "unassigned",
            "in": "query",
            "description": "Customer attention queue. Select workflows with a matching blocker whose owner is empty or absent. Mutually exclusive with owner. Explicit values must be true or false.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "blocker_code",
            "description": "For the customer attention queue, restrict attention to this application-reported blocker code.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "reason",
            "description": "For the customer attention queue, select the attention reason to include in the queue.",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "blocked",
                "stale",
                "overdue",
                "dependency",
                "escalated",
                "unacknowledged",
                "follow_up_overdue",
                "awaiting_verification",
                "sla_breached",
                "sla_at_risk"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneLimit"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneCursor"
          }
        ],
        "responses": {
          "200": {
            "description": "Customer attention queue — One bounded page ordered by latest report publication time descending.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowAttentionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflow-readiness/queue": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "listPlatformTenantSelfWorkflowReadinessQueue",
        "summary": "List customer transition readiness across ongoing business workflows.",
        "description": "Requires platform-tenant operations read scope. Customer ownership derives from authentication. Explicit app and environment required. Samples the 100 most recently updated retained ongoing workflows, ordered by update time then stable identity descending. Evaluates up to 100 sorted current-state transitions per workflow with no planned evidence. Target Operation filters before edge sampling; owner and requirement filters apply after evaluation but before row limit. Owner means an application-assigned blocker owner or pending verification owner for the target Operation; all retained pending obligations are considered before preview limits. Unassigned means one such finding has no owner. Reporting advisories never satisfy the requirement filter or change readiness. Unmet rows precede ready rows, preserving workflow sample order and Operation/from/to edge order. Sampling and row truncation are reported separately; counts cover evaluated transitions, not an account-wide backlog. Reads are live and not an atomic snapshot; changed workflow identities are excluded. No execution authority is granted. Unknown or terminal state is not enumerated. Duplicate, empty, and unsupported query parameters are rejected.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationMilestoneScope"
          },
          {
            "name": "workflow",
            "description": "Customer readiness queue. Optional declared workflow name within the app and environment.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 63,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "target_operation",
            "description": "Customer readiness queue. Select declared transitions targeting this Operation name before edge sampling.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "owner",
            "in": "query",
            "description": "Customer readiness queue. Exact case-sensitive blocker or pending verification owner for the transition Operation. Maximum 128 UTF-8 bytes without controls. Mutually exclusive with unassigned=true.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "name": "unassigned",
            "in": "query",
            "description": "Customer readiness queue. Select transitions with an unassigned blocker or pending verification obligation. Mutually exclusive with owner. Explicit values must be true or false.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "app_id",
            "in": "query",
            "required": true,
            "description": "Customer readiness queue. Explicit application UUID within the authenticated account.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "requirement",
            "in": "query",
            "description": "Customer readiness queue. Select an unmet declared readiness requirement. Reporting advisories are excluded.",
            "schema": {
              "type": "string",
              "enum": [
                "state_unknown",
                "terminal",
                "transition_undeclared",
                "from_state_mismatch",
                "revision_mismatch",
                "contract_version_mismatch",
                "application_blocked",
                "dependency_unmet",
                "milestone_required",
                "policy_evidence_required",
                "dependency_required",
                "invariant_evidence_required",
                "effect_evidence_required",
                "retained_milestone_required",
                "retained_milestone_invalidated",
                "retained_milestone_expired",
                "retained_milestone_group_unmet",
                "path_selection_invalid"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Customer readiness queue. Maximum matching transitions returned after filtering. No cursor is issued for this live sample.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Customer transition readiness rows with explicit live sampling counts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowReadinessQueueResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflow-attention/summary": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "summarizePlatformTenantSelfWorkflowAttention",
        "summary": "Customer attention summary — Summarize all matching retained workflow attention.",
        "description": "Requires platform_tenant:operations:read. Customer identity comes only from credentials; tenant overrides are rejected. Explicit app and environment selectors are required. Staleness and overdue deadlines are evaluated at the first page time carried by the cursor; current reports and retention can change during browsing. Unknown/unreported state is not enumerated. Target Operations match reported blockers or applicable selected-contract edges on stale or overdue workflows. Totals cover all matching retained snapshots regardless of group pagination. Groups may overlap and should not be added together. Blocker statistics within code and target groups cover that code or target only. Ages derive from application-reported first_observed_at; missing ages are counted separately. Group cursors are separate from queue cursors. The summary grants no execution authority.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationMilestoneAppID"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneScope"
          },
          {
            "name": "group_by",
            "description": "For the customer attention summary, dimension used to aggregate matching workflow instances.",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "workflow",
              "enum": [
                "owner",
                "workflow",
                "blocker_code",
                "target_operation",
                "dependency_status",
                "required_outcome_code"
              ]
            }
          },
          {
            "name": "workflow",
            "description": "For the customer attention summary, restrict results to this declared workflow name.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 63,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "target_operation",
            "description": "For the customer attention summary, restrict attention to blockers targeting this Operation name.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "dependency_status",
            "in": "query",
            "description": "Customer attention summary — Filter unresolved direct prerequisites by status. Both dependency filters must match the same reference.",
            "schema": {
              "type": "string",
              "enum": [
                "waiting",
                "unknown",
                "outcome_mismatch"
              ]
            }
          },
          {
            "name": "required_outcome_code",
            "description": "For the customer attention summary, restrict unresolved prerequisites to this required business outcome code.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "priority",
            "in": "query",
            "description": "Customer attention summary. Exact effective blocker priority matched with owner and other blocker filters. Omitted blocker priority counts as normal.",
            "schema": {
              "type": "string",
              "enum": [
                "low",
                "normal",
                "high",
                "urgent"
              ]
            }
          },
          {
            "name": "sort",
            "in": "query",
            "description": "Customer attention summary. Queue ordering. Deadline sorts earliest business deadline first with undated workflows last. Summary groups remain in group-value order.",
            "schema": {
              "type": "string",
              "enum": [
                "updated_at",
                "deadline"
              ],
              "default": "updated_at"
            }
          },
          {
            "name": "owner",
            "in": "query",
            "description": "Customer attention summary. Exact case-sensitive public application-assigned blocker owner, limited to 128 UTF-8 bytes without control characters. Mutually exclusive with unassigned=true; owner, blocker code, and target filters must match the same blocker.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "name": "unassigned",
            "in": "query",
            "description": "Customer attention summary. Select workflows with a matching blocker whose owner is empty or absent. Mutually exclusive with owner. Explicit values must be true or false.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "blocker_code",
            "description": "For the customer attention summary, restrict attention to this application-reported blocker code.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          {
            "name": "reason",
            "description": "For the customer attention summary, select the attention reason to include in the queue.",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "blocked",
                "stale",
                "overdue",
                "dependency",
                "escalated",
                "unacknowledged",
                "follow_up_overdue",
                "awaiting_verification",
                "sla_breached",
                "sla_at_risk"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneLimit"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneCursor"
          }
        ],
        "responses": {
          "200": {
            "description": "Customer attention summary — Totals over all matching workflows and one bounded page of groups ordered by value ascending.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowAttentionSummary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/operation-milestones": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "listAccountBusinessMilestones",
        "summary": "Read a business entity timeline across related Operations.",
        "description": "Requires account read scope and MFA. Explicit app/environment/reference selectors and optional customer selection remain within account ownership. Paired workflow and workflow-instance selectors narrow the feed to one run and include a grouped workflow_instance view with ordered declared steps, latest matching facts, current state, and independently paginated transition history. Facts are ordered by first platform publication time, not inferred business causality.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneScope"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneSubjectType"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneSubjectID"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneWorkflow"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneWorkflowInstanceID"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneTenantID"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneLimit"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneCursor"
          },
          {
            "$ref": "#/components/parameters/OperationWorkflowStateCursor"
          },
          {
            "$ref": "#/components/parameters/OperationWorkflowStaleOnly"
          }
        ],
        "responses": {
          "200": {
            "description": "Account environment business-reference milestone feed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationMilestonesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/customer-operation-milestones": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "listPlatformTenantSelfBusinessMilestones",
        "summary": "Read a business entity timeline for the authenticated customer.",
        "description": "Requires platform_tenant:operations:read. Identity comes only from credentials. The app, environment, and paired public reference select related retained work. Paired workflow and workflow-instance selectors narrow the feed to one run and include a grouped workflow_instance view with ordered declared steps, latest matching facts, current state, and independently paginated transition history. Opaque pagination binds all selectors; other customers with the same entity ID remain isolated.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationMilestoneAppID"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneScope"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneSubjectType"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneSubjectID"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneWorkflow"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneWorkflowInstanceID"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneLimit"
          },
          {
            "$ref": "#/components/parameters/OperationMilestoneCursor"
          },
          {
            "$ref": "#/components/parameters/OperationWorkflowStateCursor"
          },
          {
            "$ref": "#/components/parameters/OperationWorkflowStaleOnly"
          }
        ],
        "responses": {
          "200": {
            "description": "Authenticated customer business-reference milestone feed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationMilestonesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/runtime/operations/{id}/milestones": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "reportOperationMilestone",
        "summary": "Publish a committed public business milestone.",
        "description": "Requires a current workload assertion and invocation attempt/capability. Validates the pinned schema, then deduplicates by logical Operation and milestone ID across recovery. Identical retries return the original fact; changed identity content conflicts. Publication never changes business completion or delivery state.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "$ref": "#/components/parameters/OperationXFaasInvocationId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationAttempt"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationCapability"
          }
        ],
        "security": [
          {
            "operationsWorkloadIdentity": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationMilestoneRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Committed business fact published or its original acknowledgement replayed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationMilestone"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/runtime/operations/{id}/milestones/validate": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "validateOperationMilestones",
        "summary": "Validate public milestones before the application transaction commits.",
        "description": "Requires the active workload and invocation claim. This bounded, read-only check validates pinned declarations, payload schemas, duplicate identity and remaining milestone capacity. Failure allows the SDK to roll back business writes; success does not publish or reserve capacity.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "$ref": "#/components/parameters/OperationXFaasInvocationId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationAttempt"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationCapability"
          }
        ],
        "security": [
          {
            "operationsWorkloadIdentity": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationMilestoneValidationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Submitted milestone contracts validated under the current execution claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationMilestoneValidationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/runtime/operations/{id}/workflow-states": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "reportOperationWorkflowState",
        "summary": "Publish an app-reported business workflow state.",
        "description": "Requires the current workload and invocation claim. The state name and contract version must match the pinned workflow definition. A transition's referenced milestones must already be retained for the same Operation.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "$ref": "#/components/parameters/OperationXFaasInvocationId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationAttempt"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationCapability"
          }
        ],
        "security": [
          {
            "operationsWorkloadIdentity": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationWorkflowStateReport"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "State update accepted idempotently, even when a newer revision is already current.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowStateReportResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/runtime/operations/{id}/workflow-states/validate": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "validateOperationWorkflowStates",
        "summary": "Validate app-reported workflow states before transaction commit.",
        "description": "Requires the active workload and invocation claim. Validates the workflow contract version, transition edge, required milestone evidence and transaction-assigned revisions before commit. Evidence IDs must refer to facts in the same submitted transaction batch. This does not publish facts or reserve capacity. Maximum request size is 131072 bytes.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "$ref": "#/components/parameters/OperationXFaasInvocationId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationAttempt"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationCapability"
          }
        ],
        "security": [
          {
            "operationsWorkloadIdentity": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationWorkflowStateValidationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "All candidate state updates passed validation under the current execution claim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowStateValidationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/runtime/operations/{id}/progress": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "reportOperationProgress",
        "summary": "Report progress from the current workload attempt.",
        "description": "Requires a fresh platform-issued workload JWT with audience gregale:operations and matching account, app and instance, plus current dispatch proof. Stale attempts, expired leases and customer credentials are denied. report_id retries are idempotent; changed report contents conflict. Stages must match the pinned definition.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "$ref": "#/components/parameters/OperationXFaasInvocationId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationAttempt"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationCapability"
          }
        ],
        "security": [
          {
            "operationsWorkloadIdentity": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationReportRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated projection after accepting or replaying the fenced report.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/runtime/operations/{id}/artifacts": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "attachOperationArtifact",
        "summary": "Attach verified managed-object result bytes.",
        "description": "Requires workload JWT and current dispatch proof as for progress. The object must be in a ready, private, account/app/environment-owned managed bucket. Exact size and SHA-256 are verified before the attachment and durable event commit. Repeated report_id with the same declaration is idempotent. A verified copy is retained under a private platform key; subsequent source mutation or deletion does not change the retained result.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "$ref": "#/components/parameters/OperationXFaasInvocationId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationAttempt"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationCapability"
          }
        ],
        "security": [
          {
            "operationsWorkloadIdentity": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationArtifactRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated projection containing the verified managed-object reference.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/runtime/job-operations/{id}/control": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "getJobOperationExecutionControl",
        "summary": "Observe the current single-task Job Operation lease.",
        "description": "Observe cancellation, the current lease and the fixed deadline using the scheduler-injected native task proof. Reads grant no renewal, result publication or retry authority. Account credentials and other runtime proof kinds cannot substitute. Admission remains closed pending native qualification.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationJobRunId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationJobInstanceId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationGeneration"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationAttempt"
          }
        ],
        "security": [
          {
            "jobOperationCapability": []
          }
        ],
        "responses": {
          "200": {
            "description": "Current task control observation, with no-store caching.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationJobControlResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/runtime/job-operations/{id}/progress": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "reportJobOperationProgress",
        "summary": "Report progress for the current single-task Job Operation lease.",
        "description": "Report bounded stage progress for the current native task. Stable report IDs are immutable within this generation and share the result and file namespace. The scheduler capability, run, instance, generation and attempt must match an active claim. Reporting never completes or retries a task.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationJobRunId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationJobInstanceId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationGeneration"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationAttempt"
          }
        ],
        "security": [
          {
            "jobOperationCapability": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationJobReportRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation snapshot after a durable progress report.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/runtime/job-operations/{id}/result": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "prepareJobOperationResult",
        "summary": "Report result for the current single-task Job Operation lease.",
        "description": "Prepare schema-validated typed output for the current leased Job task. A stable result report is immutable and grants no business success until host-confirmed task exit. Uncertain exit requires reconciliation. Progress and private file reports share its ID namespace.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationJobRunId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationJobInstanceId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationGeneration"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationAttempt"
          }
        ],
        "security": [
          {
            "jobOperationCapability": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationJobReportRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation snapshot with its typed result privately prepared.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/runtime/job-operations/{id}/artifacts": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "prepareJobOperationArtifact",
        "summary": "Verify and retain a private file for the current Job Operation task.",
        "description": "Requires the scheduler-injected task capability and matching run, instance, generation, attempt, unexpired lease and active owner. Stable report IDs share the progress/result namespace. Changed declarations conflict. Preparation verifies source ownership, private scope, size and SHA-256 and retains a private platform copy. Same-generation replay does not reread the source. Files remain private until host-confirmed success with a typed result or explicit account success recovery. Safe retry clears file receipts. Admission remains closed pending native qualification.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationJobRunId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationJobInstanceId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationGeneration"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationAttempt"
          }
        ],
        "security": [
          {
            "jobOperationCapability": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationArtifactRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified private managed-source file preparation receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationJobArtifactResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/runtime/job-operations/{id}/artifact-receipts": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "reuseJobOperationArtifact",
        "summary": "Look up a verified file receipt for the current Job Operation task.",
        "description": "Look up an existing verified managed-source file receipt with the live native task proof. Matching metadata returns the retained copy without reading or modifying the source. Changed declarations conflict. This lookup grants neither publication nor business retry authority.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationJobRunId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationJobInstanceId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationGeneration"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationAttempt"
          }
        ],
        "security": [
          {
            "jobOperationCapability": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationArtifactRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Existing managed-source receipt availability and metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationJobArtifactResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/runtime/operations/{id}/artifact-uploads": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "uploadOperationArtifact",
        "summary": "Upload direct private file bytes with current HTTP invocation authority.",
        "description": "Stable report ID, name, exact size and SHA-256 bind a private upload receipt to the current HTTP invocation attempt. Requires a workload JWT for gregale:operations plus current invocation, attempt and capability. No bucket, source URI, provider credential or storage key is accepted. Bytes are verified under existing artifact quotas and transfer budgets. Each copy reserves fresh staging storage; concurrent copies converge and losing objects are cleaned up. Receipt lookup and committed replay do not repeat business code. New attachments are fenced by cancellation and live dispatch authority. Files download only after confirmed HTTP success or existing explicit success recovery; retaining bytes never settles the invocation.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "$ref": "#/components/parameters/OperationXFaasInvocationId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationCapability"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationAttempt"
          },
          {
            "name": "report_id",
            "description": "Stable immutable report identity within the current HTTP invocation attempt.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "name": "name",
            "description": "Filename for the private HTTP result, without path separators.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "name": "size_bytes",
            "description": "Declared HTTP result byte count within captured file quotas.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "sha256",
            "description": "HTTP file checksum as lowercase hexadecimal with a sha256: prefix.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^sha256:[0-9a-f]{64}$"
            }
          }
        ],
        "security": [
          {
            "operationsWorkloadIdentity": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified HTTP file receipt; the invocation remains unsettled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationArtifactUploadResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/runtime/operations/{id}/artifact-upload-receipts": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "reuseOperationUpload",
        "summary": "Look up a private HTTP file receipt without sending bytes.",
        "description": "Requires a current HTTP workload assertion and matching invocation proof. Checks the immutable declaration and live invocation attempt without reserving storage or reading bytes. Available false is returned only after authorization with no matching verified receipt. Matching committed receipts can be replayed after cancellation while the claim remains live; new files cannot be attached.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "$ref": "#/components/parameters/OperationXFaasInvocationId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationCapability"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationAttempt"
          }
        ],
        "security": [
          {
            "operationsWorkloadIdentity": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationArtifactUploadRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "HTTP receipt availability and private metadata without a byte transfer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationArtifactUploadResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/runtime/job-operations/{id}/artifact-uploads": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "uploadJobOperationArtifact",
        "summary": "Upload direct private file bytes with current native Job authority.",
        "description": "Stable report ID, name, exact size and SHA-256 bind a private upload receipt. Requires the current scheduler task proof and active owner. No source URI, bucket, provider credential or storage key is accepted. Exact bytes are verified under existing artifact quotas and bounded transfer budgets. A fresh staging object is reserved for each copy; concurrent copies converge and losing objects are cleaned up. Committed replay can return without reading the body. Files publish only with confirmed task success and typed output or explicit account success recovery. Production admission remains closed pending native qualification.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationJobRunId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationJobInstanceId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationGeneration"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationAttempt"
          },
          {
            "name": "report_id",
            "description": "Stable immutable report identity within the native generation.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "name": "name",
            "description": "Customer-visible filename without path separators.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "name": "size_bytes",
            "description": "Exact number of uploaded bytes under captured operation limits.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "sha256",
            "description": "Lowercase SHA-256 digest prefixed with sha256: for byte verification.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^sha256:[0-9a-f]{64}$"
            }
          }
        ],
        "security": [
          {
            "jobOperationCapability": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Direct upload receipt for verified private bytes; preparation is not business success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationJobArtifactResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/runtime/job-operations/{id}/artifact-upload-receipts": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "reuseJobOperationUpload",
        "summary": "Look up a direct private file upload receipt without sending bytes.",
        "description": "Requires the current native Job proof. Checks the immutable declaration and current task authority, including generation and ownership. Available false is returned only after successful authorization with no matching retained copy. Committed replay never reads a source object or repeats a business handler.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationJobRunId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationJobInstanceId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationGeneration"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationAttempt"
          }
        ],
        "security": [
          {
            "jobOperationCapability": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationArtifactUploadRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Direct upload receipt lookup without receiving or writing bytes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationJobArtifactResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/runtime/workflow-operations/{id}/artifact-uploads": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "uploadWorkflowOperationArtifact",
        "summary": "Upload direct private result bytes with current final workflow action authority.",
        "description": "Requires a current Operations workload assertion and native final-action proof for the pinned workflow run, step, generation and attempt. The descriptor declares immutable report ID, filename, byte count and SHA-256 without a source URI or storage credential. Each copy reserves unique staging storage and verifies exact bytes under existing quotas and transfer budgets. Current native owner, cancellation, lease and deadline are rechecked before private I/O and commit. Receipt identity remains stable across approved resumes; copies stay private until confirmed final-step success or explicit success recovery. Retention never settles a step or retries business effects.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationAttempt"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationExecutionKind"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationWorkflowRunId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationWorkflowStep"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationGeneration"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationWorkflowCapability"
          },
          {
            "name": "report_id",
            "description": "Immutable final-action file report identity across approved workflow resumes.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "name": "name",
            "description": "Workflow result filename containing no path separators.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "name": "size_bytes",
            "description": "Exact final-action upload size subject to retained workflow file quotas.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "sha256",
            "description": "Workflow upload digest encoded as sha256: and lowercase hexadecimal.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^sha256:[0-9a-f]{64}$"
            }
          }
        ],
        "security": [
          {
            "operationsWorkloadIdentity": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Retained private workflow upload receipt awaiting final-action confirmation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowArtifactResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/runtime/workflow-operations/{id}/artifact-upload-receipts": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "reuseWorkflowOperationUpload",
        "summary": "Reuse a direct workflow file receipt without transferring bytes.",
        "description": "Checks a direct file declaration under current native final-step authority. Matching retained receipts are rebound to an approved resumed attempt without reserving storage, consuming reports or transferring bytes. A missing receipt returns available false only after authorization and quota validation. Conflicts, cancellation and stale proofs fail closed. Lookup does not confirm the workflow action or grant recovery authority.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationAttempt"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationExecutionKind"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationWorkflowRunId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationWorkflowStep"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationGeneration"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationWorkflowCapability"
          }
        ],
        "security": [
          {
            "operationsWorkloadIdentity": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationArtifactUploadRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Direct workflow receipt availability with any current-attempt rebind applied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowArtifactResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/runtime/workflow-operations/{id}/control": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "getWorkflowOperationExecutionControl",
        "summary": "Observe cancellation and time bounds for a native workflow attempt.",
        "description": "Requires a fresh Operations workload assertion and current native run, step, recovery generation, attempt and capability proof on the pinned deployment. Available to every linear HTTP action of a workflow Operation. The fixed deadline is current attempt started_at plus the captured step timeout (30 seconds when omitted). The usable budget ends at the earlier native lease or deadline. Reads never renew leases, consume reports or authorize retries. Cancellation atomically interrupts native authority; a denied control read also stops the cooperating handler. Existing verified copies remain retained under normal recovery policy. Available while new admission is closed.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationAttempt"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationExecutionKind"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationWorkflowRunId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationWorkflowStep"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationGeneration"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationWorkflowCapability"
          }
        ],
        "security": [
          {
            "operationsWorkloadIdentity": []
          }
        ],
        "responses": {
          "200": {
            "description": "Read-only current native attempt observation. Cache-Control is no-store.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowControlResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/runtime/workflow-operations/{id}/artifact-receipts": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "reuseWorkflowOperationArtifact",
        "summary": "Check or reuse a verified workflow result copy.",
        "description": "Requires workload identity and a current final-step proof. An explicit available=false authorizes a new upload. A matching durable receipt is rebound to the current attempt without rereading or rewriting the source. Invalid or expired proofs fail; they never return available=false.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationAttempt"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationExecutionKind"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationWorkflowRunId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationWorkflowStep"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationGeneration"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationWorkflowCapability"
          }
        ],
        "security": [
          {
            "operationsWorkloadIdentity": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationArtifactRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Current verified-copy availability for this declaration and attempt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowArtifactResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/runtime/workflow-operations/{id}/artifacts": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "prepareWorkflowOperationArtifact",
        "summary": "Prepare a private workflow result copy.",
        "description": "Verifies an owned private managed object and retains its exact bytes under a platform key. The durable receipt survives a lost response and an approved operation resume. Files are published only after confirmed final-step success, or explicit operator success reconciliation; preparing a file does not complete the operation.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationAttempt"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationExecutionKind"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationWorkflowRunId"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationWorkflowStep"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationGeneration"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleOperationWorkflowCapability"
          }
        ],
        "security": [
          {
            "operationsWorkloadIdentity": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationArtifactRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Prepared verified-copy receipt, pending final-step confirmation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowArtifactResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/invocations/{id}": {
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "getPlatformTenantSelfInvocation",
        "summary": "Read this tenant's invocation status and result.",
        "description": "Requires a tenant-bound token with platform_tenant:invocations:read. Returns this customer's status and guest result without original request headers, payload or owner metadata. Foreign, unbound and missing invocations return the same 404.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Invocation whose status and result are requested.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current status and result for the authenticated customer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantInvocationResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/platform-tenant-self/invocations/{id}/cancel": {
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "cancelPlatformTenantSelfInvocation",
        "summary": "Cancel this tenant's pending or dispatching invocation.",
        "description": "Requires a tenant-bound token with platform_tenant:invocations:manage. Cancels this customer's pending or dispatching invocation; repeated cancellation is safe. An already running request may finish and its side effects cannot be undone. Foreign, unbound and missing invocations return the same 404.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Invocation to cancel for the authenticated customer.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Invocation state after the cancellation request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantInvocationResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/platform-tenant-self/invocations/{id}/replay": {
      "post": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "replayPlatformTenantSelfInvocation",
        "summary": "Replay this tenant's failed or dead-lettered invocation.",
        "description": "Requires a tenant-bound token with platform_tenant:invocations:manage.\nOnly this customer's failed or dead-lettered unbound unkeyed work is\neligible. Preserves the original customer, request, deployment scope,\nretry policy and trusted parent/root lineage. Each parent has one durable\nchild shared with account-operator replay. Repeated and concurrent\nrequests return it regardless of Idempotency-Key, including after\ncompletion; further recovery targets the failed child. A pruned child\nreturns 409 invocation_replay_unavailable. Foreign, unbound and missing\ninvocations return the same 404. Current app ownership is always checked.\n",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Original failed or dead-lettered invocation to replay.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional transport key; parent identity deduplicates across keys and account-operator requests.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Durable replay acceptance with a tenant-self status URL.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AsyncInvokeResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/platform-tenant-self/usage": {
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "getPlatformTenantSelfUsage",
        "summary": "Read this tenant's own cross-app raw usage.",
        "description": "Requires a tenant-bound access token with platform_tenant:usage:read. The credential cannot select or impersonate a different tenant.",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "description": "Inclusive UTC-day boundary for the requested tenant usage.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "until",
            "in": "query",
            "description": "Exclusive UTC-day boundary; buckets before this instant are included. Defaults to the next UTC midnight, so today is included.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "This tenant's usage over the requested bounded window.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantUsageResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/v1/platform-tenant-self/usage-statements": {
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "listPlatformTenantSelfStatements",
        "summary": "List this tenant's finalized cross-app usage statements.",
        "description": "Requires a tenant-bound access token with platform_tenant:statements:read. Drafts and superseded revisions are never exposed. Statements overlapping the requested window are returned newest period and revision first.",
        "parameters": [
          {
            "name": "period_start",
            "in": "query",
            "required": true,
            "description": "Inclusive UTC-minute start of the lookup window; the range may be at most 90 days.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "period_end",
            "in": "query",
            "required": true,
            "description": "Exclusive UTC-minute end of the lookup window.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum statements in this page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Zero-based offset for the next page; use next_offset from the previous response.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000000,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One bounded page of finalized statements.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantSelfStatementListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          }
        }
      }
    },
    "/v1/platform-tenant-self/usage-statements/{statement_id}": {
      "parameters": [
        {
          "name": "statement_id",
          "in": "path",
          "required": true,
          "description": "Finalized immutable statement revision belonging to this token's tenant.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "platform-tenants"
        ],
        "operationId": "getPlatformTenantSelfStatement",
        "summary": "Read one of this tenant's finalized statement revisions.",
        "description": "Draft, superseded, and other tenants' statements all appear as not found.",
        "responses": {
          "200": {
            "description": "Finalized statement snapshot.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTenantStatementResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/consumers": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "consumers"
        ],
        "operationId": "listAPIConsumers",
        "summary": "List stable API consumer identities for an app.",
        "responses": {
          "200": {
            "description": "Consumer identities (never includes credentials).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "tags": [
          "consumers"
        ],
        "operationId": "createAPIConsumer",
        "summary": "Register a stable API consumer identity.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAPIConsumerRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created consumer identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/apps/{slug}/tcp-listeners": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listAppTCPListeners",
        "summary": "List an app's raw TCP listeners.",
        "description": "Lists stable public TCP endpoints owned by the app. Each listener\nforwards its public port to the declared guest port; disabled\nlisteners fail closed at the edge while retaining their public port.\n",
        "responses": {
          "200": {
            "description": "The app's TCP listeners.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TCPListenerResponse"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "createAppTCPListener",
        "summary": "Expose one app port over raw TCP.",
        "description": "Creates a TCP listener. Passthrough is enabled immediately; TLS\ntermination starts disabled and requires a verified app-owned domain\nand an explicitly provisioned edge certificate before enabling.\n`public_port` is optional; when it\nis omitted Gregale allocates a free port from the reserved\n40000–49999 range. Public ports remain stable across instance wake,\nmigration, and redeployments. `name` and `guest_port` must match an\nexplicitly declared TCP listener in the app manifest. Unnamed\ndeclarations use the deterministic name `tcp-<guest_port>`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTCPListenerRequest"
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "201": {
            "description": "The created TCP listener.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TCPListenerResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/tcp-listeners/{name}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "Listener name within the app.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,30}$"
          }
        }
      ],
      "patch": {
        "tags": [
          "apps"
        ],
        "operationId": "updateAppTCPListener",
        "summary": "Change serving state or TLS policy of an app TCP listener.",
        "description": "Supply exactly one of enabled or tls. TLS policy changes atomically disable the endpoint and cancel existing sessions; provision the selected certificate policy before explicitly re-enabling. Disabling retains the stable public port.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateTCPListenerRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated TCP listener.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TCPListenerResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "apps"
        ],
        "operationId": "deleteAppTCPListener",
        "summary": "Delete an app TCP listener.",
        "responses": {
          "204": {
            "description": "No body. The listener was removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/tcp-listeners/{name}/tls-status": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "TCP endpoint whose observed certificates are requested.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,30}$"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "appTCPListenerTLSStatus",
        "summary": "Read observed edge certificate status for a TCP listener.",
        "description": "Returns customer-safe certificate evidence for each observed edge.\nMissing evidence, evidence at least sixty seconds old, and changed or\ndisabled TLS intent have unknown status. This does not establish fleet\ncoverage, client trust, public routing or guest availability.\n",
        "responses": {
          "200": {
            "description": "Certificate evidence from observed edges only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TCPListenerTLSStatusResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Certificate observation storage is unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/udp-listeners": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listAppUDPListeners",
        "summary": "List an app's public UDP listeners.",
        "responses": {
          "200": {
            "description": "Stable app-owned datagram endpoints.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/UDPListenerResponse"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "createAppUDPListener",
        "summary": "Reserve an app-owned public UDP endpoint.",
        "description": "Requires a matching declared UDP workload port. New endpoints start disabled and require an explicit enable request plus the operator's source-CIDR rollout.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateUDPListenerRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The reserved disabled UDP endpoint.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UDPListenerResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/udp-listeners/{name}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "UDP workload listener selected for mutation.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,30}$"
          }
        }
      ],
      "patch": {
        "tags": [
          "apps"
        ],
        "operationId": "updateAppUDPListener",
        "summary": "Enable or disable a public UDP listener.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateUDPListenerRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The UDP endpoint's updated serving state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UDPListenerResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "apps"
        ],
        "operationId": "deleteAppUDPListener",
        "summary": "Delete a public UDP listener.",
        "responses": {
          "204": {
            "description": "The datagram endpoint was removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/consumers/{consumer_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "consumer_id",
          "in": "path",
          "required": true,
          "description": "Target API consumer identity UUID.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "consumers"
        ],
        "operationId": "getAPIConsumer",
        "summary": "Fetch one API consumer identity.",
        "responses": {
          "200": {
            "description": "The consumer identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "tags": [
          "consumers"
        ],
        "operationId": "revokeAPIConsumer",
        "summary": "Revoke an API consumer identity.",
        "responses": {
          "200": {
            "description": "The revoked consumer identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/consumers/{consumer_id}/usage": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "consumer_id",
          "in": "path",
          "required": true,
          "description": "Consumer identity whose durable minute usage is returned.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "since",
          "in": "query",
          "required": false,
          "description": "RFC3339 lower bound. Defaults to the trailing 30 days.",
          "schema": {
            "type": "string",
            "format": "date-time"
          }
        },
        {
          "name": "until",
          "in": "query",
          "required": false,
          "description": "RFC3339 exclusive upper bound, snapped to UTC midnight. Defaults to the next UTC midnight, so today is included.",
          "schema": {
            "type": "string",
            "format": "date-time"
          }
        }
      ],
      "get": {
        "tags": [
          "consumers"
        ],
        "operationId": "getAPIConsumerUsage",
        "summary": "Read durable minute usage for one API consumer.",
        "description": "Returns idempotent request, error, and billable-unit counters for the\nselected stable consumer. The ledger is independent from sampled\nrequest telemetry. Anonymous traffic is retained separately and is\nnot charged to this consumer identity.\n",
        "responses": {
          "200": {
            "description": "Durable API consumer usage over the requested window.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerUsageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/consumers/{consumer_id}/usage/quote": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "consumer_id",
          "in": "path",
          "required": true,
          "description": "Consumer identity whose priced usage is returned.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "since",
          "in": "query",
          "required": false,
          "description": "Optional RFC3339 lower bound for the quote period; defaults to the trailing 30 days.",
          "schema": {
            "type": "string",
            "format": "date-time"
          }
        },
        {
          "name": "until",
          "in": "query",
          "required": false,
          "description": "Optional RFC3339 exclusive upper bound for the quote period; defaults to the next UTC midnight, so today is included.",
          "schema": {
            "type": "string",
            "format": "date-time"
          }
        }
      ],
      "get": {
        "tags": [
          "consumers"
        ],
        "operationId": "getAPIConsumerUsageQuote",
        "summary": "Quote one API consumer's priced usage.",
        "description": "Applies the app's immutable, versioned request rate cards to durable\nconsumer usage. The result is a deterministic estimate, not an invoice\nor a payment authorization. Usage before the first effective rate card\nis returned as unpriced_units rather than silently treated as free.\n",
        "responses": {
          "200": {
            "description": "Deterministic usage quote over the requested window.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerUsageQuoteResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/consumers/{consumer_id}/usage-completeness": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "consumer_id",
          "in": "path",
          "required": true,
          "description": "Consumer identity whose billed usage is checked.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "since",
          "in": "query",
          "required": true,
          "description": "RFC3339 start of the period to check, usually a statement's period_start.",
          "schema": {
            "type": "string",
            "format": "date-time"
          }
        },
        {
          "name": "until",
          "in": "query",
          "required": true,
          "description": "RFC3339 exclusive end of the period to check; at most 90 days after since.",
          "schema": {
            "type": "string",
            "format": "date-time"
          }
        }
      ],
      "get": {
        "tags": [
          "consumers"
        ],
        "operationId": "getAPIConsumerUsageCompleteness",
        "summary": "Check one API consumer's billed usage against request telemetry.",
        "description": "Compares successful requests in the billing ledger with successful\nrequests in request telemetry, hour by hour, so usage the ledger\nnever received is visible before a statement is invoiced. Only whole\nUTC hours that have settled (10 minutes) and that telemetry still\nretains (14 days) are checked. Telemetry is sampled, so it proves a\nlower bound of missing usage but cannot prove completeness of every\nrequest. Read-only; nothing is stored.\n",
        "responses": {
          "200": {
            "description": "Completeness of billed usage over the checked hours.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerUsageCompletenessResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/consumers/{consumer_id}/usage-statements": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "consumer_id",
          "in": "path",
          "required": true,
          "description": "Consumer identity whose durable usage statements are returned.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "consumers"
        ],
        "operationId": "listAPIConsumerUsageStatements",
        "summary": "List durable API consumer usage statements.",
        "description": "Returns immutable quote snapshots newest period first.",
        "responses": {
          "200": {
            "description": "Durable usage statements for the consumer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerUsageStatementListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "tags": [
          "consumers"
        ],
        "operationId": "createAPIConsumerUsageStatement",
        "summary": "Snapshot an API consumer usage quote or create a late-usage adjustment.",
        "description": "Creates an immutable, auditable statement revision for the explicit UTC-minute period. An unchanged draft replays. If usage or effective prices changed, the open draft becomes superseded and a new draft revision is created. After finalization, new units create the next revision containing only those units; no new units replay the latest revision. Finalized revisions are never rewritten.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAPIConsumerUsageStatementRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The latest existing revision; the period has no new usage or the draft is unchanged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerUsageStatementResponse"
                }
              }
            }
          },
          "201": {
            "description": "The newly created statement revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerUsageStatementResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/apps/{slug}/consumers/{consumer_id}/usage-statements/{statement_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "consumer_id",
          "in": "path",
          "required": true,
          "description": "Consumer identity whose statement is being read.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "statement_id",
          "in": "path",
          "required": true,
          "description": "Durable usage statement UUID.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "consumers"
        ],
        "operationId": "getAPIConsumerUsageStatement",
        "summary": "Fetch one durable API consumer usage statement.",
        "responses": {
          "200": {
            "description": "The immutable usage statement snapshot.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerUsageStatementResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/consumers/{consumer_id}/usage-statements/{statement_id}/finalize": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "consumer_id",
          "in": "path",
          "required": true,
          "description": "Consumer identity owning the statement.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "statement_id",
          "in": "path",
          "required": true,
          "description": "Durable usage statement UUID to finalize.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "consumers"
        ],
        "operationId": "finalizeAPIConsumerUsageStatement",
        "summary": "Finalize a fully priced API consumer usage statement.",
        "description": "Records the payable lifecycle transition; repeated calls are idempotent. A new transition emits a durable, signed usage_statement.finalized app webhook when a matching subscription exists.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "The finalized usage statement.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerUsageStatementResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/apps/{slug}/consumers/{consumer_id}/usage-statements/{statement_id}/handoff": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "consumer_id",
          "in": "path",
          "required": true,
          "description": "Consumer identity whose billing handoff is being recorded.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "statement_id",
          "in": "path",
          "required": true,
          "description": "Durable usage statement UUID to hand off.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "consumers"
        ],
        "operationId": "getAPIConsumerUsageStatementHandoff",
        "summary": "Fetch a customer billing handoff receipt.",
        "description": "Returns the immutable external invoice reference recorded for a finalized usage statement.",
        "responses": {
          "200": {
            "description": "The immutable billing handoff receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerUsageStatementHandoffResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "tags": [
          "consumers"
        ],
        "operationId": "claimAPIConsumerUsageStatement",
        "summary": "Record a customer billing handoff for a finalized statement.",
        "description": "Claims a finalized usage statement for the customer's own billing system. Repeating the same claim returns the original receipt; a statement or external invoice ID cannot be claimed twice.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ClaimAPIConsumerUsageStatementRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The existing billing handoff receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerUsageStatementHandoffResponse"
                }
              }
            }
          },
          "201": {
            "description": "The newly recorded billing handoff receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerUsageStatementHandoffResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/apps/{slug}/consumers/{consumer_id}/usage-statements/{statement_id}/invoice": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "consumer_id",
          "in": "path",
          "required": true,
          "description": "Consumer whose statement is exported.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "statement_id",
          "in": "path",
          "required": true,
          "description": "Finalized statement revision to export.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "consumers"
        ],
        "operationId": "getAPIConsumerUsageStatementInvoice",
        "summary": "Read the app consumer statement's invoice export.",
        "responses": {
          "200": {
            "description": "The app consumer statement's export.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatementInvoiceExportResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "tags": [
          "consumers"
        ],
        "operationId": "exportAPIConsumerUsageStatementInvoice",
        "summary": "Export a finalized app consumer statement as an invoice in Stripe, Paddle or Lago.",
        "description": "Exports one finalized app consumer statement revision to the\nprovider in the body (default stripe; connect it with\nPUT /v1/account/billing-connections/{provider}).\nThe connection's collection mode decides whether the\nprovider keeps a draft, sends it or charges it. One item per rate card\nand unit price, plus a rounding item, makes the invoice equal the\nstatement total rounded to the currency's minor unit; with a negative\nline, Paddle and Lago get a single summary item instead. The\nstatement's handoff records the provider invoice ID on success. A retry\nresumes the same invoice, a completed export is returned as is, and a\nstatement exports to one provider only. While another attempt is\nexporting the statement the answer is 409\n`statement_invoice_export_in_progress`; an export the provider refused\nbefore creating an invoice can be retried with another customer or\nprovider. Currencies with up to three decimal\nplaces; Paddle takes USD, EUR and GBP.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateStatementInvoiceRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The completed app consumer statement export.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatementInvoiceExportResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "description": "The app consumer statement or customer cannot be invoiced, or the provider rejected the request.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "502": {
            "description": "The provider could not be reached (`billing_provider_unavailable`); retry to resume the app consumer statement export.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The provider could not be reached (`billing_provider_unavailable`); retry to resume the app consumer statement export. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/rate-cards": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "consumers"
        ],
        "operationId": "listAPIConsumerRateCards",
        "summary": "List an app's immutable API consumer rate cards.",
        "responses": {
          "200": {
            "description": "Rate-card history in effective-time order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerRateCardListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "tags": [
          "consumers"
        ],
        "operationId": "createAPIConsumerRateCard",
        "summary": "Publish a new immutable API consumer rate card.",
        "description": "Publishes an app-level request price. Rate cards are append-only and\nmust use one currency per app. If effective_from is omitted, the card\nstarts at the next UTC minute.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAPIConsumerRateCardRequest"
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "201": {
            "description": "The newly published rate card.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerRateCardResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/apps/{slug}/consumer-plans": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "consumers"
        ],
        "operationId": "listAPIConsumerPlans",
        "summary": "List an app's consumer plans.",
        "responses": {
          "200": {
            "description": "Consumer plans by name.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerPlanListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "tags": [
          "consumers"
        ],
        "operationId": "createAPIConsumerPlan",
        "summary": "Create a named consumer plan.",
        "description": "A plan bundles enforcement limits with its own rate-card history\n(rate cards created with plan_id). App-wide rate cards are the default\nplan for consumers without an assignment. At most 20 plans per app.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAPIConsumerPlanRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerPlanResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/apps/{slug}/consumer-plans/{plan_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "plan_id",
          "in": "path",
          "required": true,
          "description": "Consumer plan UUID.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "put": {
        "tags": [
          "consumers"
        ],
        "operationId": "updateAPIConsumerPlanLimits",
        "summary": "Replace a consumer plan's limits.",
        "description": "Limits are enforcement, not prices, so they change in place; the gateway applies them within 15 seconds. Prices change through new rate-card versions.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAPIConsumerPlanLimitsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerPlanResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/consumers/{consumer_id}/plan-assignments": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "consumer_id",
          "in": "path",
          "required": true,
          "description": "Consumer whose plan assignments are listed or appended.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "consumers"
        ],
        "operationId": "listAPIConsumerPlanAssignments",
        "summary": "List a consumer's plan assignments, oldest first.",
        "responses": {
          "200": {
            "description": "Append-only plan history.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerPlanAssignmentListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "tags": [
          "consumers"
        ],
        "operationId": "assignAPIConsumerPlan",
        "summary": "Move a consumer onto a plan from a UTC minute.",
        "description": "The assignment takes effect from effective_from (default the next minute; never in the past) and requires the target plan to have a rate card in force then. Statements price each minute with the plan in force; monthly allowances and tiers keep counting across the change. An empty plan_id returns the consumer to the default plan.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssignAPIConsumerPlanRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new assignment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerPlanAssignmentResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/apps/{slug}/consumers/{consumer_id}/credits": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "consumer_id",
          "in": "path",
          "required": true,
          "description": "Consumer whose prepaid credit is listed or granted.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "consumers"
        ],
        "operationId": "listAPIConsumerCredits",
        "summary": "List a consumer's prepaid credit grants, newest first, with the usable balance per currency.",
        "responses": {
          "200": {
            "description": "The consumer's grants and balances.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerCreditListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "tags": [
          "consumers"
        ],
        "operationId": "createAPIConsumerCredit",
        "summary": "Grant a consumer prepaid credit.",
        "description": "Finalized statements in the credit's currency draw it down, the grant\nthat expires first before grants that never expire, in the same\ntransaction that finalizes them. Credit never pays more\nthan a statement's amount. A consumer holds at most 100 grants with\ncredit left.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAPIConsumerCreditRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new grant.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerCreditResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The consumer already holds 100 grants with credit left.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid currency, amount, note or expiry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/consumers/{consumer_id}/credits/{credit_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "consumer_id",
          "in": "path",
          "required": true,
          "description": "Consumer that holds the credit.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "credit_id",
          "in": "path",
          "required": true,
          "description": "Credit grant to void.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "delete": {
        "tags": [
          "consumers"
        ],
        "operationId": "voidAPIConsumerCredit",
        "summary": "Void what is left of a prepaid credit grant; credit already applied stays applied.",
        "responses": {
          "200": {
            "description": "The voided grant.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerCreditResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/consumers/{consumer_id}/spend-cap": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "consumer_id",
          "in": "path",
          "required": true,
          "description": "Consumer whose monthly spend is capped.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "consumers"
        ],
        "operationId": "getAPIConsumerSpendCap",
        "summary": "Read a consumer's monthly spend cap and its last check.",
        "responses": {
          "200": {
            "description": "The cap and whether it is reached this month.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerSpendCapResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "tags": [
          "consumers"
        ],
        "operationId": "putAPIConsumerSpendCap",
        "summary": "Set a consumer's monthly spend cap.",
        "description": "Once the month's amount due passes the cap, the gateway answers the\nconsumer with 402 `consumer_spend_cap_reached` until the month ends,\nthe cap rises or credit is added. The amount due is the month to\ndate priced like a statement, minus usable prepaid credit. The API\nchecks it every minute and at once when the cap or credit changes,\nso a consumer can overshoot by about two minutes of traffic. A zero\ncap allows prepaid usage only.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutAPIConsumerSpendCapRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The stored cap, checked at once.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerSpendCapResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "description": "Invalid currency or cap.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "consumers"
        ],
        "operationId": "deleteAPIConsumerSpendCap",
        "summary": "Remove a consumer's spend cap.",
        "responses": {
          "204": {
            "description": "The spend cap was removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/consumers/{consumer_id}/trial": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "consumer_id",
          "in": "path",
          "required": true,
          "description": "Consumer whose free trial is read or changed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "consumers"
        ],
        "operationId": "getAPIConsumerTrial",
        "summary": "Read a consumer's free trial.",
        "responses": {
          "200": {
            "description": "The consumer's trial.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerTrialResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "tags": [
          "consumers"
        ],
        "operationId": "putAPIConsumerTrial",
        "summary": "Start a consumer's one free trial, or move the end of a running one.",
        "description": "Usage in the trial is priced at zero and consumes no included units.\nA new trial starts at the next UTC minute; a running trial's end can\nmove, never before the next minute. A consumer whose trial has ended\ncannot get another (409).\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutAPIConsumerTrialRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The stored trial.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerTrialResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "description": "Invalid trial length or end.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "consumers"
        ],
        "operationId": "endAPIConsumerTrial",
        "summary": "End a consumer's running trial at the next minute.",
        "responses": {
          "204": {
            "description": "The trial ends at the next minute, or was removed before it started."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/consumer-billing-policy": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "consumers"
        ],
        "operationId": "getAPIConsumerBillingPolicy",
        "summary": "Read the app's overdue-invoice rule.",
        "responses": {
          "200": {
            "description": "The app's overdue rule.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerBillingPolicyResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "tags": [
          "consumers"
        ],
        "operationId": "putAPIConsumerBillingPolicy",
        "summary": "Refuse consumers whose exported invoice is unpaid some days after its due date.",
        "description": "Every 5 minutes the API places a hold on each consumer whose exported\ninvoice is open or uncollectible with an amount left at least\nblock_overdue_after_days past its due date, and lifts holds that no\nlonger apply. The gateway answers a held consumer with 402\n`consumer_invoice_overdue`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutAPIConsumerBillingPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The stored rule.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerBillingPolicyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "description": "Days outside 0 to 365.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "consumers"
        ],
        "operationId": "deleteAPIConsumerBillingPolicy",
        "summary": "Remove the app's overdue rule; holds lift at the next check.",
        "responses": {
          "204": {
            "description": "The overdue rule was removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/consumer-signup": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "consumers"
        ],
        "operationId": "getConsumerSignup",
        "summary": "Read the app's self-service sign-up settings.",
        "responses": {
          "200": {
            "description": "The app's sign-up settings and hosted page URL.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsumerSignupSettingsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "tags": [
          "consumers"
        ],
        "operationId": "putConsumerSignup",
        "summary": "Let the app's customers sign up themselves and save a card with Stripe Checkout.",
        "description": "Customers sign up on the hosted page (page_url) or through the public\nsign-up API: they pick one of plan_ids (none offers the default\nplan), save a card in the account's own Stripe account, and get a\nconsumer key with key_scopes. Needs the account's Stripe billing\nconnection. A restricted Stripe key needs write access to Customers\nand Checkout Sessions and read access to SetupIntents.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutConsumerSignupRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The stored settings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsumerSignupSettingsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Stripe is not connected.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "A provider other than Stripe, an unknown plan, an invalid scope or URL, or a value out of range.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "consumers"
        ],
        "operationId": "deleteConsumerSignup",
        "summary": "Turn sign-up off; pending sign-ups can no longer complete.",
        "responses": {
          "204": {
            "description": "Sign-up was turned off."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/consumer-signups": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "consumers"
        ],
        "operationId": "listConsumerSignups",
        "summary": "List the app's latest 100 sign-ups, newest first.",
        "responses": {
          "200": {
            "description": "The app's sign-ups.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsumerSignupListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/consumer-overdue-holds": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "consumers"
        ],
        "operationId": "listAPIConsumerOverdueHolds",
        "summary": "List the consumers the gateway refuses because of an overdue invoice.",
        "responses": {
          "200": {
            "description": "The app's held consumers, oldest due date first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerOverdueHoldListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/consumers/{consumer_id}/usage-alerts": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "consumer_id",
          "in": "path",
          "required": true,
          "description": "Consumer whose usage alerts are listed.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "consumers"
        ],
        "operationId": "listAPIConsumerUsageAlerts",
        "summary": "List the plan usage alerts a consumer crossed.",
        "description": "Returns up to 100 recorded crossings of the consumer's plan alert\nthresholds, newest first. Each crossing also emitted one\nconsumer.usage_threshold webhook; this list reconciles missed\ndeliveries.\n",
        "responses": {
          "200": {
            "description": "The consumer's usage alerts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerUsageAlertListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/rate-cards/{rate_card_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "rate_card_id",
          "in": "path",
          "required": true,
          "description": "Immutable API consumer rate-card UUID.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "consumers"
        ],
        "operationId": "getAPIConsumerRateCard",
        "summary": "Fetch one API consumer rate card.",
        "responses": {
          "200": {
            "description": "The requested immutable rate card.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIConsumerRateCardResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/consumers/{consumer_id}/keys": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "consumer_id",
          "in": "path",
          "required": true,
          "description": "API consumer identity UUID owning these credentials.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "consumers"
        ],
        "operationId": "listConsumerKeys",
        "summary": "List credentials for an API consumer (secret omitted).",
        "responses": {
          "200": {
            "description": "Consumer keys without plaintext secrets.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsumerKeyListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "tags": [
          "consumers"
        ],
        "operationId": "createConsumerKey",
        "summary": "Issue a new consumer credential. Plaintext is returned once.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateConsumerKeyRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created credential; key is returned exactly once.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsumerKeyResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "403": {
            "$ref": "#/components/responses/PlanLimit"
          }
        }
      }
    },
    "/v1/apps/{slug}/consumers/{consumer_id}/keys/{key_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "consumer_id",
          "in": "path",
          "required": true,
          "description": "API consumer identity UUID for the key being revoked.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "key_id",
          "in": "path",
          "required": true,
          "description": "Consumer credential UUID.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "delete": {
        "tags": [
          "consumers"
        ],
        "operationId": "revokeConsumerKey",
        "summary": "Revoke a consumer credential.",
        "responses": {
          "200": {
            "description": "The revoked credential (secret omitted).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsumerKeyResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/deleted-apps": {
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listDeletedApps",
        "summary": "List account-owned retained deleted apps.",
        "description": "Bounded lifecycle inventory; never includes another account's tombstones.\nEligibility does not reserve quota or capacity. Use the returned deadline\nand evaluation time, not a deadline inferred from the browser clock.\n",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum records in this account-owned page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 25
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Opaque cursor from this account and inventory order. Restart when rejected.",
            "schema": {
              "type": "string",
              "maxLength": 1024
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One bounded account-owned page.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedAppListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/deleted-apps/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Exact deleted-app ID returned by this account's inventory.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getDeletedApp",
        "summary": "Read one account-owned deleted app before restore review.",
        "description": "Returns current lifecycle evidence for the exact owned retained ID; foreign and restored IDs are absent.",
        "responses": {
          "200": {
            "description": "Current lifecycle evidence; active or foreign apps return 404.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedAppSummary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/deleted-apps/{id}/restore": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Exact account-owned deleted-app ID; never resolved to a replacement slug.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "restoreDeletedApp",
        "summary": "Restore an identified app within its retained deletion window.",
        "description": "Requires deploy-write, MFA completion and trusted browser origin for cookie\nauthentication. Rechecks identity, deadline, purge claim, quota and capacity.\nThis operation has no idempotent replay receipt. After an uncertain response,\nreconcile exact-ID reads; never automatically retry or fall back to slug restore.\nSuccess acknowledges restoration, not execution health.\n",
        "requestBody": {
          "description": "Optional empty object; no dry-run or other fields are accepted.",
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "maxProperties": 0
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The restored exact app.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/restore": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "restoreApp",
        "summary": "Restore an app during its deletion grace window.",
        "description": "Bodyless legacy callers remain supported. An optional expected_app_id\nfences the selected identity on updated servers. For mixed-version\nsafety, use the dedicated deleted-app ID route instead of relying on\nlegacy body handling. This route has no idempotent replay receipt.\n",
        "requestBody": {
          "description": "Optional reviewed app identity on updated servers; bodyless callers remain compatible.",
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "expected_app_id": {
                    "type": "string",
                    "format": "uuid",
                    "minLength": 32,
                    "maxLength": 36
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The restored app.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/deploy-tokens": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listDeployTokens",
        "summary": "List deploy tokens for an app.",
        "responses": {
          "200": {
            "description": "Deploy-token metadata. Plaintexts are never returned by list.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListDeployTokensResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "createDeployToken",
        "summary": "Create a deploy token scoped to this app.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateDeployTokenRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Token metadata and plaintext. Capture plaintext immediately; it is never returned again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeployTokenResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/deploy-tokens/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Deploy-token identifier returned by the list or create endpoint.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "delete": {
        "tags": [
          "apps"
        ],
        "operationId": "revokeDeployToken",
        "summary": "Revoke an app deploy token.",
        "responses": {
          "204": {
            "description": "Token revoked."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/deploy-tokens/{id}/rotate": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Deploy-token identifier to rotate, returned by the list or create endpoint.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "rotateDeployToken",
        "summary": "Rotate an app deploy token.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RotateDeployTokenRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "New token metadata and plaintext. The predecessor is revoked atomically.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RotateDeployTokenResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/preview/{slug}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "previews"
        ],
        "operationId": "getPreview",
        "summary": "Get a first-class preview resource.",
        "description": "Returns preview identity, public URL, expiration, latest preview and\nproduction deployments, safe changes from production, and links to\nthe native streaming logs, time-windowed metrics, and configuration\nendpoints. Secret values and ciphertext are never included.\n",
        "responses": {
          "200": {
            "description": "Preview resource and production comparison.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreviewResourceResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/preview/{slug}/environment": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "previews"
        ],
        "operationId": "getPreviewEnvironmentStatus",
        "summary": "Read the current-head workload set for a GitHub PR preview.",
        "description": "The slug must be the root preview app of a recorded GitHub PR set.\nThe response evaluates only preview deployments for the recorded\ncommit. It never reports a root as ready while an expected sibling is\nmissing, building, failed, or on an older commit. Closed PRs are not\nready. Developer previews and unrecorded legacy PR previews return 404.\nRequires the deployment read scope and account ownership of the root.\n",
        "responses": {
          "200": {
            "description": "Current-head preview environment status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreviewEnvironmentStatusResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/preview/{slug}/destroy": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "previews"
        ],
        "operationId": "destroyPreview",
        "summary": "Tear down a preview app.",
        "description": "One-click destroy of a preview app row. Typically fired from a \"Tear down this preview\" link\nposted to the GitHub pull request by the GitHub integration. Distinct from\n`DELETE /v1/apps/{slug}` because the preview teardown also\nstamps `apps.preview_pr_state='torn_down'` so the janitor\ndoesn't re-process the row on a subsequent tick, and emits a\ndistinct audit kind (`preview.destroyed_by_customer` vs\n`app.deleted`).\n",
        "responses": {
          "204": {
            "description": "No body. The preview was removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "404 — slug does not identify a preview app. Use DELETE /v1/apps/{slug} to destroy a production app.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem",
                  "example": {
                    "type": "https://gregale.dev/docs/errors/preview-not-found",
                    "code": "preview_not_found",
                    "title": "Preview not found",
                    "detail": "the slug does not identify a preview app; use DELETE /v1/apps/{slug} to destroy a production app",
                    "status": 404
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/previews": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "previews"
        ],
        "operationId": "createPreview",
        "summary": "Provision or reopen a pull-request preview app.",
        "description": "Creates the stable `pr-{N}-{parent_slug}` preview environment for a\nproduction app. The operation is idempotent for the same pull request\nand returns the app metadata; deploy source separately with\n`POST /v1/apps/{slug}/deployments/source-ref`.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePreviewRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Existing preview environment returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppResponse"
                }
              }
            }
          },
          "201": {
            "description": "Preview environment created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/dev/bridges": {
      "get": {
        "tags": [
          "dev"
        ],
        "operationId": "listDevBridges",
        "summary": "List active development sessions owned by the account.",
        "description": "Bounded inventory. Returns at most 100 active leases, newest expiry first. Connection state is informational and unknown after observer restart or eviction. No credentials are returned.",
        "responses": {
          "200": {
            "description": "Active owned sessions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListDevBridgesResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "description": "Development bridge inventory is disabled."
          }
        }
      },
      "post": {
        "tags": [
          "dev"
        ],
        "operationId": "createDevBridge",
        "summary": "Create a leased local service development session.",
        "description": "Operator-gated feature. Select an owned app in an unprotected non-production project environment. Credentials are returned once; the request token routes only the selected application graph, while the attachment token connects the laptop. The lease lasts one hour.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateDevBridgeRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Development session and one-time credentials created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateDevBridgeResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Development bridge is disabled or unavailable."
          }
        }
      }
    },
    "/v1/dev/bridges/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Opaque development session identifier returned by creation.",
          "schema": {
            "type": "string",
            "minLength": 43,
            "maxLength": 43
          }
        }
      ],
      "get": {
        "tags": [
          "dev"
        ],
        "operationId": "getDevBridge",
        "summary": "Inspect a development session without its credentials.",
        "responses": {
          "200": {
            "description": "Owned development session metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevBridgeSession"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "tags": [
          "dev"
        ],
        "operationId": "revokeDevBridge",
        "summary": "Revoke a development session and close its laptop connection.",
        "responses": {
          "204": {
            "description": "Session revoked."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/dev/bridges/{id}/activity": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Owned development session identifier.",
          "schema": {
            "type": "string",
            "minLength": 43,
            "maxLength": 43
          }
        }
      ],
      "get": {
        "tags": [
          "dev"
        ],
        "operationId": "getDevBridgeActivity",
        "summary": "Inspect recent connection and request metadata.",
        "description": "Temporary API observer window. Queries, headers and bodies are excluded. Restart or bounded eviction clears activity; observation never authorizes routing.",
        "responses": {
          "200": {
            "description": "Bounded session activity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevBridgeActivity"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Development bridge activity is disabled."
          }
        }
      }
    },
    "/v1/dev/bridges/{id}/webhook-replays": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Destination development session identifier.",
          "schema": {
            "type": "string",
            "minLength": 43,
            "maxLength": 43
          }
        }
      ],
      "post": {
        "tags": [
          "dev"
        ],
        "operationId": "replayDevBridgeWebhook",
        "summary": "Copy one verified webhook receipt to the local service.",
        "description": "Requires account deploy permission and the session request credential. Copies only a provider-verified receipt for the intercepted app. Creates a separate durable receipt before dispatch; the original invocation stays untouched. Repeating the same key never redispatches. An uncertain or interrupted dispatch must be inspected before explicitly requesting another copy. Provider signature headers are excluded because the original receipt already records verification.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReplayDevBridgeWebhookRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "New or previously recorded development replay receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevBridgeWebhookReplay"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Session routing credential is invalid or expired."
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/dev/bridges/{id}/webhook-replays/{replay}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Owning development session identifier.",
          "schema": {
            "type": "string",
            "minLength": 43,
            "maxLength": 43
          }
        },
        {
          "name": "replay",
          "in": "path",
          "required": true,
          "description": "Replay receipt identifier, including after session revocation.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "dev"
        ],
        "operationId": "getDevBridgeWebhookReplay",
        "summary": "Inspect an owned development webhook copy receipt.",
        "responses": {
          "200": {
            "description": "Persisted copy outcome without payload or credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevBridgeWebhookReplay"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/dev/sessions/{project}/patches/{generation}": {
      "parameters": [
        {
          "name": "project",
          "in": "path",
          "required": true,
          "description": "Project label of the developer session that published the patch.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{1,38})[a-z0-9]$",
            "minLength": 3,
            "maxLength": 40
          }
        },
        {
          "name": "generation",
          "in": "path",
          "required": true,
          "description": "Patch generation returned in the upload response's dev_patch.generation.",
          "schema": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        }
      ],
      "get": {
        "tags": [
          "dev"
        ],
        "operationId": "getDevPatchStatus",
        "summary": "Inspect delivery of a developer live patch.",
        "description": "Reports whether a published developer live patch reached the running developer environment. The state is pending until an instance acknowledges it, then applied, or failed with a bounded error code. Never renews the developer lease.",
        "parameters": [
          {
            "name": "workspace_id",
            "in": "query",
            "required": false,
            "description": "Opaque local workspace identity returned by the CLI derivation.",
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Live patch delivery state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevPatchStatusResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/dev/sessions/{project}": {
      "parameters": [
        {
          "name": "project",
          "in": "path",
          "required": true,
          "description": "Stable local project label used to derive the developer URL.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{1,38})[a-z0-9]$",
            "minLength": 3,
            "maxLength": 40
          }
        }
      ],
      "put": {
        "tags": [
          "dev"
        ],
        "operationId": "upsertDevSession",
        "summary": "Create or refresh a remote developer environment.",
        "description": "Creates one stable preview app per account, project, and developer workspace, or renews its 24-hour lease. Omitting workspace_id retains the legacy account-and-project identity.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertDevSessionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Existing developer environment refreshed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevSessionResponse"
                }
              }
            }
          },
          "201": {
            "description": "Developer environment created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevSessionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "get": {
        "tags": [
          "dev"
        ],
        "operationId": "getDevSession",
        "summary": "Inspect a remote developer environment.",
        "description": "Returns the stable URL, app, lease expiry, and safe PostgreSQL and automatic bucket binding state of one developer environment. Unlike the upsert, this read never renews the lease or provisions resources.",
        "parameters": [
          {
            "name": "workspace_id",
            "in": "query",
            "required": false,
            "description": "Opaque local workspace identity of the environment to read, as derived by the CLI. Omit only to read a legacy session.",
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Developer environment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevSessionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "dev"
        ],
        "operationId": "destroyDevSession",
        "summary": "Tear down a remote developer environment.",
        "parameters": [
          {
            "name": "workspace_id",
            "in": "query",
            "required": false,
            "description": "Opaque local workspace identity returned by the CLI derivation. Omit only to target a legacy session.",
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{32}$"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Developer environment removed."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/dev/test-runs/{run_id}": {
      "parameters": [
        {
          "name": "run_id",
          "in": "path",
          "required": true,
          "description": "Lowercase hexadecimal ID shared only by sessions in this test run.",
          "schema": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          }
        }
      ],
      "put": {
        "tags": [
          "dev"
        ],
        "operationId": "registerScenarioTest",
        "summary": "Register an isolated service namespace for a scenario test.",
        "description": "All members must be live developer sessions from this account and run. A missing sibling never resolves to production.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterScenarioTestRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Durable webhook capture policy registered before source deployment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegisterScenarioTestResponse"
                }
              }
            }
          },
          "204": {
            "description": "Test workloads registered."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "501": {
            "$ref": "#/components/responses/RehearsalNotEnabled"
          }
        }
      },
      "delete": {
        "tags": [
          "dev"
        ],
        "operationId": "deleteScenarioTest",
        "summary": "Release a scenario test namespace after all members are destroyed.",
        "responses": {
          "204": {
            "description": "Test namespace released."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/dev/test-runs/{run_id}/suspend-resume": {
      "parameters": [
        {
          "name": "run_id",
          "in": "path",
          "required": true,
          "description": "Lowercase hexadecimal ID of this account's enrolled rehearsal run.",
          "schema": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          }
        }
      ],
      "post": {
        "tags": [
          "dev"
        ],
        "operationId": "beginScenarioSuspendResume",
        "summary": "Request the enrolled after-setup suspend/resume checkpoint.",
        "description": "Account-owned isolated run only. Managed-job checkpoints arm automatically through their original relay and return 409 here. After-setup requests are idempotent and do not repeat uncertain pauses. Complete requires original VM and collector receipts plus scheduler publication. Durable handling remains available when new enrollment is disabled.",
        "responses": {
          "200": {
            "description": "Pending, complete or explicitly incomplete lifecycle evidence.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScenarioSuspendResumeEvidence"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "get": {
        "tags": [
          "dev"
        ],
        "operationId": "getScenarioSuspendResume",
        "summary": "Read retained suspend/resume lifecycle receipts.",
        "description": "Reads retained lifecycle receipts for this account without requesting execution. Pending and incomplete evidence cannot establish a successful resume. Previously enrolled receipts remain readable when new admission is disabled.",
        "responses": {
          "200": {
            "description": "Current run-owned checkpoint evidence, including completed and explicitly incomplete owner receipts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScenarioSuspendResumeEvidence"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/dev/test-runs/{run_id}/actions/seal": {
      "parameters": [
        {
          "name": "run_id",
          "in": "path",
          "required": true,
          "description": "Lowercase hexadecimal identity of this account's capture run.",
          "schema": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          }
        }
      ],
      "post": {
        "tags": [
          "dev"
        ],
        "operationId": "sealScenarioTestActions",
        "summary": "Close a test run and export its supported action evidence.",
        "description": "Waits for supported managed work to settle, then irreversibly fences new simulation relay admission and waits for owning recorders to acknowledge closing. Previously admitted requests may finish. Repeating a successful seal returns the immutable retained snapshot. Coverage includes managed webhook intent and enrolled simulated relay attempts; arbitrary direct network traffic and external queues remain outside scope.",
        "responses": {
          "200": {
            "description": "Immutable complete or explicitly incomplete action snapshot. Payloads are included only in a complete inventory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScenarioActionSnapshot"
                }
              }
            }
          },
          "202": {
            "description": "Managed work, simulation requests or recorder acknowledgements remain pending. Simulation relay admission may already be irreversibly closed; retry collection without submitting new work.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScenarioActionSnapshot"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/dev/test-runs/{run_id}/objects": {
      "parameters": [
        {
          "name": "run_id",
          "in": "path",
          "required": true,
          "description": "Isolated rehearsal run receiving a fresh object namespace.",
          "schema": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          }
        }
      ],
      "post": {
        "tags": [
          "dev"
        ],
        "operationId": "createScenarioObjects",
        "summary": "Create an isolated S3 fixture namespace before deploying a rehearsal workload.",
        "description": "Disabled by default. Pins bounded fixture bytes in dedicated rehearsal tables and injects run-scoped credentials, AWS_REGION, AWS_ENDPOINT_URL_S3 and S3_BUCKET as sealed ephemeral app secrets. The private adapter never accesses managed or production buckets. Only the primary contained app and its commands receive credentials. Requires no existing deployment and complete contained simulation enrollment.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateScenarioObjectsRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Starting objects captured and private storage credentials delivered before deployment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScenarioObjectsReceipt"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "501": {
            "$ref": "#/components/responses/RehearsalNotEnabled"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "dev"
        ],
        "operationId": "deleteScenarioObjects",
        "summary": "Revoke a rehearsal namespace and remove its object bodies.",
        "description": "Cleanup remains available with admission disabled. Missing or terminal resources succeed idempotently. A transaction fences pending requests and removes all current object bytes before acknowledging cleanup.",
        "responses": {
          "204": {
            "description": "Object bytes are absent and runtime access is revoked."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/dev/test-runs/{run_id}/objects/seal": {
      "parameters": [
        {
          "name": "run_id",
          "in": "path",
          "required": true,
          "description": "Isolated run whose object mutations are ready for independent collection.",
          "schema": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          }
        }
      ],
      "post": {
        "tags": [
          "dev"
        ],
        "operationId": "sealScenarioObjects",
        "summary": "Fence object requests, collect final content digests, and confirm cleanup.",
        "description": "Requires a deployment belonging to the fixture app and complete sealed action evidence. New requests are fenced before waiting for admitted requests. Unsupported operations, unfinished uploads, bounds violations, collector errors or failed cleanup cannot produce complete evidence. Evidence publication and removal of object bodies share one transaction. Completed sealing is idempotent for the same deployment.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SealScenarioObjectsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Independently collected object effects with confirmed namespace cleanup.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScenarioObjectsEvidence"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/dev/test-runs/{run_id}/postgres": {
      "parameters": [
        {
          "name": "run_id",
          "in": "path",
          "required": true,
          "description": "Lowercase hexadecimal identity of this account's isolated rehearsal run.",
          "schema": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          }
        }
      ],
      "post": {
        "tags": [
          "dev"
        ],
        "operationId": "createScenarioPostgres",
        "summary": "Provision a disposable PostgreSQL fixture before deploying a rehearsal workload.",
        "description": "Opt-in operator preview for contained warm rehearsals. Executes declared SQL as an unprivileged login on a dedicated fixture cluster, independently captures selected starting rows, and injects DATABASE_URL as a sealed ephemeral app secret. Connection URLs and passwords are never returned. One fresh database per account/run; no existing deployment, managed binding, or production snapshot is accepted.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateScenarioPostgresRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Isolated starting data captured and secret delivered before deployment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScenarioPostgresReceipt"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "501": {
            "$ref": "#/components/responses/RehearsalNotEnabled"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "dev"
        ],
        "operationId": "deleteScenarioPostgres",
        "summary": "Fence and remove this account's disposable PostgreSQL fixture.",
        "description": "Cleanup remains available when enrollment is disabled. A missing journal or an already confirmed deletion succeeds. Active fixture cleanup is confirmed before returning.",
        "responses": {
          "204": {
            "description": "Fixture database and login are absent."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/dev/test-runs/{run_id}/postgres/seal": {
      "parameters": [
        {
          "name": "run_id",
          "in": "path",
          "required": true,
          "description": "Isolated run whose database observations are ready to be fenced and collected.",
          "schema": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          }
        }
      ],
      "post": {
        "tags": [
          "dev"
        ],
        "operationId": "sealScenarioPostgres",
        "summary": "Fence PostgreSQL writes, collect final committed rows, and confirm fixture deletion.",
        "description": "Requires complete sealed action evidence and a deployment belonging to the fixture app. Unfinished SQL, collector loss, unsupported relations, oversized evidence or failed cleanup cannot produce complete evidence. Repeating a completed seal returns its retained receipt. Lock waits are sampled; short waits may be missed. Row updates appear as a deletion and insertion in the selected row multiset.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SealScenarioPostgresRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bounded independent database evidence with confirmed cleanup.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScenarioPostgresEvidence"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/dev/test-runs/{run_id}/chaos": {
      "parameters": [
        {
          "name": "run_id",
          "in": "path",
          "required": true,
          "description": "Random lowercase hexadecimal identity shared by the run's developer sessions.",
          "schema": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          }
        }
      ],
      "put": {
        "tags": [
          "dev"
        ],
        "operationId": "injectScenarioTestChaos",
        "summary": "Install a bounded fault plan for an isolated scenario run.",
        "description": "Rules apply only to authenticated internal service calls between registered members, expire automatically, and cannot affect production or public traffic.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InjectScenarioTestChaosRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Fault plan installed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InjectScenarioTestChaosResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "tags": [
          "dev"
        ],
        "operationId": "clearScenarioTestChaos",
        "summary": "Clear the active fault plan for an isolated scenario run.",
        "description": "Removes the run's active faults immediately. The run must still have at least one live registered member.",
        "responses": {
          "204": {
            "description": "Fault plan cleared."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/dev/test-runs/{run_id}/chaos/matches": {
      "parameters": [
        {
          "name": "run_id",
          "in": "path",
          "required": true,
          "description": "Lowercase hexadecimal ID shared by all developer sessions in this scenario run.",
          "schema": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          }
        }
      ],
      "get": {
        "tags": [
          "dev"
        ],
        "operationId": "getScenarioTestChaosMatches",
        "summary": "Read fault-match counts for the current scenario plan.",
        "description": "Returns run-scoped counts of HTTP requests and TCP connections matched by the current or most recently cleared fault plan.",
        "responses": {
          "200": {
            "description": "Fault-match evidence for the current plan generation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScenarioTestChaosMatchesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/dev/sessions/{project}/syncs": {
      "parameters": [
        {
          "name": "project",
          "in": "path",
          "required": true,
          "description": "Local project label used to locate the developer environment sync endpoint.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{1,38})[a-z0-9]$",
            "minLength": 3,
            "maxLength": 40
          }
        }
      ],
      "post": {
        "tags": [
          "dev"
        ],
        "operationId": "recordDevSync",
        "summary": "Record a redacted edit-to-live receipt.",
        "description": "Stores bounded phase timings for one developer deployment. Repeating the same app and deployment ID is idempotent.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecordDevSyncRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Receipt stored or already present.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevSyncHistoryItem"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/dev/sessions/{project}/seed": {
      "parameters": [
        {
          "name": "project",
          "in": "path",
          "required": true,
          "description": "Local project label of the developer session to seed, as for PUT /v1/dev/sessions/{project}.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{1,38})[a-z0-9]$",
            "minLength": 3,
            "maxLength": 40
          }
        }
      ],
      "post": {
        "tags": [
          "dev"
        ],
        "operationId": "seedDevSessionFromEnvironmentBranch",
        "summary": "Seed a rehearsal member from a simulated environment branch.",
        "description": "Deploys one workload of a simulated environment branch into the developer session of a rehearsal run. The member reuses the branch deployment's build and gets the branch's variables and secrets; managed PostgreSQL and object-storage bindings are not copied, so the rehearsal declares isolated fixtures. The deployment goes live after one boot. Repeating the request returns the deployment already seeded.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SeedDevSessionFromEnvironmentBranchRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The member's deployment, priming or already live.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SeedDevSessionFromEnvironmentBranchResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/dev/sessions/{project}/history": {
      "parameters": [
        {
          "name": "project",
          "in": "path",
          "required": true,
          "description": "Local project label used to locate the developer environment history.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{1,38})[a-z0-9]$",
            "minLength": 3,
            "maxLength": 40
          }
        }
      ],
      "get": {
        "tags": [
          "dev"
        ],
        "operationId": "listDevSyncHistory",
        "summary": "List bounded edit-to-live history.",
        "parameters": [
          {
            "name": "workspace_id",
            "in": "query",
            "required": false,
            "description": "Opaque local workspace identity. Omit only for a legacy session.",
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{32}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Number of recent receipts to return.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Newest-first developer sync history and trend summary.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevSyncHistoryResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/custom-metrics": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "operationId": "listCustomMetrics",
        "summary": "List the app's pushed custom metrics",
        "description": "Returns every stored custom metric for the app, including rows whose last push is older than the freshness window. Stale rows are returned with `stale: true` rather than hidden — an operator debugging \"why isn't my custom target scaling\" needs to see that the value is old, because a hidden expired row looks identical to a missing one. Distinct from GET /v1/apps/{slug}/metrics, which serves the per-app Prometheus rollup of what the PLATFORM measured.",
        "tags": [
          "apps"
        ],
        "responses": {
          "200": {
            "description": "The app's custom metrics.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomMetricListResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/custom-metrics/{name}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "Metric name. Must match [a-z][a-z0-9_]{0,62}.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,62}$"
          }
        }
      ],
      "put": {
        "operationId": "putCustomMetric",
        "summary": "Push a custom application metric",
        "description": "Upserts one customer-pushed gauge, used as a scaling signal by a `metric: custom` target. The caller is frequently NOT the app — a cron, a database trigger, or the customer's own infrastructure — which is the point: a parked app has no process, so a scale-to-zero platform whose custom signal required a running instance could never scale from zero on it. The value is FLEET-TOTAL; the scheduler computes ceil(value / target). Pushing a name the app already holds always succeeds (it is an upsert); only a NEW name can hit the per-app cap.",
        "tags": [
          "apps"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomMetricRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "The gauge was stored and is now visible to the scheduler on its next tick."
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/CustomMetricInvalid"
          }
        }
      },
      "delete": {
        "operationId": "deleteCustomMetric",
        "summary": "Delete a custom application metric",
        "description": "Removes one stored gauge, freeing a slot against the per-app cap. Deleting a name that does not exist returns 204, not 404: the caller's intent is \"this metric is gone\", which is already true, and a 404 would make a retry of a successful delete look like a failure.",
        "tags": [
          "apps"
        ],
        "responses": {
          "204": {
            "description": "Deleted. Also returned when the metric did not exist: the caller's intent is already satisfied, and a 404 would make a retry of a successful delete look like a failure."
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/mcp-task-compatibility": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "put": {
        "operationId": "putMCPTaskCompatibilityReport",
        "summary": "Publish an MCP task handler compatibility snapshot",
        "description": "Replaces the app's bounded observer snapshot with aggregate waiting-task and live-worker counts by tool and handler version. The report contains no task IDs, owners, or payloads; timestamps are assigned by Gregale.",
        "tags": [
          "mcp"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MCPTaskCompatibilityReportRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Snapshot stored."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "description": "Request body exceeds 128 KiB."
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          }
        }
      },
      "get": {
        "operationId": "getMCPTaskCompatibilityReport",
        "summary": "Read the latest MCP task handler compatibility snapshot",
        "description": "Returns the latest bounded observer snapshot, including server-computed freshness. An unpublished snapshot is returned as published=false and stale=true.",
        "tags": [
          "mcp"
        ],
        "responses": {
          "200": {
            "description": "Latest snapshot or an explicit unpublished/stale response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPTaskCompatibilityReportResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/notification-channels": {
      "get": {
        "operationId": "listNotificationChannels",
        "summary": "List the account's alert notification channels",
        "description": "Returns Slack, PagerDuty and email channels with their last delivery outcome. Destinations are shown as non-secret hints only.",
        "tags": [
          "alert_rules"
        ],
        "responses": {
          "200": {
            "description": "The account's channels.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/NotificationChannelResponse"
                  }
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          }
        }
      },
      "post": {
        "operationId": "createNotificationChannel",
        "summary": "Add an alert notification channel",
        "description": "Slack takes an incoming-webhook URL on hooks.slack.com; PagerDuty takes an Events API v2 routing key and region; email may only address the account's own email. Secret destinations are sealed at rest and never returned.",
        "tags": [
          "alert_rules"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateNotificationChannelRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The channel was created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationChannelResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "409": {
            "description": "The account already has a channel with this name.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The account is at its channel cap; the problem carries limit and observed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/notification-channels/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Notification channel identifier returned when the channel was created.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getNotificationChannel",
        "summary": "Get one notification channel",
        "description": "Returns one channel with its last delivery outcome.",
        "tags": [
          "alert_rules"
        ],
        "responses": {
          "200": {
            "description": "The channel.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationChannelResponse"
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "patch": {
        "operationId": "updateNotificationChannel",
        "summary": "Rename a notification channel or replace its destination",
        "description": "Renames the channel or replaces its Slack webhook URL or PagerDuty routing key in place, so a leaked destination is rotated without unbinding the channel from its rules. The kind never changes; an email channel can only be renamed. A PagerDuty region changes only together with a new routing key. A new destination clears the channel's last error.",
        "tags": [
          "alert_rules"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateNotificationChannelRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated channel.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationChannelResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      },
      "delete": {
        "operationId": "deleteNotificationChannel",
        "summary": "Delete a notification channel",
        "description": "Removes the channel; alert rules stop delivering to it. Refused with 409 notification_channel_in_use while the channel is the only destination of a rule (no webhook and no other channel), naming those rules.",
        "tags": [
          "alert_rules"
        ],
        "responses": {
          "204": {
            "description": "The channel was deleted."
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/notification-channels/{id}/test": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Identifier of the channel to send the test notification through.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "operationId": "testNotificationChannel",
        "summary": "Send a test notification through a channel",
        "description": "Sends a clearly marked test message and records the outcome on the channel. Returns 200 whether or not the destination accepted it; delivered and error say which.",
        "tags": [
          "alert_rules"
        ],
        "responses": {
          "200": {
            "description": "The test outcome.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TestNotificationChannelResponse"
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/custom-metrics/{name}/series": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "The pushed custom metric whose history to read.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,62}$"
          }
        }
      ],
      "get": {
        "operationId": "getCustomMetricSeries",
        "summary": "Read a custom metric's history",
        "description": "Internal preview, enabled by `FAAS_CUSTOM_METRIC_HISTORY_ENABLED=1`;\notherwise 503 `custom_metric_history_unavailable`.\n\nReturns the values Prometheus recorded from pushed custom metrics over\n`range` (`1h`, `6h`, `24h` default, `7d`, `15d`). Only fresh pushes are\nrecorded, so a gap means nothing was pushed then. Prometheus failure\nreturns 200 with `source: \"degraded: <reason>\"` and null `points`.\n",
        "tags": [
          "apps"
        ],
        "parameters": [
          {
            "name": "range",
            "in": "query",
            "required": false,
            "description": "History window. Default 24h.",
            "schema": {
              "type": "string",
              "enum": [
                "1h",
                "6h",
                "24h",
                "7d",
                "15d"
              ],
              "default": "24h"
            }
          },
          {
            "name": "labels",
            "in": "query",
            "required": false,
            "description": "One labelled series, by the `key` the metric list returns for it (for example `queue=emails`). Omitted: the metric's aggregate.",
            "schema": {
              "type": "string",
              "maxLength": 1024
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The recorded history.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomMetricSeriesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/otlp/v1/metrics": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "operationId": "postOTLPMetrics",
        "summary": "Ingest OTLP/HTTP metrics as custom metrics",
        "description": "Internal preview, enabled by `FAAS_CUSTOM_METRIC_HISTORY_ENABLED=1`;\notherwise 503. Point an OpenTelemetry exporter's metrics endpoint here\nwith a `metrics:write` API key as the bearer token.\n\nAccepts an OTLP `ExportMetricsServiceRequest` as `application/x-protobuf`\nor `application/json` (at most 1 MiB) and answers in the same encoding.\nGauges are stored as gauges and cumulative monotonic sums as counters;\nmetric names are lowercased with `.`, `-` and `/` mapped to `_`. Delta\nor non-monotonic sums, histograms, data points with attributes,\nnegative values, and names beyond the per-app limit are not stored and\nare reported through `partialSuccess`.\n",
        "tags": [
          "apps"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/x-protobuf": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "application/json": {
              "schema": {
                "type": "object",
                "description": "OTLP ExportMetricsServiceRequest in its JSON encoding."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The export was processed; rejected data points are reported in partialSuccess.",
            "content": {
              "application/x-protobuf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "OTLP ExportMetricsServiceResponse in its JSON encoding."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/slos": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "operationId": "listSLOs",
        "summary": "List the app's customer-defined SLOs",
        "description": "Returns every SLO defined on the app, name-ordered. Distinct from GET /v1/apps/{slug}/slo, which reports the fixed 99.5% availability panel.",
        "tags": [
          "apps"
        ],
        "responses": {
          "200": {
            "description": "The app's SLO definitions.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SLOResponse"
                  }
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "createSLO",
        "summary": "Define an SLO on the app",
        "description": "Creates an availability or latency SLO with an objective between 90% and 99.99% over a rolling 7- or 30-day window. Latency thresholds are limited to the gateway histogram bucket bounds so attainment is exact. An app can hold at most 10 SLOs.",
        "tags": [
          "apps"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSLORequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The SLO was created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SLOResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The app already has an SLO with this name.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The app is at its SLO cap; the problem carries limit and observed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/slos/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "SLO identifier returned when the SLO was created.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getSLO",
        "summary": "Get one customer-defined SLO and its error budget",
        "description": "Returns one SLO definition with its status: attainment and budget remaining over the window from hourly history, and live 1h/6h burn rates. An id belonging to another app returns 404.",
        "tags": [
          "apps"
        ],
        "responses": {
          "200": {
            "description": "The SLO definition.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SLOResponse"
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteSLO",
        "summary": "Delete a customer-defined SLO",
        "description": "Removes the SLO and frees a slot against the per-app cap.",
        "tags": [
          "apps"
        ],
        "responses": {
          "204": {
            "description": "The SLO was deleted."
          }
        }
      }
    },
    "/v1/apps/{slug}/synthetics": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "operationId": "listSyntheticChecks",
        "summary": "List the app's synthetic checks",
        "description": "Returns every scheduled HTTP check defined on the app, name-ordered.",
        "tags": [
          "apps"
        ],
        "responses": {
          "200": {
            "description": "The app's synthetic checks.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SyntheticCheckResponse"
                  }
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "createSyntheticCheck",
        "summary": "Define a synthetic check on the app",
        "description": "Schedules a GET or HEAD request to a path on the app's own hostname every 5, 15, or 60 minutes, through the public edge. A probe that wakes a parked app is billed like any request. An app can have at most 5 checks.",
        "tags": [
          "apps"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSyntheticCheckRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The check was created and will run within one interval.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SyntheticCheckResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The app already has a synthetic check with this name.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The app is at its synthetic check cap; the problem carries limit and observed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/synthetics/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Synthetic check identifier returned when the check was created.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getSyntheticCheck",
        "summary": "Get one synthetic check and its recent results",
        "description": "Returns one check definition with 24-hour and 7-day uptime, 24-hour p95 latency, and the last 20 runs. An id belonging to another app returns 404.",
        "tags": [
          "apps"
        ],
        "responses": {
          "200": {
            "description": "The check definition.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SyntheticCheckResponse"
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "patch": {
        "operationId": "updateSyntheticCheck",
        "summary": "Pause or resume a synthetic check",
        "description": "Sets whether the check runs. To change its path, schedule or expectations, delete and recreate it.",
        "tags": [
          "apps"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSyntheticCheckRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated check.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SyntheticCheckResponse"
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteSyntheticCheck",
        "summary": "Delete a synthetic check",
        "description": "Removes the check and its run history.",
        "tags": [
          "apps"
        ],
        "responses": {
          "204": {
            "description": "The check was deleted."
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/pre-auth-observations": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppPreAuthObservations",
        "summary": "Observe-mode decisions for each configured pre-auth policy.",
        "description": "Read-only security telemetry, available on every app plan. Each policy\nreports how often observe mode would have blocked a request and the\nfinal response class of those requests. A 2xx response is a possible\nfalse-positive signal, not proof that the requester was legitimate.\nRoute policy IDs are bounded slots (route_0..route_15 and\nfailures_0..failures_15). Reordering or replacing routes within the\nrequested range can mix counts from different configurations;\nuse a window after the last policy edit. Empty counts may mean no\ntraffic. On Prometheus failure,\nsource starts with `degraded:` and counts are zero.\n",
        "parameters": [
          {
            "name": "range",
            "in": "query",
            "description": "Time window for the returned policy observations. Defaults to five minutes.",
            "schema": {
              "type": "string",
              "enum": [
                "5m",
                "15m",
                "1h",
                "6h",
                "24h",
                "7d",
                "15d"
              ],
              "default": "5m"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Per-policy shadow decisions and final response classes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreAuthObservationsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/edge-protection": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppEdgeProtection",
        "summary": "Summarize what the edge rejected for an app.",
        "description": "Read-only security telemetry from the per-app gateway counters that\nthe edge security alert presets evaluate: pre-auth source-limit\ndecisions, kind=validate mismatches by mode, and requests answered by\nthe other edge gates (JWT, IP, geo, ingress, body limits, throttles)\nby gate and status. On Prometheus failure, source starts with\n`degraded:` and counts are zero.\n",
        "parameters": [
          {
            "name": "range",
            "in": "query",
            "description": "Time window. Defaults to one hour.",
            "schema": {
              "type": "string",
              "enum": [
                "5m",
                "15m",
                "1h",
                "6h",
                "24h",
                "7d",
                "15d"
              ],
              "default": "1h"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Edge rejection counts for the range.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EdgeProtectionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/edge-protection/attack-mode": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "getAppEdgeAttackMode",
        "summary": "Read an app's attack mode.",
        "responses": {
          "200": {
            "description": "The app's attack mode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EdgeAttackModeStatus"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "put": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "enableAppEdgeAttackMode",
        "summary": "Switch attack mode on, or extend it.",
        "description": "Challenges every request to every host of the app until it ends. Available on every plan, outside the plan's\nedge-rule quotas. The response returns once the serving gateways\nhave applied it; `X-Faas-Edge-Rules-State: converging` with 503 means it\nwas saved but not yet acknowledged. An empty body applies the\ndefault duration of one hour.\n",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnableEdgeAttackModeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Attack mode is on.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EdgeAttackModeStatus"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "disableAppEdgeAttackMode",
        "summary": "Switch attack mode off.",
        "description": "Removes the attack-mode rule. Succeeds when attack mode is already off.",
        "responses": {
          "200": {
            "description": "Attack mode is off.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EdgeAttackModeStatus"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/release-review": {
      "get": {
        "operationId": "getAppReleaseReview",
        "summary": "Read an atomic app configuration and release review",
        "tags": [
          "apps"
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug for release review.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "description": "Registered named environment in the app's project; omit for default.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9-]{0,32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Configuration and selected-scope release identities for reviewed staging",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppReleaseReview"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/health": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "environment",
          "in": "query",
          "required": false,
          "description": "Registered app environment whose serving health is observed; omit for its default environment.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,32}$"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppHealth",
        "summary": "Explain observed app serving health.",
        "description": "Read-only assessment of selected-scope HTTP serving deployments,\nreplica readiness, node evidence and the last 5 minutes of request\ntelemetry scoped to current traffic-bearing releases in the selected scope. It never wakes\nor probes a workload. Structural evidence is available on every plan;\nrequest telemetry follows the existing Hobby+ metrics entitlement.\nMissing, failed, stale or truncated evidence cannot confirm health.\nA failed latest release does not erase older serving evidence.\nScale-to-zero idle is expected when no warm replicas are required.\nWorker and job execution health is not assessed.\nRequires apps:read or admin scope. No MFA required.\n",
        "responses": {
          "200": {
            "description": "Evidence assessment, including unknown checks.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppHealthResponse"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Read scope required.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "App not found for this account.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/status": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "environment",
          "in": "query",
          "required": false,
          "description": "Registered app environment whose conditions are read; omit for its default environment.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,32}$"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppStatus",
        "summary": "Read an app's conditions.",
        "description": "Preview (resource-conditions capability). The app's Ready,\nProgressing and Degraded conditions, derived when read\nfrom the same evidence as GET /v1/apps/{slug}/health and never\nstored. It never wakes or probes a workload. An idle app that scales\nto zero is Ready=True with reason idle. A terminal condition will not\nchange without a new request. Requires apps:read or admin scope. No\nMFA required. Cache-Control no-store.\n",
        "responses": {
          "200": {
            "description": "The app's conditions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResourceStatus"
                }
              }
            }
          },
          "default": {
            "description": "Missing sign-in or read scope, an app this account does not own, the capability turned off, or the rate limit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/labels": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "patch": {
        "tags": [
          "apps"
        ],
        "operationId": "updateAppLabels",
        "summary": "Set and remove an app's labels.",
        "description": "Preview (resource-labels capability). Sets and removes labels in one\natomic write and returns every label the app carries after it. The\nwrite is idempotent. A result over 32 labels is refused with\nlabel_limit_exceeded; an invalid key or value with invalid_label_key\nor invalid_label_value; a key under gregale.dev/ with\nreserved_label_key. Emits a resource.labels.changed audit event.\nRequires apps:deploy or admin scope and MFA. While the capability is\non, GET /v1/apps and GET /v1/apps/{slug} include each app's labels,\nand GET /v1/apps and GET /v1/domains take ?selector=, a Kubernetes\nlabel selector such as team=billing,tier in (web,api),!canary (=,\n==, !=, key, !key, in, notin; at most 4096 bytes); a domain matches\nthrough its app. An invalid selector is a 400\ninvalid_label_selector, and a selector while the capability is off\na 403 capability_not_released. These fields join the GA\ndescription of those routes when the capability does.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LabelChange"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The app's labels after the write.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LabelsResponse"
                }
              }
            }
          },
          "default": {
            "description": "An invalid change, missing sign-in, deploy scope or MFA, an app this account does not own, the capability turned off, or the rate limit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/health/history": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listAppHealthHistory",
        "summary": "Read recorded app health changes.",
        "description": "Requires apps:read or admin; no MFA required. Background collection\nrecords default HTTP serving assessments independently of dashboard\nreads, without waking or probing workloads. Baseline, meaningful\nchanges and expired-evidence gaps are newest first. Times describe\nobservations or evidence expiry, not exact incident start/end times.\nRetains up to 100 entries within 4 MiB and 30 days per app; each entry\nis bounded to 64 KiB. Missing, foreign, aged or pruned cursors return\n404. Latest retains its original time; collector_fresh is false when\nunavailable or expired. Reads never create or refresh stored evidence.\n",
        "parameters": [
          {
            "name": "limit",
            "description": "Maximum number of retained observations to return.",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "before",
            "in": "query",
            "description": "ID of the last retained entry from the preceding page.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Recorded observations and collection freshness; Cache-Control no-store.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppHealthHistoryPage"
                }
              }
            }
          },
          "default": {
            "description": "Invalid page parameters, access denial, missing cursor, or unavailable storage.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/changes": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppChangeTimeline",
        "summary": "Read an app's change timeline.",
        "description": "Internal preview, enabled by `FAAS_CHANGE_TIMELINE_ENABLED=1`;\notherwise 403 `change_timeline_unavailable`. Requires apps:read or\nadmin; no MFA required.\n\nMerges deployment audit, edge-rule changes, the latest runtime-config\nchange, route incidents, recorded health transitions, and environment\nand domain activity into one newest-first list. The window defaults to\nthe last 24 hours, `until` is clamped to now, and the window is at most\n7 days. At most 200 events are returned (`truncated: true` when more\nexist). A source that cannot be read is named in `unavailable_sources`\nand the remaining sources are still returned. Summaries never contain\nvalues, credentials, actors, or raw error text.\n",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "description": "Window start (RFC 3339). Defaults to 24 hours before until.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "until",
            "in": "query",
            "description": "Window end (RFC 3339), exclusive. Defaults to and is clamped to now.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The change timeline; Cache-Control no-store.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppChangeTimelineResponse"
                }
              }
            }
          },
          "default": {
            "description": "Invalid window, access denial, or the preview is disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/log-events": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "observability"
        ],
        "operationId": "searchAppLogEvents",
        "summary": "Search an app's log events.",
        "description": "Internal preview, enabled by\n`FAAS_LOG_SEARCH_ENABLED=1`; otherwise 403 `log_search_unavailable`.\nRequires apps:read or admin.\n\nReturns one newest-first page of the app's log ledger. Filters\ncombine with AND. A text search (`q`) covers at most 24 hours and\nanswers 400 `log_search_window_too_large` beyond that; every search\nruns under a 5 second statement timeout and answers 503\n`log_search_timeout` when it trips. An account runs at most 2 log\nreads at once; a read that waits over 2 seconds for one answers 429\n`log_reads_busy` with Retry-After. Pass `next_cursor` back as\n`cursor` for the following page.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/LogSearchSince"
          },
          {
            "$ref": "#/components/parameters/LogSearchUntil"
          },
          {
            "$ref": "#/components/parameters/LogSearchSource"
          },
          {
            "$ref": "#/components/parameters/LogSearchLevel"
          },
          {
            "$ref": "#/components/parameters/LogSearchRoute"
          },
          {
            "$ref": "#/components/parameters/LogSearchStatus"
          },
          {
            "$ref": "#/components/parameters/LogSearchDeployment"
          },
          {
            "$ref": "#/components/parameters/LogSearchRequest"
          },
          {
            "$ref": "#/components/parameters/LogSearchTrace"
          },
          {
            "$ref": "#/components/parameters/LogSearchText"
          },
          {
            "$ref": "#/components/parameters/LogSearchSaved"
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Page size.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "The next_cursor of the previous page.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of matching events.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LogEventsResponse"
                }
              }
            }
          },
          "default": {
            "description": "Invalid filters, a window over its bound, a timeout, or the preview is disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/log-events/facets": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "observability"
        ],
        "operationId": "getAppLogEventFacets",
        "summary": "Count an app's log events by facet.",
        "description": "Internal preview behind `FAAS_LOG_SEARCH_ENABLED=1`.\nTakes the same filters as the search and counts the matches by\nsource, level, status class, and the ten busiest routes. Counts sum\neach event's occurrences. The window is at most 7 days.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/LogSearchSince"
          },
          {
            "$ref": "#/components/parameters/LogSearchUntil"
          },
          {
            "$ref": "#/components/parameters/LogSearchSource"
          },
          {
            "$ref": "#/components/parameters/LogSearchLevel"
          },
          {
            "$ref": "#/components/parameters/LogSearchRoute"
          },
          {
            "$ref": "#/components/parameters/LogSearchStatus"
          },
          {
            "$ref": "#/components/parameters/LogSearchDeployment"
          },
          {
            "$ref": "#/components/parameters/LogSearchRequest"
          },
          {
            "$ref": "#/components/parameters/LogSearchTrace"
          },
          {
            "$ref": "#/components/parameters/LogSearchText"
          },
          {
            "$ref": "#/components/parameters/LogSearchSaved"
          }
        ],
        "responses": {
          "200": {
            "description": "Facet counts for the window.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LogEventFacetsResponse"
                }
              }
            }
          },
          "default": {
            "description": "Invalid filters, a window over 7 days, a timeout, or the preview is disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboards": {
      "get": {
        "tags": [
          "observability"
        ],
        "operationId": "listDashboards",
        "summary": "List the account's custom dashboards.",
        "description": "Internal preview behind `FAAS_CUSTOM_DASHBOARDS_ENABLED=1`.\nReturns the account's saved dashboards by name.\n",
        "responses": {
          "200": {
            "description": "The account's dashboards.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DashboardsResponse"
                }
              }
            }
          },
          "default": {
            "description": "The preview is disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "observability"
        ],
        "operationId": "createDashboard",
        "summary": "Create a custom dashboard.",
        "description": "Saves a named dashboard of up to 24 widgets. Each widget references a\nsignal by kind (app_metric, log_count, custom_metric, slo) and an app\nthe account owns. An account keeps at most 20 dashboards.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DashboardRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created dashboard, with widget defaults applied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Dashboard"
                }
              }
            }
          },
          "default": {
            "description": "Invalid widgets, a taken name (dashboard_name_taken), the per-account limit (dashboard_quota_exceeded), or the preview is disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboards/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/DashboardID"
        }
      ],
      "get": {
        "tags": [
          "observability"
        ],
        "operationId": "getDashboard",
        "summary": "Get a custom dashboard.",
        "description": "Returns one of the account's dashboards with its widgets.",
        "responses": {
          "200": {
            "description": "The dashboard.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Dashboard"
                }
              }
            }
          },
          "default": {
            "description": "No such dashboard (dashboard_not_found), or the preview is disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "observability"
        ],
        "operationId": "replaceDashboard",
        "summary": "Replace a custom dashboard.",
        "description": "Replaces the dashboard's name and widgets.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DashboardRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The replaced dashboard.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Dashboard"
                }
              }
            }
          },
          "default": {
            "description": "Invalid widgets, a taken name, no such dashboard, or the preview is disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "observability"
        ],
        "operationId": "deleteDashboard",
        "summary": "Delete a custom dashboard.",
        "description": "Deletes one of the account's dashboards.",
        "responses": {
          "204": {
            "description": "The dashboard is deleted."
          },
          "default": {
            "description": "No dashboard to delete (dashboard_not_found), or the preview is disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboards/{id}/data": {
      "parameters": [
        {
          "$ref": "#/components/parameters/DashboardID"
        }
      ],
      "get": {
        "tags": [
          "observability"
        ],
        "operationId": "getDashboardData",
        "summary": "Read a custom dashboard's widgets.",
        "description": "Resolves every widget for its window through the code behind the\nper-app endpoints: request metrics, log search counts, pushed custom\nmetrics and SLO status. A widget that cannot be read carries `error`\nand no value; the rest still resolve. An account reads at most two\ndashboards at once; a third read is refused with 429\n`dashboard_data_busy` and `Retry-After`.\n",
        "responses": {
          "200": {
            "description": "The resolved widgets.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DashboardData"
                }
              }
            }
          },
          "default": {
            "description": "No dashboard to read widgets for (dashboard_not_found), two reads of the account's dashboards already in progress (dashboard_data_busy), or the preview is disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/incidents": {
      "get": {
        "tags": [
          "observability"
        ],
        "operationId": "listIncidents",
        "summary": "List the account's incidents.",
        "description": "Internal preview behind `FAAS_INCIDENTS_ENABLED=1`.\nOne list of alert rule firing periods, route monitor incidents and\nplatform incidents from the status page: everything open plus what\nresolved since `since`, open first, then newest first, at most 100.\nEach entry says who in the account acknowledged it. A source that\ncannot be read (including `acknowledgements`) is named in\n`unavailable_sources`.\n",
        "parameters": [
          {
            "name": "app",
            "in": "query",
            "required": false,
            "description": "Keep one app's incidents (platform incidents always show).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "`open` lists open incidents only; `all` (the default) adds resolved ones.",
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "all"
              ]
            }
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "description": "RFC 3339; resolved incidents from here on. Default 7 days ago, at most 30.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The incidents.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IncidentsResponse"
                }
              }
            }
          },
          "default": {
            "description": "An invalid query, an unknown app, or the preview is disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/incidents/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/IncidentID"
        }
      ],
      "get": {
        "tags": [
          "observability"
        ],
        "operationId": "getIncident",
        "summary": "Read an incident and its evidence.",
        "description": "The incident with what the platform has for it: an alert's\nnotifications and the log context its newest one carried, a platform\nincident's status updates, for an app incident the app's change\ntimeline from an hour before it opened until it resolved, and the\naccount's acknowledgement and notes.\n",
        "responses": {
          "200": {
            "description": "The incident.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IncidentDetail"
                }
              }
            }
          },
          "default": {
            "description": "No such incident (incident_not_found), or the preview is disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/incidents/{id}/acknowledge": {
      "parameters": [
        {
          "$ref": "#/components/parameters/IncidentID"
        }
      ],
      "post": {
        "tags": [
          "observability"
        ],
        "operationId": "acknowledgeIncident",
        "summary": "Acknowledge an open incident.",
        "description": "Records that someone in the account took the incident on. An\naccount acknowledges an incident once; acknowledging again returns\nthe first acknowledgement with 200. Acknowledging does not change\nwhat an alert rule sends.\n",
        "responses": {
          "200": {
            "description": "The account's existing acknowledgement.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IncidentNote"
                }
              }
            }
          },
          "201": {
            "description": "The new acknowledgement.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IncidentNote"
                }
              }
            }
          },
          "default": {
            "description": "No such incident (incident_not_found), a resolved incident (incident_resolved), the per-incident note limit (incident_notes_limit), or the preview is disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/incidents/{id}/notes": {
      "parameters": [
        {
          "$ref": "#/components/parameters/IncidentID"
        }
      ],
      "post": {
        "tags": [
          "observability"
        ],
        "operationId": "addIncidentNote",
        "summary": "Add a note to an incident.",
        "description": "Appends a note to an open or resolved incident. Notes cannot be\nedited or deleted. A note is at most 2000 characters, and an\nincident holds at most 100 notes from an account, its\nacknowledgement included.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IncidentNoteRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The note.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IncidentNote"
                }
              }
            }
          },
          "default": {
            "description": "An empty or too long note, no such incident (incident_not_found), the per-incident note limit (incident_notes_limit), or the preview is disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/log-searches": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "observability"
        ],
        "operationId": "listAppLogSavedSearches",
        "summary": "List an app's saved log searches.",
        "description": "Internal preview behind `FAAS_LOG_SEARCH_ENABLED=1`.\nReturns the app's saved searches by name. Each holds filters only;\na search, the dashboard or an alert brings its own window.\n",
        "responses": {
          "200": {
            "description": "The app's saved searches.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LogSavedSearchesResponse"
                }
              }
            }
          },
          "default": {
            "description": "Unknown app, or the preview is disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/log-searches/{name}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/LogSavedSearchName"
        }
      ],
      "put": {
        "tags": [
          "observability"
        ],
        "operationId": "putAppLogSavedSearch",
        "summary": "Create a saved log search or replace its filters.",
        "description": "Stores the query canonically: only source, level, status, route,\ndeployment_id, request_id, trace_id and q, one value each. An app\nkeeps at most 25 saved searches; replacing one never counts.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LogSavedSearchRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The stored saved search.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LogSavedSearch"
                }
              }
            }
          },
          "default": {
            "description": "Invalid name or filters, the per-app limit (log_saved_search_quota_exceeded), or the preview is disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "observability"
        ],
        "operationId": "deleteAppLogSavedSearch",
        "summary": "Delete a saved log search.",
        "description": "Deletes the app's saved search by name.",
        "responses": {
          "204": {
            "description": "The saved search is deleted."
          },
          "default": {
            "description": "No such saved search (log_saved_search_not_found), or the preview is disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/metrics": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppMetrics",
        "summary": "Per-app request metrics.",
        "description": "Time-windowed rollup of one app's gateway activity. The `range`\nparameter is a closed vocabulary bounded by Prometheus\nretention (`prom_retention_days: 15`):\n\n  `5m` (default) | `15m` | `1h` | `6h` | `24h` | `7d` | `15d`\n\nWake latency (`wake_p95_ms`) is the FLEET p95\n(`gateway_wake_latency_seconds` is unlabeled). On Prometheus\nfailure the endpoint returns 200 with zeroed fields and\n`source: \"degraded: <reason>\"`, matching the public status\npage contract.\n",
        "parameters": [
          {
            "name": "range",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "5m",
                "15m",
                "1h",
                "6h",
                "24h",
                "7d",
                "15d"
              ],
              "default": "5m"
            },
            "description": "Time window. Default `5m`."
          }
        ],
        "responses": {
          "200": {
            "description": "The metrics snapshot.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppMetricsResponse"
                },
                "example": {
                  "app_id": "0123456789abcdef0123456789abcdef",
                  "range": "5m",
                  "source": "prometheus",
                  "as_of": "2026-07-28T13:00:00Z",
                  "request_count": 142,
                  "latency_p50_ms": 12.4,
                  "latency_p95_ms": 87.3,
                  "latency_p99_ms": 412.5,
                  "error_rate_pct": 0.7,
                  "cold_start_pct": 8.5,
                  "wake_p95_ms": 380.2,
                  "wakes_24h": 47
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Plan does not unlock the per-app metrics surface. Free\nplan — Hobby or above required. The gate runs BEFORE\n`loadApp` so a Free customer probing a slug never gets a\n404 (slug-leak guard).\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                },
                "example": {
                  "type": "https://gregale.dev/docs/errors/plan_per_app_metrics_not_allowed",
                  "title": "Per-app metrics unavailable on this plan",
                  "status": 402,
                  "code": "plan_per_app_metrics_not_allowed",
                  "detail": "the free plan does not include per-app metrics; upgrade to Hobby or above.",
                  "docs_url": "https://gregale.dev/docs/plans#per-app-metrics"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/wake-timeline": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppWakeTimeline",
        "summary": "Per-app wake timeline (JSON mirror of the dashboard page).",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Inclusive RFC3339 lower bound; defaults to 24 hours before until."
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Inclusive RFC3339 upper bound; defaults to now."
          },
          {
            "name": "pagination",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "keyset_v1"
              ]
            },
            "description": "Opt in to window-first keyset paging. Legacy reads select 100 recent instance candidates before time filtering."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "description": "Page size in keyset_v1 mode only; legacy requests ignore this parameter."
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 2048
            },
            "description": "Opaque page.next_cursor. Repeat original normalized since/until and limit with keyset_v1. Bound to account and immutable app; grants no authority."
          }
        ],
        "description": "Wire-friendly mirror of the dashboard's per-app wake-timeline\nHTML page (`/dashboard/apps/{slug}/wake-timeline`).\nThe HTML page keeps its pre-rendered HTML chips; this endpoint\nemits the same data as JSON so a separate frontend agent can\nrender without re-parsing HTML.\n\nLegacy requests select 100 recent candidates before time filtering, joined\nagainst the events table's `wake.boot_started` rows for the\nper-row telemetry (Trigger, QueuedCount, ConcurrencyAtAdmit,\nAtCapacity, ReadyInMS). The aggregation math is shared with\nthe HTML page:\n\n  - 24h cutoff descending-break: the moment a row's\n    `started_at` falls before the trailing-24h instant, the\n    loop breaks (no further iteration). Older\n    rows with no `started_at` are not eligible for the break\n    (always in scope).\n  - Two-denominator rule for `at_capacity_pct`: numerator is\n    the count of rows where the events join succeeded AND\n    the at_capacity flag is true; denominator is the count\n    of rows where the events join succeeded\n    (`wake_count_with_meta`). Older rows contribute\n    to `wake_count_24h` but not the denominator — same\n    posture as the HTML page.\n\nOpt-in keyset_v1 filters app and inclusive since/until before limiting\nand seeking in descending (started_at, instance ID) order. Missing\nstart times are excluded. Bounds normalize to PostgreSQL microseconds;\ndefault until resolves once to now and must not be in the future.\nsince must precede until. Repeat the original bounds/limit on every\npage. Boot and completion metadata are app-scoped. Source failures\nreturn errors, not successful empty/partial results. Page metadata\nechoes selection and cursor; counts/histograms describe this page\nonly. Complete marks the end of this live retained read, not complete\ncapture or a snapshot. Inserts, retention and metadata can affect pages.\n\nPlan-gated Hobby+ (mirror of /v1/apps/{slug}/metrics —\nsame `code` so a downgrade between the two endpoints flips\nboth at once).\n",
        "responses": {
          "200": {
            "description": "The wake-timeline snapshot.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppWakeTimelineResponse"
                },
                "example": {
                  "app": {
                    "app_id": "0123456789abcdef0123456789abcdef",
                    "slug": "my-api"
                  },
                  "wake_count_24h": 24,
                  "wake_count_with_meta": 20,
                  "at_capacity_count": 3,
                  "at_capacity_pct": 15,
                  "trigger_histogram": {
                    "manual.cron": 8,
                    "manual.api": 7,
                    "scheduled.idle": 5
                  },
                  "rows": [
                    {
                      "kind": "wake.boot_started",
                      "state": "RUNNING",
                      "at": "2026-07-28T13:00:00Z",
                      "trigger": "manual.api",
                      "queued_count": 0,
                      "concurrency_at_admit": 2,
                      "at_capacity": false,
                      "at_capacity_present": true,
                      "ready_in_ms": 342
                    },
                    {
                      "kind": "wake.boot_started",
                      "state": "RUNNING",
                      "at": "2026-07-28T12:58:11Z",
                      "at_capacity": false,
                      "at_capacity_present": false,
                      "ready_in_ms": -1
                    }
                  ],
                  "as_of": "2026-07-28T13:00:00.123456Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Plan does not unlock the per-app wake-timeline. Free plan —\nHobby or above required. Same code as /v1/apps/{slug}/metrics\n(plan_per_app_metrics_not_allowed) so a single downgrade\nflips both endpoints at once.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                },
                "example": {
                  "type": "https://gregale.dev/docs/errors/plan_per_app_metrics_not_allowed",
                  "title": "Per-app metrics unavailable on this plan",
                  "status": 402,
                  "code": "plan_per_app_metrics_not_allowed",
                  "detail": "the free plan does not include per-app metrics; upgrade to Hobby or above.",
                  "docs_url": "https://gregale.dev/docs/plans#per-app-metrics"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/usage": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppUsage",
        "summary": "Per-app billing usage summary (trailing 30d by default).",
        "description": "Customer-facing billing rollup for one app over a caller-\nsupplied window (default: trailing 30d, clamped at 90d upper\nbound). Plan-gated Hobby+ — Free gets 402\n`plan_app_usage_summary_not_allowed`.\n\nWindow resolution: `since` and `until` are RFC3339 timestamps.\nBoth default to UTC midnight snaps; `until` defaults to\n`now` snapped down, `since` defaults to `until - 30d`. The\nhandler clamps `since` to `until - 90d` so a customer cannot\nunbounded-scan `usage_minutes` (retention is 30d; the\n90d ceiling is a forward-compatibility ceiling for when\n`usage_daily` lands).\n\nOverage computation: `overage_gb_hours = max(0, gb_hours -\nplan_included_gb_hours)`. The included band is echoed from\n`acct.Plan.PlanIncludedGBHours`; the overage figure is the\ninteger-rounded float the Stripe pusher bills at $0.05/GB-h.\n\nSource: `usage_minutes` today (after the 30d retention cap).\n`usage_daily` / `mixed` land with the trail-period reader\nfollow-up — same wire shape, no migration needed.\n",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "RFC3339 lower bound. Default: `until - 30d`."
          },
          {
            "name": "until",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "RFC3339 upper bound. Default: `now()` snapped to UTC midnight."
          }
        ],
        "responses": {
          "200": {
            "description": "The usage summary.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppUsageSummaryResponse"
                },
                "example": {
                  "slug": "my-api",
                  "period_start": "2026-07-28T00:00:00Z",
                  "period_end": "2026-08-27T00:00:00Z",
                  "mb_seconds": 4194304000,
                  "gb_hours": 1.135417,
                  "requests": 8421,
                  "tx_bytes": 94371840,
                  "builder_seconds": 192.5,
                  "cold_boot_count": 14,
                  "plan_included_gb_hours": 50,
                  "overage_gb_hours": 0,
                  "source": "usage_minutes",
                  "as_of": "2026-08-27T13:00:00.123456Z"
                }
              }
            }
          },
          "400": {
            "description": "Invalid window — `since`/`until` not RFC3339, or `since`\nlater than `until`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Plan does not unlock the per-app usage summary. Free\nplan — Hobby or above required. Same posture as the\nother per-app observability surfaces; the gate runs\nBEFORE `loadApp` so a Free customer probing a slug\nnever gets a 404 (slug-leak guard).\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                },
                "example": {
                  "type": "https://gregale.dev/docs/errors/plan_app_usage_summary_not_allowed",
                  "title": "Per-app usage summary unavailable on this plan",
                  "status": 402,
                  "code": "plan_app_usage_summary_not_allowed",
                  "detail": "the free plan does not include the per-app usage summary; upgrade to Hobby or above.",
                  "docs_url": "https://gregale.dev/docs/plans#usage-summary"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/analytics": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppRequestAnalytics",
        "summary": "Aggregated historical request analytics.",
        "description": "Returns an aggregate request overview for one app: total requests,\nerrors, cold boots, weighted p50/p95/p99 latency, and the top\nroute/method combinations, or a bounded top-N grouping by country,\nreferrer host, client family, status, or stable API consumer identity. This is the customer analytics surface;\nrequest identifiers and trace payloads remain on the debugger routes.\n\n`since` accepts a duration such as `24h` or `7d` and defaults to\n`24h`. The effective window is clamped to the plan's\n`DebugTelemetryRetentionDays` (Hobby 3d, Pro 7d, Scale 14d).\n`window_clamped` tells callers when the requested lookback was wider\nthan the retained telemetry. The response contains at most 50 route\nrows; `routes_truncated` indicates that more routes matched.\n\nCounts and percentiles include the recorder's collapsed row `count`,\nso the result represents original requests rather than stored rows.\nRoute groups also include cold-request p95 and platform-runner guest\nexecution wall-time percentiles when available, p95 time from\n`wake.boot_started` to `wake.boot_completed` for correlated route wakes,\nplus bounded sampled dependency span timings for platform-classified dependencies. The\ndependency values are not complete call counts; `dependencies_truncated`\nmarks row or cardinality caps. CPU time and route memory peaks are not\ninferred from these fields.\nGrouped results contain at most 50 groups plus `__other__`. Consumer\ngrouping uses the stable consumer UUID and reports anonymous traffic\nas `__anonymous__`. Only a normalized User-Agent family, hostname-only\nreferrer, and country code are stored; no IP, cookie, script, raw\nUser-Agent, or full URL is used.\nThe endpoint is read-only, IDOR-safe, and plan-gated by\n`DebugTelemetryEnabled`.\n",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "24h"
            },
            "description": "Lookback duration (`24h`, `3d`, `7d`) or RFC3339 start timestamp. Defaults to `24h` and is retention-clamped."
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Optional RFC3339 upper-bound timestamp for the historical window. It must be within the plan's telemetry retention, counted back from now."
          },
          {
            "name": "group_by",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "route",
                "country",
                "referrer_host",
                "ua_family",
                "status",
                "consumer_id"
              ],
              "default": "route"
            },
            "description": "Bounded top-N grouping dimension. Defaults to route."
          }
        ],
        "x-since": "2026-09",
        "responses": {
          "200": {
            "description": "Aggregated request analytics.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RequestAnalyticsResponse"
                },
                "example": {
                  "slug": "my-api",
                  "since": "24h",
                  "from": "2026-09-04T13:00:00.123456Z",
                  "until": "2026-09-05T13:00:00.123456Z",
                  "window_clamped": false,
                  "requests": 8421,
                  "error_requests": 37,
                  "error_rate_pct": 0.4394,
                  "cold_boots": 14,
                  "p50_ms": 12,
                  "p95_ms": 87,
                  "p99_ms": 412,
                  "routes": [
                    {
                      "route": "/users",
                      "method": "GET",
                      "requests": 4200,
                      "error_requests": 12,
                      "error_rate_pct": 0.2857,
                      "cold_boots": 5,
                      "p50_ms": 9,
                      "p95_ms": 54,
                      "p99_ms": 180
                    }
                  ],
                  "routes_limit": 50,
                  "routes_truncated": false,
                  "as_of": "2026-09-05T13:00:00.123456Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/analytics/route-customers": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppRouteCustomerUsage",
        "summary": "Observed customer usage by route and deployment.",
        "description": "Returns retained route usage for one immutable deployment owned by the\napp. Consumer and platform-tenant identities come from request-time\ntelemetry; current consumer-to-tenant links are never used to infer\nhistorical attribution. Identity ownership is checked against the app\nand account. Revoked customers remain part of historical observations.\n\nCounts include collapsed row weights. The top 200 route/method rows\neach contain at most 20 identity groups, ordered by observed requests.\nDistinct consumer and tenant counts precede these caps and overlap;\ndo not add them together. Omitted customer requests and truncation flags\nremain explicit. Anonymous and unresolved identities are separate.\nObservation timestamps may represent minute buckets.\n\nCoverage is always observed_only: disabled recording, sampling, dropped\nevents and expired telemetry prevent proof of complete customer exposure\nor that an unobserved route is unused. Route usage does not establish\nwhich clients will break. No customer names, external references,\ncredentials, payloads, query strings or request identifiers are returned.\nThis read uses the normal read scopes and DebugTelemetryEnabled plan gate.\n",
        "parameters": [
          {
            "name": "deployment_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Immutable deployment UUID owned by this app; missing or foreign deployments return 404."
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "24h"
            },
            "description": "Positive lookback duration or RFC3339 start timestamp; clamped to current plan retention."
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Exclusive upper bound, default now; must be within current retained telemetry and not in the future."
          }
        ],
        "x-since": "2026-10",
        "responses": {
          "200": {
            "description": "Observed route customer exposure for the selected deployment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteCustomerUsageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/analytics/timeseries": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppRequestAnalyticsTimeseries",
        "summary": "Request analytics time series by hour.",
        "description": "Returns zero-filled UTC hourly buckets for customer request analytics.\nEach bucket contains request and error counts, error rate, cold boots,\nand weighted p50/p95/p99 latency. The window is half-open [since, until)\nand is clamped to the plan's DebugTelemetryRetentionDays.\n\n`since` accepts a duration such as `24h` or `7d`, or an RFC3339 start\ntimestamp. `until` is an optional RFC3339 exclusive upper bound and\ndefaults to now. The endpoint is read-only, IDOR-safe, and plan-gated\nby `DebugTelemetryEnabled`.\nSet `group_by` to country, referrer_host, ua_family, status, or consumer_id to\nreceive zero-filled series for the top 50 groups plus `__other__`.\n",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "24h"
            },
            "description": "Lookback duration or RFC3339 start timestamp. Defaults to `24h`."
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Exclusive end timestamp; omitted means current server time. It must be within the plan's telemetry retention, counted back from now."
          },
          {
            "name": "route",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 256
            },
            "description": "Exact bounded route label to drill into (for example `GET /users/{id}`). Must be provided together with `method`; omitted means all routes."
          },
          {
            "name": "method",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "GET",
                "POST",
                "PUT",
                "PATCH",
                "DELETE",
                "HEAD",
                "OPTIONS",
                "OTHER"
              ]
            },
            "description": "Exact HTTP method for the selected route. Must be provided together with `route`; omitted means all methods."
          },
          {
            "name": "group_by",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "route",
                "country",
                "referrer_host",
                "ua_family",
                "status",
                "consumer_id"
              ]
            },
            "description": "Return grouped series for the selected dimension. Omitted preserves the app-wide points shape; route/method filters require group_by=route or omission."
          }
        ],
        "x-since": "2026-09",
        "responses": {
          "200": {
            "description": "Zero-filled hourly request analytics buckets.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RequestAnalyticsTimeseriesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/routes": {
      "parameters": [
        {
          "name": "environment",
          "in": "query",
          "schema": {
            "type": "string"
          },
          "description": "Registered named environment; mutually exclusive with scope."
        },
        {
          "name": "scope",
          "in": "query",
          "schema": {
            "type": "string",
            "enum": [
              "default"
            ]
          },
          "description": "Explicit default scope. Omitting both selectors retains legacy aggregation."
        },
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppRoutes",
        "summary": "Per-route breakdown for opt-in apps.",
        "description": "Returns the `routes` array of the per-app metrics surface.\nProduction reads the fleet Prometheus aggregate; single-box\ndevelopment may use the gateway loopback listener.\nThe array is empty when `route_metrics_enabled` is false\non the app (the gateway handler returns 200 + empty\nrows rather than 404 — the customer-facing \"feature off\"\nstate is not a 404). Labels use declared templates when available,\notherwise common numeric/UUID/long-hex segments become `{id}`.\nUnrecognized slug segments remain literal, and `__route_other__`\nmarks the per-app metrics cardinality overflow.\n",
        "responses": {
          "200": {
            "description": "The per-route rows for the app.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppRoutesResponse"
                },
                "example": {
                  "slug": "my-api",
                  "app_id": "11111111-1111-1111-1111-111111111111",
                  "routes": [
                    "GET /users",
                    "POST /orders",
                    "__route_other__"
                  ],
                  "source": "live",
                  "cap_hit": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/audit/requests": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppRequestAudit",
        "summary": "List exact gateway-observed request audit records (opt-in)",
        "description": "Requires an MFA session or an authorized API key. Records are one per\ncompleted request, not collapsed debugger buckets. Only gateway-verified\nconsumer and platform-tenant IDs are included. Application user,\nbusiness action and internal/outbound dependency calls are not inferred.\nThe trusted public-gateway source IP is included when available.\nThe default window is 24 hours; at most 31 days may be\nqueried at once. Undeclared route candidates can contain literal path\nsegments; enable collection only after reviewing this privacy tradeoff.\nExact records are removed after 30 days. The bounded list has no\ncursor export yet and is not a compliance/WORM archive.\n",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "description": "Inclusive UTC start of the audit window.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "until",
            "in": "query",
            "description": "Exclusive UTC end of the audit window.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum newest records to return.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded exact request evidence, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RequestAuditListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/discovered-routes": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppDiscoveredRoutes",
        "summary": "Persisted, bounded API route inventory",
        "description": "Returns up to 500 distinct observed method/template candidates with\nfirst/last seen times and replay-safe request counts. Discovery has\nits own operator opt-in, independent of exact request audit and its\n30-day retention. Undeclared paths can retain literal segments, so\noperators must review path privacy before enabling discovery.\n",
        "responses": {
          "200": {
            "description": "Persisted discovered route candidates.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiscoveredRoutesResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/streaming-cap": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppStreamingCap",
        "summary": "Per-app streaming classification probe.",
        "parameters": [
          {
            "name": "host",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Request host to resolve a per-edge-rule cap. Supply together\nwith `path` and `method`; omit all three for the plan-level cap.\n"
          },
          {
            "name": "path",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^/",
              "maxLength": 4096
            },
            "description": "Request path to resolve against kind=limit rules."
          },
          {
            "name": "method",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Z]+$",
              "maxLength": 32
            },
            "description": "HTTP method to resolve against kind=limit rules."
          }
        ],
        "description": "Returns the streaming-status enum (one of `streaming`,\n`accept-json-downgrade`, `flag-disabled`, `plan-disallows`,\n`operator-disabled`, `upgrade-bypass`) the gateway handler\nwould stamp on the `Streaming-Status` response header for a\nrepresentative request to this app, plus the effective\nresponse-body cap (in bytes) and the per-gate flags.\n\nWith no query parameters the probe is a pure read against the\nAPI cache (the per-account `Plan` and the per-app\n`streaming_enabled` flag). Supplying `host`, `path`, and `method`\ntogether performs a bounded loopback read of the gateway's compiled\nkind=limit rules and reports a matching streaming response cap with\n`cap_kind=\"endpoint-rule\"`. If the gateway is unavailable or no rule\nmatches, the response falls back to the plan cap.\n\nThe operator opt-in (`FAAS_GATEWAY_STREAMING` env) remains\ngateway-side state, so the canonical signal is the\n`Streaming-Status` response header on a real request, not this probe.\nA customer evaluating \"will my next request stream?\" must\nconsider the operator-side flag separately.\n\n`status=plan-disallows` means the customer's plan tier\nforbids `streaming_enabled=true`; the CreateApp gate\nalready returns 403 `CodePlanStreamingNotAllowed` so this\nrow should be unreachable from a properly-validated app,\nbut the probe still reflects the persisted state for\naudits and pinned-SDK migrations.\n",
        "responses": {
          "200": {
            "description": "The streaming classification for the app.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppStreamingStatus"
                },
                "example": {
                  "app_id": "11111111-1111-1111-1111-111111111111",
                  "status": "streaming",
                  "effective_cap_bytes": 104857600,
                  "plan_cap_bytes": 104857600,
                  "flag_enabled": true,
                  "plan_allowed": true,
                  "cap_kind": "plan"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/slo": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppSLO",
        "summary": "Per-app customer-facing SLO panel.",
        "description": "Closed-set windowed SLO panel for one app — the\ncustomer-facing equivalent of AWS CloudWatch\nper-function / GCP Cloud Run per-service. Distinct from\n`GET /v1/apps/{slug}/metrics` which\nis the 5m-window dashboard panel. The /slo surface is the\n\"yesterday's SLO\" / \"this week's SLO\" summary, with the\ncustomer-facing SLO signals co-located with the\nbilling-derivable `instance_hours` / `gb_hours` fields.\n\nThe `window` parameter is a closed vocabulary, a strict\nsubset of the /metrics range vocabulary:\n\n  `1h` | `24h` (default) | `7d`\n\n`wake_queue_p95_ms` is null and `wake_queue_sample_status` is\n`unavailable` while the wake-queue histogram lacks tenant labels. On\nPrometheus failure the endpoint returns 200 with zeroed\nfields and `source: \"degraded: <reason>\"`, matching the\npublic status page contract. When Postgres is down but\nthe PromQL pass succeeded, only `instance_hours` /\n`gb_hours` are zeroed and `source` is\n`\"degraded: postgres unavailable\"`.\n\nThis is a Hobby+ per-app observability surface. Free\naccounts receive 402 before the app slug is resolved.\n",
        "parameters": [
          {
            "name": "window",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "1h",
                "24h",
                "7d"
              ],
              "default": "24h"
            },
            "description": "Window for the per-app SLO panel. Default `24h`."
          }
        ],
        "responses": {
          "200": {
            "description": "The SLO panel.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppSLOResponse"
                },
                "example": {
                  "app_id": "0123456789abcdef0123456789abcdef",
                  "app_slug": "my-app",
                  "window": "24h",
                  "source": "prometheus",
                  "as_of": "2026-08-07T15:30:00Z",
                  "request_duration": {
                    "p50_ms": 14.2,
                    "p95_ms": 87,
                    "p99_ms": 312.5
                  },
                  "error_rate_pct": 0.41,
                  "cold_boot_rate_pct": 3.1,
                  "instance_hours": 0,
                  "gb_hours": 0,
                  "wake_queue_p95_ms": null,
                  "wake_queue_sample_status": "unavailable",
                  "requests_total": 4321,
                  "throttled_total": 0
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanPerAppMetricsNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/issue-events/otlp/{signal}": {
      "post": {
        "operationId": "ingestIssueOTLP",
        "tags": [
          "apps"
        ],
        "summary": "Ingest OTLP JSON exception events",
        "description": "Accepts bounded OTLP trace exception events or exception log records using a deployment-bound issue token. Unrelated telemetry is ignored. Deterministic event IDs permit safe retry after partial delivery. Protobuf encoding is not supported.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug owning the issue reporting scope.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "signal",
            "description": "OTLP JSON signal, either traces or logs.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "traces",
                "logs"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Exceptions accepted, including exact retries. Partial success reports permanently rejected logs or spans.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "partialSuccess": {
                      "type": "object",
                      "properties": {
                        "rejectedLogRecords": {
                          "type": "string",
                          "description": "Decimal count of rejected log records."
                        },
                        "rejectedSpans": {
                          "type": "string",
                          "description": "Decimal count of rejected spans."
                        },
                        "errorMessage": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issue-events": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "ingestIssueEvent",
        "summary": "Capture an exception using a deployment-bound issue ingest token.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IssueEvent"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Occurrence accepted or exact retry acknowledged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueEventResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issue-lifecycle-alert-policy": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getIssueLifecycleAlertPolicy",
        "summary": "Read native new-issue and regression alert filters.",
        "description": "Unconfigured apps return revision zero, all environments and zero cooldown.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Current lifecycle alert policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueLifecycleAlertPolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "apps"
        ],
        "operationId": "setIssueLifecycleAlertPolicy",
        "summary": "Replace native new-issue and regression alert filters.",
        "description": "Requires deploy-write and session MFA. Empty environments means all exact environments. The cooldown is shared across created/regressed native Slack alerts per canonical issue, across channels and teams. Zero disables throttling. Only queue admission consumes it; missing routes, capacity failures and previews do not. Edits preserve receipts and affect future events only; queued messages are unchanged. Merge uses the latest member receipt. No events are replayed. Lifecycle audit webhooks, impact/frequency alerts, reminders and tracker notifications retain their independent policies. Stale revisions return 409.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateIssueLifecycleAlertPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated policy; identical writes preserve its revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueLifecycleAlertPolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "description": "Lifecycle alert policy revision changed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issue-lifecycle-alert-policy/preview": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "previewIssueLifecycleAlert",
        "summary": "Preview a draft lifecycle alert filter without sending.",
        "description": "Requires app read access and Issues entitlement. Evaluates the supplied draft's environment filter and shared cooldown for a hypothetical created/regressed event, resolving merged aliases. Reads one database snapshot and returns the saved policy revision at that snapshot. Does not save, reserve cooldown, mutate lifecycle or contact Slack. Allowed means this policy permits the event; actual delivery separately applies native event subscription, ignore/response state, eligible routing, capacity and sender gates.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreviewIssueLifecycleAlertRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Draft policy eligibility at the preview snapshot.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueLifecycleAlertPreview"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issue-compound-alert-policy": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getIssueCompoundAlertPolicy",
        "summary": "Read application issue event-compound rules.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Current compound policy; an unconfigured app has revision zero and no AND rules.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueCompoundAlertPolicy"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "apps"
        ],
        "operationId": "setIssueCompoundAlertPolicy",
        "summary": "Replace application issue event-compound rules.",
        "description": "Replaces up to ten named AND rules using expected_revision. Both event count and verified distinct customer count must meet their thresholds in the same (now-window, now] retained-event window, optionally scoped to one environment. Active ignores and snoozes suppress admission. Only a new accepted capture inside the window triggers evaluation; retries, configuration changes and expiry alone do not notify. Cooldowns are per rule and canonical issue, survive enable toggles, and reset for changed conditions or timing. Activity, webhook issue.compound_threshold_reached and native Slack admission commit with the capture. Delivery requires an enabled subscription or eligible team destination. Frequency and fixed-window customer-impact policies remain independent.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateIssueCompoundAlertPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved compound AND rules and their resulting revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueCompoundAlertPolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "description": "Compound rules changed since the supplied revision; reload and review before retrying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issue-compound-alert-policy/preview": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "previewIssueCompoundAlert",
        "summary": "Preview an unsaved compound alert rule against retained issue evidence.",
        "description": "Evaluates every draft predicate in one read-only snapshot and resolves merged aliases. Reports current retained counts and cooldown eligibility without a hypothetical new capture, saving, queue admission, receipt mutation or Slack requests. Allowed means rule eligibility only; routing, subscriptions and queue/sender checks still govern delivery.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreviewIssueCompoundAlertRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Draft rule conditions at the observation time.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueCompoundAlertPreview"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issue-frequency-alert-policy": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getIssueFrequencyAlertPolicy",
        "summary": "Read application issue event-frequency rules.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Current policy. Unconfigured apps return revision zero and no rules.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueFrequencyAlertPolicy"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "apps"
        ],
        "operationId": "setIssueFrequencyAlertPolicy",
        "summary": "Replace application issue event-frequency rules.",
        "description": "Requires the current revision (zero initially). Replaces up to ten named rules; an empty array removes all rules. Stale writes return 409. Counts retained accepted occurrences per canonical issue in (now-window, now]. Only a new capture inside the window evaluates a rule. At or above threshold, the first eligible capture after cooldown alerts again. Active ignore periods suppress alerts while collection continues. Configuration edits do not send notifications. Changing a rule's environment, threshold, window or cooldown starts a fresh cycle on the next capture; unchanged rules and disable/re-enable retain cooldowns. Webhook event is issue.frequency_threshold_reached. This policy does not alter customer-impact alerts.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateIssueFrequencyAlertPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueFrequencyAlertPolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "description": "Policy revision changed. Read the current policy and retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issue-impact-alert-policy": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getIssueImpactAlertPolicy",
        "summary": "Read the app's customer-impact alert policy.",
        "description": "Returns the threshold for verified distinct customers in a rolling 24-hour window. A zero threshold disables the policy.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The current policy; disabled apps report minimum_customers as zero.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueImpactAlertPolicy"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "apps"
        ],
        "operationId": "setIssueImpactAlertPolicy",
        "summary": "Configure or disable customer-impact alerts for an app.",
        "description": "Setting minimum_customers to zero disables the policy. Policy changes apply prospectively; they do not backfill alerts for issues already above the threshold.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateIssueImpactAlertPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueImpactAlertPolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issue-ownership-rules": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getIssueOwnershipRules",
        "summary": "Read the app's automatic issue ownership rules.",
        "description": "Rules are ordered and only apply when Gregale creates a new issue group. Every populated matcher on a rule must match; route prefixes respect path-segment boundaries.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The current ordered policy; apps without rules return an empty list.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueOwnershipRules"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "apps"
        ],
        "operationId": "setIssueOwnershipRules",
        "summary": "Replace the app's automatic issue ownership rules.",
        "description": "Replaces the complete ordered policy and applies prospectively to new issue groups. Existing assignments are unchanged, and later manual assignments remain authoritative. Each target must be the app owner or an active organization member.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IssueOwnershipRules"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated ordered policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueOwnershipRules"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/deployments/{deployment_id}/issue-source-maps": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "deployment_id",
          "description": "Deployment UUID whose source-map publication is being managed.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "put": {
        "tags": [
          "apps"
        ],
        "operationId": "publishIssueSourceMaps",
        "summary": "Publish immutable deployment-local source-map artifacts.",
        "description": "Requires deploy-write permission and session MFA. Source contents and extensions are discarded. Matching canonical manifests are idempotent; a different manifest for the deployment conflicts, including after retirement.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublishIssueSourceMapsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Artifact readiness and immutable identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueSourceMapsMetadata"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "description": "Immutable manifest conflict or active artifact quota exceeded."
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getIssueSourceMaps",
        "summary": "Inspect deployment source-map readiness without downloading mapping artifacts.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Read-only artifact metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueSourceMapsMetadata"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "apps"
        ],
        "operationId": "retireIssueSourceMaps",
        "summary": "Retire mapping blobs while preserving their immutable deployment identity.",
        "description": "Requires deploy-write permission and session MFA. New symbolicated captures require the same manifest to be restored; retained exact event retries remain idempotent.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Retired metadata, including the preserved manifest digest.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueSourceMapsMetadata"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issue-saved-views": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listIssueSavedViews",
        "summary": "List the app's shared named issue inbox filters.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Up to 20 shared saved views, ordered by name and key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListIssueSavedViewsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issue-saved-views/{view_key}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "view_key",
          "description": "Stable key of the shared issue query to read, replace or delete.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,47}$",
            "maxLength": 48
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getIssueSavedView",
        "summary": "Read the latest shared view definition.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Named filters; me remains relative to the eventual authenticated reader.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueSavedView"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "apps"
        ],
        "operationId": "putIssueSavedView",
        "summary": "Save or replace a shared named issue inbox view.",
        "description": "Requires deploy-write permission and session MFA. Existing keys replace their definition; new keys consume the 20-view app quota. Filters are bounded known fields, not executable queries. UUID assignees must be currently eligible app owners or active organization members. Views confer no additional read permission.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutIssueSavedViewRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved definition and editor metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueSavedView"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "description": "Shared view quota reached."
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "apps"
        ],
        "operationId": "deleteIssueSavedView",
        "summary": "Delete a shared view without changing any issues.",
        "description": "Requires deploy-write permission and session MFA.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "Shared view deleted."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issue-teams": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listIssueTeams",
        "summary": "List app-scoped teams and their members.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Up to 20 teams, ordered by name and key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListIssueTeamsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issue-teams/{team_key}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "team_key",
          "description": "Stable application team key used to manage its identity and membership.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,47}$",
            "maxLength": 48
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getIssueTeam",
        "summary": "Get a team by its stable key.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Team identity, name, member roster and editor metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueTeam"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "apps"
        ],
        "operationId": "putIssueTeam",
        "summary": "Create or replace a team name and complete membership roster.",
        "description": "Membership grants no app access. Members must already be eligible app owners or active organization members. Mutations require deploy-write permission and session MFA. Teams referenced by issue assignments or routing rules cannot be deleted.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutIssueTeamRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Team identity and complete member roster.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueTeam"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "description": "Team quota reached."
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "apps"
        ],
        "operationId": "deleteIssueTeam",
        "summary": "Delete an unused team.",
        "description": "Deletes the unused application team after checking that no issue assignments or routing rules reference it. Requires deploy-write permission and session MFA.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "Team deleted."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "description": "Team still owns issues or routing rules."
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issue-release-comparison": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "compareIssueReleases",
        "summary": "Compare observed release request health and issue signals over the last 24 hours.",
        "description": "Request counts expand telemetry row weights and span all traffic for each deployment. Issue signals use the selected environment. These are independent retained observations, not complete traffic, crash-free sessions, or a controlled experiment. Unknown request rates and deltas are null.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "baseline",
            "description": "Baseline deployment UUID for the issue health comparison.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "candidate",
            "description": "Candidate deployment UUID compared with the selected baseline.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "environment",
            "description": "Issue environment included in both deployment health observations.",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "application",
              "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Both deployment observations from one consistent database snapshot.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueReleaseComparison"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issues/{issue_id}/native-tickets": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "issue_id",
          "in": "path",
          "required": true,
          "description": "Original Gregale issue identity retained across creation retries.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "createNativeIssueTicket",
        "summary": "Create or recover a GitHub ticket through the owned app connection.",
        "description": "Requires Issues entitlement, deploy-write and session MFA. Pins the owned installation and bound repository identity. Retains a server receipt before dispatch; reusing request_id with different inputs or binding is refused. An unconfirmed dispatch can only recover a marker-verified existing ticket after the 15-second dispatch window. A created result means the ticket exists and attachment must be retried with identical inputs. At most 100 receipts are retained per original issue. Installation Issues write permission is required; credentials remain server-side.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Explicit content, target repository and stable request identity for creation or recovery.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateNativeIssueTicketRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Durable ticket evidence and attachment state; created requires retrying attachment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeIssueTicketResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "description": "Request conflict or unconfirmed dispatch or retained receipt quota reached; preserve request inputs and recover the existing ticket."
          },
          "502": {
            "description": "GitHub rejected creation or connected credentials are unavailable."
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issues/{issue_id}/tracker-links/{link_id}/native-linear-status": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "issue_id",
          "in": "path",
          "required": true,
          "description": "Gregale issue identity whose current group contains the Linear reference.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "link_id",
          "in": "path",
          "required": true,
          "description": "Stored Linear reference selected for explicit lifecycle synchronization.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getNativeLinearIssueTrackerStatus",
        "summary": "Preview a linked Linear lifecycle using the stored owner connection.",
        "description": "Requires app read access and the app owner with Issues entitlement and deploy eligibility. Verifies the stored workspace/viewer/team and linked ticket identity. Returns status plus connection revision and group fingerprint for an explicit push. Archived and canceled or unfamiliar provider states require manual triage. No credentials are returned.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Verified linked Linear status and current preview scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeLinearIssueTrackerStatus"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "description": "Connection or group changed or provider state requires manual triage."
          },
          "502": {
            "description": "Provider identity or credential availability could not be confirmed."
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "updateNativeLinearIssueTrackerStatus",
        "summary": "Explicitly push the Gregale lifecycle to its linked Linear ticket.",
        "description": "Requires the app owner with Issues entitlement and deploy-write and session MFA. desired_state must match the current open/resolved Gregale lifecycle. Sends a known provider snapshot and preview connection revision/group fingerprint. A changing lifecycle additionally requires an explicit active same-team workflow state UUID of the matching type. Rechecks scope before dispatch and after the provider response. Aligned lifecycles remain unchanged. A provider write already dispatched cannot be recalled and the two systems do not share an atomic transaction.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Explicit lifecycle push with observed provider and connection/group scope.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateNativeLinearIssueTrackerStatusRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Confirmed provider lifecycle and unchanged preview scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeLinearIssueTrackerStatus"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "description": "Provider snapshot or connection or group changed or the lifecycle is unsupported."
          },
          "502": {
            "description": "Provider operation or workflow selection could not be confirmed."
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issues/{issue_id}/native-linear-tickets": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "issue_id",
          "in": "path",
          "required": true,
          "description": "Original Gregale issue identity whose current group receives the confirmed Linear reference.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "createNativeLinearIssueTicket",
        "summary": "Create or recover a Linear ticket using the owner's stored team connection.",
        "description": "Requires the app owner with Issues entitlement and deploy-write and session MFA. Verifies the stored workspace/viewer/team before dispatch. request_id must be UUID v4 and is used as the provider issue ID. A durable receipt fences concurrent dispatch and preserves uncertain outcomes. Retry identical inputs to finish attachment; after an uncertain create use recover=true to query the stable UUID without needing a URL. Same-identity credential replacement preserves recovery. Changed identity or inputs conflict. Responses never include credentials. A provider write already dispatched cannot be recalled by disconnect.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Explicit ticket inputs and stable UUID; recovery is an explicit decision after an unconfirmed dispatch.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateNativeLinearIssueTicketRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Durable creation evidence; created means attachment requires retry and linked means the reference is confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeIssueTicketResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "description": "Connection or inputs changed or outcome is unconfirmed or request quota is exhausted."
          },
          "502": {
            "description": "Provider verification or credential availability failed or creation was explicitly rejected."
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issue-tracker-linear-connection": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getIssueTrackerLinearConnection",
        "summary": "Read the app owner's Linear connection metadata.",
        "description": "Requires app read access and the app owner. Returns only non-secret identity and revision. Unconfigured apps return disconnected with revision zero. Inspection remains available after an Issues plan downgrade.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Linear connection metadata without credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueTrackerLinearConnection"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "apps"
        ],
        "operationId": "updateIssueTrackerLinearConnection",
        "summary": "Connect or disconnect an owner-scoped Linear personal API key.",
        "description": "Requires the app owner with deploy-write and session MFA. Connecting additionally requires Issues entitlement and an account eligible to deploy. Verifies workspace and viewer and active team before sealing credentials. expected_revision fences competing changes. Disconnect erases credentials without provider access and remains available after a plan downgrade. This does not enable automatic sync or perform provider writes.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Explicit connection decision and known revision; personal API key is accepted only when connecting.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateIssueTrackerLinearConnectionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated non-secret connection metadata and revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueTrackerLinearConnection"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "description": "The connection revision changed; read metadata again."
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issues/{issue_id}/tracker-links/{link_id}/auto-sync": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "issue_id",
          "in": "path",
          "required": true,
          "description": "Gregale issue identity whose current group contains the automatic sync reference.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "link_id",
          "in": "path",
          "required": true,
          "description": "Stored GitHub or Linear reference whose automatic sync policy is inspected or configured.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getIssueTrackerAutoSync",
        "summary": "Read an automatic native tracker lifecycle policy.",
        "description": "Requires app read access and Issues entitlement. Unconfigured references return disabled with revision zero. Conflicts and blocked outcomes pause the worker until an owner explicitly re-enables an aligned policy.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Opt-in policy and latest durable reconciliation outcome.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueTrackerAutoSync"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "apps"
        ],
        "operationId": "updateIssueTrackerAutoSync",
        "summary": "Enable or disable future Gregale-to-tracker lifecycle pushes.",
        "description": "Requires the app owner, Issues entitlement, deploy-write and session MFA. expected_revision fences competing policy changes. Enabling requires either expected_status for GitHub or expected_linear_status plus distinct linear_open_state_id and linear_resolved_state_id for Linear, and expected_issue_state; the lifecycles must already match. Verifies active Linear workflows in the connected team. Pins the canonical group and owned repository binding or Linear connection revision. The background worker preserves uncertain pending writes and pauses on provider edits or unsupported states or changed groups/connections. Disabling does not require live provider access. Linear pending writes with an unconfirmed outcome are observed without redispatch; explicitly align and re-enable to resume. A provider write already dispatched during disable cannot be recalled.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Explicit delegation decision and observed policy/native snapshot for automatic sync.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateIssueTrackerAutoSyncRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Persisted automatic sync policy with its new configuration revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueTrackerAutoSync"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "description": "Policy or native snapshot changed or lifecycle alignment is required before delegation."
          },
          "502": {
            "description": "Native provider snapshot could not be confirmed."
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issues/{issue_id}/tracker-links/{link_id}/native-status": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "issue_id",
          "description": "Gregale issue identity whose canonical group owns the tracker reference.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "link_id",
          "description": "Tracker reference identity to read or synchronize through the native connection.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getNativeIssueTrackerStatus",
        "summary": "Read a linked GitHub issue through the app owner's native installation.",
        "description": "Requires Issues entitlement and app read access. Verifies the caller-owned installation, pinned bound repository identity, current repository visibility and issue-group reference membership. GitHub installation credentials stay server-side. Linear native connections are unsupported.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Canonical issue, reference, connection and observed provider status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeIssueTrackerStatus"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "description": "Native connection missing, unsupported status or changed binding/reference."
          },
          "502": {
            "description": "Provider status could not be confirmed."
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "updateNativeIssueTrackerStatus",
        "summary": "Push the current Gregale lifecycle through the native GitHub connection.",
        "description": "Requires deploy-write and session MFA. desired_state must match the current canonical Gregale issue. expected must be the observed linked GitHub status. Rechecks reference membership, installation ownership, repository identity and visibility before using server credentials. Refuses changed snapshots and unsupported states. Separate APIs cannot provide an atomic cross-provider transaction; preview again after uncertain outcomes.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateNativeIssueTrackerStatusRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified native connection and resulting provider status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NativeIssueTrackerStatus"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "description": "Native connection missing, unsupported status or changed snapshot."
          },
          "502": {
            "description": "Provider update could not be confirmed; preview again."
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issues/{issue_id}/tracker-links": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "issue_id",
          "description": "Issue group UUID that owns the external tracker references.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listIssueTrackerLinks",
        "summary": "List GitHub and Linear references across this canonical issue group.",
        "description": "Links remain attached to original issue identities through merges and splits. Returns at most 50 references per page; cursors are bound to the app and canonical issue.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "cursor",
            "description": "Opaque continuation token from the preceding tracker-reference page.",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "References and an optional continuation cursor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListIssueTrackerLinksResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "putIssueTrackerLink",
        "summary": "Attach an existing tracker issue or update its display title.",
        "description": "Requires deploy-write and session MFA. Canonicalizes public GitHub issue and Linear URLs; ignores tracking queries, fragments and Linear title slugs. An existing group reference is reused. New references are capped at 20 per canonical group; existing references survive merges above that limit. Records actor activity. No provider request, ticket creation, access verification or status synchronization occurs.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutIssueTrackerLinkRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Canonical reference and creation/update metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueTrackerLink"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "description": "Tracker-reference quota reached."
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issues/{issue_id}/tracker-links/{link_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "issue_id",
          "description": "Issue group UUID whose selected tracker reference will be removed.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "link_id",
          "description": "Stored tracker-reference UUID to detach from the selected issue group.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "delete": {
        "tags": [
          "apps"
        ],
        "operationId": "deleteIssueTrackerLink",
        "summary": "Remove a tracker reference from this issue group.",
        "description": "Requires deploy-write and session MFA. Records unlink activity; the provider ticket is unchanged.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "Reference removed."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issues/bulk-actions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "bulkActOnIssues",
        "summary": "Atomically assign, resolve, ignore, or reopen selected issue groups.",
        "description": "Requires deploy-write permission and session MFA. Up to 50 distinct issue UUIDs; merged aliases are acted on once and return one canonical issue. Any missing issue or invalid action rolls back the entire batch. Regrouping is excluded. Supports the standard Idempotency-Key header.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkIssueActionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Canonical issue groups after the complete batch commits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkIssueActionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "description": "Idempotency conflict."
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issues": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listIssues",
        "summary": "List durable grouped application issues.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "state",
            "description": "Filter by open, resolved, or ignored lifecycle state.",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "environment",
            "description": "Exact issue environment namespace.",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "team",
            "description": "Shared inbox for a team UUID in this app. Mutually exclusive with assignee.",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "assignee",
            "description": "Filter by me, unassigned, or an owner account UUID.",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "description": "Issue ordering; impact ranks by verified distinct customers in the fixed 24-hour window.",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "recent",
                "impact"
              ],
              "default": "recent"
            }
          },
          {
            "name": "tag",
            "description": "Exact allowed operational key=value match on retained occurrences in the fixed 24-hour window.",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "min_customers",
            "description": "Return issues affecting at least this many verified distinct customers in the fixed 24-hour window.",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "cursor",
            "description": "Opaque next_cursor from the previous issue page.",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A bounded page of issues for this application.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListIssuesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issues/{issue_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "issue_id",
          "description": "UUID of the durable issue within this app.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getIssue",
        "summary": "Read sanitized evidence, release history, activity, and observed customer impact.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "since",
            "description": "RFC3339 impact-window start, clamped to plan retention.",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "event_cursor",
            "description": "Opaque next_event_cursor for earlier occurrences.",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "release_cursor",
            "description": "Opaque next_release_cursor for earlier deployment history.",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "activity_cursor",
            "description": "Opaque next_activity_cursor for earlier actions.",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Issue evidence, verified impact, and paginated history.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueDetail"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "apps"
        ],
        "operationId": "deleteIssue",
        "summary": "Permanently delete a standalone issue and its retained history.",
        "description": "Split linked groups and remove derived branches first. A later occurrence may create a new issue.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "abandon_unconfirmed_tickets",
            "in": "query",
            "description": "Explicitly abandon expired unconfirmed ticket dispatches. The provider may still have created a ticket, and deleting the issue removes its recovery receipt. Confirmed unattached tickets still block deletion.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Issue and its dependent history deleted."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issues/{issue_id}/split-preview": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "issue_id",
          "description": "Original fingerprint identity within this app, including a linked member.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "previewIssueSplit",
        "summary": "Preview exact occurrence matches without changing grouping.",
        "description": "Read-only snapshot of all retained evidence for one original identity. Missing lifetime evidence remains unclassified. Every populated matcher must equal the sanitized stored value.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IssueSplitMatcher"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Retained match counts, unavailable history, and bounded matching IDs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueSplitPreview"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issues/{issue_id}/split-rules": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "issue_id",
          "description": "UUID of the original fingerprint source; derived branches cannot have nested rules.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "createIssueSplitRule",
        "summary": "Split retained matches and route future matching captures.",
        "description": "Creates an immutable ordered rule and an open branch with the source canonical owner. Repeating the same source and matcher returns the existing rule without replaying evidence. At most eight rules, including disabled rules, per source. Branches count toward issue storage limits.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IssueSplitMatcher"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Rule and branch created with actor-attributed activity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueSplitRule"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issues/{issue_id}/split-rules/{rule_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "issue_id",
          "description": "UUID of the original source owning the routing rule whose enabled state should change.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "rule_id",
          "description": "Immutable rule UUID belonging to the source issue.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "patch": {
        "tags": [
          "apps"
        ],
        "operationId": "updateIssueSplitRule",
        "summary": "Enable or disable an existing occurrence routing rule.",
        "description": "Changes future routing only. Existing evidence, prior retry destinations, matcher, and priority remain unchanged.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IssueSplitRuleUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Rule state returned; changes append actor-attributed activity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueSplitRule"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issues/{issue_id}/split-rules/{rule_id}/undo": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "issue_id",
          "description": "Original source issue UUID owning the rule to undo.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "rule_id",
          "description": "Rule UUID to disable and combine with its reviewed source group.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "undoIssueSplitRule",
        "summary": "Disable a split rule and merge its isolated branch atomically.",
        "description": "Requires the reviewed canonical source ID. Rejects changed destinations and unrelated branch links. Destination owner and lifecycle win. Existing occurrence provenance and original counters remain intact. Other enabled rules continue routing by priority. A repeated completed undo is a no-op.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IssueSplitRuleUndoRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Disabled rule; its branch is combined with the reviewed source group.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueSplitRule"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issues/{issue_id}/actions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "issue_id",
          "description": "UUID of the issue whose ownership or lifecycle should change.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "actOnIssue",
        "summary": "Assign, resolve in a deployment, reopen, or ignore an issue.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IssueActionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Issue state or ownership updated with audited activity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Issue"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issue-ingest-tokens": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "createIssueIngestToken",
        "summary": "Create a reporting-only credential bound to one app and deployment.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateIssueIngestTokenRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Reporting credential created; the secret is shown once.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueIngestToken"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listIssueIngestTokens",
        "summary": "List issue ingest credential metadata.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Reporting credential metadata without bearer secrets.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListIssueIngestTokensResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/issue-ingest-tokens/{token_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "token_id",
          "description": "UUID of the reporting credential to revoke.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "delete": {
        "tags": [
          "apps"
        ],
        "operationId": "revokeIssueIngestToken",
        "summary": "Revoke an issue ingest credential.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "Reporting credential revoked for subsequent ingestion."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/errors/summary": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppErrorsSummary",
        "summary": "Per-app customer-facing automatic error grouping summary.",
        "description": "Sentry-style grouped error view scoped to a customer's\napp. One row per `(account_id, app_id, fingerprint)` over\nthe requested `[since, until]` window, sorted by `count\nDESC, last_seen_at DESC, fingerprint ASC`. Distinct from\n`GET /v1/apps/{slug}/slo` which is\nthe closed-set SLO summary (`1h` / `24h` / `7d`) — the\nerrors summary uses a continuous `[since, until]` window\nwith an explicit RFC3339Nano stamp instead.\n\nThe window is clamped to `AppErrorsWindowMaxHours` (168h).\nWhen the clamp fires, `window_clamped` is true so the\ndashboard can render a \"you widened the window past the\ncap\" tile. The endpoint returns 200 with `items: []`\nwhen no fingerprints are present in the window — never\n404. Cross-account slug is a 404 (IDOR-safe; the error\nis byte-identical to a real \"no such app\" 404).\n\nFingerprints are derived at write time as\n`sha256(route_template || \"\\x1f\" || http_status ||\n\"\\x1f\" || error_class)`. The route is the matched\ntemplate (e.g. `/users/{id}`), NEVER the expanded URL —\nthis is the load-bearing cardinality fix that keeps the\ntop-N bounded.\n",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "date-time"
            },
            "description": "RFC3339Nano UTC window start. Defaults to `until - 24h`."
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "date-time"
            },
            "description": "RFC3339Nano UTC window end. Defaults to `now()`."
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "description": "Opaque pagination cursor from the previous response's `next_cursor`. Empty for the first page."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 20,
              "minimum": 1,
              "maximum": 100
            },
            "description": "Page size. Default `AppErrorsSummaryDefaultLimit=20`, capped at `AppErrorsSummaryMaxLimit=100`."
          }
        ],
        "responses": {
          "200": {
            "description": "The grouped error summary.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorsSummaryResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Plan does not unlock the per-app error surfacing. Free\nplan — Hobby or above required. The gate runs BEFORE\n`loadApp` so a Free customer probing a slug never gets\na 404 (slug-leak guard).\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                },
                "example": {
                  "type": "https://gregale.dev/docs/errors/plan_app_errors_not_allowed",
                  "title": "Per-app errors unavailable on this plan",
                  "status": 402,
                  "code": "plan_app_errors_not_allowed",
                  "detail": "the free plan does not include per-app errors; upgrade to Hobby or above.",
                  "docs_url": "https://gregale.dev/docs/plans#app-errors"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/errors/{fingerprint}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "fingerprint",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "description": "64-hex-char SHA-256 fingerprint of the error group; sha256(route_template || 0x1f || status || 0x1f || error_class)."
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listAppErrorRequests",
        "summary": "Per-fingerprint drill-down rows.",
        "description": "Cursor-paginated drill-down over the request rows that\nlanded on this fingerprint. Returns 404 when the\nfingerprint has been purged by the retention cron or\nnever existed; the cross-account slug case is also 404\n(IDOR-safe byte-identical to a real \"no such app\" 404).\n",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "description": "Opaque pagination cursor (received_at, request_id compound). Empty for the first page."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 20,
              "minimum": 1,
              "maximum": 100
            },
            "description": "Page size. Default `AppErrorsSummaryDefaultLimit=20`."
          }
        ],
        "responses": {
          "200": {
            "description": "The drill-down rows (newest-first).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorRequestsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/errors/{fingerprint}/first": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "fingerprint",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "description": "64-hex-char SHA-256 fingerprint to inspect; the oldest request row for this group is returned with its redacted headers."
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppErrorSample",
        "summary": "Single oldest sample row + redacted headers.",
        "description": "Returns the OLDEST request row for the fingerprint plus\nthe redacted `headers_sample` (jsonb-decoded) and the\nlist of `redactions_applied` pattern names so the\ndashboard can render a \"we redacted X / Y / Z\" badge.\nReturns 404 when the fingerprint has been purged.\n",
        "responses": {
          "200": {
            "description": "The sample row.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorSampleResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/debug/requests": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listAppDebugRequests",
        "summary": "Per-app request telemetry.",
        "description": "Recent request telemetry rows for an app — status, latency_ms, route,\nmethod, deployment_id, cold_boot, trace_id, received_at, and the\nnumber of original requests represented by each collapsed row. Rows\nare split by bounded latency bucket so aggregate percentiles retain\ndistribution signal; `latency_ms` is that bucket's inclusive upper\nbound (and can therefore be slightly conservative).\nThe endpoint is plan-gated by\n`DebugTelemetryEnabled` (Free off; Hobby/Pro/Scale on).\nThe window is clamped to `DebugTelemetryRetentionDays`\n(Hobby 3d, Pro 7d, Scale 14d). When the clamp fires, the\neffective `since` is returned in the response so the\ndashboard can render a \"you widened past the cap\" tile. Results are\ncursor-paginated in `(received_at DESC, id DESC)` order. The opaque\ncursor pins the effective window, route, and every supplied filter, so callers can safely\nwalk pages while new telemetry arrives. `complete` is true only when\nevery retained row in that bounded window is present in the page.\nFilters are applied before pagination and echoed in `filters` so an\nincident link can be reproduced exactly.\nReturns 200 with `requests: []` when no rows exist in the\nwindow — never 404. Cross-account slug is 404 (IDOR-safe;\nbyte-identical to \"no such app\").\n",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "description": "Duration or 'Nd' alias. Defaults to `24h`. Clamped to plan's `DebugTelemetryRetentionDays`."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "minimum": 1,
              "maximum": 200,
              "default": 20
            },
            "description": "Page size, default 20, max 200."
          },
          {
            "name": "route",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "maxLength": 256
            },
            "description": "Exact route-template filter."
          },
          {
            "name": "deployment_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "description": "Exact deployment UUID filter."
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "minimum": 100,
              "maximum": 599
            },
            "description": "Exact HTTP status filter."
          },
          {
            "name": "cold_boot",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            },
            "description": "Filter cold-start requests when true, or warm requests when false."
          },
          {
            "name": "consumer_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "maxLength": 64
            },
            "description": "Consumer UUID, or __anonymous__ for requests without a stable consumer identity."
          },
          {
            "name": "min_latency_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "minimum": 0,
              "maximum": 86400000
            },
            "description": "Minimum inclusive latency bucket bound in milliseconds."
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "maxLength": 8192
            },
            "description": "Opaque next_cursor from a previous response. The cursor must be reused with the same app and filters."
          }
        ],
        "responses": {
          "200": {
            "description": "Page of recent request telemetry rows.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DebugTelemetryListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/debug/requests/export": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "exportAppDebugRequests",
        "summary": "Export retained request telemetry.",
        "description": "Downloads a bounded, metadata-only request-log artifact for the app.\nThe default format is newline-delimited JSON (`ndjson`); `csv` is\navailable for spreadsheet and support workflows. The export uses the\nsame plan retention boundary as the debugger list, never includes\nrequest bodies, headers, source IPs, or raw span attributes, and is\ncapped at 10,000 rows. It takes the request list's filters.\n`X-Faas-Request-Log-Window` and `X-Faas-Request-Log-Retention-Clamped`\ndescribe the effective window applied to the artifact, and\n`X-Faas-Request-Log-Truncated` says whether the row limit cut it short.\nIn CSV, a value that would start a spreadsheet formula is written\nwith a leading apostrophe.\n",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "description": "Lookback duration (for example `24h` or `3d`). Defaults to `24h` and is clamped to plan retention."
          },
          {
            "name": "route",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "maxLength": 256
            },
            "description": "Filter the exported rows by exact route template."
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ndjson",
                "csv"
              ],
              "default": "ndjson"
            },
            "description": "Export encoding."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "minimum": 1,
              "maximum": 10000,
              "default": 10000
            },
            "description": "Maximum number of retained rows to export."
          },
          {
            "name": "deployment_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "description": "Export only rows served by this deployment UUID."
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "minimum": 100,
              "maximum": 599
            },
            "description": "Export only rows with this HTTP status."
          },
          {
            "name": "cold_boot",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            },
            "description": "Export only cold-start rows when true, or only warm rows when false."
          },
          {
            "name": "consumer_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "maxLength": 64
            },
            "description": "Export only one consumer's rows (UUID), or __anonymous__ for rows without a stable consumer identity."
          },
          {
            "name": "min_latency_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "minimum": 0,
              "maximum": 86400000
            },
            "description": "Export only rows whose latency bucket bound is at least this many milliseconds."
          }
        ],
        "responses": {
          "200": {
            "description": "Metadata-only request telemetry export.",
            "content": {
              "application/x-ndjson": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "text/csv": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "headers": {
              "X-Faas-Request-Log-Window": {
                "schema": {
                  "type": "string"
                },
                "description": "Effective lookback window after retention clamping."
              },
              "X-Faas-Request-Log-Retention-Clamped": {
                "schema": {
                  "type": "boolean"
                },
                "description": "Whether the requested window exceeded plan retention."
              },
              "X-Faas-Request-Log-Truncated": {
                "schema": {
                  "type": "boolean"
                },
                "description": "Whether more rows matched than the row limit exported."
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/profiles/deployment-policy": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getProfileDeploymentPolicy",
        "summary": "Read the automatic CPU-check policy.",
        "description": "Returns an owned app's deployment-check configuration with app-read access. Before the first save the policy is disabled at revision zero. Metadata remains readable without profiling entitlement or backend access.",
        "responses": {
          "200": {
            "description": "Automatic check configuration and revision, including initial disabled defaults.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileDeploymentPolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "apps"
        ],
        "operationId": "saveProfileDeploymentPolicy",
        "summary": "Configure CPU checks for future successful rollouts.",
        "description": "Requires deploy-write access and the current policy revision; use zero for the initial save. Enabling requires a profiling plan and configured backend. Saving advances the revision and cancels pending checks; new completions use the new policy. The worker compares the previous successful deployment in the same environment and uses the selected runtime on both sides. Equal windows end at candidate creation for the baseline and start after rollout completion plus warm-up for the candidate. Retries preserve these windows, allow up to five attempts for late or insufficient data and remain inconclusive when data is absent. Deployment activation is independent of this background check.",
        "requestBody": {
          "required": true,
          "description": "Complete automatic profiling policy with revision protection.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveProfileDeploymentPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved deployment CPU-check policy with a new revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileDeploymentPolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/profiles/periodic-monitors": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listProfilePeriodicMonitors",
        "summary": "Inspect periodic route checks and their recent incident history.",
        "description": "App-read access and completed MFA are required. Returns up to 50 newest monitors with up to ten terminal observations each, including pinned baselines, confirmation transitions and comparison links. Samples remain in backend retention. Checks are advisory and never change rollout decisions.",
        "responses": {
          "200": {
            "description": "Bounded periodic monitor history.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListProfilePeriodicMonitorsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/profiles/deployment-checks": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listProfileDeploymentChecks",
        "summary": "List recent automatic CPU-check receipts.",
        "description": "Returns up to fifty receipts for the owned app with app-read access, newest first. Receipts keep the snapshotted policy, exact windows, attempt state and authenticated comparison link. Metadata is retained for thirty days; saved investigations retain their existing lifetime and fifty-record quota. This read does not query CPU samples.",
        "responses": {
          "200": {
            "description": "Recent deployment profiling receipts with authenticated drill-down links.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListProfileDeploymentChecksResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/profiles/deployment-checks/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Deployment UUID for an automatic profiling receipt.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getProfileDeploymentCheck",
        "summary": "Read the CPU-check receipt for a deployment.",
        "description": "Reads an owned app's receipt by deployment UUID with app-read access. Missing or foreign receipts return not found. A saved-investigation link restores the differential flamegraph; if the investigation quota was full or the saved record was deleted, the link keeps the original comparison selections instead. Missing baseline comparisons have no link.",
        "responses": {
          "200": {
            "description": "Single deployment CPU-check receipt and comparison selection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileDeploymentCheck"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/profiles/canary-checks/{deployment}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "deployment",
          "in": "path",
          "required": true,
          "description": "Canary deployment UUID.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listProfileCanaryChecks",
        "summary": "List retained CPU assessments for a deployment's canary stages.",
        "description": "Requires app-read access and completed MFA. Returns bounded, newest-first stage assessments retained for 30 days, including exact fixed profile windows, policy revision, threshold evidence and retry state. Use next_cursor as before to read older stages. The read never queries profile samples.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum number of canary stage assessments to return.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10,
              "default": 5
            }
          },
          {
            "name": "before",
            "in": "query",
            "description": "Opaque cursor from the prior page's next_cursor.",
            "schema": {
              "type": "string",
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Newest-first canary stage history page.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileCanaryHistoryPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/profiles/investigations": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listProfileInvestigations",
        "summary": "List saved profiling investigations.",
        "description": "Lists up to 50 investigations for an owned app, ordered by last update and UUID. Requires existing app-read access. Metadata remains readable after profile expiry, plan downgrades or backend outages; this operation does not query CPU samples.",
        "responses": {
          "200": {
            "description": "Bounded saved-investigation list with per-window eligibility.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListProfileInvestigationsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "createProfileInvestigation",
        "summary": "Save profiling comparison selections and notes.",
        "description": "Creates comparison metadata for retained deployments belonging to the owned app. Requires profiling entitlement and deploy-write access. Use expected_revision 0. Stores notes and selections without querying or retaining profile samples; sharing requires authenticated app access.",
        "requestBody": {
          "required": true,
          "description": "New investigation with expected_revision 0 and complete comparison selections.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveProfileInvestigationRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created metadata and authenticated dashboard link.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileInvestigationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/profiles/investigations/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Saved investigation UUID belonging to this app.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getProfileInvestigation",
        "summary": "Read a saved investigation and window retention status.",
        "description": "Reads saved metadata by its app-owned UUID with baseline and candidate eligibility under the current plan. Requires app-read access. Returned links require authentication and app ownership. A retained status establishes query eligibility, not sample presence.",
        "responses": {
          "200": {
            "description": "Saved selections and notes with current retention eligibility.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileInvestigationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "apps"
        ],
        "operationId": "updateProfileInvestigation",
        "summary": "Update a saved profiling investigation using its current revision.",
        "description": "Replaces metadata using the current revision and deploy-write access. Unchanged expired selections permit commentary edits; changed selections recheck profiling entitlement, retention and deployment ownership. Concurrent edits return 409. Saving does not extend profile retention.",
        "requestBody": {
          "required": true,
          "description": "Complete metadata replacement with the currently observed saved revision.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveProfileInvestigationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated metadata with a new saved revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileInvestigationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "apps"
        ],
        "operationId": "deleteProfileInvestigation",
        "summary": "Delete a saved profiling investigation.",
        "description": "Deletes metadata for an owned app using the current revision and deploy-write access. A stale revision returns 409, preserving concurrent edits. Deletion frees one saved-investigation slot and leaves backend profile retention unchanged.",
        "parameters": [
          {
            "name": "expected_revision",
            "in": "query",
            "required": true,
            "description": "Current saved revision to prevent deleting concurrent edits.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Investigation deleted."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/profiles/investigations/{id}/check": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "App-owned investigation UUID to assess.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "checkProfileRegression",
        "summary": "Check a saved comparison for CPU regressions.",
        "description": "Checks the exact saved windows with deploy-write access. Both relative and absolute CPU-rate thresholds must be met for a total, comparable function or complete call path. Missing samples, insufficient capture coverage, recorded failures or unavailable history produce a stored inconclusive assessment. This heuristic does not establish deployment causality or statistical confidence. Returns a new revision; concurrent edits or checks return 409. Later edits make the preserved assessment stale when its investigation_revision differs from the saved revision. Existing profiling query limits and retention apply; raw profiles are never stored.",
        "requestBody": {
          "required": true,
          "description": "Current saved revision and optional complete threshold configuration; omit options for defaults.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckProfileRegressionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved regression assessment with incremented revision and authenticated comparison link.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileInvestigationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/profiles": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppProfiles",
        "summary": "Query sampled application CPU by deployment.",
        "description": "Internal opt-in profiling. Returns function CPU totals and call paths; missing samples are explicitly empty. Times must fall within the plan retention window.",
        "parameters": [
          {
            "name": "deployment_id",
            "in": "query",
            "required": true,
            "description": "Deployment belonging to the selected app.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "runtime",
            "in": "query",
            "required": true,
            "description": "Runtime name attached by the compute broker.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start",
            "in": "query",
            "required": true,
            "description": "Inclusive capture start.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end",
            "in": "query",
            "required": true,
            "description": "Capture end after start.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "route",
            "in": "query",
            "required": false,
            "description": "Static METHOD /pattern or [unattributed]; omitted selects all CPU.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sampled CPU profile and source symbols.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/profiles/compare": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "compareAppProfiles",
        "summary": "Compare deployment CPU profiles normalized by capture duration.",
        "description": "Reads authorized deployment windows from the private profiling backend. Each function delta uses self CPU seconds divided by selected window seconds. Traffic and allocation changes also affect the result.",
        "requestBody": {
          "required": true,
          "description": "Baseline and candidate capture selections.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProfileCompareRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "CPU rate deltas or an explicit unavailable comparison reason.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileCompareResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/profiles/heap": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppHeapProfile",
        "summary": "Query the continuous live heap near a window end.",
        "description": "Requires profiling.kinds to include heap. The query is narrowed to the last collection window before end so merged snapshots are not summed. Values are live heap bytes.",
        "parameters": [
          {
            "name": "deployment_id",
            "in": "query",
            "required": true,
            "description": "Deployment whose live heap to read.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "runtime",
            "in": "query",
            "required": true,
            "description": "Runtime the heap snapshots were collected under.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start",
            "in": "query",
            "required": true,
            "description": "Earliest acceptable snapshot time.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end",
            "in": "query",
            "required": true,
            "description": "Point in time to inspect.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Live heap functions and call paths.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileHeapResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/profiles/captures": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listProfileCaptures",
        "summary": "List the app's on-demand profile captures, newest first.",
        "responses": {
          "200": {
            "description": "Up to 50 captures retained for 7 days.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileCaptureList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "createProfileCapture",
        "summary": "Capture CPU and/or heap profiles from a running instance now.",
        "description": "Queues a bounded capture on the requested or earliest-started RUNNING instance; parked apps are not woken. Poll the capture until status is ready or failed. One capture per app runs at a time; an account can start 60 per hour. Gregale also queues a heap capture automatically (trigger memory_pressure) when an instance runs low on memory, at most once per hour per app.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateProfileCaptureRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Capture queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileCapture"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/profiles/captures/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Profile capture id.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getProfileCapture",
        "summary": "Read one on-demand profile capture.",
        "responses": {
          "200": {
            "description": "Capture status and collected profile summary.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileCapture"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "apps"
        ],
        "operationId": "deleteProfileCapture",
        "summary": "Delete an on-demand profile capture.",
        "description": "Deletes the capture and its profiles with deploy-write access, freeing its share of the account's capture storage at once. A capture still queued or running is cancelled and its profiles are discarded.",
        "responses": {
          "204": {
            "description": "Capture deleted."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/profiles/captures/{id}/view": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Capture whose merged view to read.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getProfileCaptureView",
        "summary": "Merged functions and call paths of one capture kind.",
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "description": "cpu, heap, stacks, block or mutex; defaults to the capture's first kind.",
            "schema": {
              "type": "string",
              "enum": [
                "cpu",
                "heap",
                "stacks",
                "block",
                "mutex"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "CPU nanoseconds or live heap bytes merged across the instance's processes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileCaptureView"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/profiles/captures/{id}/pprof": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Capture to download.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "downloadProfileCapture",
        "summary": "Download one capture kind as a merged gzip pprof profile.",
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "description": "Kind to download as pprof: cpu, heap, stacks, block or mutex; defaults to the capture's first kind.",
            "schema": {
              "type": "string",
              "enum": [
                "cpu",
                "heap",
                "stacks",
                "block",
                "mutex"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "gzip-compressed pprof protobuf for go tool pprof, speedscope or Pyroscope.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/profiles/captures/{id}/diff": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Candidate capture id.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "diffProfileCaptures",
        "summary": "Compare one capture kind with an earlier capture of the same app.",
        "description": "Merges both captures and returns every call path and function with its baseline value, candidate value and difference, largest growth first. Values are not rescaled; captures of different durations or deployments carry warnings.",
        "parameters": [
          {
            "name": "base",
            "in": "query",
            "required": true,
            "description": "Baseline capture id of the same app.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "description": "cpu, heap, stacks, block or mutex; defaults to a kind both captures collected, preferring heap.",
            "schema": {
              "type": "string",
              "enum": [
                "cpu",
                "heap",
                "stacks",
                "block",
                "mutex"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Differential view in the kind's unit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileCaptureDiff"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/debug/coverage": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppDebugCoverage",
        "summary": "Read observed debugger signal coverage.",
        "description": "Returns bounded, weighted coverage for the debugger signals\nattached to retained request telemetry in the requested window.\nCounts are split between stored aggregate rows and the original\nrequests those rows represent. Rates are relative to represented\nrequests only; the platform does not infer a capture denominator for\nrequests dropped before persistence. Plan-gated by\n`DebugTelemetryEnabled` and clamped to `DebugTelemetryRetentionDays`.\n",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "description": "Lookback duration (e.g. 30m, 24h, 3d). Defaults to 24h and is clamped by plan retention."
          }
        ],
        "responses": {
          "200": {
            "description": "Observed debugger signal coverage.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DebugCoverageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/debug/dependencies": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppDebugDependencyLatency",
        "summary": "Historical dependency latency and regressions.",
        "description": "Returns bounded dependency percentiles and error rates derived from\nretained, redacted span summaries. The result compares the newer and\nolder halves of the selected window to flag a dependency regression,\nand includes normalized parent-to-child impact edges with exclusive\nwall-time percentiles. Each edge includes up to three representative\nrequest identifiers for the current slowest sample, baseline slowest\nsample, and an error sample when available; use them with the request\nevidence endpoint for drill-down.\nRaw span attributes, destinations, request bodies, and credentials\nare never returned. Span evidence is sampled and the response marks\nrow/cardinality truncation explicitly. Plan-gated by\n`DebugTelemetryEnabled` and clamped to `DebugTelemetryRetentionDays`.\n",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "description": "Optional dependency-history lookback; defaults to the recent 24-hour window and is bounded by plan retention."
          }
        ],
        "responses": {
          "200": {
            "description": "Historical dependency latency aggregates.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DebugDependencyLatencyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/debug/critical-paths": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppDebugCriticalPaths",
        "summary": "Historical critical-path regressions.",
        "description": "Returns bounded canonical critical paths reconstructed from retained,\nredacted span summaries. The result compares the newer and older\nhalves of the selected window to flag a path regression. Raw span\nattributes, destinations, request bodies, and credentials are never\nreturned. Each path includes up to three representative request\nidentifiers (current slowest, baseline slowest, and an error sample\nwhen available) plus the largest uncovered segment attribution. Span\nevidence is sampled and the response marks row, path-cardinality, and\nincomplete-parent coverage explicitly.\nPlan-gated by `DebugTelemetryEnabled` and clamped to\n`DebugTelemetryRetentionDays`.\n",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "description": "Optional critical-path lookback; defaults to the recent 24-hour window and is bounded by plan retention."
          }
        ],
        "responses": {
          "200": {
            "description": "Historical critical-path aggregates.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DebugCriticalPathHistoryResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/debug/running": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppDebugRunning",
        "summary": "Explain why an app is still running.",
        "description": "Returns observed scheduler causes that prevented an application from\nparking during the requested window. Causes are evidence-shaped: the\nresponse reports request activity, open connections, tail tasks,\nconfigured or temporary warm floors, cooldowns, and workload modes\nwhen those signals were observed. It does not estimate a saving or\ninfer a protocol that was not instrumented. Plan-gated by\n`DebugTelemetryEnabled` and clamped to `DebugTelemetryRetentionDays`.\n",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "description": "Optional lookback window for scheduler observations (e.g. 30m, 24h, 3d); defaults to 24h and is clamped by plan retention."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "description": "Maximum number of recent observations to return; default 20, max 100."
          }
        ],
        "responses": {
          "200": {
            "description": "Observed causes explaining why the app remained resident.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DebugRunningResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/debug/status": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppDebugStatus",
        "summary": "Summarize an app's health, release, regressions, and recent failures.",
        "description": "One answer to \"is this app healthy, and if not where do I look?\": the\nserving deployments' requests, server errors, and p95 over the window,\nthe canary rollout in flight or rolled back inside the window (with\nits request evidence), open debugger regressions, the newest\nserver-error requests, and a verdict (`failing`, `rolled_back`,\n`degraded`, `releasing`, `healthy`, or `idle`) with a one-line\nheadline. Plan-gated by `DebugTelemetryEnabled`; the window is clamped\nto `DebugTelemetryRetentionDays`.\n",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "description": "Optional lookback window (e.g. 30m, 1h, 24h); defaults to 1h and is clamped by plan retention."
          }
        ],
        "responses": {
          "200": {
            "description": "The app's debug status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DebugStatusResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/debug/rollout": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppDebugRollout",
        "summary": "Explain why a release was rolled back or is held.",
        "description": "Explains the app's newest canary rollout, or `deployment_id`, with\nrequest evidence: the safe-release decision that rolled it back, holds\nit, or advanced it; the candidate's routes compared with the stable\ndeployment over the decision window, worst first; example requests\nthat show the problem; and the candidate's open regressions. The\nevidence is read from request telemetry at request time and is not\nstored with the decision. `state` is `none` when no recent deployment\nhad a canary rollout. Plan-gated by `DebugTelemetryEnabled`; the\nwindow is clamped to `DebugTelemetryRetentionDays`.\n",
        "parameters": [
          {
            "name": "deployment_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "description": "Deployment to explain; defaults to the newest of the app's recent deployments with a canary rollout."
          }
        ],
        "responses": {
          "200": {
            "description": "The rollout explanation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DebugRolloutExplanation"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/debug/requests/{req_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "req_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Public x-faas-request-id from the response, or the internal telemetry row UUID for compatibility."
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppDebugRequest",
        "summary": "Get one request telemetry record.",
        "description": "Resolves an exact public x-faas-request-id through the durable,\napp-scoped request-ID journal, then enriches it from detailed request\ntelemetry when that sampled row exists. If only the identity mapping\nremains, the response sets `evidence_status` to `request_id_only` and\nincludes the W3C `trace_id` separately when available. Internal\ntelemetry row UUIDs remain accepted for compatibility. The lookup is\nscoped to the app resolved from `slug`, so an ID belonging to another\napp is returned as not found. This direct lookup is not limited to the\nfirst page of recent requests. Plan-gated by `DebugTelemetryEnabled`.\n",
        "responses": {
          "200": {
            "description": "Request telemetry record.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DebugTelemetryRequestItem"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/debug/requests/{req_id}/evidence": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "req_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Public x-faas-request-id whose evidence should be retrieved; internal telemetry row UUIDs remain accepted for compatibility."
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppDebugRequestEvidence",
        "summary": "Get request evidence and explanation.",
        "description": "Returns a deterministic request/wake timeline plus bounded,\nredacted span evidence for one request and links it to a matching\nactive regression observation when one exists. Database statements are sanitized fingerprints; raw\nattributes, status messages, request bodies, and headers are\nnever returned. The explanation is deterministic and suitable\nas input to a future asynchronous synthesis layer. Plan-gated\nby DebugTelemetryEnabled.\n",
        "responses": {
          "200": {
            "description": "Request evidence and deterministic explanation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DebugRequestEvidenceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/DebuggerRegressionUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/debug/regressions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listAppDebugRegressions",
        "summary": "Active regression observations.",
        "description": "Returns regression observations written by the\ndebug_regression_observations table — surfaces per-route\np95 regressions detected by the regression cron. Ordered by\nregression_factor DESC, last_detected_at DESC (worst\nfirst). Plan-gated by DebugTelemetryEnabled. The window\nis clamped to DebugTelemetryRetentionDays.\n",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            },
            "description": "Duration or 'Nd' alias. Defaults to `1h`."
          }
        ],
        "x-since": "2026-08",
        "responses": {
          "200": {
            "description": "Page of active regression observations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DebugRegressionsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/DebuggerRegressionUnavailable"
          }
        }
      },
      "patch": {
        "tags": [
          "apps"
        ],
        "operationId": "updateAppDebugRegression",
        "summary": "Update regression triage state.",
        "description": "Acknowledge, temporarily dismiss, resolve, or reopen one\ndeployment/route regression observation. This changes debugger\nworkflow metadata only; it never changes deployment traffic.\n`dismissed_until` is required only for dismiss and defaults to 24h\nwhen omitted. The server caps dismissals at 30 days.\nUse the dedicated checked actions endpoint for mandatory app/version\nguards. Legacy PATCH clients retain unguarded workflow transitions.\n",
        "x-since": "2026-09",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DebugRegressionActionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated regression observation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DebugRegressionActionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/DebuggerRegressionUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/debug/regressions/actions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "applyAppDebugRegressionAction",
        "summary": "Apply a checked regression triage action.",
        "description": "Atomically requires the exact app identity and observation version from\nthe review endpoint. A changed or missing observation returns 409\nregression_changed. Requires app write permissions, MFA and debugger\nentitlement. Records the review reason in native audit metadata. Retry\nwith the exact same body after an ambiguous response to recover the\noriginal receipt. The observation update, reason and receipt commit in\none database transaction. Operation identity binds the complete checked\nbody and account, independently of the caller's Idempotency-Key header.\nNative replay uses the existing 24-hour cache retention. This dedicated route fails closed on\nolder API nodes; it never falls back to the legacy unguarded PATCH.\nChanges triage metadata only, without changing traffic or proving health.\n",
        "x-since": "2026-10",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GuardedDebugRegressionActionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Checked triage receipt and updated observation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DebugRegressionActionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/DebuggerRegressionUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/debug/regressions/review": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppDebugRegressionReview",
        "summary": "Review one exact regression workflow observation.",
        "description": "Includes acknowledged, dismissed and resolved observations without inbox\nvisibility filters. The opaque version changes on every database update,\nincluding detector refreshes and legacy triage actions. Supply app_id as\nexpected_app_id and version as expected_version on the dedicated checked actions endpoint.\nRequires ordinary app read permissions, MFA and debugger entitlement.\nRead-only; no collection, traffic changes or health assessment.\n",
        "x-since": "2026-10",
        "parameters": [
          {
            "name": "deployment_id",
            "description": "Exact retained observation deployment identity.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "route",
            "description": "Exact stored route label, including method when present.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Exact versioned workflow observation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DebugRegressionReview"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/DebuggerRegressionUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/debug/compare": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "compareAppDebugDeployments",
        "summary": "Per-route latency compare.",
        "description": "Compares two deployments' per-route latency\ndistributions in a shared time window. Body holds the\ntwo deployment ids + optional route filter + optional\nsince/until bounds. Returns merged per-route stats with\nper-deployment p50/p95/p99 + represented request counts. Includes\nthe effective window and retention-clamping metadata.\nInvalid lookbacks, invalid/future until values, and windows wholly\noutside current plan retention are rejected. Reads retained telemetry\nwithout replaying requests or writing platform state. Plan-gated by\nDebugTelemetryEnabled.\n",
        "x-since": "2026-08",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DebugCompareRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Per-route compare stats.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DebugCompareResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/debug/requests/{req_id}/replay": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "req_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Public x-faas-request-id to replay; internal telemetry row UUIDs remain accepted for compatibility."
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "replayAppDebugRequest",
        "summary": "Replay a retained request through its mirror rule.",
        "description": "Reissues the retained request metadata through the enabled mirror\nrule for the deployment that served it. Raw request bodies and\ncredentials are not retained, so the mirror receives an empty body\nand platform-owned replay metadata only. The returned invocation ID\ncan be polled for the comparison result. Plan-gated by\nDebugTelemetryEnabled; requires ScopesDeployWriteSurface.\n",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DebugReplayRequest"
              }
            }
          }
        },
        "x-since": "2026-08",
        "responses": {
          "202": {
            "description": "Replay invocation queued for mirror execution.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DebugReplayResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "No enabled mirror rule targets the deployment that served the\nretained request. Returns `debug_replay_unsupported`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/otel/v1/traces": {
      "post": {
        "tags": [
          "telemetry"
        ],
        "operationId": "ingestOtlpSpans",
        "summary": "OTel spans writer.",
        "description": "Standard OTLP/HTTP endpoint for the OTel spans sidecar\nprotocol (POST ExportTraceServiceRequest). Auth via\nAuthorization: Bearer <api-key>. Plan-gated by\nDebugTelemetryEnabled; rate-capped by\nDebugTelemetryRequestsPerMinute; span-capped by\nDebugTelemetrySpansPerTrace. Body shape is defined by\nthe OpenTelemetry proto — the spec documents the\nendpoint metadata only. The SDK does not model this\nroute (routeExclude on sdk-coverage + spec_compliance);\nOTel SDKs speak OTLP/HTTP directly. Supports application/json\n(OTLP hexadecimal trace/span IDs) and application/x-protobuf,\noptional gzip compression, empty exports, and multi-trace batches.\nResponses use ExportTraceServiceResponse; per-trace ownership\nrejection returns partialSuccess with rejectedSpans. Error bodies\nuse google.rpc.Status in the request encoding. Missing Content-Type\nretains the legacy ordinary-protobuf JSON input decoder. Acceptance\nstages an in-memory diagnostic summary; it is not durable raw-span storage.\n",
        "x-since": "2026-08",
        "responses": {
          "200": {
            "description": "Spans accepted (truncated summary staged in flush accumulator)."
          },
          "400": {
            "description": "Invalid OTLP payload; google.rpc.Status in the request encoding."
          },
          "401": {
            "description": "Missing or invalid bearer; google.rpc.Status in the request encoding."
          },
          "402": {
            "description": "Telemetry is unavailable on the account plan; google.rpc.Status in the request encoding."
          },
          "415": {
            "description": "Unsupported media type or content encoding."
          },
          "429": {
            "description": "Request rate limit exceeded; google.rpc.Status with Retry-After."
          }
        }
      }
    },
    "/v1/apps/{slug}/deployment-aliases": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "listDeploymentAliases",
        "summary": "List named deployment aliases for an app.",
        "description": "Returns customer-managed names that point to exact immutable deployment rows, with their stable routing hosts. Changing an alias does not alter production traffic.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Alias names and their pinned deployment revisions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentAliasListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/deployment-aliases/{name}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$"
          },
          "description": "Lowercase DNS label for this app's stable revision alias."
        }
      ],
      "put": {
        "tags": [
          "deployments"
        ],
        "operationId": "setDeploymentAlias",
        "summary": "Point a named alias at an immutable deployment.",
        "description": "The target must be a routable deployment that belongs to the app. This updates only the alias mapping; it does not shift production traffic. The alias name and app identifier must fit together in one DNS label.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetDeploymentAliasRequest"
              },
              "example": {
                "deployment_id": "01234567-89ab-cdef-0123-456789abcdef"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Alias mapping after the update.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentAliasResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "deployments"
        ],
        "operationId": "deleteDeploymentAlias",
        "summary": "Remove a named deployment alias.",
        "description": "Removes the mapping only; deployments and production traffic are unchanged.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "Alias removed."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/deployment-cron-staging": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getDeploymentCronStagingSnapshot",
        "summary": "Read the HTTP cron set and its deployment staging revision.",
        "description": "Snapshots only HTTP scheduling intent for the owned app. Command crons,\nexecution progress and server-held original rows are excluded.\n`environment` reads one non-production environment's manifest crons\nand its own revision and latest deployment.\n",
        "parameters": [
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "A project environment of the app; omitted or `production` is production."
          }
        ],
        "responses": {
          "200": {
            "description": "The captured HTTP scheduling set.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentCronStagingSnapshot"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "deployments"
        ],
        "operationId": "applyDeploymentCronStaging",
        "summary": "Prepare deferred cron activation or recover legacy cron staging.",
        "description": "Prepare retains active schedules until the accepted production release is\nlive and owns all traffic. Track_upload binds an owned upload for autonomous\nrecovery of cached committed submissions. Cancel fences an unsubmitted intent.\nRepeating prepare reads its durable prepared, activated, conflict or discarded\nstatus. Legacy stage/restore replaces the complete set under locks. Command\ncrons are preserved and count toward app and account quotas. The exact\napp, unchanged latest deployment, revision, owner and canonical intent\nguard staging and cleanup. Ordinary HTTP scheduling edits, including\nsame-value updates, invalidate ownership; scheduler firing and suspension\nbookkeeping do not. Cleanup before a delayed stage fences it out. Accepted\nor uncertain deployment submission must retain staging. No builds are\ncreated; no unchecked fallback or HTTP response replay cache is used.\nRecovery restores scheduling configuration, not already dispatched work.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeploymentCronStagingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The guarded cron operation and durable activation status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentStagingReceipt"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "The replacement exceeds the app or account cron quota, or the plan does not allow crons.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "deployment_cron_conflict; app, deployment, HTTP cron set, revision or ownership changed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Cron staging storage is unavailable; scheduling recovery remains pending.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/deployment-staging": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getDeploymentStagingSnapshot",
        "summary": "Read the deployment policy revision and current profiling and tracing.",
        "description": "Atomically snapshots the owned app's policy group and latest deployment\nidentity. Use this snapshot to prepare a private pre-submission journal.\nThis endpoint does not change configuration or enqueue builds.\n",
        "responses": {
          "200": {
            "description": "The current policy snapshot.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentStagingSnapshot"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "deployments"
        ],
        "operationId": "applyDeploymentStaging",
        "summary": "Atomically stage or recover profiling and tracing for one deploy attempt.",
        "description": "Requires the same write scope and MFA checks as app settings PATCH.\nOnly profiling and tracing are supported. The exact app, unchanged latest\ndeployment and policy revision protect staging. An ownership token and\ncanonical intent digest protect cleanup against concurrent edits and ABA\nchanges. Cleanup before a delayed stage fences that stage out. No builds\nare created. The endpoint uses its own revision protocol rather than the\nHTTP response replay cache. A conflict leaves cleanup pending; there is\nno unchecked fallback. Accepted or uncertain deployment submission must\npreserve staged policies rather than requesting cleanup.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeploymentStagingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The policies were staged or their cleanup completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentStagingReceipt"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "deployment_staging_conflict; app, deployment, policy revision or ownership changed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Staging storage is unavailable; the journal remains pending.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/service-aborts/{attempt_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "attempt_id",
          "in": "path",
          "required": true,
          "description": "The opaque attempt ID persisted before reviewed service abort.",
          "schema": {
            "type": "string",
            "minLength": 32,
            "maxLength": 32,
            "pattern": "^[0-9a-f]{32}$"
          }
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getServiceAbortReceipt",
        "summary": "Read the immutable acceptance receipt for a service-abort attempt.",
        "description": "Requires deployment-read access to the owned app. Returns immutable acceptance\nof an exact reviewed default or named-environment service abort, including the original native\nreverse-handoff request ID, even after the current handoff changes. Acceptance\ndoes not establish gateway acknowledgement, request draining, completion or\ncurrent health. Compare the request ID separately with the observed handoff.\nA 404 means no retained evidence; it never proves rejection or permits replay.\nThe receipt is retained with the candidate deployment audit and app. Named receipts\nalso require the original project/environment UUIDs to match the current app\nand environment. Deleted, replaced or moved targets return no evidence.\n",
        "responses": {
          "200": {
            "description": "The immutable receipt for the original reviewed service abort.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceAbortReceipt"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Service-abort receipt storage is unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/deployment-promotions/{attempt_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "attempt_id",
          "in": "path",
          "required": true,
          "description": "The opaque attempt ID persisted before guarded traffic promotion.",
          "schema": {
            "type": "string",
            "minLength": 32,
            "maxLength": 32,
            "pattern": "^[0-9a-f]{32}$"
          }
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getDeploymentPromotionReceipt",
        "summary": "Read the immutable acceptance receipt for a promotion attempt.",
        "description": "Requires deployment-read access to the owned app. Returns the original\ncandidate and original serving guard even after traffic changes. A 404 means no retained\nreceipt is available; it does not establish rejection and must never\ntrigger automatic resubmission. Receipts expire when their deployment\nor app is purged. Named environment identities must still exist. This lookup never changes traffic.\n",
        "responses": {
          "200": {
            "description": "The immutable receipt for the original guarded traffic promotion.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentPromotionReceipt"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Promotion receipt storage is unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/deployment-submissions/{attempt_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "attempt_id",
          "in": "path",
          "required": true,
          "description": "The opaque attempt ID persisted before deployment submission.",
          "schema": {
            "type": "string",
            "minLength": 32,
            "maxLength": 32,
            "pattern": "^[0-9a-f]{32}$"
          }
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getDeploymentSubmission",
        "summary": "Read the immutable acceptance receipt for a deployment attempt.",
        "description": "Requires deployment-read access to the owned app. Returns the original\ndeployment even after failure or supersession. A 404 means no retained\nreceipt is available; it does not establish rejection and must never\ntrigger automatic resubmission. Receipts expire when their deployment\nor app is purged. This lookup does not enqueue builds or change traffic.\n",
        "responses": {
          "200": {
            "description": "The immutable accepted submission receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentSubmissionReceipt"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Receipt storage is unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/deployments": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "listAppDeployments",
        "summary": "List deployments for an app.",
        "description": "Paged backwards (newest first) for the app identified by `slug`.\n`next_before` is an opaque RFC3339Nano cursor from the last row in\nthe page; pass it as `before` to fetch older deployments. Unknown or\ncross-account app slugs return the same IDOR-safe 404 surface as the\nother app-scoped endpoints.\n",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            },
            "description": "Page size for this app (1–200; default 50)."
          },
          {
            "name": "before",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "RFC3339Nano cursor from a previous response's next_before."
          }
        ],
        "responses": {
          "200": {
            "description": "A paginated list of deployments for the app.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentListResponse",
                  "example": {
                    "items": [],
                    "next_before": null
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "deployments"
        ],
        "operationId": "createDeployment",
        "summary": "Create a deployment.",
        "description": "Two content-types are accepted:\n- `application/json` (`CreateDeploymentRequest` with an `image` field): prebuilt OCI reference.\n- `multipart/form-data`: source tarball upload (or Dockerfile escape hatch).\nSource size is plan-capped (Free/Hobby 100 MB, Pro/Scale 250 MB).\nThe optional `workflows` array is plan-gated and schema-validated;\naccepted definitions are persisted with the deployment and snapshotted\nwhen a workflow run starts.\n",
        "requestBody": {
          "required": true,
          "description": "Either a prebuilt OCI image reference (`application/json`) or a source tarball upload (`multipart/form-data`). See the operation description for plan size caps.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateDeploymentRequest",
                "example": {
                  "image": "ghcr.io/onebox-faas/hello:abc1234"
                }
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "source": {
                    "type": "string",
                    "format": "binary",
                    "description": "Multipart file field — the source tarball or Dockerfile context."
                  },
                  "dockerfile": {
                    "type": "boolean"
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "app",
                      "function"
                    ]
                  },
                  "runtime": {
                    "type": "string",
                    "enum": [
                      "node22",
                      "python312",
                      "go124",
                      "go124-alpine",
                      "node24",
                      "python313",
                      "binary"
                    ]
                  },
                  "healthcheck": {
                    "type": "string",
                    "description": "JSON startup readiness probe: exactly one HTTP path or standard gRPC health selector."
                  },
                  "override_env": {
                    "type": "string",
                    "maxLength": 1048576,
                    "description": "JSON object of non-secret environment overrides applied to this deployment revision only; values follow the plan's deployment override limits."
                  },
                  "source_root": {
                    "type": "string",
                    "maxLength": 256,
                    "pattern": "^$|^(?:\\.|(?!(?:\\.|\\.\\.)(?:/|$))[^/\\\\]+(?:/(?!(?:\\.|\\.\\.)(?:/|$))[^/\\\\]+)*)$",
                    "description": "Optional repository-relative build directory. Empty or omitted uses the app's configured root; '.' explicitly selects the archive root."
                  },
                  "scope": {
                    "type": "string",
                    "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$",
                    "description": "Named environment scope read by the developer deployment; omitted uses default."
                  },
                  "source_url": {
                    "type": "string",
                    "maxLength": 1024,
                    "description": "Optional informational repository provenance URL. The server never fetches this value; the uploaded archive remains the source of truth."
                  },
                  "commit_sha": {
                    "type": "string",
                    "minLength": 7,
                    "maxLength": 64,
                    "pattern": "^[0-9a-f]+$",
                    "description": "Optional lowercase hexadecimal Git commit identifier for deployment provenance."
                  },
                  "workflows": {
                    "type": "string",
                    "description": "JSON array of workflow definitions (plan-gated)."
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/DeploymentAttemptID"
          }
        ],
        "responses": {
          "202": {
            "description": "The deployment whose build has been accepted and queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentResponse",
                  "example": {
                    "id": "0123456789abcdef0123456789abcdef",
                    "app_id": "0123456789abcdef0123456789abcdef",
                    "image_digest": "sha256:0000000000000000000000000000000000000000000000000000000000000000",
                    "kind": "tarball",
                    "status": "pending",
                    "created_at": "2026-08-29T11:25:00Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/DeploymentForbidden"
          },
          "409": {
            "$ref": "#/components/responses/ApplicationStandardsPending"
          },
          "413": {
            "$ref": "#/components/responses/SourceTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/DeployFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/image-published": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "deployments"
        ],
        "operationId": "publishAppImage",
        "summary": "Deploy an immutable image after CI publishes it.",
        "description": "Requires deploy:write or admin and the normal deployment authentication\nchecks. App-bound deploy tokens and CI bearer tokens are accepted.\nThe app must be a project workload configured with image:. The required\nimage is a full registry/repository@sha256:digest reference matching that\nworkload's declared registry and repository. A digest-pinned declaration\naccepts only its declared digest. Tags are rejected; send the digest\nreturned by the build/push step after publication completes.\n\nApp, normalized deployment scope, and image reference form a durable\ndelivery identity. First delivery creates one pending OCI deployment\nwithout a source build. Repeated deliveries return the original row and\nits current status, including terminal states, without creating a new\ndeployment. The first accepted configuration wins for this identity;\nuse ordinary deployment or retry endpoints for intentional redeploys.\nChanging scope creates an independent delivery.\n\nNormal signature, security, plan, traffic, and account deploy-rate\nadmission apply. The Compose main container port defaults the port\noverride. Omitted workflows and the source release command inherit from\nthe latest image deployment in the same scope. Image commands, service\nbindings, and scoped environment settings use the existing app contract.\nOptional overrides and rollout policies follow CreateDeploymentRequest.\nThe project image declaration is retained. This is a CI handoff endpoint;\nnative registry webhook payloads and registry polling are not supported.\n",
        "x-faas-key-scope": [
          "admin",
          "deploy:write"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateDeploymentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The original deployment for an already accepted image delivery.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentResponse"
                }
              }
            }
          },
          "202": {
            "description": "A new image deployment was accepted and queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/DeploymentForbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/DeployFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/deployments/{id}/summary": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getAppDeploymentSummary",
        "summary": "Fetch a deployment release summary and diff.",
        "description": "Returns the selected deployment, its immediately preceding release,\na stable field-level diff of non-secret release metadata, and the\ndeployment id the app rollback operation would currently target.\nUnknown, cross-account, or slug/deployment-mismatch requests return\nthe same IDOR-safe 404 surface as the other app-scoped reads.\n",
        "responses": {
          "200": {
            "description": "The release summary.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentSummaryResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/deployments/latest": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getLatestAppDeployment",
        "summary": "Fetch the latest deployment for an app.",
        "description": "Returns the app's newest deployment by `created_at DESC`. The app slug\nand deployment are resolved within the authenticated account; an\nunknown or cross-account app and a never-deployed app all return the\nsame IDOR-safe 404 surface.\n",
        "responses": {
          "200": {
            "description": "The latest deployment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/deployments/dev-source": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "deployments"
        ],
        "operationId": "deployDevSource",
        "summary": "Create a developer deployment from a complete source snapshot or delta.",
        "description": "Transport used only for ad-hoc developer environments created by\n`gregale dev`. With an empty `dev_source_base`, `source` is a complete\nsource archive. With a base revision, `source` contains changed entries\nand `dev_source_deleted` removes paths from the cached base.\n\nThe cache is account/app scoped, node-local, and disposable. The API\nreconstructs and verifies a complete archive before applying the same\nsource-root, stateful-shape, secret-scan, Dockerfile, function, and\nenqueue gates as an ordinary source deployment. A missing base returns\n409 `dev_source_base_missing`; clients retry the target as a complete\nsnapshot. Older servers safely return 404 on this distinct route.\n",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "source",
                  "dev_source_target"
                ],
                "properties": {
                  "source": {
                    "type": "string",
                    "format": "binary",
                    "description": "Complete tar.gz when dev_source_base is absent; otherwise a tar.gz of changed entries."
                  },
                  "dev_source_base": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$",
                    "description": "Canonical cached source revision. Omit for a complete snapshot."
                  },
                  "dev_source_target": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$",
                    "description": "Canonical revision of the complete source tree after reconstruction."
                  },
                  "dev_source_deleted": {
                    "type": "string",
                    "description": "JSON string array of canonical archive paths removed since dev_source_base."
                  },
                  "dockerfile": {
                    "type": "boolean"
                  },
                  "runtime": {
                    "type": "string",
                    "enum": [
                      "node22",
                      "python312",
                      "go124",
                      "go124-alpine",
                      "node24",
                      "python313",
                      "binary"
                    ]
                  },
                  "handler": {
                    "type": "string"
                  },
                  "healthcheck": {
                    "type": "string",
                    "description": "Startup readiness for this developer-source deployment, encoded as JSON with one HTTP path or standard gRPC health selector."
                  },
                  "source_root": {
                    "type": "string",
                    "maxLength": 256,
                    "pattern": "^$|^(?:\\.|(?!(?:\\.|\\.\\.)(?:/|$))[^/\\\\]+(?:/(?!(?:\\.|\\.\\.)(?:/|$))[^/\\\\]+)*)$",
                    "description": "Build directory within the developer-source archive. Empty or omitted inherits the app's configured root; '.' selects the archive root."
                  },
                  "scope": {
                    "type": "string",
                    "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$",
                    "description": "Named environment scope read by the deployment; omitted uses default."
                  },
                  "workflows": {
                    "type": "string",
                    "description": "Optional JSON workflow-definition array attached to this developer deployment."
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "202": {
            "description": "The reconstructed developer deployment whose build has been accepted and queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EmailVerificationRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "code: dev_source_base_missing | application_standards_pending. A missing source base requires a complete snapshot; pending inherited controls require enrollment to finish.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "$ref": "#/components/responses/SourceTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/DeployFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/source-review": {
      "parameters": [
        {
          "name": "slug",
          "description": "Application slug for Git source resolution.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "reviewSourceRef",
        "summary": "Resolve a connected GitHub branch or commit and review target release configuration without building.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SourceReviewRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Immutable source and configuration review, excluding credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceReviewResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/deployments/source-ref": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "deployments"
        ],
        "operationId": "createDeploymentFromSourceRef",
        "summary": "Create a deployment from a Git source-ref (headless).",
        "description": "Headless deploy path.\nResolves the GitHub install bound to the caller's account,\nfetches the (repo, ref) tarball via the GitHub bridge, spools\nit under the per-plan SourceTarballMaxMB cap, validates shape,\nand enqueues a build (Kind=DeploymentKindGitHub) pinned to\nthe resolved 40-char commit SHA.\n\nDesigned for CI runners: bearer token only, no GitHub env\nvars required. Idempotency-Key collapses concurrent / retried\nCI jobs into one build row.\n\nDistinct from the dashboard bind path (`POST\n/v1/apps/{slug}/deployments` with a `source` multipart\nupload) which goes through the browser + UI bind picker.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SourceRefDeployRequest"
              },
              "example": {
                "repo": "onebox-faas/hello",
                "ref": "main",
                "format": "tarball"
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/DeploymentAttemptID"
          }
        ],
        "responses": {
          "202": {
            "description": "The source-ref deployment whose build has been accepted and queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentResponse",
                  "example": {
                    "id": "0123456789abcdef0123456789abcdef",
                    "app_id": "0123456789abcdef0123456789abcdef",
                    "image_digest": "sha256:0000000000000000000000000000000000000000000000000000000000000000",
                    "kind": "github",
                    "status": "pending",
                    "created_at": "2026-08-29T11:25:00Z"
                  }
                }
              }
            }
          },
          "400": {
            "description": "code: invalid_ref | validation_failed. ref must be a valid 40-char\nSHA, branch, or tag. source_branch can only be paired with a full\ncommit SHA.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EmailVerificationRequired"
          },
          "404": {
            "description": "No durable GitHub install bound to the caller's account\n(code: github_install_not_found).\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "code: source_ref_stale. source_branch no longer points at the\nrequested immutable commit SHA. A service awaiting inherited\ncontrols instead returns code: application_standards_pending.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "$ref": "#/components/responses/SourceTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "The GitHub integration unreachable or source-ref tarball fetch failed\n(code: source_ref_unavailable). Retry in ~30s. A PR preview whose\nmanaged PostgreSQL database is still provisioning answers\ncode: preview_database_provisioning; retry after Retry-After.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/deployments/source-tarball": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "deprecated": true,
        "tags": [
          "deployments"
        ],
        "operationId": "createDeploymentFromSourceTarball",
        "summary": "Create a deployment from a CLI-uploaded local tarball (zero-config).",
        "description": "Zero-config deploy path.\nThis multipart endpoint is deprecated for new clients. Use the\nresumable upload session endpoints under `/v1/uploads` for progress,\nretry-safe chunking, and commit deduplication; this route remains\navailable during the migration window.\nThe CLI uploads a gzipped tar via the `tarball` form field and\nan optional informational `{repo, ref}` JSON sidecar. The CLI\nbinary is the trust root: The API does NOT consult\n`github_installations` and does NOT attempt a server-side git\nfetch.\n\nDistinct from the source-ref path\n(`POST /v1/apps/{slug}/deployments/source-ref`) which\nresolves the GitHub install and pins the tarball to a 40-char\nSHA. The source-ref handler is unchanged; this is a parallel\ntrust path for first-deploy customers without the GitHub App\ninstalled.\n\nWire shape:\n  multipart/form-data with two fields:\n    - `tarball` (required): the gzipped tar, capped at the\n      per-plan `SourceTarballMaxMB`.\n    - `sidecar` (optional): JSON `{repo, ref}` recorded on\n      the build row for provenance only. The build pipeline\n      does NOT use the sidecar to fetch upstream — the tarball\n      bytes are the build source, and the sidecar is purely\n      informational. Operators relying on source-pinning MUST\n      use the source-ref path instead.\n\nLifecycle (fix): the refactored zero-config\nCLI path runs `POST /v1/apps` (CreateApp) BEFORE this endpoint,\nso a brand-new slug gets a 201 from CreateApp and a 202 from\nthis endpoint. A direct hit on this endpoint with a slug that\nhas never been created returns 404 — pre-#1182 zero-config\ncustomers hit this with \"no such app\"; the fix folds the\npath through CreateApp so the slug always exists by the time\nthis endpoint is reached.\n\nAudit kind: `deploy.local_tarball` (distinct from\n`deploy.source_ref`).\n\nEvery response carries the RFC 9745 `Deprecation` date,\nRFC 8594 `Sunset` date, and RFC 8288 `Link` relations. Clients\nshould migrate to `POST /v1/uploads` before the sunset date.\n",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "tarball"
                ],
                "properties": {
                  "tarball": {
                    "type": "string",
                    "format": "binary"
                  },
                  "sidecar": {
                    "$ref": "#/components/schemas/SourceTarballDeployRequest"
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/DeploymentAttemptID"
          }
        ],
        "responses": {
          "202": {
            "description": "The local-tarball deployment whose build has been accepted and queued.",
            "headers": {
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              },
              "Link": {
                "$ref": "#/components/headers/Link"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentResponse"
                }
              }
            }
          },
          "400": {
            "description": "code: validation_failed. Missing `tarball` field, malformed\nsidecar JSON, or invalid tarball shape.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EmailVerificationRequired"
          },
          "404": {
            "description": "code: not_found. The slug does not exist OR belongs to\nanother account (loadAppAndPreflight's IDOR silent-404 —\nthe API deliberately returns the same shape for both cases\nto avoid leaking the existence of other customers'\napps). The refactored zero-config CLI path\nruns CreateApp before this endpoint, so a slug should\nalways exist by the time the request lands here; a 404\non the CLI path is the symptom of a misconfigured\n--name pointing at a row the caller doesn't own.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "$ref": "#/components/responses/ApplicationStandardsPending"
          },
          "413": {
            "$ref": "#/components/responses/SourceTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/uploads": {
      "post": {
        "tags": [
          "uploads"
        ],
        "operationId": "startUpload",
        "summary": "Open a resumable upload session.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UploadStartRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Session opened.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadStartResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/SourceTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/uploads/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Upload session id (returned by POST /v1/uploads)."
        }
      ],
      "get": {
        "tags": [
          "uploads"
        ],
        "operationId": "getUploadSession",
        "summary": "Discover resumable session state and current offset.",
        "responses": {
          "200": {
            "description": "Current session state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadSessionResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "patch": {
        "tags": [
          "uploads"
        ],
        "operationId": "appendUpload",
        "summary": "Append a chunk to an open session.",
        "parameters": [
          {
            "name": "Upload-Offset",
            "in": "header",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 0
            },
            "description": "Absolute byte offset the client claims the server is at."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/offset+octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bytes accepted.",
            "headers": {
              "Upload-Offset": {
                "schema": {
                  "type": "integer",
                  "minimum": 0
                },
                "description": "New absolute offset after the append."
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          }
        }
      },
      "delete": {
        "tags": [
          "uploads"
        ],
        "operationId": "cancelUpload",
        "summary": "Cancel an open session (removes the .part file).",
        "responses": {
          "204": {
            "description": "Session cancelled."
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/uploads/{id}/commit": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Upload session id to finalize (returned by POST /v1/uploads)."
        }
      ],
      "post": {
        "parameters": [
          {
            "$ref": "#/components/parameters/DeploymentAttemptID"
          }
        ],
        "tags": [
          "uploads"
        ],
        "operationId": "commitUpload",
        "summary": "Finalize the session, validate the tarball, enqueue the build.",
        "responses": {
          "201": {
            "description": "Deployment created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentResponse"
                }
              }
            }
          },
          "202": {
            "description": "Previously accepted upload deployment recovered by its submission receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Upload session conflict or code application_standards_pending while inherited controls await persistence.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          }
        }
      }
    },
    "/v1/apps/{slug}/deployments/{deployment}/openapi": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "deployment",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Deployment UUID."
        }
      ],
      "get": {
        "tags": [
          "openapi_discovery"
        ],
        "operationId": "getDeploymentOpenAPIDoc",
        "summary": "Read the captured OpenAPI document for a deployment.",
        "description": "Returns the OpenAPI document the cold-boot probe captured from the customer's app. The probe runs unconditionally during cold boot; the API surfaces the doc only on paid plans (Hobby/Pro/Scale). Free customers receive 402 + openapi_docs_not_allowed. Cache-Control: 5 min. Response headers: X-OpenAPI-Doc-Source (cold_boot or manual_upload), X-OpenAPI-Doc-Truncated (1 if clipped at 128 KiB), X-OpenAPI-Doc-Byte-Size, X-OpenAPI-Doc-Deployment-ID, X-OpenAPI-Doc-App-ID, X-OpenAPI-Doc-SHA256, X-OpenAPI-Doc-Captured-At and X-OpenAPI-Doc-Updated-At. These authenticated metadata headers bind the unchanged body to its capture.",
        "responses": {
          "200": {
            "description": "The OpenAPI document.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "The captured OpenAPI document, body unchanged. The customer's /openapi.json is returned verbatim — no rewriting, no field normalisation."
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Free plan cannot access endpoint discovery. MicroVM captures the doc, but the API refuses to expose it.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No document captured for this deployment, or the deployment id is not owned by the caller (IDOR floor).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "openapi_discovery"
        ],
        "operationId": "updateDeploymentOpenAPIDoc",
        "summary": "Manually upload.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated row.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "The stored OpenAPI doc with its metadata envelope.",
                  "required": [
                    "deployment_id",
                    "account_id",
                    "app_id",
                    "source",
                    "byte_size",
                    "captured_at",
                    "updated_at"
                  ],
                  "properties": {
                    "deployment_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "account_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "app_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "cold_boot",
                        "manual_upload"
                      ]
                    },
                    "byte_size": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 131072
                    },
                    "doc_sha256": {
                      "type": "string",
                      "description": "Lower-case hex SHA-256 of the stored body."
                    },
                    "truncated": {
                      "type": "boolean"
                    },
                    "captured_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "doc": {
                      "type": "object",
                      "description": "The OpenAPI document body."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Two distinct 402 reasons: openapi_docs_not_allowed (Free plan cannot use endpoint discovery), plan_openapi_doc_quota_reached (per-account Plan.OpenAPIDocsPerAccount() cap reached).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "description": "code: plan_openapi_doc_too_large. Body exceeds Plan.OpenAPIDocMaxBytes() (Hobby 100 KiB, Pro 100 KiB, Scale 100 KiB).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "openapi_discovery"
        ],
        "operationId": "deleteDeploymentOpenAPIDoc",
        "summary": "Delete the captured OpenAPI document for a deployment.",
        "description": "Companion to PATCH — explicitly wipes the captured doc (re-applied on next cold boot of the deployment).",
        "responses": {
          "204": {
            "description": "Deleted (row gone)."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Free plan cannot use endpoint discovery.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/deployments/{deployment}/route-policy": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "deployment",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "UUID of the deployment whose gateway policy snapshot is requested."
        }
      ],
      "get": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "getDeploymentRoutePolicySnapshot",
        "summary": "Read the gateway policy captured with a deployment.",
        "description": "Returns the immutable edge-rule set captured atomically when this\ndeployment first became live. Rules use the same owner-scoped shape as\nthe current app edge-rule endpoint. Older deployments without a\nsnapshot return 404 so callers can report historical policy as unknown.\n",
        "responses": {
          "200": {
            "description": "Captured gateway route policy and fingerprint.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentRoutePolicySnapshotResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "Deployment is not owned by the caller or has no captured route policy.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/openapi": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "openapi_import"
        ],
        "operationId": "getAppOpenAPI",
        "summary": "Read the imported (or auto-generated) OpenAPI document for an app.",
        "description": "Two source modes (selected via `?source=`):\n\n- `manual_import` (default): returns the customer's uploaded\n  doc verbatim. Mirrors item #1's /deployments/{dep}/openapi\n  but on the app-keyed `app_openapi_docs` table.\n\n- `auto`: generates a document from the\n  imported doc + observed routes (bridge) +\n  existing edge rules; the merged spec is cached for 5 min\n  per (app_id, sha(doc), sha(routes), sha(rules)). Cache\n  headers: X-Faas-Cache: hit|miss, X-OpenAPI-Doc-Source:\n  \"auto\" | \"degraded: routes_unavailable\" |\n  \"degraded: rules_unavailable\" | \"empty: no_import_no_rules\".\n\nLimits are abuse-surface, not plan-tier — every plan\nincluding Free can import. Per-account row cap is\nPlan.OpenAPIImportsPerAccount (Free 100, Hobby 1000,\nPro 10000, Scale 10000). Plan-tier gate is intentionally\nabsent on this surface.\n",
        "parameters": [
          {
            "name": "source",
            "in": "query",
            "required": false,
            "description": "Source mode. `manual_import` (default) returns the persisted customer doc verbatim. `auto` returns the platform-merged spec (imported doc ∪ observed routes ∪ existing edge rules).",
            "schema": {
              "type": "string",
              "enum": [
                "manual_import",
                "auto"
              ],
              "default": "manual_import"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The OpenAPI document (imported or auto-generated).",
            "headers": {
              "X-OpenAPI-Doc-Source": {
                "schema": {
                  "type": "string"
                },
                "description": "Provenance marker: manual_import, auto, degraded: routes_partial, degraded: routes_unavailable, degraded: rules_unavailable, empty: no_import_no_rules. Auto documents also carry x-faas-observed-routes with source, availability, and fleet collector coverage."
              },
              "X-OpenAPI-Doc-Version": {
                "schema": {
                  "type": "string"
                },
                "description": "OpenAPI version declared by the imported doc (3.0.x / 3.1.x)."
              },
              "X-OpenAPI-Doc-Byte-Size": {
                "schema": {
                  "type": "integer"
                },
                "description": "Raw byte size of the persisted doc body."
              },
              "X-Faas-Cache": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "hit",
                    "miss"
                  ]
                },
                "description": "Cache hit/miss on the `?source=auto` path. Omitted on `?source=manual_import`."
              },
              "X-OpenAPI-Doc-Annotations-Count": {
                "schema": {
                  "type": "integer"
                },
                "description": "Count of `x-faas-edge-rules` annotations on the auto-gen spec (zero on manual_import)."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "The OpenAPI document body. manual_import returns the persisted doc verbatim; auto returns the merged spec (imported doc ∪ observed routes ∪ `x-faas-edge-rules` annotations)."
                }
              }
            }
          },
          "400": {
            "description": "code: invalid_source. `source` query value is not in the enum."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "code: not_found. No imported doc exists for this app (manual_import mode), or the app slug is cross-tenant."
          },
          "405": {
            "description": "code: dry_run_requires_post. `?source=dry_run` is GET-only 405; dry-run is POST-only."
          }
        }
      },
      "post": {
        "tags": [
          "openapi_import"
        ],
        "operationId": "importAppOpenAPI",
        "summary": "Import an OpenAPI document for an app.",
        "description": "Customer-facing import.\nReads the body, validates it (structural-minimum\nOpenAPI 3.0 / 3.1 check), enforces size + endpoint\ncaps, persists via UpsertAppOpenAPIDoc, emits\napp.openapi_import.replaced audit + pg_notify on\nNotifyAppOpenAPIDocChanged. The auto-gen cache\n(NotifyAppOpenAPIDocChanged + NotifyEdgeRuleChanged\nfan-in) is flushed per-app so the next `?source=auto`\nread recomputes.\n\nLimits (abuse-surface, not plan-tier): body cap\nstate.OpenAPIImportMaxDocBytes (256 KiB), endpoint\ncap state.OpenAPIImportMaxEndpoints (50). Per-account\nrow cap is Plan.OpenAPIImportsPerAccount.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "OpenAPI 3.0/3.1 document. The validator only requires openapi, info, paths to be present + object-shaped; everything else is passthrough.",
                "required": [
                  "openapi",
                  "info",
                  "paths"
                ],
                "properties": {
                  "openapi": {
                    "type": "string",
                    "description": "OpenAPI version (3.0.x / 3.1.x)."
                  },
                  "info": {
                    "type": "object"
                  },
                  "paths": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppOpenAPIImportResponse"
                }
              }
            }
          },
          "400": {
            "description": "code: empty_body. Body is zero bytes."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "code: openapi_import_quota_reached. Plan.OpenAPIImportsPerAccount() cap reached."
          },
          "413": {
            "description": "code: openapi_import_too_large. Body exceeds state.OpenAPIImportMaxDocBytes (256 KiB) on the import endpoint."
          },
          "422": {
            "description": "code: openapi_import_invalid or openapi_import_too_many_endpoints. Doc fails the structural-minimum validator or declares more than state.OpenAPIImportMaxEndpoints (50) endpoints on the import endpoint."
          }
        }
      },
      "delete": {
        "tags": [
          "openapi_import"
        ],
        "operationId": "deleteAppOpenAPI",
        "summary": "Delete the imported OpenAPI document for an app.",
        "description": "Idempotent: returns 204 even if no row existed.\nEmits app.openapi_import.deleted audit + pg_notify\non NotifyAppOpenAPIDocChanged so the auto-gen cache\nflushes.\n",
        "responses": {
          "204": {
            "description": "Deleted (row gone from app_openapi_docs)."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/apps/{slug}/openapi/dry-run": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "openapi_import"
        ],
        "operationId": "dryRunAppOpenAPI",
        "summary": "Read-only preview of edge-rule suggestions for an imported doc.",
        "description": "POST-only (the body IS the import body). Same auth chain\nas the GET surface minus the MFA requirement (read-only).\nValidates the doc and walks paths, emitting one\nEdgeRuleSuggestion per (path, method) pair NOT already\ncovered by an existing validate edge rule. Empty array\nwhen the doc is fully covered.\n\nCustomer pastes each suggestion's Path + Methods + Kind\n+ Action back into the existing create-edge-rule endpoint\n(item #2 D3). Does NOT persist; does NOT emit pg_notify.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "openapi",
                  "info",
                  "paths"
                ],
                "properties": {
                  "openapi": {
                    "type": "string"
                  },
                  "info": {
                    "type": "object"
                  },
                  "paths": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry-run suggestions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppOpenAPIImportDryRunResponse"
                }
              }
            }
          },
          "400": {
            "description": "code: empty_body."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "413": {
            "description": "code: openapi_import_too_large. Body exceeds state.OpenAPIImportMaxDocBytes (256 KiB) on the dry-run endpoint."
          },
          "422": {
            "description": "code: openapi_import_invalid or openapi_import_too_many_endpoints. Doc fails the structural-minimum validator or declares more than state.OpenAPIImportMaxEndpoints (50) endpoints on the dry-run endpoint."
          }
        }
      }
    },
    "/v1/apps/{slug}/openapi/preview": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "openapi_import"
        ],
        "operationId": "previewAppOpenAPIPolicy",
        "summary": "Preview declared routes, observed routes, and matching edge policies.",
        "description": "Read-only route-policy preview for API-hosting roadmap item 11.\nJoins the persisted OpenAPI declaration with the gateway's observed\nroute labels and the app's edge rules. Each route is classified as\n`matched`, `declared_only`, or `observed_only`; `covered` is true\nwhen at least one enabled edge rule matches the path and method.\nObserved routes come from the fleet-wide Prometheus aggregate. A\npartial scrape returns the available union with\n`source=degraded: routes_partial`; a total bridge failure sets\n`observed_available` to false and reports\n`source=degraded: routes_unavailable`. Collector counts distinguish\nboth states from a healthy fleet that has not received traffic. No\npolicy or document writes occur on this endpoint.\n",
        "responses": {
          "200": {
            "description": "Declared-vs-observed route and policy preview.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppOpenAPIPolicyPreviewResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-removal/policy": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getRouteRemovalPolicy",
        "summary": "Read the production route removal policy.",
        "description": "Requires apps:read or admin and completed MFA. An unconfigured app reports revision 0 and mode report.",
        "responses": {
          "200": {
            "description": "Current policy and durable production baseline.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteRemovalPolicy"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "apps"
        ],
        "operationId": "setRouteRemovalPolicy",
        "summary": "Configure server route removal enforcement.",
        "description": "Requires account admin authorization and completed MFA. expected_revision is mandatory. First configuration requires one production baseline at 100 percent, or no production deployments. Policy changes invalidate previous approvals. Quiet observation begins when a policy first adopts a baseline, resets on full cutover or capture changes, and survives policy mode changes.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetRouteRemovalPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved route retirement policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteRemovalPolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-lifecycle/history": {
      "get": {
        "operationId": "listRouteLifecycleHistory",
        "tags": [
          "apps"
        ],
        "summary": "List production lifecycle review history",
        "description": "Requires read authorization and completed MFA. Returns newest retained reviews first by immutable review ID. Successful production traffic increases and blocked application review attempts are retained; rolled-back successful reviews and direct SQL rejections are not retained. Captures and graph IDs are historical metadata. Approval status is evaluated at read time and is not a fresh rollout authorization. Older reviews may have no recorded binding evidence. Metadata is bounded to 20 approvals, 64 captures and 64 graph IDs per approval; truncated indicates omitted metadata. Full successor pins remain available through the approval receipt endpoint. Configuration snapshots, credentials and OpenAPI payloads are never returned.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum retained reviews to return.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 20,
              "default": 10
            }
          },
          {
            "name": "before",
            "in": "query",
            "description": "Retained app-owned review ID from next_cursor.",
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]*$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retained production lifecycle reviews",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteLifecycleHistoryPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-lifecycle/approvals": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "approveRouteLifecycle",
        "summary": "Approve exact captured lifecycle successor changes.",
        "description": "Requires account admin authorization, owner or organization owner/admin identity, completed MFA and same-origin session protection. The server validates explicit authorized canonical or verified custom-domain HTTPS successor mappings against captured inline rooted OpenAPI operation contracts. Unknown or incompatible results fail closed. Receipt bindings include gate, saved requirements and removal policy revisions, configured policy fingerprint and authoritative capture hashes. Receipts expire after one hour and bind destination ownership, capture, hostname and production routing. Destination capture, domain, rule and routing changes invalidate receipts. All destination pins must be supplied together; project destinations require one active production graph member and verified frozen workload settings; ambiguous routing is unavailable for approval. Only successor-review findings on production traffic increases may be cleared; other lifecycle, removal and contract checks remain enforced. Workers also require the receipt database configuration binding to remain current.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApproveRouteLifecycleRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Durable compatibility approval receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteLifecycleApproval"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-lifecycle/approvals/{approval_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "approval_id",
          "description": "App-owned lifecycle approval receipt identifier.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getRouteLifecycleApproval",
        "summary": "Inspect an app-owned lifecycle approval receipt.",
        "description": "Requires read authorization and completed MFA. Returns the persisted review bindings and capture invalidation timestamp. An expired or policy-stale receipt remains readable and does not authorize a production traffic increase.",
        "responses": {
          "200": {
            "description": "Persisted approval receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteLifecycleApproval"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-removal/approvals": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "approveRouteRemoval",
        "summary": "Store an authenticated approval for exact route removal.",
        "description": "Requires account admin authorization and completed MFA. Uses server-owned captures, canonical successor mappings and retained production telemetry. Requires a staged baseline exposing old and successor routes, compatible successors in the candidate, the configured quiet grace period and explicit observed-only acknowledgement. Approver and timestamps are derived from authentication and server time. Approval is recorded durably. Local attestations and uploaded readiness statuses cannot satisfy this authorization. An approval does not waive other deployment or contract gates.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApproveRouteRemovalRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Durable approval receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteRemovalApproval"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-removal/check": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "checkRouteRemoval",
        "summary": "Read authoritative route removal blockers.",
        "description": "Requires apps:read or admin and completed MFA. Uses the same evaluator as production traffic transitions. This read is advisory; enforcement repeats within the traffic transaction. Missing captures, stale approvals, changed policies or renewed old-route observations block enforce mode.",
        "parameters": [
          {
            "name": "deployment_id",
            "description": "Candidate deployment whose removed routes are evaluated.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current policy, removed operations and blockers.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteRemovalCheck"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-requirements": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getSavedRouteRequirements",
        "summary": "Read saved route requirements.",
        "description": "Read the current normalized version 2 route intent and its revision. Public exception rationale is replaced before storage. Requires apps:read or admin and completed MFA. This is the current record; previous revisions remain in customer version control.",
        "responses": {
          "200": {
            "description": "Current saved route intent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SavedRouteRequirements"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "apps"
        ],
        "operationId": "saveRouteRequirements",
        "summary": "Save route requirements with a revision check.",
        "description": "Save version 2 route groups or exact assignments after comparing expected_revision. Use 0 to create the first record. Identical normalized intent at the current revision is a no-op. Requires deploy:write or admin and completed MFA. Does not change gateway configuration or invoke application routes.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveRouteRequirementsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved normalized route intent and current revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SavedRouteRequirements"
                }
              }
            }
          },
          "400": {
            "description": "Invalid revision or requirements document.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-requirements/check": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "checkRouteRequirements",
        "summary": "Check saved intent against a captured deployment.",
        "description": "Read saved requirements, current account/app policy and the selected app-owned capture in one consistent snapshot. Requires apps:read or admin and completed MFA. Violated and unknown findings return a report with 200; unavailable inventory never passes. The result checks current configured policy rather than historical gateway behavior or runtime authorization. No report is persisted and no application request is sent.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckRouteRequirementsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Current policy coverage with saved revision and capture provenance.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteRequirementsCheck"
                }
              }
            }
          },
          "400": {
            "description": "Invalid deployment identity or expected revision.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/rollouts/{id}/observation": {
      "get": {
        "operationId": "getWorkerRolloutObservation",
        "summary": "Read a coherent worker-generation residency snapshot",
        "tags": [
          "deployments"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug for worker rollout observation.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "description": "Exact deployment ID for worker rollout observation.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "environment",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Selected environment for passive worker generation observations; omit for the default scope."
          },
          {
            "name": "scope",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "default"
              ]
            },
            "description": "Explicit default scope. Exactly one selector is required."
          }
        ],
        "responses": {
          "200": {
            "description": "Database snapshot of selected and retired worker residents. Does not establish queue processing or external consumer completion.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkerRolloutObservation"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/operational-summary": {
      "parameters": [
        {
          "name": "environment",
          "in": "query",
          "schema": {
            "type": "string"
          },
          "description": "Environment whose passive operational summary is requested; omit for the default scope."
        },
        {
          "name": "scope",
          "in": "query",
          "schema": {
            "type": "string",
            "enum": [
              "default"
            ]
          },
          "description": "Choose default-scope operational evidence; do not combine with an environment selector."
        },
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppOperationalSummary",
        "summary": "Read current production monitoring and recovery progress.",
        "description": "Requires app read access and completed MFA. Joins current default-scope production route evidence, metadata for the saved open incident, pending checked rollbacks across app scopes, and pending or failed restart handoffs. Reads do not wake workloads, change traffic, or declare incident recovery. Component availability and bounded-list truncation are explicit. Deployment smoke verification remains a separate launch-time result. Customer identities, request evidence, free-form rollback reasons and internal restart errors are omitted. An environment selector or scope=default returns an attributed scoped summary, scoped health and explicitly scoped recovery records; aggregate route-monitor evaluations and unscoped restart handoffs are omitted.",
        "responses": {
          "200": {
            "description": "Independently observed operational facts; unavailable components remain explicit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppOperationalSummary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-budgets": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "scope",
          "in": "query",
          "schema": {
            "type": "string",
            "enum": [
              "default"
            ]
          },
          "description": "Select scope=default or one registered environment, exactly one selector is required."
        },
        {
          "name": "environment",
          "in": "query",
          "schema": {
            "type": "string"
          },
          "description": "Registered named environment; cannot be combined with scope."
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getEnvironmentRouteBudgets",
        "summary": "Read effective advisory budgets for one environment.",
        "description": "Requires app read access and completed MFA. Defaults to app-budget inheritance. Reports immutable identity, override revision and parent revision. Excludes customer grouping and recovery actions.",
        "responses": {
          "200": {
            "description": "Effective advisory route budgets and their policy source.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvironmentRouteBudgets"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "apps"
        ],
        "operationId": "setEnvironmentRouteBudgets",
        "summary": "Save a reviewed environment budget override or restore inheritance.",
        "description": "Requires deployment write access, completed MFA and account admission. Enabling requires telemetry entitlement. Pins app/environment identities and both revisions atomically. A save increments the override revision and resets completed observation windows, including return to inheritance. Request UUID and body are bound to a durable native receipt; replay returns the original result after later edits. No traffic, release gate, production monitor, incident or automatic rollback changes. Body limit is 16 KiB.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetEnvironmentRouteBudgetsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved intent or original replay receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvironmentRouteBudgets"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Enabling requires telemetry entitlement and account admission.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-budgets/receipts/{request_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "request_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Exact original nonzero request UUID."
        },
        {
          "name": "scope",
          "in": "query",
          "schema": {
            "type": "string",
            "enum": [
              "default"
            ]
          },
          "description": "Select scope=default or one registered environment; exactly one selector is required."
        },
        {
          "name": "environment",
          "in": "query",
          "schema": {
            "type": "string"
          },
          "description": "Current named environment containing the original receipt; mutually exclusive with scope=default."
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getEnvironmentRouteBudgetReceipt",
        "summary": "Read an original durable environment budget receipt.",
        "description": "Requires current app read access and completed MFA. Matches account, app and current immutable project/environment identities. Returns historical committed policy revisions and the exact original request fingerprint, excluding configuration values. Later policy edits do not replace this receipt. A missing, inaccessible or unavailable receipt never proves non-commit. This endpoint performs no mutation, replay, approval or expiry renewal and does not establish runtime health.",
        "responses": {
          "200": {
            "description": "Historical policy-intent receipt, not current configuration or runtime completion.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvironmentRouteBudgetReceipt"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-monitor": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getRouteMonitor",
        "summary": "Read advisory production route monitoring intent.",
        "description": "Defaults to disabled, revision zero and no routes. Requires app read access and completed MFA. Configuration is independent of the canary guard. customer_group_by optionally evaluates the same absolute budgets per request-time tenant or API consumer.",
        "responses": {
          "200": {
            "description": "Current advisory production monitor configuration.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteMonitorConfig"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "apps"
        ],
        "operationId": "setRouteMonitor",
        "summary": "Save advisory production route budgets with a revision check.",
        "description": "Requires deployment write access and completed MFA. Enabling requires request telemetry entitlement and routes with absolute budgets. customer_group_by optionally evaluates the same budgets per request-time tenant or API consumer. Replacement intent requires expected_revision; identical intent is a no-op. Changed intent supersedes an open incident without claiming recovery and requires fresh windows. Disabled intent remains writable after a downgrade. Body limit is 16 KiB.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetRouteMonitorRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated or unchanged production monitoring intent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteMonitorConfig"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Enabling production monitoring requires request telemetry entitlement.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Monitor revision changed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/routes/advice": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getRouteAdvice",
        "summary": "Suggest edge rules for observed routes with what-if estimates.",
        "description": "Read-only route advisor. Reads retained request telemetry for\nthe app's busiest observed routes across deployments and suggests three\nkinds of edge rules: cache for anonymous, successful GET routes with\nrepeat traffic; async for POST routes that time out or exceed a 10 s\np95; and a per-consumer throttle when one consumer dominates a route and\na limit exists that no other observed consumer reaches. A route needs at\nleast 200 requests in the window, and routes that already have a rule of\nthe suggested kind (enabled or not) are skipped.\n\nEach suggestion carries its evidence, an estimate replayed from the same\nwindow, cautions, and ready-to-create rule bodies: one per hostname (the\nplatform hostname and every verified custom domain), always disabled.\nNothing is applied; create the rules with POST /v1/apps/{slug}/edge-rules\nand enable them after review. Suggestion IDs are stable for the same\nkind, method and route. Estimates are observed_only and upper bounds:\nthe cache estimate cannot see credential headers or query strings.\nUses the normal read scopes, completed MFA and the DebugTelemetryEnabled\nplan gate.\n",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "168h"
            },
            "description": "Positive lookback duration (for example 7d) or RFC3339 start timestamp; clamped to current plan retention."
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Exclusive end of the advice window, default now; must be within retained telemetry and not in the future."
          },
          {
            "name": "cache_max_age",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 3600,
              "default": 60
            },
            "description": "What-if cache lifetime in seconds for cache estimates and proposed cache rules."
          }
        ],
        "x-since": "2026-10",
        "responses": {
          "200": {
            "description": "Route advisor suggestions for the window.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteAdviceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/routes/awake": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getRouteAwake",
        "summary": "Show which routes keep a scale-to-zero app awake.",
        "description": "Read-only awake-time report. Awake time is the app's billed\nrunning time (plan RAM + 8 MB per running second) from the usage\nledger. It is attributed, minute by minute, to the routes whose\nrequests restarted the idle timer: a 2xx response from an instance, or\na request that cold-booted it. Requests the gateway answered itself\n(edge cache hits, edge answers, rejected credentials) never wake the\napp and are not counted.\n\nFor each of the busiest ten routes the report estimates the awake time\nand the change in cold wakes had that route's requests never reached\nthe app, flags routes called at a steady interval (uptime monitors,\npollers), and suggests serving anonymous GET traffic from the edge\ncache or calling less often than the idle timeout. Awake time no\nrequest explains (synthetic probes, scheduled prewarm, minimum\ninstances, queue, cron and waitUntil work) is reported as\nunattributed. Minute resolution makes every figure an estimate. Uses\nthe normal read scopes, completed MFA and the DebugTelemetryEnabled\nplan gate.\n",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "168h"
            },
            "description": "Start of the awake report window: a positive lookback duration (for example 7d) or an RFC3339 timestamp, clamped to current plan retention."
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Exclusive end of the window, default now; must be within retained telemetry and not in the future."
          }
        ],
        "x-since": "2026-10",
        "responses": {
          "200": {
            "description": "Awake time and the routes that caused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteAwakeResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/routes/insights": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getRouteInsights",
        "summary": "List the app's proactive route insights.",
        "description": "Findings the route insights evaluator records every six hours for\napps that ran in the last day: `kept_awake` when a client\ncalling a route at a steady interval keeps a mostly-awake app from\nparking, `cacheable` when the gateways measured a route safe to\ncache for a given lifetime, and, for routes that already have a cache\nrule, `cache_stale` when refills found the body changed\nbefore the rule's max-age ran out and `cache_too_short` when the body\nstayed the same far longer. Active insights come first, then those\nresolved in the last seven days. An insight resolves after a day\nwithout being observed. Subscribe app webhooks to\n`routes.insight.detected` and `routes.insight.resolved` to be told of\neach transition; the webhook payload is the same insight object.\nUses the normal read scopes, completed MFA and the\nDebugTelemetryEnabled plan gate.\n",
        "x-since": "2026-10",
        "responses": {
          "200": {
            "description": "The app's route insights.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteInsightsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/routes/insights/{id}/fix": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "The insight id from GET /v1/apps/{slug}/routes/insights."
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "fixRouteInsight",
        "summary": "Apply a route insight's fix.",
        "description": "Applies the edge-rule change the insight's `fix` describes: `create_cache_rule` creates an enabled `@app`\ncache rule with the measured safe max-age, `set_cache_max_age` and\n`disable_cache_rule` change the cache rule serving exactly this route,\nand `add_cache_override` adds a narrower rule ahead of a rule that also\ncovers other routes. A `cache_stale` fix then purges the route's cached\nresponses. Rules are written through the same path as the edge-rules\nAPI, so plan quotas, validation and fleet convergence apply.\n\n`fix_id` must be the `fix.id` the insight lists now; if the insight or\nthe app's edge rules changed, the request fails with 409\n`route_insight_fix_changed` and nothing is written. An insight that is\nresolved or has no fix fails with 409 `route_insight_no_fix`. On\nsuccess the route's affected insights resolve with `fix_action` and\n`fixed_at`, and stay resolved for at least one evidence window. Uses\nthe deploy-write scopes, completed MFA, the DebugTelemetryEnabled plan\ngate and Idempotency-Key replay.\n",
        "x-since": "2026-10",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RouteInsightFixRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The fix was applied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteInsightFixResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The insight has no fix to apply (`route_insight_no_fix`), or the fix changed since it was read (`route_insight_fix_changed`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/service-wake-ahead": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getServiceWakeAhead",
        "summary": "Read an app's service wake-ahead opt-in.",
        "description": "Service wake-ahead is off by default. When it is on and this\napp starts a cold wake, the gateway also starts restoring the services\nit has measured this app calling soon after it wakes, so their restores\noverlap instead of running one after another. Measurement is per\ngateway and needs at least 20 observed wakes of this app before any\nservice is woken ahead. Woken services are billed like any other\nrunning instance. Requires app read access and completed MFA.\n",
        "x-since": "2026-10",
        "responses": {
          "200": {
            "description": "The app's wake-ahead opt-in.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceWakeAheadResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "apps"
        ],
        "operationId": "setServiceWakeAhead",
        "summary": "Turn an app's service wake-ahead on or off.",
        "description": "Sets the opt-in. Gateways apply the change within 30 seconds.\nWake-ahead never starts while fleet residency is at or above 60% of the\nadmission ceiling, never parks other instances to make room, and goes\nthrough the same admission and plan concurrency limits as a request.\nRequires deploy write access and completed MFA. Body limit is 1 KiB.\n",
        "x-since": "2026-10",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetServiceWakeAheadRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated opt-in.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceWakeAheadResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-priorities": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getRoutePriorities",
        "summary": "Read the routes served first and last when an app is saturated.",
        "description": "Route priorities order the queue requests wait in while every\nroutable instance of the app is busy. Critical requests are served\nbefore normal ones and normal before bulk; within a class the queue\nstays first in, first out, and the request already at the head is never\nmoved. When the queue is full, a request takes the place of the newest\nwaiting request of a lower class, which receives the usual 503 with\nRetry-After. Saved rules apply when present (source configured);\notherwise the app's route-health selectors are critical (route_health);\notherwise there are none. Crawlers and link-preview bots that match no\nrule are bulk. Requires app read access and completed MFA.\n",
        "x-since": "2026-10",
        "responses": {
          "200": {
            "description": "The app's effective route priorities.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutePrioritiesResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "apps"
        ],
        "operationId": "setRoutePriorities",
        "summary": "Replace an app's saved route priorities.",
        "description": "Saves at most 20 rules, matched in order; the first match wins. A path\nis a route template (/users/{id}) or an edge-rule glob (/exports/*); an\nomitted method matches every method. An empty list saves \"no\npriorities\" and turns off the route-health default. Gateways apply the\nchange within 30 seconds. Requires deploy write access and completed\nMFA. Body limit is 16 KiB.\n",
        "x-since": "2026-10",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetRoutePrioritiesRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The effective route priorities after saving.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutePrioritiesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "apps"
        ],
        "operationId": "resetRoutePriorities",
        "summary": "Delete an app's saved route priorities.",
        "description": "Deletes saved rules so the route-health default applies again. Requires deploy write access and completed MFA.",
        "x-since": "2026-10",
        "responses": {
          "200": {
            "description": "The effective route priorities after the reset.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutePrioritiesResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-monitor/report": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getRouteMonitorReport",
        "summary": "Read observed route budgets for the fully serving production deployment.",
        "description": "Read-only evaluation of two closed UTC minute windows with a 30 second ingestion allowance. Selects the sole fully serving default-scope live deployment; split, incomplete, sparse or unavailable context is unknown. Errors require 20 represented requests and at least two errors to confirm a budget violation; latency requires 100 requests per window. Both windows must start after configuration and serving anchors. If customer_group_by is configured, the same budgets are evaluated per observed request-time identity and sustained cohort violations can make the overall result violated. Customer identities are redacted by default; customer_details=true explicitly includes observed tenant or consumer UUIDs. Coverage is observed_only, not an SLO or full capture. Does not create incidents or change traffic.",
        "parameters": [
          {
            "name": "customer_details",
            "in": "query",
            "description": "Explicitly include request-time tenant or consumer UUIDs when customer_group_by is configured. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current observed production route budget evaluation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteMonitorReport"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-monitor/preview": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "previewRouteMonitor",
        "summary": "Evaluate proposed route budgets against recent production traffic without saving them.",
        "description": "Read-only evaluation of proposed absolute budgets against the two latest closed UTC minute windows for the sole fully serving default-scope deployment. Requires app read access and completed MFA. Uses the deployment and rollout observation anchors, but not the saved monitor update anchor, because the proposal has not been saved. If the proposal groups by customer, customer IDs are redacted by default. Saving changed configuration resets its observation anchor, so this preview is current evidence and not a prediction of the first post-save report. Violated and unknown findings return 200; no configuration, incident or traffic state is changed. Body limit is 16 KiB.",
        "parameters": [
          {
            "name": "customer_details",
            "in": "query",
            "description": "Explicitly include observed tenant or consumer UUIDs when customer_group_by is selected. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreviewRouteMonitorRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Read-only evaluation of the proposed budgets and saved revision used for comparison.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteMonitorPreview"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-monitor/incidents": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listRouteMonitorIncidents",
        "summary": "List bounded saved production route incidents.",
        "description": "Requires app read access, completed MFA and current request telemetry entitlement. Returns opening reports and bounded saved redacted debugger evidence. History retains the active incident plus the newest 100 closed incidents within 8 MiB. Pruned or foreign cursors return not found.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum incidents to return.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10,
              "default": 5
            }
          },
          {
            "name": "before",
            "in": "query",
            "description": "Page before this owned retained incident UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One bounded page of retained production route incidents.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteMonitorIncidentPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Listing saved production incidents requires current telemetry entitlement.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-monitor/incidents/{incident}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "incident",
          "in": "path",
          "required": true,
          "description": "Owned retained production route incident UUID.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getRouteMonitorIncident",
        "summary": "Read the opening evidence and closure of one saved production route incident.",
        "description": "Requires app read access, completed MFA and current request telemetry entitlement. Opening windows, deployment, commit, budgets, request references and dependency summaries are captured when the worker opens the incident. Recovered means comparable healthy windows for all selected budgets and all customers recorded as violating during the incident; superseded means context changed and never emits recovery. Customer identities are redacted by default; customer_details=true explicitly includes saved request-time tenant or consumer UUIDs. Debugger links recheck current retention and authorization.",
        "parameters": [
          {
            "name": "customer_details",
            "in": "query",
            "description": "Explicitly include saved request-time tenant or consumer UUIDs when customer_group_by is configured. Defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Saved production incident opening evidence and closure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteMonitorIncident"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Inspecting this saved production incident requires current telemetry entitlement.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-health/gate": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getRouteHealthGate",
        "summary": "Read critical telemetry routes, guard mode and revision.",
        "description": "Defaults to report mode with no selected routes and revision 0. Requires apps:read or admin and completed MFA. Applies to subsequent traffic increases of an existing canary.",
        "responses": {
          "200": {
            "description": "Current app canary route gate.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteHealthGate"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "apps"
        ],
        "operationId": "setRouteHealthGate",
        "summary": "Save exact route selectors and guard mode with a revision check.",
        "description": "Requires deploy:write or admin and completed MFA. Enforce mode requires traffic split and request telemetry entitlement, and at least one selected route. Maximum 20 distinct exact normalized telemetry method/path selectors. Optional max_p95_ms enables an absolute latency budget; check_latency enables the independent relative slowdown check. expected_revision is mandatory; use 0 initially. Identical configuration is a no-op after checking the revision. Changing selectors, latency checks or mode resets the observation anchor. Request body limit is 16 KiB.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetRouteHealthGateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated or unchanged gate configuration.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteHealthGate"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Configuration revision changed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-health/deployments/{deployment}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "deployment",
          "description": "Owned canary deployment UUID whose current critical-route telemetry is compared with its serving predecessor.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getRouteHealthReport",
        "summary": "Compare observed critical route errors and optional p95 latency for candidate and stable deployments.",
        "description": "Requires apps:read or admin and completed MFA. Compares exact normalized telemetry labels and weighted counts in two consecutive closed UTC minute windows, behind a 30 second ingestion allowance. Error checks need 20 represented requests on each deployment per window. Selected latency checks need 100, with p95 estimates weighted by collapsed telemetry counts. A positive max_p95_ms is an absolute candidate budget; check_latency independently checks for at least 1.5 times stable p95 and at least 100 ms additional latency. Each signal is confirmed independently across both windows. Both windows must begin after the current stage and latest configuration update. Missing, sparse, ambiguous or unavailable evidence is unknown. Coverage is observed_only; full capture and requests dropped before storage cannot be established. Enforce mode holds subsequent advances unless every selected route is healthy. This read does not change traffic; the configured recovery action is evaluated separately by the canary worker. Stable deployment is the sole other live serving deployment in the same scope.",
        "parameters": [
          {
            "name": "customers",
            "in": "query",
            "description": "Include advisory customer health cohorts. Never changes aggregate health or rollout decisions.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "customer_group_by",
            "in": "query",
            "description": "Request-time identity dimension. Requires customers=true. Tenant is the default; consumer groups API consumers independently.",
            "schema": {
              "type": "string",
              "enum": [
                "tenant",
                "consumer"
              ]
            }
          },
          {
            "name": "customer_details",
            "in": "query",
            "description": "Include scoped customer UUIDs. Requires customers=true. IDs are omitted by default.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current observation evidence, identities and route verdicts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteHealthReport"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-health/deployments/{deployment}/investigation": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "deployment",
          "in": "path",
          "required": true,
          "description": "Owned in-flight candidate deployment to investigate against its serving stable revision.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getRouteHealthInvestigation",
        "summary": "Investigate route errors or latency using retained request evidence.",
        "description": "Requires app read access, completed MFA and request telemetry entitlement. Aggregate report, selected finding and bounded examples share one read-only repeatable-read snapshot, exact candidate/stable pair and closed health windows. The default errors signal selects all 5xx or a watched status code. Latency requires a configured latency check and status_code zero, includes successful responses, and compares retained dependency, guest and wake timings separately from full route p95. Optional customer selection uses recorded tenant or consumer attribution, including identities outside the customer report cap and revoked consumers. Customer UUID input explicitly includes the selected ID; other customer identities are excluded. Counts preserve publisher weights; examples are telemetry rows and may represent multiple requests. Trace links do not guarantee retained spans. This diagnostic read changes no rollout state and includes no payloads, credentials, request headers or raw URLs.",
        "parameters": [
          {
            "name": "method",
            "in": "query",
            "required": true,
            "description": "Exact configured HTTP method for the normalized telemetry label.",
            "schema": {
              "type": "string",
              "enum": [
                "GET",
                "POST",
                "PUT",
                "PATCH",
                "DELETE",
                "HEAD",
                "OPTIONS"
              ]
            }
          },
          {
            "name": "path",
            "in": "query",
            "required": true,
            "description": "Exact configured normalized route path, without a method prefix or expanded parameters.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 240
            }
          },
          {
            "name": "signal",
            "in": "query",
            "description": "Errors is the default. Latency requires check_latency or a positive max_p95_ms and cannot be combined with a nonzero status_code.",
            "schema": {
              "type": "string",
              "enum": [
                "errors",
                "latency"
              ]
            }
          },
          {
            "name": "status_code",
            "in": "query",
            "description": "Zero compares all 5xx responses; a nonzero code must be selected in this route's watch_statuses.",
            "schema": {
              "type": "integer",
              "enum": [
                0,
                401,
                403,
                404,
                422,
                429
              ],
              "default": 0
            }
          },
          {
            "name": "customer_group_by",
            "in": "query",
            "description": "Recorded identity dimension for a selected customer UUID. Requires customer_id; defaults to tenant when supplied.",
            "schema": {
              "type": "string",
              "enum": [
                "tenant",
                "consumer"
              ]
            }
          },
          {
            "name": "customer_id",
            "in": "query",
            "description": "Canonical UUID of an owned tenant or app consumer. Selection explicitly exposes this UUID in the investigation.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current health evidence and bounded metadata references for the requested signal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteHealthInvestigation"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-health/deployments/{deployment}/history": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "deployment",
          "description": "Deployment UUID whose retained canary route-health decisions are listed.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listRouteHealthHistory",
        "summary": "Explain saved canary route health decisions with an immutable timeline.",
        "description": "Requires apps:read or admin and completed MFA. Available after plan downgrade and rollout completion. Only real advance evaluations with selected routes create snapshots; reads never create history. Identical retries reuse the original decision. Retains the newest 100 entries within 4 MiB per deployment, with each encoded entry bounded to 64 KiB. Pages are newest first by checked_at and id. A missing, foreign or pruned cursor returns 404. Historical evidence does not establish current health or continuous incident duration.",
        "parameters": [
          {
            "name": "limit",
            "description": "Maximum number of saved health decisions to return in this page; defaults to 5 and cannot exceed 10.",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10,
              "default": 5
            }
          },
          {
            "name": "before",
            "in": "query",
            "description": "Retained decision UUID from this deployment; excludes this entry and every newer entry.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Saved decision page; entries is empty when no evaluations have been saved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteHealthHistoryPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-health/deployments/{deployment}/history/{decision_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "deployment",
          "description": "Deployment UUID that owns the requested saved canary health decision.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "decision_id",
          "description": "Retained health decision UUID identifying the exact rollout evaluation evidence to retrieve.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getRouteHealthHistoryEntry",
        "summary": "Read the exact observations and thresholds behind a retained rollout decision.",
        "description": "Requires apps:read or admin and completed MFA. Account, app and deployment scoped. Available after plan downgrade and rollout completion. Returns 404 for a missing, foreign or pruned decision. Reads never evaluate telemetry or change traffic. Allowed entries committed with the traffic transaction; blocked entries preserve only the held evaluation. Later failed traffic transactions leave no allowed snapshot.",
        "responses": {
          "200": {
            "description": "Immutable saved decision, including error and latency evidence and observation context.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteHealthHistoryEntry"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-requirements/gate": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getCanaryRouteGate",
        "summary": "Read canary route gate mode and revision.",
        "description": "Defaults to report mode and revision 0. Requires apps:read or admin and completed MFA. Gates route-requirements evidence on canary advances and lifecycle declarations on production traffic increases, including initial activation and ordinary cutovers. Dark staging, validated abort and automatic incident recovery remain available.",
        "responses": {
          "200": {
            "description": "Current saved route-requirements gate mode and revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CanaryRouteGate"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "apps"
        ],
        "operationId": "setCanaryRouteGate",
        "summary": "Set report or enforce mode with a gate revision check.",
        "description": "Requires deploy:write or admin and completed MFA. Enforce mode requires saved route requirements and a plan with canaries and captured endpoint discovery. Report mode remains available after downgrade. expected_revision is mandatory; use 0 initially. Identical mode is a no-op after checking the revision.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetCanaryRouteGateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved or unchanged canary route-requirements gate configuration.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CanaryRouteGate"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Gate revision changed or route requirements are missing.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-requirements/checks/{deployment}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "deployment",
          "description": "App-owned captured deployment UUID whose latest automatic requirement check and freshness are requested.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAutomaticRouteCheck",
        "summary": "Read the latest automatic route check and freshness.",
        "description": "Read queue state and the latest stored deployment verdict in a consistent snapshot. Freshness compares current intent revision/hash, capture hash/truncation and configuration hash. A historical satisfied result can be stale. Requires apps:read or admin, completed MFA and current captured endpoint discovery entitlement. Does not run a new check or gate deployment.",
        "responses": {
          "200": {
            "description": "Latest stored verdict with current queue and freshness state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomaticRouteCheck"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Current plan does not include captured endpoint discovery.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-requirements/checks/{deployment}/history": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "deployment",
          "description": "Captured deployment UUID whose retained route requirement check history is listed.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listRouteCheckHistory",
        "summary": "List retained route check history.",
        "description": "Read bounded completed evidence newest first. Retains at most 20 entries and 64 MiB of encoded history per deployment. A missing/pruned cursor returns 404. Requires app read access, completed MFA and current captured endpoint discovery entitlement. Historical satisfied evidence cannot satisfy a current deployment gate.",
        "parameters": [
          {
            "name": "limit",
            "description": "Maximum number of completed requirement-check summaries in this page; defaults to 5 with a maximum of 10.",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10,
              "default": 5
            }
          },
          {
            "name": "before",
            "description": "Retained check UUID from this deployment; return only older entries and exclude the selected entry.",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retained completed checks and optional next cursor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteCheckHistoryPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Current plan lacks the captured endpoint discovery entitlement required to list route check history.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-requirements/checks/{deployment}/history/{check_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "deployment",
          "description": "Captured deployment UUID that owns the requested historical route requirement check.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "check_id",
          "description": "Retained completed check UUID selecting the exact immutable requirement and finding-change evidence.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getRouteCheckHistoryEntry",
        "summary": "Read one retained immutable route check.",
        "description": "Read the exact completion identified by a change notification. Missing or expired evidence returns 404. Requires app read access, completed MFA and current captured endpoint discovery entitlement. Historical evidence does not establish current safety.",
        "responses": {
          "200": {
            "description": "Retained immutable check and finding changes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteCheckHistoryEntry"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Reading retained requirement-check evidence requires captured endpoint discovery on the current plan.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-requirements/checks/{deployment}/refresh": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "deployment",
          "description": "App-owned captured deployment UUID to queue for automatic route requirements reevaluation.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "refreshAutomaticRouteCheck",
        "summary": "Queue a current route check for one deployment.",
        "description": "Accept an empty body and durably queue current saved intent, capture and policy evaluation. Coalesces with pending work and resets a failed retry. Requires apps:read or admin, completed MFA and captured endpoint discovery entitlement. This action changes no gateway policy and makes no application requests. Poll getAutomaticRouteCheck for completion.",
        "responses": {
          "202": {
            "description": "Durable check queued or existing pending check retained.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "app_id",
                    "deployment_id",
                    "status"
                  ],
                  "properties": {
                    "app_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "deployment_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "The current plan cannot queue route requirement reevaluation because captured endpoint discovery is unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-policy/plan": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "planRoutePolicy",
        "summary": "plan route policy.",
        "description": "Read a consistent app policy snapshot and propose throttle and budget changes for concrete requests or captured route groups. Group plans bind an app-owned captured deployment contract and report full inventory impact. Requires apps:read or admin and completed MFA. This POST only reads configuration.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RoutePolicyPlanRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Consistent policy snapshot with proposed rule changes and before/after coverage.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutePolicyPlan"
                }
              }
            }
          },
          "400": {
            "description": "code: validation_failed. Invalid or oversized route requirements document.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-policy/apply": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "Idempotency-Key",
          "in": "header",
          "required": true,
          "description": "Stable retry key, retained with the receipt for the app lifetime. Reuse with a different request returns conflict.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "applyRoutePolicy",
        "summary": "apply route policy.",
        "description": "Recompute the reviewed fingerprint under account, app, and rule locks, plus deployment and captured-contract locks for group plans. Commit all changes and a durable receipt in one transaction. Requires deploy:write or admin and completed MFA. The same idempotency key and request recover the original receipt after a lost response. Gateway state is a separate observation; converging or unknown does not undo a committed receipt.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RoutePolicyApplyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Committed transaction receipt and gateway acknowledgment observation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutePolicyApplyResponse"
                }
              }
            }
          },
          "400": {
            "description": "code: validation_failed. Missing confirmation, invalid fingerprint, or invalid retry key.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/route-policy/receipts/{receipt_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "receipt_id",
          "in": "path",
          "required": true,
          "description": "Durable route policy receipt ID.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getRoutePolicyReceipt",
        "summary": "get route policyReceipt.",
        "description": "Recover the committed rule IDs and configuration verification for this owned app. The receipt is historical evidence, not a fresh live policy or gateway check.",
        "responses": {
          "200": {
            "description": "Historical configuration verification and real rule IDs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutePolicyReceipt"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/openapi/apply": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "openapi_import"
        ],
        "operationId": "applyAppOpenAPIPolicy",
        "summary": "Plan or explicitly apply generated OpenAPI validation rules.",
        "description": "The default request is a read-only plan. It returns a deterministic\n`preview_sha256` approval token and the validation rules that would be\ncreated for uncovered OpenAPI operations. To mutate policy, repeat the\nrequest with `confirm=true` and the exact token. If the document or\nedge rules changed in the meantime, the server returns 409\n`openapi_policy_stale` and no writes occur. Applying an already-covered\ndocument is an idempotent no-op. A missing match_host defaults to the\napp's platform hostname. Requires MFA and deploy-write scope.\n",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplyAppOpenAPIPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Policy plan or applied rules.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppOpenAPIPolicyApplyResponse"
                }
              }
            }
          },
          "400": {
            "description": "code: validation or openapi_policy_confirmation_required."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "code: openapi_policy_stale. The approval token no longer matches the current plan."
          },
          "422": {
            "description": "code: validation. A generated rule failed edge-rule validation."
          },
          "500": {
            "description": "Internal server error."
          }
        }
      }
    },
    "/v1/apps/{slug}/openapi/diff": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "openapi_import"
        ],
        "operationId": "diffAppOpenAPIContract",
        "summary": "Preview the production OpenAPI contract gate.",
        "description": "Read-only contract diff. Compares the current projected\nOpenAPI surface against the latest captured live snapshot in the\nrequested scope (default `prod`). `blocking=true` means a production\npromotion would be rejected while `FAAS_API_CONTRACT_DIFF_ENABLED`\nis enabled. The route remains registered while the flag is off and\nreturns 503 `api_contract_diff_disabled`.\n",
        "parameters": [
          {
            "name": "scope",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
            },
            "description": "Deployment scope to compare; defaults to `prod`."
          }
        ],
        "responses": {
          "200": {
            "description": "Contract diff result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAPIContractDiffResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "code: api_contract_diff_disabled."
          }
        }
      }
    },
    "/v1/apps/{slug}/diff": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "deploydiff"
        ],
        "operationId": "diffApp",
        "summary": "Read-only preview of what a deploy would change.",
        "description": "Server-side equivalent of\n`gregale deploy --diff` — runs the same engine\nand returns the same wire shape (DiffResponse).\n\nRead-only: no DB writes, no audit row, no deployment row. The\napp-not-found case is 200 with `diff.changes[]` containing a\n`would_create_app` row + the quota gate firing against the\ncustomer's plan — a CI consumer can preview a fresh deploy the\nsame way the CLI does.\n\nAuth: bearer-key with `apps:read` or `deploy:write` (or admin). NO MFA on this\nendpoint, mirroring GET /v1/apps/{slug}/metrics.\n\nSchema-break detection is text-only (handler / entrypoint\n/ env-key changes → warn-severity Breaks); response schemas\nare not diffed yet.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DiffRequest"
              },
              "example": {
                "image": "ghcr.io/me/api@sha256:abc",
                "app_config": {
                  "ram_mb": 512,
                  "max_concurrency": 30
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "DiffResponse with `blocking: true` if any break has\n`severity: \"error\"`. CI gate input — `jq '.blocking'`\ncollapses to a single bool.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiffResponse"
                },
                "example": {
                  "diff": {
                    "slug": "api",
                    "plan": "hobby",
                    "changes": [
                      {
                        "field": "memory",
                        "kind": "modify",
                        "before": 256,
                        "after": 512
                      }
                    ],
                    "breaks": [
                      {
                        "code": "plan_limit_concurrency",
                        "severity": "error",
                        "reason": "max_concurrency exceeds plan cap",
                        "field": "concurrency",
                        "observed": 30,
                        "limit": 20
                      }
                    ]
                  },
                  "blocking": true,
                  "slug": "api",
                  "plan": "hobby"
                }
              }
            }
          },
          "400": {
            "description": "code: validation_failed. Body is malformed JSON, fails\nstrict-decode, or has a plan lookup error.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "code: forbidden. Caller's bearer key lacks both\n`apps:read` and admin scope.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "code: capacity. The store read failed for the baseline\nbuilder (deployment / env / crons / edge rules).\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/rollback": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "deployments"
        ],
        "operationId": "rollbackApp",
        "summary": "Roll back to the previous deployment, or to a specific historical deployment.",
        "description": "Without a request body, rolls back to the most-recent superseded\ndeployment (the pre-#976 behaviour).\n\nWith `target_deployment_id` in the body, rolls back to the\nnamed deployment. The id must belong to this app and the row\nmust be superseded or live with zero traffic. Rolling back to the\nalready-current live deployment is rejected (409\n`rollback_target_already_live`). A target whose snapshot has\nbeen garbage-collected is rejected (409\n`rollback_target_snapshot_expired`).\nWith both `target_deployment_id` and `expected_current_deployment_id`,\nstarts an exact checked rollback. The expected deployment must still\nserve all traffic with no active rollout in this scope. A 202 response\nincludes `rollback_operation`, confirming durable intent. Readiness,\nartifact and API contract checks precede a zero-traffic activation;\nfresh binding evidence is checked at the traffic transaction. Service\ncompletion also waits for the existing gateway ACK and drain handoff.\nStored binding enforcement requires this exact workflow.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "name": "Rollback-Attempt-ID",
            "in": "header",
            "required": false,
            "description": "Persisted opaque identity for an exact default-scope request or service rollback without alert attribution, database restoration or release acknowledgement. The accepted operation UUID is this hexadecimal identity. Reuse returns 409 rollback_attempt_accepted or rollback_attempt_conflict without starting another operation; GET the original operation separately.",
            "schema": {
              "type": "string",
              "minLength": 32,
              "maxLength": 32,
              "pattern": "^[0-9a-f]{32}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RollbackRequest"
              },
              "example": {
                "target_deployment_id": "0123456789abcdef0123456789abcdef"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The selected deployment and, for an exact checked request or service rollback, its accepted durable rollback operation. Acceptance does not imply completion.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentResponse",
                  "example": {
                    "id": "0123456789abcdef0123456789abcdef",
                    "app_id": "0123456789abcdef0123456789abcdef",
                    "image_digest": "sha256:0000000000000000000000000000000000000000000000000000000000000000",
                    "kind": "tarball",
                    "status": "pending",
                    "created_at": "2026-08-29T11:25:00Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/RollbackTargetNotFound"
          },
          "409": {
            "$ref": "#/components/responses/RollbackConflict",
            "description": "one of: no_rollback_target | rollback_target_already_live | rollback_target_snapshot_expired | rollback_deployment_changed | rollback_operation_required | rollback_attempt_accepted | rollback_attempt_conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/alert-rollbacks": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "alert_rules"
        ],
        "operationId": "listAlertRollbacks",
        "summary": "List recent automatic canary rollbacks.",
        "description": "Read-only, bounded to the 32 most recently updated production alert rollback actions for this owned app. Alert fires pin the exact active canary and serving predecessor. Binding blockers retry fresh evidence after APID restarts; deployment changes fail without retargeting.",
        "responses": {
          "200": {
            "description": "Recent alert rollback receipts, newest update first.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "maxItems": 32,
                  "items": {
                    "$ref": "#/components/schemas/AlertRollback"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/alert-rollbacks/{fire}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "fire",
          "in": "path",
          "required": true,
          "description": "UUID of the production alert delivery that captured this rollback.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "alert_rules"
        ],
        "operationId": "getAlertRollback",
        "summary": "Read one automatic canary rollback.",
        "description": "Read-only status for an immutable alert fire and deployment pair. Complete includes the audit committed with traffic restoration; blocked is pending recovery rather than completion. A failed target selection has no eligible pair and never selects one later.",
        "responses": {
          "200": {
            "description": "Durable alert rollback receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlertRollback"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/rollbacks/{operation}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "operation",
          "in": "path",
          "required": true,
          "description": "UUID of the accepted historical rollback operation.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getRollbackOperation",
        "summary": "Read an exact historical rollback operation.",
        "description": "Read-only progress for a pinned deployment pair. Complete includes a committed routing audit; service completion also requires the matching handoff to finish. Blocked operations retry fresh evidence without choosing another deployment.",
        "responses": {
          "200": {
            "description": "Durable rollback progress.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RollbackOperation"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/database-switches": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "listDatabaseSwitches",
        "summary": "List rollbacks that restore the database.",
        "description": "An app's database switches, newest first.",
        "responses": {
          "200": {
            "description": "The app's switches.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DatabaseSwitchList"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/database-switches/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Database switch UUID.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getDatabaseSwitch",
        "summary": "Read a rollback that restores the database.",
        "description": "The switch's phase, restore point, databases, drain counts and outcome.",
        "responses": {
          "200": {
            "description": "The switch.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DatabaseSwitch"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/database-switches/{id}/cancel": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "UUID of the database switch to cancel.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "deployments"
        ],
        "operationId": "cancelDatabaseSwitch",
        "summary": "Cancel a rollback that restores the database.",
        "description": "Unwinds the switch; the app keeps its current release and database. Refused with database_switch_not_cancellable once the switch started switching the release and the bindings.",
        "responses": {
          "202": {
            "description": "Cancellation recorded; the worker unwinds the switch.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DatabaseSwitch"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/rollouts/recover": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "deployments"
        ],
        "operationId": "recoverRollout",
        "summary": "Operator manual rollout recovery.",
        "description": "The operator escape hatch for a stuck canary rollout. Three\nclosed-set actions:\n\n  - `advance`: bumps `canary_step` by 1, stamps\n    `canary_step_started_at = now()`, and redistributes the\n    traffic-split (largest-remainder Σ = 100). Requires the\n    rollout to be stuck (`canary_step_started_at` older than\n    the canned 30-minute stuck-after window). On a healthy\n    rollout the handler returns 409 `rollout_not_stuck`\n    with the suggestion \"use --action promote instead\".\n\n  - `promote`: short-circuits the rollout to\n    `canary_step = canary_total_steps` and\n    `rollout_state = 'complete'`, with `traffic_percent = 100`\n    on the in-flight row + 0 on the siblings. No stuck-check;\n    this is the operator's \"I'm sure, ship it\" path.\n\n  - `abort`: ordinary canaries transition synchronously to\n    `rollout_state = 'aborted'`. A zero-step service rollout instead\n    records a durable abort request and returns 202; the scheduler restores\n    the predecessor route, waits for gateway acknowledgement and\n    candidate request drain, then finalises the abort. `advance` and\n    `promote` are invalid for service rollouts. Emits a\n    `deploy.rolled_back` audit row for the operator intent.\n\nReturns the post-transition Deployment + the audit row id\nso the operator's terminal can echo `audit_id=…`. Plan-tier\ngated to Pro+ (Hobby / Free get 403\n`plan_traffic_split_not_allowed`).\n\nFor an exact canary abort, supply both `deployment_id` and\n`expected_predecessor_deployment_id`. The older predecessor must\nremain live and serving in the same app/scope. If its stored binding\nrelease policy enforces verification, recovery checks that exact\nrecipient's fresh evidence and rechecks policy revisions and expiry\ninside the recovery transaction. Missing or changed evidence leaves\ntraffic unchanged. Success restores the predecessor to 100 percent,\naborts the selected canary, and includes an exact recovery receipt.\nFor an exact service abort, the pinned predecessor may remain live\nat zero weight after cutover. The response is 202 with a\n`service_recovery` receipt confirming the durable request only.\nAPID checks that recipient and ready service capacity before publishing\nroutes; the scheduler then completes gateway acknowledgement and request drain.\nGET the exact deployment to observe `service_rollout_handoff` progress\nand bounded `bindings_check` blockers. Restarted workers resume the same\nrequest and never substitute a different predecessor.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "name": "Service-Abort-Attempt-ID",
            "in": "header",
            "required": false,
            "description": "Opaque identity saved before an exact reviewed default or named-environment service abort.\nAcceptance is recorded atomically with reverse-handoff intent. Accepted\nrepeats return 409 service_abort_attempt_accepted; a changed reviewed\nrequest returns 409 service_abort_attempt_conflict. Read the retained\nservice-aborts receipt after a lost response; never replay accepted intent.\nNamed scopes require the complete project/environment release review and current\nunprotected write admission. Unsupported recovery modes reject this header.\n",
            "schema": {
              "type": "string",
              "minLength": 32,
              "maxLength": 32,
              "pattern": "^[0-9a-f]{32}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecoverRolloutRequest"
              },
              "example": {
                "action": "promote",
                "reason": "manual-test"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The post-recovery deployment + audit row id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RolloutTransitionResponse"
                }
              }
            }
          },
          "202": {
            "description": "A service-rollout abort was accepted for scheduler-owned zero-downtime handoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RolloutTransitionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Canary traffic splitting is unavailable on the Hobby / Free plan.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "one of: rollout_not_stuck | rollout_state_invalid",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "action ∉ {advance, promote, abort} (closed-set check).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/park": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "parkApp",
        "summary": "Manually park all running instances.",
        "parameters": [
          {
            "name": "fresh",
            "in": "query",
            "description": "For isolated previews, invalidate snapshots after drain so the next request cold-boots from the artifact. Production apps reject fresh parking.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "expected_deployment_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "The deployment UUID to compare atomically before parking. A stale or absent current deployment returns 409 without parking; reuse this UUID on drain retries."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "All matching instances were parked."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/park/conditional": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "parkAppIfDeployment",
        "summary": "Park instances only if the latest deployment matches.",
        "description": "Unsupported control planes reject this route without parking. Clients must never fall back to unconditional parking.",
        "parameters": [
          {
            "name": "fresh",
            "in": "query",
            "description": "For an isolated preview, invalidate its snapshots after all instances drain so the next request cold-boots from the artifact. Production apps reject this option.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "expected_deployment_id"
                ],
                "properties": {
                  "expected_deployment_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Compare the latest app deployment atomically with parking. A changed or missing deployment returns 409 without parking; resend the same guard on drain retries."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Parked only when the deployment UUID matched."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/wake": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "wakeApp",
        "summary": "Queue a durable instance pre-warm.",
        "responses": {
          "200": {
            "description": "The app already has a routable running instance; no wake is queued. wake_id is that instance's wake id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppWakeResponse"
                }
              }
            }
          },
          "202": {
            "description": "Wake accepted and correlated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppWakeResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AdmissionRefused"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/ConcurrencyLimit"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/restart": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "restartApp",
        "summary": "Restart an app.",
        "description": "Parks every live instance, captures a fresh snapshot, and queues one\nreplacement wake. Requests are single-flight per app; the returned\nwake_id identifies the replacement wake in the wake timeline. With\n`fresh=true`, destroys live instances without capturing process memory,\ninvalidates cached snapshots, and cold-boots with the latest environment\nand secrets. The fresh path is durably queued.\nFor `fresh=true`, use the returned `wake_id` with\n`GET /v1/apps/{slug}/runtime-config-restarts/{wake_id}` to inspect\nqueued, running, retrying, completed, or failed status and any safe\nfailure reason.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "name": "fresh",
            "in": "query",
            "required": false,
            "description": "Cold-boot with current runtime configuration instead of capturing/restoring process memory.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Restart accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppRestartResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AdmissionRefused"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/runtime-config-restarts/{wake_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "wake_id",
          "in": "path",
          "required": true,
          "description": "Wake ID returned by POST /v1/apps/{slug}/restart?fresh=true.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getRuntimeConfigRestartStatus",
        "summary": "Get the status of a fresh runtime-configuration restart.",
        "description": "Returns the durable scheduler handoff state for a fresh restart.\n`completed` means the replacement operation finished successfully;\n`failed` means the durable handoff exhausted its retry budget. A\nfailure_reason is a stable, safe category and does not expose internal\nerror details.\n",
        "responses": {
          "200": {
            "description": "Current durable restart status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeConfigRestartStatusResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/prewarm": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "createPrewarm",
        "summary": "Schedule capacity restoration ahead of a demand window.",
        "description": "Persists a temporary prewarm intent. The scheduler claims it during the\nplatform's lead time (currently 60 seconds before wake_at), restores\nup to count instances through the normal admission gates, and never\nchanges the app's permanent min_instances floor.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PrewarmRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Prewarm intent accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrewarmIntentResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      }
    },
    "/v1/apps/{slug}/prewarms": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listPrewarms",
        "summary": "List scheduled and completed prewarm intents.",
        "responses": {
          "200": {
            "description": "Prewarm intents ordered by demand-window start.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PrewarmIntentResponse"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      }
    },
    "/v1/apps/{slug}/prewarms/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Prewarm intent UUID.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "delete": {
        "tags": [
          "apps"
        ],
        "operationId": "cancelPrewarm",
        "summary": "Cancel a pending prewarm intent.",
        "responses": {
          "204": {
            "description": "Prewarm intent cancelled."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      }
    },
    "/v1/apps/{slug}/cache": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "delete": {
        "tags": [
          "apps"
        ],
        "operationId": "purgeAppCache",
        "summary": "Purge cached responses for an app.",
        "description": "Records a durable response-cache purge request for every gateway and\nthe optional distributed cache tier. Gateways replay missed requests;\n`GET /v1/apps/{slug}/policy/status` reports convergence in `response_cache`.\nThe optional path glob limits the purge to\nmatching normalized request paths. The optional tag limits it to\nresponses carrying that Cache-Tag. Path and tag are mutually exclusive;\nomit both to purge the complete app cache.\n",
        "parameters": [
          {
            "name": "path",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Optional normalized request path glob (for example `/products/*`)."
          },
          {
            "name": "tag",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:/-]+$"
            },
            "description": "Optional cache tag (for example `product:42`); cannot be combined with path."
          }
        ],
        "responses": {
          "204": {
            "description": "Purge durably requested; check policy status for application."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/overage-cap": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "getOverageCap",
        "summary": "Read the account's monthly overage cap.",
        "description": "Returns integer cents, zero when no overage is allowed, or null when no cap is set.",
        "responses": {
          "200": {
            "description": "The saved monthly overage cap.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountOverageCapResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "500": {
            "description": "Could not read the saved cap.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "account"
        ],
        "operationId": "raiseOverageCap",
        "summary": "Set or clear the account's spend cap.",
        "description": "Sets accounts.overage_cap_cents in integer cents. Body shape:\n\n    {\"overage_cap_cents\": <int|null>}\n\nPass `null` (or omit the field) to clear the cap (NULL).\nPass 0 to set \"no overage allowed.\" Passing a positive integer\nsets the monthly ceiling. The migration CHECK constraint pins\n`overage_cap_cents IS NULL OR overage_cap_cents >= 0`; a\nnegative value is rejected at the API validator before the\nstore ever sees it, returning 400 `validation_failed`.\n\nOnce current-month overage meets/exceeds the cap, the scheduler refuses\nnew wakes with `code: admission_refused` (HTTP 402). The cap is\naccount-self-scoped (admin scope required; a dashboard session also\nneeds a step-up within the last 5 minutes) and the response\nis the post-update account state. Audit row\n`overage.cap_changed` is emitted on every successful call.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RaiseOverageCapRequest"
              },
              "example": {
                "overage_cap_cents": 10000
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "The updated account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountResponse"
                },
                "example": {
                  "id": "0123456789abcdef0123456789abcdef",
                  "email": "alice@example.com",
                  "plan": "pro",
                  "status": "active"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/account/egress-overage": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "getEgressOverage",
        "summary": "Read the account's egress overage election.",
        "description": "Without the election every plan stops at its monthly egress allowance:\nthe account's apps are parked (`quota_exceeded_egress`) until the month\nends or the plan grows. With it, egress above the allowance is billed as\noverage, within the spend cap, while egress billing is live\n(`billing: live`); while `billing` is `off` the allowance still holds.\n",
        "responses": {
          "200": {
            "description": "The account's election.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EgressOverageResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      },
      "put": {
        "tags": [
          "account"
        ],
        "operationId": "setEgressOverage",
        "summary": "Turn the account's egress overage election on or off.",
        "description": "`{\"enabled\": true|false}`. Requires admin scope and MFA; a dashboard\nsession also needs a step-up within the last 5 minutes. Turning it on\nneeds a paid plan (HTTP 402 `plan_egress_overage_not_allowed`); turning\nit off is always allowed. Egress already sent while the election was on\nis still billed. Audit row `egress_overage.changed` records each change.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EgressOverageRequest"
              },
              "example": {
                "enabled": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The election after the change.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EgressOverageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "code: plan_egress_overage_not_allowed — the plan stops at its egress allowance; upgrade to a paid plan.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/v1/apps/{slug}/rename": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "renameApp",
        "summary": "Rename an app.",
        "requestBody": {
          "required": true,
          "description": "Rename payload — the new slug. See RenameAppRequest.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RenameAppRequest",
                "example": {
                  "new_slug": "hello-world-v2"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "The renamed app.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppResponse",
                  "example": {
                    "id": "0123456789abcdef0123456789abcdef",
                    "slug": "hello-world",
                    "type": "app",
                    "runtime": "",
                    "ram_mb": 256,
                    "max_concurrency": 2,
                    "concurrency_per_vm": 5,
                    "idle_timeout_s": 60,
                    "min_instances": 0,
                    "state": "running",
                    "last_deployment_id": "0123456789abcdef0123456789abcdef",
                    "created_at": "2026-07-01T08:00:00Z",
                    "updated_at": "2026-07-23T11:25:00Z",
                    "require_authn": false
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "$ref": "#/components/responses/ConflictRename"
          }
        }
      }
    },
    "/v1/install/connections": {
      "get": {
        "tags": [
          "github"
        ],
        "operationId": "listGitHubAccountConnections",
        "summary": "List this account's GitHub deployment connections.",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Deployment installations and a fresh management CSRF token; credentials are never returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GitHubAccountConnections"
                }
              }
            }
          }
        }
      }
    },
    "/v1/install/connections/{installationID}": {
      "parameters": [
        {
          "name": "installationID",
          "in": "path",
          "required": true,
          "description": "GitHub installation whose deployment connection should be removed from this account.",
          "schema": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        }
      ],
      "delete": {
        "tags": [
          "github"
        ],
        "operationId": "disconnectGitHubAccountConnection",
        "summary": "Remove only this account's deployment access and bindings. Preserve login and other accounts.",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GitHubConnectionManageRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Disconnected. Safe to repeat."
          },
          "400": {
            "description": "Missing or invalid management CSRF token."
          }
        }
      }
    },
    "/v1/install/connections/{installationID}/verify": {
      "parameters": [
        {
          "name": "installationID",
          "in": "path",
          "required": true,
          "description": "Connected GitHub installation whose current access should be verified for this account.",
          "schema": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        }
      ],
      "post": {
        "tags": [
          "github"
        ],
        "operationId": "verifyGitHubAccountConnection",
        "summary": "Verify live GitHub repository access and installation permissions.",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GitHubConnectionManageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Current access granted on GitHub.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GitHubConnectionVerification"
                }
              }
            }
          },
          "400": {
            "description": "Verification requires a valid management CSRF token and installation identifier."
          },
          "404": {
            "description": "Installation not connected to this account."
          },
          "503": {
            "description": "GitHub verification temporarily unavailable."
          }
        }
      }
    },
    "/v1/install/repos/list": {
      "post": {
        "tags": [
          "github"
        ],
        "operationId": "listInstallableRepos",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "summary": "List repos the user's GitHub App installation can see.",
        "description": "Cookie-session-authenticated (NOT API-key). Hydrates the\ndashboard bind picker's repo dropdown. Returns the repos\nvisible to the user's GitHub App installation — the GitHub integration\nresolves the per-install token from the session's account.\n\nthe exact installation must be durably connected to\nthe session's Gregale account before any GitHub call. A separate\nGitHub sign-in claim is not required. Live installation verification\nand account-scoped repository access checks still apply.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InstallBindRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Repos the install can see.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RepoResponse"
                  }
                }
              }
            }
          },
          "400": {
            "description": "code: invalid_request — missing/malformed body or installation_id.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "`github_install_not_owned` if the exact installation is not\nconnected to the signed-in Gregale account; `forged` if the\nlive GitHub installation verification fails. Unknown and foreign\ninstallation IDs have the same response.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "502": {
            "description": "code: github_unreachable — the GitHub integration could not reach api.github.com; retry in a minute.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "code: githubd_not_ready — the GitHub integration is not wired on this host (M7.5 slices 7-8).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/github/repos": {
      "get": {
        "tags": [
          "github"
        ],
        "operationId": "listGitHubRepositories",
        "summary": "List repositories visible to the account's GitHub App installation.",
        "description": "Bearer API-key surface for customer automation. Requires the\ndedicated `github:manage` scope. `installation_id` names one of\nthe account's connected installations; without it the account's\nonly installation is used, and an account with several gets a 409\n`github_installation_required` naming them. Installation\ncredentials are never returned.\n",
        "security": [
          {
            "bearerAuth": [
              "github:manage"
            ]
          }
        ],
        "parameters": [
          {
            "name": "installation_id",
            "in": "query",
            "required": false,
            "description": "A GitHub App installation connected to the account.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Repositories currently visible to the account's GitHub App installation.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RepoResponse"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "The account has not completed GitHub App installation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The account has several connected installations and none was named.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "502": {
            "description": "GitHub could not be reached while listing repositories.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/github": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "github"
        ],
        "operationId": "getGitHubConnection",
        "summary": "Read the GitHub installation and repository binding for an app.",
        "description": "Bearer API-key surface for customer automation. Requires the\ndedicated `github:manage` scope and never returns a CSRF token or\ninstallation credentials.\n",
        "security": [
          {
            "bearerAuth": [
              "github:manage"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Automation-safe installation and binding snapshot.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GitHubInstallStatus"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "github"
        ],
        "operationId": "disconnectGitHubConnection",
        "summary": "Remove an app's GitHub repository binding.",
        "description": "Bearer API-key surface for customer automation. Requires\n`github:manage`; the account-level GitHub installation remains\navailable for a later bind. Safe to retry with an idempotency key.\n",
        "security": [
          {
            "bearerAuth": [
              "github:manage"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Automation disconnect completed; the installation remains available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GitHubInstallStatus"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/github/deployment-policy": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "github"
        ],
        "operationId": "getGitHubDeploymentPolicy",
        "summary": "Read the customer-owned GitHub deployment policy.",
        "description": "Returns the project-level policy applied to source staging,\npull-request previews, and preview-to-production internal service\ncalls. A missing policy row resolves to the safe defaults for a new\nproject. Legacy allow_marked compatibility rows are migrated to deny;\ncustomers can explicitly opt back in when production calls are safe.\nAn app without a project reports the defaults with an empty\n`project_id` and its own `production_trigger` and\n`preview_enabled`.\n",
        "security": [
          {
            "bearerAuth": [
              "github:manage"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Current GitHub deployment policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GitHubDeploymentPolicy"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      },
      "patch": {
        "tags": [
          "github"
        ],
        "operationId": "patchGitHubDeploymentPolicy",
        "summary": "Update the customer-owned GitHub deployment policy.",
        "description": "Updates project-level GitHub deployment behaviour. Fields are\nreplace-on-write; omitted fields retain their current values. The\nignored_paths list accepts exact paths, one-segment shell globs, and\ntrailing `/**` directory patterns. `preview_service_policy=deny`\nrejects preview calls to production dependencies before discovery or\nwake-up; `allow_marked` preserves the marked-call compatibility mode.\nAn app without a project can set only `production_trigger` and\n`preview_enabled`, once it is bound to a repository; other fields\nanswer 409 `project_required`. Mutations require MFA.\n",
        "security": [
          {
            "bearerAuth": [
              "github:manage"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GitHubDeploymentPolicyPatch"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated GitHub deployment policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GitHubDeploymentPolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/apps/{slug}/github/bind": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "github"
        ],
        "operationId": "bindGitHubConnection",
        "summary": "Bind or rebind an app to a visible GitHub repository.",
        "description": "Bearer API-key surface for customer automation. Requires\n`github:manage`. The installation_id must belong to the account and\nthe requested repository must currently be visible to that GitHub App\ninstallation. Safe to retry with an idempotency key.\n",
        "security": [
          {
            "bearerAuth": [
              "github:manage"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InstallBindRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Automation bind completed and the repository edge is active.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InstallBindResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Installation ownership or repository-access proof failed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "502": {
            "description": "GitHub could not be reached.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "GitHub could not be reached. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/github/sync": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "github"
        ],
        "operationId": "syncGitHubConnection",
        "summary": "Check an app's GitHub repository access now.",
        "description": "Bearer API-key surface for customer automation. Requires\n`github:manage`; GitHub is queried and the app is detached only when\nits bound repository is no longer accessible.\n",
        "security": [
          {
            "bearerAuth": [
              "github:manage"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Post-reconciliation connection projection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GitHubInstallStatus"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "502": {
            "description": "The GitHub repository catalog was unavailable during reconciliation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The GitHub repository catalog was unavailable during reconciliation. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/github/activity/retry": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "github"
        ],
        "operationId": "retryGitHubActivity",
        "summary": "Retry recent failed GitHub activity for an app.",
        "description": "Bearer API-key surface for customer automation. Requires\n`github:manage`; requeues up to 10 recent dead webhook deliveries\nand Check Run updates belonging to this account-owned app. The\nresponse contains aggregate counts only and never exposes queue\nidentifiers, webhook payloads, or worker errors. Safe to retry with\nan idempotency key.\n",
        "security": [
          {
            "bearerAuth": [
              "github:manage"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Recent failed GitHub activity was queued for recovery.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GitHubActivityRetryResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/install/bind": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "github"
        ],
        "operationId": "getGitHubInstallBinding",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "summary": "Inspect the app's GitHub repository binding.",
        "description": "Cookie-session-authenticated (NOT API-key). Returns the durable\nGitHub installation metadata and the app's repository binding without\nexposing installation credentials. The response also carries the\nnamed CSRF token required by the sync and disconnect actions.\n",
        "responses": {
          "200": {
            "description": "Current installation and binding state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GitHubInstallStatus"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "code: capacity — the installation and binding state could not be loaded.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "github"
        ],
        "operationId": "bindAppInstall",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "summary": "Persist the (account, app, installation, repo, branch) bind row.",
        "description": "Cookie-session-authenticated (NOT API-key). Persists the\nGitHub install binding.\n\nthe exact installation must be durably connected to\nthe session's Gregale account. Requires the named, account-bound\nbind_app_to_repo CSRF proof. A separate GitHub sign-in claim is not\nrequired. Live installation verification and the GitHub integration's current\nrepository access check still run before persistence.\n\nOn success emits `auth.install.bound` for the audit trail.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InstallBindRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bind persisted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InstallBindResponse"
                }
              }
            }
          },
          "400": {
            "description": "code: invalid_request — missing/malformed body, installation_id, or repo_full_name.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Repository binding refused. A valid account-bound\n`bind_app_to_repo` CSRF token and named cookie are required.\n`github_install_not_owned` if the exact installation is not\nconnected to the signed-in Gregale account; `forged` if the\nlive GitHub installation verification fails. Unknown and foreign\ninstallation IDs have the same response.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "502": {
            "description": "code: github_unreachable — the GitHub integration could not reach api.github.com when persisting the bind; retry in a minute.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "code: github_unreachable — the GitHub integration could not reach api.github.com when persisting the bind; retry in a minute. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "github"
        ],
        "operationId": "disconnectGitHubApp",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "summary": "Disconnect an app from its GitHub repository.",
        "description": "Cookie-session-authenticated and CSRF-protected. Idempotently removes\nthe app's repository binding and invalidates the GitHub integration's binding cache.\nThe GitHub App installation remains connected to the account so it can\nbe rebound to another repository.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GitHubInstallMutationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The app is no longer bound to a repository.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GitHubInstallStatus"
                }
              }
            }
          },
          "400": {
            "description": "code: validation — missing or invalid CSRF token for disconnect.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "code: capacity — the GitHub integration could not remove the binding.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/install": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "github"
        ],
        "operationId": "getGitHubInstallStatus",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "summary": "Read the GitHub installation and binding health for an app.",
        "description": "Cookie-session-authenticated (NOT API-key). This is the canonical\ndashboard status endpoint. It returns `not_installed`, `installed`,\nor `bound` state and never includes sealed installation credentials.\nA named CSRF token is returned for subsequent sync or disconnect\nrequests.\n",
        "responses": {
          "200": {
            "description": "Current GitHub connection state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GitHubInstallStatus"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "code: capacity — the connection state could not be read.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/install/sync": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "github"
        ],
        "operationId": "syncGitHubInstall",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "summary": "Reconcile an app's GitHub repository access immediately.",
        "description": "Cookie-session-authenticated and CSRF-protected. Queries GitHub's\ncurrent installation repository list and detaches the app only when\nits bound repository is no longer accessible. The response includes\nthe remote repository count and whether this app was detached.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GitHubInstallMutationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Reconciled connection state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GitHubInstallStatus"
                }
              }
            }
          },
          "400": {
            "description": "code: validation — a valid CSRF token is required for GitHub sync.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "code: github_not_bound or github_install_not_found — the app or installation must be connected first.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "502": {
            "description": "code: github_unreachable — GitHub could not be queried.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "code: capacity — the connection state could not be reconciled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/install/activity/retry": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "github"
        ],
        "operationId": "retryGitHubInstallActivity",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "summary": "Retry failed GitHub activity from the signed-in dashboard session.",
        "description": "This cookie-session action is CSRF-protected and requeues up to 10\nrecent dead webhook deliveries and Check Run updates belonging to\nthe signed-in account's app. It returns aggregate counts only;\nqueue identifiers, webhook payloads, and worker errors remain private.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GitHubInstallMutationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Browser recovery request accepted; aggregate retry counts are returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GitHubActivityRetryResponse"
                }
              }
            }
          },
          "400": {
            "description": "code: validation — a valid CSRF token is required for GitHub activity retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/instances": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "instances"
        ],
        "operationId": "listInstances",
        "summary": "Read-only instance list for an app.",
        "description": "By default this returns only resident and in-flight instances, bounded\nby the app's effective concurrency limit. Set `history=true` to return\nthe newest 100 retained lifecycle rows. The history view is not a\ncomplete audit log: PARKED wake rows expire after the configured\ninstance-retention window (30 days by default), and only the newest\n100 retained rows are returned. Snapshots are durable deployment\nartifacts with their own lifecycle and are not removed with PARKED\ninstance history.\n",
        "parameters": [
          {
            "name": "history",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "When true, include the newest 100 retained lifecycle rows; PARKED rows expire after 30 days by default."
          }
        ],
        "responses": {
          "200": {
            "description": "Current instances, or the bounded retained history when `history=true`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/InstanceResponse"
                  }
                },
                "example": [
                  {
                    "id": "0123456789abcdef0123456789abcdef",
                    "app_id": "0123456789abcdef0123456789abcdef",
                    "deployment_id": "0123456789abcdef0123456789abcdef",
                    "state": "running",
                    "ram_mb": 256,
                    "started_at": "2026-07-23T11:25:00Z"
                  }
                ]
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/deployments/{deployment}/instances/{instance}/mcp-health": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "deployment",
          "description": "Deployment UUID containing the exact replica selected for the MCP health probe.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "instance",
          "description": "Running instance UUID targeted by the MCP health probe.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "mcp"
        ],
        "operationId": "probeMCPInstanceHealth",
        "summary": "Probe MCP catalog health on one exact replica.",
        "description": "Requires app read scope and MFA. The platform validates that the\ndeployment belongs to the app and the instance is RUNNING in that\ndeployment, then forwards a GET to the fixed `/healthz` path on that\ninstance. The response includes platform-stamped app, deployment, and\ninstance IDs; workload response headers cannot override them. The\nsupplied host is only the virtual-host authority delivered to the\nworkload and cannot contain a path or URL credentials.\n",
        "parameters": [
          {
            "name": "host",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Virtual-host authority used for this replica health request, including an optional port."
          }
        ],
        "responses": {
          "200": {
            "description": "Exact instance response and platform-selected identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPInstanceHealthProbeResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/deployments/{deployment}/instances/{instance}/mcp-probe": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "deployment",
          "description": "Deployment UUID containing the exact replica selected for the MCP protocol probe.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "instance",
          "description": "Running instance UUID targeted by the MCP protocol probe.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "mcp"
        ],
        "operationId": "probeMCPInstanceProtocol",
        "summary": "Send one read-only MCP protocol request to an exact replica.",
        "description": "Requires app read scope and MFA. The platform verifies that the\ninstance is RUNNING in the requested deployment, then forwards one\nallowlisted MCP initialize or catalog-list request to the supplied\nliteral endpoint path on that exact instance. Tool execution, resource\nreads, prompt rendering, and task operations are rejected. The response\nincludes platform-stamped identity and a bounded workload response.\nThe optional MCP-Probe-Authorization header carries a workload bearer\ntoken for this request only; it is not logged or stored.\n",
        "parameters": [
          {
            "name": "MCP-Probe-Authorization",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "format": "password",
              "maxLength": 8192
            },
            "description": "Optional bearer token forwarded to the MCP workload. Never returned or persisted."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MCPInstanceProtocolProbeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bounded MCP protocol response from the verified running replica.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MCPInstanceProtocolProbeResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/logs": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "streamAppLogs",
        "summary": "Stream app logs (SSE).",
        "description": "Server-Sent Events stream of instance logs. NOTE: this endpoint is\ncurrently mounted behind `s.authLimited` and is documented here for\nreference; the dashboard and CLI also consume it directly.\n\nTwo modes share this URL:\n\n- **Snapshot (default)** — `?follow=0` replays the retained entries\n  from each live instance and closes with `event: end`. This is the\n  mode used by `gregale logs` for a finite command that can be piped\n  into other tools.\n\n- **Live** — `?follow=1` holds the connection open and streams new\n  entries from the per-instance ring buffer. The stream terminates\n  with `event: end` when the backstop fires (10 minutes idle), the\n  scheduler returns NotFound (parked app), or the connection closes.\n\n- **Archive (`?archive=1`)** — fetches a single day's\n  per-instance log batch from the S3 bucket the API shipper\n  writes into. `?instance=<id>` selects the Firecracker instance\n  id; `?date=YYYY-MM-DD` selects the day. The response is the\n  same SSE shape as the live stream (`event: log` per line,\n  `event: end` terminal with `archive_complete` /\n  `archive_missing` / `archive_degraded` reasons) so the SDK\n  decoder treats the two paths interchangeably. Archive is\n  gated by `Plan.LogArchiveEnabled()` — Free customers receive a\n  one-day archive window. The per-plan retention cap (Free 1d /\n  Hobby 7d / Pro 30d / Scale 90d) refuses `?date=` values\n  outside the window with 403 + `log_archive_retention_exceeded`.\n\nEach `event: log` payload preserves the original `line`. When that\nline is a valid JSON object with a recognized `level` or `severity`\nfield, the server adds a canonical `level` value (`info`, `warn`, or\n`error`); plain-text and unclassified lines omit the field.\n",
        "parameters": [
          {
            "name": "follow",
            "in": "query",
            "schema": {
              "type": "integer",
              "enum": [
                0,
                1
              ],
              "default": 0
            },
            "description": "If 1, hold the connection open and stream new entries; if 0 (default), replay the retained page and close."
          },
          {
            "name": "grep",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Substring filter applied to each log line."
          },
          {
            "name": "since",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "RFC3339 lower-bound on the line timestamp."
          },
          {
            "name": "level",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "info",
                "warn",
                "error"
              ]
            },
            "description": "Exact match on the structured `level` field (info, warn, or error) surfaced in each matching log event. Empty = no level filter. The CLI and the API handler both validate against the same enum (api.IsValidLogLevel); an unknown value short-circuits with an SSE error frame carrying code invalid_level.\n"
          },
          {
            "name": "archive",
            "in": "query",
            "schema": {
              "type": "integer",
              "enum": [
                0,
                1
              ],
              "default": 0
            },
            "description": "If 1, serve archived logs from S3 instead of the live ring buffer. Requires `instance=<id>` and `date=YYYY-MM-DD`. Gated by `Plan.LogArchiveEnabled()` — Free plans have a one-day archive window. The per-plan retention cap (Free 1d / Hobby 7d / Pro 30d / Scale 90d) refuses `date=` values outside the window.\n"
          },
          {
            "name": "instance",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._-]{1,128}$"
            },
            "description": "Required when `archive=1`. The Firecracker instance id to read archived logs from (matches the `instance_id` field in the live SSE frames).\n"
          },
          {
            "name": "date",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Required when `archive=1`. The day to read in YYYY-MM-DD UTC. Must be inside the per-plan retention cap (Free 1d / Hobby 7d / Pro 30d / Scale 90d) — outside values return 403 + `log_archive_retention_exceeded`. Future dates are refused with the same code.\n"
          }
        ],
        "responses": {
          "200": {
            "description": "A text/event-stream of structured log lines, terminated by an empty SSE frame when the connection closes.",
            "content": {
              "text/event-stream": {}
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Plan does not include log archive read-back. This response is reserved for plans without archive entitlement.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                },
                "example": {
                  "type": "about:blank",
                  "title": "Log archive unavailable on this plan",
                  "status": 402,
                  "code": "plan_log_archive_not_allowed",
                  "detail": "the requested plan does not include log archive read-back; upgrade to a plan with archive access to query historical logs from object storage."
                }
              }
            }
          },
          "403": {
            "description": "Log archive retention cap exceeded; `?date=` is outside the per-plan window.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                },
                "example": {
                  "type": "about:blank",
                  "title": "",
                  "status": 403,
                  "code": "log_archive_retention_exceeded",
                  "detail": "?date=2026-07-01 is outside the per-plan window"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/secret-revocations/{revocation_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "revocation_id",
          "in": "path",
          "required": true,
          "description": "Identifier returned by DELETE with Prefer: return=representation.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "secrets"
        ],
        "operationId": "getSecretRevocation",
        "summary": "Read runtime acknowledgements for a deleted secret.",
        "description": "Returns the value-free runtime roster captured at deletion and its latest application acknowledgement state.",
        "responses": {
          "200": {
            "description": "Durable secret revocation progress.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppSecretRevocationResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/secrets": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/EnvScope"
        }
      ],
      "get": {
        "tags": [
          "secrets"
        ],
        "operationId": "listSecrets",
        "summary": "List sealed secrets on an app.",
        "responses": {
          "200": {
            "description": "Sealed-secret envelopes on the app (plaintext never returned).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppSecretListResponse",
                  "example": {
                    "items": [],
                    "next_before": null
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/secret-references": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/SecretReferenceEnvironment"
        }
      ],
      "get": {
        "tags": [
          "secrets"
        ],
        "operationId": "listAppSecretReferences",
        "summary": "List destination-to-source secret references in a registered environment.",
        "description": "Requires the same read permission and MFA posture as secret metadata. Returns names only and shared variable/reference quota usage.",
        "responses": {
          "200": {
            "description": "References and the current catalog environment identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppSecretReferenceListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/secret-references/{key}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/SecretKey"
        },
        {
          "$ref": "#/components/parameters/SecretReferenceEnvironment"
        }
      ],
      "put": {
        "tags": [
          "secrets"
        ],
        "operationId": "setAppSecretReference",
        "summary": "Select a scoped secret source for a destination environment key.",
        "description": "Requires secrets write permission and the same MFA posture as sealed secret writes. The named source must exist in\nthe exact environment and a plaintext variable cannot shadow the destination.\nReferences share the cross-environment variable quota. The write retains the\nobserved catalog identity, invalidates scoped snapshots and applies on a future\ncold wake. Git-owned fields require an active temporary override in enforce mode.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutAppSecretReferenceRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Stored reference names and catalog identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppSecretReferenceResponse"
                }
              }
            }
          },
          "400": {
            "description": "code: validation_failed | env_var_invalid_key | secret_not_found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Reference update rejected. code: environment_field_git_managed | secret_reference_conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "secrets"
        ],
        "operationId": "deleteAppSecretReference",
        "summary": "Suppress a primary workload secret destination while preserving the sealed source.",
        "description": "Requires secrets write permission and the same MFA posture as sealed secret writes. Uses the observed catalog identity and the same Git ownership/override contract as PUT. An already suppressed unowned destination is an idempotent success. Removing a reference preserves the sealed value and records durable suppression of this destination on future cold wakes, including original deployment references and automatic delivery. PUT clears that suppression. Suppressed destinations have a separate bound of 1024 keys per application across environments and do not consume the variable quota.",
        "responses": {
          "204": {
            "description": "Destination suppressed on future cold wakes; the sealed source value is retained."
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Reference removal rejected. code: environment_field_git_managed | secret_reference_conflict",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/secrets/{key}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/SecretKey"
        },
        {
          "$ref": "#/components/parameters/ConfigGuardQuery"
        },
        {
          "$ref": "#/components/parameters/EnvScope"
        }
      ],
      "put": {
        "tags": [
          "secrets"
        ],
        "operationId": "setSecret",
        "summary": "Set a sealed secret.",
        "description": "Seals the plaintext value against the host X25519 recipient and\npersists the ciphertext. The plaintext never lands in PG. Existing\nsnapshots are invalidated; running processes retain their current\nenvironment until a cold wake or `POST /restart?fresh=true`.\n",
        "requestBody": {
          "required": true,
          "description": "Secret payload — key name + plaintext. Sealed at rest; plaintext never returned.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutAppSecretRequest",
                "example": {
                  "key": "DATABASE_URL",
                  "value": "postgres://..."
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The stored sealed-secret envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppSecretResponse",
                  "example": {
                    "key": "DATABASE_URL",
                    "sealed_ciphertext": "<base64 x25519+xsalsa20-poly1305 ciphertext>",
                    "version": 1,
                    "created_at": "2026-07-23T11:25:00Z"
                  }
                }
              }
            }
          },
          "400": {
            "description": "400 on PUT /v1/apps/{slug}/secrets/{key}?scope=... — any of {secret_invalid_key, env_scope_invalid, env_scope_reserved}.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlanLimitSecrets"
          },
          "413": {
            "$ref": "#/components/responses/SecretValueTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "secrets"
        ],
        "operationId": "deleteSecret",
        "summary": "Delete a sealed secret.",
        "description": "Deletes the sealed value. The legacy default is 204 No Content; send `Prefer: return=representation` to receive the durable, value-free acknowledgement record for the active authorized runtime roster.",
        "parameters": [
          {
            "name": "Prefer",
            "in": "header",
            "required": false,
            "description": "Request the revocation receipt instead of the legacy empty response.",
            "schema": {
              "type": "string",
              "enum": [
                "return=representation"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The sealed value was removed; returned when `Prefer: return=representation` is sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppSecretRevocationResponse"
                }
              }
            }
          },
          "204": {
            "description": "The sealed value was removed. Returned when no Prefer header is sent."
          },
          "400": {
            "description": "400 on DELETE /v1/apps/{slug}/secrets/{key}?scope=... — any of {secret_invalid_key, secret_not_found, env_scope_invalid, env_scope_reserved}.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/secrets/{key}/rotate": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/SecretKey"
        },
        {
          "$ref": "#/components/parameters/ConfigGuardQuery"
        },
        {
          "$ref": "#/components/parameters/EnvScope"
        }
      ],
      "post": {
        "tags": [
          "secrets"
        ],
        "operationId": "rotateAppSecret",
        "summary": "Re-seal a sealed secret under the current host identity.",
        "description": "Re-seals the `(app_id, key)` row under the current host X25519\nrecipient and stamps the kid column. Emits `secret.rotated`\naudit kind when the row already had a value; emits `secret.set`\nwhen the row was previously empty (first-time rotation). The\nsame byte cap as PUT applies (`SecretValueMaxBytes`). Existing\nsnapshots are invalidated after the write.\n",
        "requestBody": {
          "required": true,
          "description": "New plaintext value. Sealed at rest server-side; plaintext never returned.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RotateAppSecretRequest",
                "example": {
                  "value": "sk_live_newvalue"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The rotated sealed-secret envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RotateAppSecretResponse",
                  "example": {
                    "key": "STRIPE_KEY",
                    "rotated_at": "2026-08-10T11:37:52.123Z",
                    "kid": "age1q..."
                  }
                }
              }
            }
          },
          "400": {
            "description": "400 on POST /v1/apps/{slug}/secrets/{key}/rotate?scope=... — any of {secret_invalid_key, secret_not_found, env_scope_invalid, env_scope_reserved}.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/SecretValueTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/secret-requests": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "secrets"
        ],
        "operationId": "requestSecretEntry",
        "summary": "Ask the signed-in account owner to enter a secret on a one-time page.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SecretEntryRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Private bridge response; ticket and exchange_code must never be returned to an agent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SecretEntryResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/secret-requests/status": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "secrets"
        ],
        "operationId": "getSecretEntryStatus",
        "summary": "Privately check whether the owner has set a requested secret; never returns the value.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SecretEntryStatusRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Pending or set.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SecretEntryStatus"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/registry-credentials": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "registry"
        ],
        "operationId": "listRegistryCredentials",
        "summary": "List sealed private-registry credentials on an app.",
        "description": "Returns every (registry, username, timestamps) triple on the app.\nPlaintext passwords are never returned — the image service transiently\nunseals the ciphertext in the pull path. Quota metadata\n(`quota_max`, `count`) is included so the CLI can render a\nprogress bar without a second call.\n",
        "responses": {
          "200": {
            "description": "List of credential envelopes on the app (plaintext never returned).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppRegistryCredentialListResponse",
                  "example": {
                    "credentials": [
                      {
                        "registry": "registry.gregale.dev",
                        "username": "alice",
                        "created_at": "2026-08-01T11:25:00Z",
                        "updated_at": "2026-08-01T11:25:00Z"
                      }
                    ],
                    "quota_max": 2,
                    "count": 1
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "put": {
        "tags": [
          "registry"
        ],
        "operationId": "setRegistryCredential",
        "summary": "Set or replace a sealed private-registry credential.",
        "description": "Seals the plaintext password against the host X25519 recipient\n(namespace `\"registry_creds\"`) and upserts the `(app_id, registry)`\nrow. The plaintext never lands in PG. Re-PUTs of an existing\n`(app, host)` replace the ciphertext and bump `updated_at`\nWITHOUT consuming a new quota slot.\n",
        "requestBody": {
          "required": true,
          "description": "Registry host + username + plaintext password. Sealed at rest.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutAppRegistryCredentialRequest",
                "example": {
                  "registry": "registry.gregale.dev",
                  "username": "alice",
                  "password": "s3cret-basic-auth-pw"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The stored credential envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppRegistryCredentialResponse",
                  "example": {
                    "registry": "registry.gregale.dev",
                    "username": "alice",
                    "created_at": "2026-08-01T11:25:00Z",
                    "updated_at": "2026-08-01T11:25:00Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRegistryHost"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlanRegistryCredentialsNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/PlanRegistryCredentialQuota"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "registry"
        ],
        "operationId": "deleteRegistryCredential",
        "summary": "Delete a sealed private-registry credential.",
        "description": "Removes the `(app_id, registry)` row. The registry host is the\nURL resource and is supplied via the `?registry=` query param\n(URL-encoded). Hosts may carry a `:port` — path segments don't\nescape cleanly.\n",
        "parameters": [
          {
            "name": "registry",
            "in": "query",
            "required": true,
            "description": "Registry host to delete (URL-encoded; matches the host stored on the row).",
            "schema": {
              "type": "string",
              "maxLength": 253
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No body. The credential row was removed."
          },
          "400": {
            "$ref": "#/components/responses/RegistryCredentialNotFound"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/security": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "security"
        ],
        "operationId": "getAppSecurity",
        "summary": "Read the app security posture.",
        "description": "Customer-scoped, read-only configuration checks for an app. The\nreport never includes credentials, raw IP ranges, or edge-rule\naction payloads. Findings are deterministic and include remediation\nguidance suitable for CI and dashboards.\n",
        "responses": {
          "200": {
            "description": "The app security posture.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppSecurityPostureResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "tags": [
          "security"
        ],
        "operationId": "patchAppSecurity",
        "summary": "Configure app security enforcement (admin + MFA).",
        "description": "Operator-only surface for the per-app cosign signature-enforcement\nflag and deploy-time posture policy. Mounted with\n`authLimited → requireMFA → requireScope(ScopesAdminOnly...)`.\n`security_policy=enforce` rejects new deploys while high-severity\nconfiguration findings remain; live-image evidence findings remain\nvisible but do not block the replacement needed for recovery. `warn`\nis advisory and `off` preserves historical behavior.\n\nEach field is optional; omitted fields are unchanged and supplied\nfields are applied atomically.\n\nAudit event: `app.security_updated` carries old/new values.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AppSecurityRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated flag state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppSecurityResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/security/recover": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "security"
        ],
        "operationId": "recoverAppSecurityQuarantine",
        "summary": "Recover an app from image-scan quarantine.",
        "description": "Restores an app to active only when the selected deployment is live,\nnewer than the recorded security quarantine, uses a different image\ndigest, and carries complete digest-matched scan evidence with zero\nHIGH, CRITICAL, or UNKNOWN findings. Every live canary deployment is\nchecked before traffic is restored. The transition is idempotent and\nemits an audited security recovery event.\nRequires deploy-write scope and MFA.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SecurityQuarantineRecoveryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The app was restored to active.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SecurityQuarantineRecoveryResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "409": {
            "description": "The replacement deployment is not yet eligible for recovery.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/static-egress-ip": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "security"
        ],
        "operationId": "getAppStaticEgressIP",
        "summary": "Read the per-app static egress IP pin.",
        "description": "Returns the customer's pinned IPv4 + the audit timestamp +\nthe per-app quota cap (StaticEgressIPsPerApp, 1 in v1). A\nScale customer with no pin yet sees `ip=null`,\n`set_at=null`, `plan_cap=1`, `plan_allowed=true`. Free /\nHobby / Pro return `plan_allowed=false` so the CLI can\nrender the upsell without a separate plan lookup.\n\nMounted with the standard auth chain (no MFA, no admin\nscope — the customer owns the pin).\n",
        "responses": {
          "200": {
            "description": "The current pin state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppStaticEgressIPResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "put": {
        "tags": [
          "security"
        ],
        "operationId": "setAppStaticEgressIP",
        "summary": "Pin an IPv4 to the app's egress traffic (Scale-only).",
        "description": "Customer-supplied IPv4 from their own range. The host\nbridge aliases the IP and a per-host postrouting\nMASQUERADE sibling rewrites matching tenant source\ntraffic to the customer's IP. v1 limits:\n\n* Plan must be Scale (Plan.StaticEgressIPAllowed).\n* IPv4-only (IPv6 is rejected at the DB CHECK).\n* Not RFC1918, link-local, multicast, or /0.\n* Per-app quota of 1 (StaticEgressIPsPerApp) — two apps\n  on the same account cannot pin the same IP.\n\nSending `{\"ip\": \"203.0.113.42\", \"set\": true}` upserts\nthe pin. Sending `{\"ip\": \"\", \"set\": false}` clears\nit. The DELETE verb below is a convenience wrapper\nfor the clear path.\n\nAudit event: `app.static_egress_ip_set` carries the\naccount/app/ip triple.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetAppStaticEgressIPRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The new pin state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppStaticEgressIPResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Plan doesn't allow static egress IPs (Free / Hobby / Pro).\nStable code: `plan_static_egress_ip_not_allowed`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Per-app quota exceeded (another app on the same account\nalready pins the same IP). Stable code:\n`plan_static_egress_ip_quota`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "delete": {
        "tags": [
          "security"
        ],
        "operationId": "clearAppStaticEgressIP",
        "summary": "Clear the per-app static egress IP pin.",
        "description": "Removes the apps.static_egress_ip pin and stamps\nstatic_egress_ip_set_at=NULL. Survives replay across\nscale-to-zero (the new pin state is read at wake time\nand the per-host egress renderer is re-applied on\nchange).\n",
        "responses": {
          "204": {
            "description": "Pin cleared."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/networks": {
      "get": {
        "tags": [
          "networking"
        ],
        "operationId": "listPrivateNetworks",
        "summary": "List Gregale-owned private networks.",
        "description": "Returns the caller's private-network definitions. This surface is\ndark-launched with FAAS_PRIVATE_NETWORK_FABRIC_ENABLED and is\nindependent of DigitalOcean or any other provider API.\n",
        "responses": {
          "200": {
            "description": "Account-scoped private networks.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrivateNetworkListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "503": {
            "description": "Gregale-owned network fabric is disabled for this account-scoped listing.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "networking"
        ],
        "operationId": "createPrivateNetwork",
        "summary": "Create a Gregale-owned private network.",
        "description": "Creates an IPv4 RFC1918 /16-/28 address space owned by Gregale.\nThe region is a Gregale placement label, not a DigitalOcean region\nidentifier. Host bridge/overlay activation remains asynchronous and\napp attachments stay fail-closed until ready.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePrivateNetworkRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Network definition created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrivateNetwork"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "The account plan does not include private networking.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Name or regional CIDR conflicts with an existing network.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Gregale-owned network fabric is disabled for network creation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/networks/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Stable Gregale network identifier returned at creation.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          }
        }
      ],
      "get": {
        "tags": [
          "networking"
        ],
        "operationId": "getPrivateNetwork",
        "summary": "Read a Gregale-owned private network.",
        "responses": {
          "200": {
            "description": "Private network definition.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrivateNetwork"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Gregale-owned network fabric is disabled for this network read.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "networking"
        ],
        "operationId": "deletePrivateNetwork",
        "summary": "Delete a private network with no app attachments.",
        "responses": {
          "204": {
            "description": "Network deleted."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Network still has an app attachment.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Gregale-owned network fabric is disabled for this network deletion.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/networks/{id}/members": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Stable Gregale network identifier whose members are listed.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          }
        }
      ],
      "get": {
        "tags": [
          "networking"
        ],
        "operationId": "listPrivateNetworkMembers",
        "summary": "List members and address capacity for a private network.",
        "description": "Returns the account-scoped stable address reservations for this\nGregale-owned network. Capacity excludes the network address, gateway,\nand broadcast address; this endpoint is inventory only and does not\nprobe workloads or call DigitalOcean APIs.\n",
        "responses": {
          "200": {
            "description": "Private-network member inventory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrivateNetworkMembersResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Gregale-owned network fabric is disabled for this network inventory read.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/networks/{id}/peerings": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Stable Gregale network identifier whose peerings are listed.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          }
        }
      ],
      "get": {
        "tags": [
          "networking"
        ],
        "operationId": "listPrivateNetworkPeerings",
        "summary": "List peerings for a private network.",
        "description": "Returns account-scoped peering intents involving this network. A\npending or error peering remains fail-closed until both route domains\nconverge; this surface does not call DigitalOcean APIs.\n",
        "responses": {
          "200": {
            "description": "Private-network peerings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrivateNetworkPeeringListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Gregale-owned network fabric is disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "networking"
        ],
        "operationId": "createPrivateNetworkPeering",
        "summary": "Request peering with another private network.",
        "description": "Creates a pending, symmetric peering between two Gregale-owned\nnetworks in the same account and region. Networks must have\nnon-overlapping IPv4 CIDRs. Route activation is asynchronous and\nremains fail-closed until the node fabric converges.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePrivateNetworkPeeringRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Peering intent accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrivateNetworkPeering"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Private networking is unavailable on this account plan for peering.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The two networks are already peered.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The Gregale-owned fabric is disabled for peering creation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/networks/{id}/peerings/{peer_id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Stable Gregale network identifier.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          }
        },
        {
          "name": "peer_id",
          "in": "path",
          "required": true,
          "description": "Stable peering identifier returned when the intent is created.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          }
        }
      ],
      "get": {
        "tags": [
          "networking"
        ],
        "operationId": "getPrivateNetworkPeering",
        "summary": "Read a private-network peering.",
        "responses": {
          "200": {
            "description": "Private-network peering.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrivateNetworkPeering"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "The Gregale-owned fabric is disabled for peering reads.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "networking"
        ],
        "operationId": "deletePrivateNetworkPeering",
        "summary": "Remove a private-network peering intent.",
        "responses": {
          "204": {
            "description": "Peering removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "The Gregale-owned fabric is disabled for peering deletion.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/networks/{id}/policy": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Network identifier whose reusable firewall policy is being replaced.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          }
        }
      ],
      "put": {
        "tags": [
          "networking"
        ],
        "operationId": "updatePrivateNetworkPolicy",
        "summary": "Replace a private network's reusable firewall policy.",
        "description": "Replaces the network-level IPv4 CIDR allowlist and optional\nprotocol/port rules used by every attached workload. Empty lists\npreserve the legacy allow-all behavior; non-empty rules are enforced\nfail-closed. App-level policy may further restrict destinations but\ncannot broaden the network baseline.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePrivateNetworkPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated private network definition.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrivateNetwork"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Private networking plan required for policy updates.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Gregale-owned network fabric is disabled for this policy update.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/network/private": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "networking"
        ],
        "operationId": "getAppPrivateNetworkAttachment",
        "summary": "Read the app private-network attachment intent.",
        "description": "Returns feature and plan capability metadata plus the current\nattachment, or `attachment=null` when none is configured. A pending\nor error attachment never admits private traffic.\n",
        "responses": {
          "200": {
            "description": "Current private-network attachment state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppPrivateNetworkAttachmentResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "503": {
            "description": "The cluster operator has not enabled private-network attachments for this request.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "networking"
        ],
        "operationId": "setAppPrivateNetworkAttachment",
        "summary": "Request a private-network attachment.",
        "description": "Replaces the app's provider-neutral attachment intent. Pro and Scale\nplans may request up to their plan CIDR cap (16 and 64 respectively).\nNetwork ID and region use the lowercase provider-neutral identifier\ngrammar. CIDRs must be non-default IPv4 RFC1918 ranges, must not\noverlap each other, and must not overlap Gregale's reserved ranges.\nThe response is `202 Accepted` with `status=pending`; traffic remains\nblocked until a connector advances the row to `ready`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AppPrivateNetworkAttachmentRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Attachment intent accepted for asynchronous reconciliation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppPrivateNetworkAttachmentResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "The account plan does not include private-network attachments.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "503": {
            "description": "Private-network attachment routes are disabled on this cluster.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "networking"
        ],
        "operationId": "clearAppPrivateNetworkAttachment",
        "summary": "Remove the app private-network attachment intent.",
        "responses": {
          "204": {
            "description": "Attachment intent removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "503": {
            "description": "The cluster has not enabled private-network attachments.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/trusted_signers": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "security"
        ],
        "operationId": "listAppTrustedSigners",
        "summary": "List the per-app trusted-publisher list (admin).",
        "description": "Lists every (signer_name, public_key_pem) row for this app. Admin-scoped; the wire form is the\nbase64-encoded DER SPKI bytes, NOT a PEM-armoured block.\nEmpty list is the EXPECTED state for any app with\nrequire_signed=false. Mounted with `authLimited → requireMFA →\nrequireScope(ScopesAdminOnly...)`.\n",
        "responses": {
          "200": {
            "description": "The trusted-publisher list (may be empty).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppTrustedSignerListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/trusted_signers/{name}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "in": "path",
          "name": "name",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
          },
          "description": "Lower-case signer label. Matches the on-disk filename (without .pem) under /etc/faas/secrets/trusted-publishers/."
        }
      ],
      "put": {
        "tags": [
          "security"
        ],
        "operationId": "putAppTrustedSigner",
        "summary": "Onboard (or replace) a trusted publisher (admin + MFA).",
        "description": "Writes the (app_id, signer_name) row with the supplied base64-DER\nblob. The API decodes the blob and persists it\nverbatim; the image service mirrors the row to `/etc/faas/secrets/trusted-publishers/{name}.pem`\nand refreshes its in-memory trust cache on `pg_notify('trusted_signer_changed')`.\nPUT semantics: idempotent re-PUT replaces the previous blob.\n\nAudit event: `app.trusted_signer_added`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddTrustedSignerRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The onboarded trusted signer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrustedSigner"
                }
              }
            }
          },
          "400": {
            "description": "trusted_signer_invalid (bytes out of [64,1024] range, non-ECDSA, non-P-256, etc).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Forbidden — admin scope required, OR plan_limit_trusted_signers when the per-app count would exceed the plan cap.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/AppNotFound"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "delete": {
        "tags": [
          "security"
        ],
        "operationId": "deleteAppTrustedSigner",
        "summary": "Offboard a trusted publisher (admin + MFA).",
        "description": "Deletes the (app_id, signer_name) row. 404 returns the canonical\n`trusted_signer_not_found` Problem so `gregale trusted-publishers remove`\ncan treat absent rows as idempotent success.\n\nAudit event: `app.trusted_signer_removed`.\n",
        "responses": {
          "204": {
            "description": "Row removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "trusted_signer_not_found — the (slug, name) row does not exist.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/tenant-surfaces": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "tenant-surfaces"
        ],
        "operationId": "listTenantSurfaces",
        "summary": "List tenant surfaces on an app.",
        "description": "Returns every active tenant surface on the app. Soft-deleted\nsurfaces are filtered out server-side. Returns 503 when the\n`FAAS_TENANT_SURFACES_ENABLED` flag is off (the cluster ships\ndark until the cert-engine real-mint ADR lands).\n",
        "responses": {
          "200": {
            "description": "The active surfaces on the app.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListTenantSurfacesResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/TenantSurfacesNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/TenantSurfacesNotEnabled"
          }
        }
      },
      "post": {
        "tags": [
          "tenant-surfaces"
        ],
        "operationId": "createTenantSurface",
        "summary": "Add a tenant surface with seed hostnames.",
        "description": "A tenant surface. One\nsurface holds N hostnames under one SAN bundle. Returns 202\n(the cert engine has to mint; the surface is in pending/active\nstate).\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTenantSurfaceRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The new surface (pending active).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantSurfaceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/TenantSurfacesNotAllowed"
          },
          "403": {
            "description": "code: tenant_surface_quota | tenant_hostname_quota | forbidden — the account or seed-hostname cap is exhausted, or the caller lacks scope.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "code: tenant_hostname_already_claimed | conflict — a seed hostname or surface name is already claimed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/TenantSurfacesNotEnabled"
          }
        }
      }
    },
    "/v1/apps/{slug}/tenant-surfaces/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "description": "The tenant surface id."
        }
      ],
      "get": {
        "tags": [
          "tenant-surfaces"
        ],
        "operationId": "getTenantSurface",
        "summary": "Get one tenant surface.",
        "responses": {
          "200": {
            "description": "The surface + its hostnames.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantSurfaceResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/TenantSurfacesNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/TenantSurfacesNotEnabled"
          }
        }
      },
      "delete": {
        "tags": [
          "tenant-surfaces"
        ],
        "operationId": "deleteTenantSurface",
        "summary": "Remove a tenant surface (soft-delete + cascade hostnames).",
        "responses": {
          "204": {
            "description": "Surface and hostnames removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/TenantSurfacesNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/TenantSurfacesNotEnabled"
          }
        }
      }
    },
    "/v1/apps/{slug}/tenant-surfaces/{id}/hostnames": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "description": "The tenant surface id this hostname is being added to."
        }
      ],
      "post": {
        "tags": [
          "tenant-surfaces"
        ],
        "operationId": "addTenantHostname",
        "summary": "Add a hostname to an existing surface.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddTenantHostnameRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The hostname (pending DNS-01 verification).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantHostnameResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/TenantSurfacesNotAllowed"
          },
          "403": {
            "description": "code: tenant_hostname_quota | forbidden — the surface hostname cap is exhausted or the caller lacks scope.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "code: tenant_hostname_already_claimed | conflict — the hostname belongs to another tenant surface.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/TenantSurfacesNotEnabled"
          }
        }
      }
    },
    "/v1/apps/{slug}/tenant-surfaces/{id}/hostnames/{hostname}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "description": "The tenant surface id this hostname is being removed from."
        },
        {
          "name": "hostname",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "The hostname (lowercased canonical form)."
        }
      ],
      "delete": {
        "tags": [
          "tenant-surfaces"
        ],
        "operationId": "removeTenantHostname",
        "summary": "Remove a hostname from a surface.",
        "responses": {
          "204": {
            "description": "Hostname removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/TenantSurfacesNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/TenantSurfacesNotEnabled"
          }
        }
      }
    },
    "/v1/apps/{slug}/env-diff": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "env"
        ],
        "operationId": "getAppEnvDiff",
        "summary": "Render the env-diff matrix (presence / value-equality across scopes).",
        "description": "Returns the (rows × scopes) matrix of env vars + sealed\nsecrets on the app. Secrets never reveal plaintext — the\ncell carries {present, value_hash} for secret rows and\n{present, value} for env rows. Two cells with the same\n`value_hash` therefore share byte-identical plaintext\n(collision probability 2^-64). Older rows have\n`value_hash = ''` and emit no `value_hash` key.\n",
        "responses": {
          "200": {
            "description": "Env-diff matrix.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvDiffResponse",
                  "example": {
                    "app_slug": "demo",
                    "scopes": [
                      "prod",
                      "staging"
                    ],
                    "rows": [
                      {
                        "key": "DATABASE_URL",
                        "kind": "secret",
                        "cells": {
                          "prod": {
                            "present": true,
                            "value_hash": "aaaa1111aaaa1111"
                          },
                          "staging": {
                            "present": true,
                            "value_hash": "bbbb2222bbbb2222"
                          }
                        }
                      },
                      {
                        "key": "LOG_LEVEL",
                        "kind": "env",
                        "cells": {
                          "prod": {
                            "present": true,
                            "value": "info"
                          },
                          "staging": {
                            "present": true,
                            "value": "debug"
                          }
                        }
                      }
                    ],
                    "generated_at": "2026-08-19T12:00:00Z"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/env": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/EnvScope"
        }
      ],
      "get": {
        "tags": [
          "env"
        ],
        "operationId": "listEnv",
        "summary": "List env vars on an app.",
        "description": "Returns every env var key + timestamps on the app. The plaintext\nvalue NEVER appears in the response — guest-init reads the value\nat process start from `/etc/faas/env.json` inside the guest.\n\n**scope filter.** The optional `?scope=`\nquery param selects which scope to read. Omitted = the\ndefault scope (legacy behaviour, byte-identical wire).\n`?scope=__all__` returns the nested `env_by_scope` response\nshape with every scope on the app; the flat `env` array\nis empty in that arm (discriminated union). Any other\n`?scope=<slug>` filters to that one scope. Invalid scope\nvalues return 400 `env_scope_invalid`.\n",
        "responses": {
          "200": {
            "description": "Env var envelopes on the app (plaintext never returned).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppEnvListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/EnvScopeInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/scaling": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "environment",
          "in": "query",
          "schema": {
            "type": "string"
          },
          "description": "Named project environment; omit for the default app."
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppScaling",
        "summary": "Read scaling settings and their revision.",
        "description": "Requires read access. Named environments must have a materialized workload revision.",
        "responses": {
          "200": {
            "description": "Current desired configuration; does not imply running instance convergence.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppScalingSnapshot"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "applyAppScaling",
        "summary": "Commit reviewed scaling settings with a recoverable request ID.",
        "description": "Requires deploy:write and the same MFA, plan and capacity admission as app settings updates.\nThe expected app UUID and revision are checked under the write lock. Default revisions advance for\nevery accepted request and for legacy changes to RAM, CPU, concurrency or min instances.\nNamed environments use their workload revision, including no-op revision semantics.\nSettings and the receipt commit atomically. Reuse request_id with the exact original\nbody after an interruption to recover the original receipt even after later writes.\nChanging the body under an accepted ID returns scaling_request_conflict; a stale\nrevision returns scaling_revision_conflict. Receipts survive until the app is purged.\nNamed production and protected environments require their existing approved workflow.\nA receipt confirms desired configuration only; named settings require a subsequent\ndeployment, and default settings do not prove guest readiness or replica convergence.\n",
        "requestBody": {
          "description": "Reviewed scaling fields and the revision and request identity to preserve on retry.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplyAppScalingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Original durable configuration receipt, including on replay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppScalingReceipt"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Write permission, MFA, capability or plan admission denied.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Scaling revision changed, request ID reused, or environment protected.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Commit outcome uncertain; recover or retry the original request ID and body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/scaling/requests/{request_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "environment",
          "in": "query",
          "schema": {
            "type": "string"
          },
          "description": "Environment of the original scaling request; omit to recover a default-app request."
        },
        {
          "name": "request_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Original scaling request UUID."
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppScalingReceipt",
        "summary": "Recover a scaling configuration receipt without performing a write.",
        "description": "Requires current read access to the app and selected environment. Receipt settings may have been superseded; read the current revision separately.",
        "responses": {
          "200": {
            "description": "Original durable configuration receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppScalingReceipt"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/env/batch": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/EnvScope"
        },
        {
          "$ref": "#/components/parameters/ConfigGuardQuery"
        }
      ],
      "post": {
        "tags": [
          "env"
        ],
        "operationId": "applyEnvBatch",
        "summary": "Atomically set and delete non-secret variables in one scope.",
        "description": "Requires env:write. Compares expected_revision against configuration\nhistory and live values, then commits all variables, one history revision,\nsnapshot invalidation and a value-free replay receipt in one transaction.\nUse revision 0 only for an empty scope with no history. Reuse request_id with the exact\noriginal body after an uncertain response; the original receipt is\nreturned even if later changes advanced the revision. Receipts are kept\nfor at least 24 hours. Reusing an ID with a changed body conflicts.\nRevision conflicts require another review and a new request ID.\nRunning instances receive values on their next cold wake or fresh restart.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnvBatchRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Durable transaction receipt; variable values are omitted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvBatchResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlanLimitEnvVars"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Configuration changed, request ID reused, or a field is managed by environment GitOps.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "$ref": "#/components/responses/EnvValueTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Transaction unavailable; retry the original request ID and body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/env/batch/requests/{request_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/EnvScope"
        },
        {
          "name": "request_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Original configuration batch request UUID."
        },
        {
          "name": "X-Gregale-Env-Receipt-Proof",
          "in": "header",
          "required": false,
          "schema": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "description": "Original private receipt proof when the batch supplied one. Never place this value in a URL."
        }
      ],
      "get": {
        "tags": [
          "env"
        ],
        "operationId": "getEnvBatchReceipt",
        "summary": "Read an original value-free configuration batch receipt.",
        "description": "Requires current app and scope read access. Named-environment receipts must contain the current immutable environment identity; legacy receipts without it are unavailable. This read does not replay a batch or prove current configuration or restart completion.",
        "responses": {
          "200": {
            "description": "Original retained value-free receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvBatchResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Configuration batch receipt storage is unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/config/revisions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/EnvScope"
        },
        {
          "name": "limit",
          "in": "query",
          "required": false,
          "description": "Revisions to return, newest first.",
          "schema": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 20
          }
        }
      ],
      "get": {
        "tags": [
          "env"
        ],
        "operationId": "listConfigRevisions",
        "summary": "List a scope's config revisions.",
        "description": "Newest first. Each customer env or secret write records a revision of the scope's complete config; the newest 100 are kept. Values are not listed; read one revision for its variables.",
        "responses": {
          "200": {
            "description": "Config revisions and the scope's newest config guard.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListConfigRevisionsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/config/revisions/{revision}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/EnvScope"
        },
        {
          "name": "revision",
          "in": "path",
          "required": true,
          "description": "The scope's config revision number, from the config history.",
          "schema": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        }
      ],
      "get": {
        "tags": [
          "env"
        ],
        "operationId": "getConfigRevision",
        "summary": "Read one config revision.",
        "description": "The scope's variables and secret versions after the change. Secret values and fingerprints are never returned.",
        "responses": {
          "200": {
            "description": "The config revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConfigRevisionDetail"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/config/guard": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/EnvScope"
        }
      ],
      "get": {
        "tags": [
          "env"
        ],
        "operationId": "getConfigGuard",
        "summary": "Read a scope's newest config guard.",
        "description": "A guard judges the first traffic served with a changed config against the config before it, and restores the previous config when the new one fails. 404 `config_guard_not_found` when no change in the scope was guarded.",
        "responses": {
          "200": {
            "description": "The config guard and, once closed, its decision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConfigGuard"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/scheduled-releases": {
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "listScheduledReleases",
        "summary": "List scheduled releases.",
        "description": "The account's scheduled releases: pending ones first, soonest first, then the most recently ended.",
        "parameters": [
          {
            "name": "app",
            "in": "query",
            "required": false,
            "description": "Only this app's schedules.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The scheduled releases.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScheduledReleaseListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/freezes": {
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "listReleaseFreezes",
        "summary": "List the account's deploy freezes.",
        "description": "The account's unlifted freezes that have not ended: active and upcoming windows, weekly windows and after-rollback policies. They cover the account's personal apps; a company organization's freezes are on `/v1/orgs/{slug}/freezes`. `app` narrows the list to the freezes covering one personal app; a company app is refused with 409.",
        "parameters": [
          {
            "name": "app",
            "in": "query",
            "required": false,
            "description": "Only freezes covering this app's slug.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The account's freezes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListReleaseFreezesResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "deployments"
        ],
        "operationId": "createReleaseFreeze",
        "summary": "Freeze production releases.",
        "description": "Creates a window, weekly or after-rollback freeze for one personal app or, without `app`, for every personal app of the account. While a freeze is active, new production deployments are refused with `release_frozen` unless the request carries `override_freeze`. A company app's freezes belong to its organization: naming one is refused with 409.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateReleaseFreezeRequest"
              },
              "example": {
                "app": "my-api",
                "kind": "window",
                "ends_at": "2026-12-27T09:00:00Z",
                "reason": "holiday freeze"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The freeze.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReleaseFreeze"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/freezes/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "The freeze's ID.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "delete": {
        "tags": [
          "deployments"
        ],
        "operationId": "liftReleaseFreeze",
        "summary": "Lift a deploy freeze.",
        "description": "Stops the freeze from withholding releases. Needs the admin scope (a signed-in session or an admin key); a deploy:write key gets 403. The freeze is kept, with who lifted it and when, for the audit trail. 404 `release_freeze_not_found` when no unlifted freeze has this ID.",
        "responses": {
          "200": {
            "description": "The lifted freeze.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReleaseFreeze"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/freeze-status": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getReleaseFreezeStatus",
        "summary": "Whether production releases of an app are frozen now.",
        "description": "Lists the freezes that would refuse a production release of the app now, and the freeze that starts next within a week.",
        "responses": {
          "200": {
            "description": "The app's freeze status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReleaseFreezeStatus"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/freezes": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "listAppReleaseFreezes",
        "summary": "List the deploy freezes covering an app.",
        "description": "The app owner's unlifted freezes that have not ended, on all of its apps and on this app. A company app's freezes belong to its organization; a personal app's to its account. Requires `org.read_app` on a company app.",
        "responses": {
          "200": {
            "description": "The freezes covering the app.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListReleaseFreezesResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "deployments"
        ],
        "operationId": "createAppReleaseFreeze",
        "summary": "Freeze production releases of an app.",
        "description": "Creates a window, weekly or after-rollback freeze on the app, owned by the app's owner: the company organization of a company app. On a company app a member who deploys may create a window; weekly and after-rollback policies need an owner or admin (`org.manage_app_security`). `app` in the body must be empty or this app.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateReleaseFreezeRequest"
              },
              "example": {
                "kind": "window",
                "ends_at": "2026-12-27T09:00:00Z",
                "reason": "incident 4711"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The freeze on the app, owned by the app's owner.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReleaseFreeze"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/freezes/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "The ID of a freeze on this app.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "delete": {
        "tags": [
          "deployments"
        ],
        "operationId": "liftAppReleaseFreeze",
        "summary": "Lift a deploy freeze on an app.",
        "description": "Lifts a freeze on this app. Needs the admin scope (a signed-in session or an admin key). Freezes on all of an owner's apps are lifted on `/v1/freezes/{id}` or `/v1/orgs/{slug}/freezes/{id}`. On a company app a member who deploys may lift a window they created; any other freeze needs an owner or admin. 404 `release_freeze_not_found` when no unlifted freeze on this app has this ID.",
        "responses": {
          "200": {
            "description": "The lifted freeze on the app.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReleaseFreeze"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/freezes": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "listOrgReleaseFreezes",
        "summary": "List a company organization's deploy freezes.",
        "description": "The organization's unlifted freezes that have not ended, on all of its apps and on single apps. Requires `org.read_app`. A personal organization's apps use `/v1/freezes` (409).",
        "responses": {
          "200": {
            "description": "The organization's freezes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListReleaseFreezesResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "orgs"
        ],
        "operationId": "createOrgReleaseFreeze",
        "summary": "Freeze production releases of every app of a company organization.",
        "description": "Creates a freeze on all of the organization's apps; `app` must be empty (freeze one app with `POST /v1/apps/{slug}/freezes`). A member who deploys (`org.deploy_app`) may create a window; weekly and after-rollback policies need an owner or admin.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateReleaseFreezeRequest"
              },
              "example": {
                "kind": "window",
                "ends_at": "2026-12-27T09:00:00Z",
                "reason": "holiday freeze"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The freeze on all of the organization's apps.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReleaseFreeze"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/freezes/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "The ID of one of the organization's freezes.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "delete": {
        "tags": [
          "orgs"
        ],
        "operationId": "liftOrgReleaseFreeze",
        "summary": "Lift a company organization's deploy freeze.",
        "description": "Lifts one of the organization's freezes. Needs the admin scope (a signed-in session or an admin key). A member who deploys may lift a window they created; any other freeze needs an owner or admin. 404 `release_freeze_not_found` when the organization has no unlifted freeze with this ID.",
        "responses": {
          "200": {
            "description": "The organization's lifted freeze.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReleaseFreeze"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/release-gates": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "listReleaseGates",
        "summary": "List an app's release gates.",
        "description": "Gates on the app's SLOs, new error groups and custom metrics. The canary circuit breaker and the post-release watch abort or roll back a release that fails one.",
        "responses": {
          "200": {
            "description": "The app's release gates.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListReleaseGatesResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "deployments"
        ],
        "operationId": "createReleaseGate",
        "summary": "Add a release gate.",
        "description": "An slo gate names one of the app's SLOs; a new_errors gate counts error groups the release produced first; a custom_metric gate bounds a custom metric's average; an ai gate fails a release whose AI gateway calls got worse than its baseline's. Omitted numbers take Gregale's defaults.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateReleaseGateRequest"
              },
              "example": {
                "name": "checkout-slo",
                "kind": "slo",
                "slo": "checkout",
                "max_burn_rate": 10
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The release gate.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReleaseGate"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/release-gates/{name}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "The release gate's name.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_-]{0,62}$"
          }
        }
      ],
      "delete": {
        "tags": [
          "deployments"
        ],
        "operationId": "deleteReleaseGate",
        "summary": "Remove a release gate.",
        "description": "Needs the admin scope (a signed-in session or an admin key); a deploy:write key cannot remove the gates it deploys past. 404 `release_gate_not_found` when the app has no gate with this name.",
        "responses": {
          "200": {
            "description": "The removed release gate.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReleaseGate"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/release-approval-policy": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getReleaseApprovalPolicy",
        "summary": "Show an app's release approval policy.",
        "description": "404 `release_approval_policy_not_found` when the app does not require approvals.",
        "responses": {
          "200": {
            "description": "The app's approval policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReleaseApprovalPolicy"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "put": {
        "tags": [
          "deployments"
        ],
        "operationId": "setReleaseApprovalPolicy",
        "summary": "Require approvals for an app's production releases.",
        "description": "Creates or replaces the policy. Needs the admin scope (a signed-in session or an admin key). Each production release then waits in a canary stage until enough eligible people approve it. Organization owners and admins may change the policy. An app outside an organization always counts its owner's own approval.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetReleaseApprovalPolicyRequest"
              },
              "example": {
                "required_approvals": 2,
                "after_stage": 1,
                "timeout_minutes": 1440,
                "approvers": "admin"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The saved policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReleaseApprovalPolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "deployments"
        ],
        "operationId": "deleteReleaseApprovalPolicy",
        "summary": "Stop requiring release approvals.",
        "description": "Needs the admin scope (a signed-in session or an admin key). Releases waiting for approval continue on the canary's next step.",
        "responses": {
          "204": {
            "description": "The policy was removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/release-approvals": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "listReleaseApprovals",
        "summary": "List an app's releases waiting for approval.",
        "description": "Releases in state waiting, and those past their timeout that the canary worker is about to abort.",
        "responses": {
          "200": {
            "description": "The waiting releases.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListReleaseApprovalsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/config/rollback": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/EnvScope"
        }
      ],
      "post": {
        "tags": [
          "env"
        ],
        "operationId": "rollbackConfig",
        "summary": "Restore a scope's variables to a config revision.",
        "description": "Sets and deletes variables until the scope matches the revision, as one guarded change. Secrets cannot be restored from a revision; those that differ are listed in `secrets_not_restored`. Reviewed requests may pin the current revision and immutable targets, and provide a private proof and request ID for passive receipt recovery.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConfigRollbackRequest"
              },
              "example": {
                "revision": 12
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "What the rollback changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConfigRollbackResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/config/rollback/requests/{request_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/EnvScope"
        },
        {
          "name": "request_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Original reviewed rollback request UUID."
        },
        {
          "name": "X-Gregale-Env-Receipt-Proof",
          "in": "header",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "description": "Original private receipt proof. Never put it in a URL."
        }
      ],
      "get": {
        "tags": [
          "env"
        ],
        "operationId": "getConfigRollbackReceipt",
        "summary": "Read a reviewed configuration rollback receipt.",
        "description": "Returns value-free evidence for the original app and environment, subject to current read access. Never replays a rollback.",
        "responses": {
          "200": {
            "description": "The original rollback receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConfigRollbackReceipt"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/env/{key}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/SecretKey"
        },
        {
          "$ref": "#/components/parameters/ConfigGuardQuery"
        },
        {
          "$ref": "#/components/parameters/EnvScope"
        }
      ],
      "put": {
        "tags": [
          "env"
        ],
        "operationId": "setEnv",
        "summary": "Set an env var.",
        "description": "Persists the plaintext value verbatim in the app_envs table (no\nseal step). Env vars are non-sensitive runtime config by contract\n— credentials stay on `/v1/apps/{slug}/secrets/{key}`. Applies on\nnext cold wake; cached snapshots are invalidated and the running\ninstance is unaffected. Use `POST /restart?fresh=true` to apply now.\n\n**scope filter.** The optional `?scope=`\nquery param selects which scope to write. Omitted = the\ndefault scope (legacy behaviour). The reserved sentinel\n`__all__` is rejected with 400 `env_scope_reserved` on\nwrites (it has no meaning on a single-row write). Invalid\nscope shapes return 400 `env_scope_invalid`.\n",
        "requestBody": {
          "required": true,
          "description": "Env var payload — key name + plaintext.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutAppEnvRequest",
                "example": {
                  "value": "debug"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The stored env var envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppEnvResponse",
                  "example": {
                    "key": "LOG_LEVEL",
                    "scope": "default",
                    "created_at": "2026-07-28T11:25:00Z",
                    "updated_at": "2026-07-28T11:25:00Z"
                  }
                }
              }
            }
          },
          "400": {
            "description": "400 on PUT /v1/apps/{slug}/env/{key}?scope=... — any of {env_var_invalid_key, env_scope_invalid, env_scope_reserved}.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlanLimitEnvVars"
          },
          "413": {
            "$ref": "#/components/responses/EnvValueTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "env"
        ],
        "operationId": "deleteEnv",
        "summary": "Delete an env var.",
        "description": "Removes the (app_id, scope, key) row. `?scope=` selects\nwhich scope; omitted = the default scope. `?scope=__all__`\nis rejected (400 `env_scope_reserved`) — same reason as\non PUT: the sentinel has no meaning on a single-row\ndelete. Returns 400 `env_var_not_found` (not 404) when\nno row matches — the URL resource is the env-var, not\nthe app.\n",
        "responses": {
          "204": {
            "description": "No body. The env var was removed."
          },
          "400": {
            "description": "400 on DELETE /v1/apps/{slug}/env/{key}?scope=... — any of {env_var_not_found, env_scope_invalid, env_scope_reserved}.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/upstreams": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "deployment_scope",
          "in": "query",
          "required": false,
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
          },
          "description": "Optional server-side filter\nthat narrows the list to one deployment. Omitted = return\nall deployments for the app. Same shape as `scope` (1..40\nchars, lowercase alnum + dash); empty string is treated as\n\"no filter\".\n"
        }
      ],
      "get": {
        "tags": [
          "upstreams"
        ],
        "operationId": "listAppDataUpstreams",
        "summary": "List data upstreams on an app.",
        "description": "Returns every captured (host_redacted_hash, kind, port) tuple\non the app. The plaintext host NEVER appears in the response —\nonly the SHA-256 hash of (salt||host).\n\nThe list is bounded by the per-plan `api.DataPlacementHintsPerApp`\nquota (Free=0, Hobby=3, Pro=10, Scale=50). When FAAS_DATA_PLACEMENT\nis on the classifier derives entries on env mutation; when OFF\nthe table stays empty and the response is `[]`.\n\n`?deployment_scope=` narrows\nthe list to one deployment so the dashboard can render\nstaging-vs-prod independently. Omitted = \"all deployments\".\n",
        "responses": {
          "200": {
            "description": "Captured upstreams on the app (plaintext never returned).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataUpstreamListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "put": {
        "tags": [
          "upstreams"
        ],
        "operationId": "createAppDataUpstream",
        "summary": "Add a data upstream to an app.",
        "description": "Captures a (host, kind, port) tuple so the metering service probe loop\ncan dial it and the scheduler can bias wake placement by the\nprobed RTT. Plaintext host is hashed via\n`sha256(HostHashSalt||host)` before insert; the response\nreturns the hashed form only (invariant).\n\n**Plan limits.** Free plan returns 402\n`plan_data_upstreams_not_allowed`. Hobby/Pro/Scale hit their\nper-app cap (3/10/50) before the request body is parsed —\nserver returns 403 `plan_limit_data_upstreams` with the\nobserved count. Invalid inputs return 400\n`upstream_invalid_{kind,host,port}`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutDataUpstreamRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The stored upstream envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataUpstreamResponse"
                }
              }
            }
          },
          "400": {
            "description": "400 — any of {upstream_invalid_kind, upstream_invalid_host, upstream_invalid_port}.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "402 — plan_data_upstreams_not_allowed (Free plan).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "403 — plan_limit_data_upstreams (per-app cap exceeded).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/upstreams/history": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "from",
          "in": "query",
          "required": false,
          "schema": {
            "type": "string",
            "format": "date-time"
          },
          "description": "Inclusive RFC3339 window start. Defaults to 24 hours before `to`; the maximum window is 30 days."
        },
        {
          "name": "to",
          "in": "query",
          "required": false,
          "schema": {
            "type": "string",
            "format": "date-time"
          },
          "description": "Exclusive RFC3339 window end. Defaults to the current time."
        },
        {
          "name": "bucket",
          "in": "query",
          "required": false,
          "schema": {
            "type": "string",
            "default": "5m"
          },
          "description": "Aggregation bucket duration, from 1m through 24h. The result is capped at 1000 buckets."
        },
        {
          "name": "region",
          "in": "query",
          "required": false,
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9_-]{1,32}$"
          },
          "description": "Optional probe region filter. Omitted returns every region with samples."
        },
        {
          "name": "deployment_scope",
          "in": "query",
          "required": false,
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
          },
          "description": "Optional deployment scope filter from the overlay."
        }
      ],
      "get": {
        "tags": [
          "upstreams"
        ],
        "operationId": "getAppDataUpstreamHistory",
        "summary": "Get historical data-upstream probe metrics.",
        "description": "Returns one time series per captured upstream and probe region.\nEach bucket contains p50/p95 successful RTTs and the total number\nof probes, including failures. The query is bounded to the probe\nretention window and is aggregated server-side; raw probe rows and\nplaintext hosts are never returned.\n",
        "responses": {
          "200": {
            "description": "Bucketed upstream probe history.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/DataUpstreamHistoryResponse"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid time window, bucket, or region filter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/upstreams/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Upstream id (UUID)."
        }
      ],
      "get": {
        "tags": [
          "upstreams"
        ],
        "operationId": "getAppDataUpstream",
        "summary": "Get one data upstream.",
        "description": "Returns the single upstream row by id. Plaintext host NEVER\nappears in the response (invariant).\n",
        "responses": {
          "200": {
            "description": "The upstream envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataUpstreamResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "tags": [
          "upstreams"
        ],
        "operationId": "deleteAppDataUpstream",
        "summary": "Delete a data upstream.",
        "description": "Removes one row by id. Cascades into the probe set\n(next probe tick no longer dials the host).\n",
        "responses": {
          "204": {
            "description": "No body. The upstream was removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "404 — upstream_not_found.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/upstreams/{id}/circuit-breaker": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Id of the upstream whose egress circuit-breaker policy is being changed."
        }
      ],
      "patch": {
        "tags": [
          "upstreams"
        ],
        "operationId": "updateAppDataUpstreamCircuitBreaker",
        "summary": "Update an upstream's egress circuit-breaker policy.",
        "description": "Opts one upstream into (or out of) egress circuit breaking, and\noptionally tunes its thresholds.\n\nEnabling this grants the platform permission to REJECT your app's\nconnections to this upstream while its circuit is open. Plaintext\nhosts never appear in the request or the response; upstreams are\naddressed by id and identified by `host_redacted_hash`.\n\nPlan-gated: accounts whose plan allows no egress breakers receive\n402. The per-app cap counts only ENABLED upstreams, so turning one\noff, or re-saving one that is already on, is never blocked.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateUpstreamCircuitBreakerRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated upstream envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataUpstreamResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "402 — the plan does not allow egress circuit breakers, or the per-app cap is reached.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "404 — upstream_not_found: no upstream with this id belongs to the app.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "422 — validation failed on the circuit-breaker body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "503 — `egress_circuit_disabled`: the request sets `enabled: true`\nbut this platform does not enforce egress circuit breakers yet,\nso the breaker would never reject a connection. Turning a breaker\noff is still accepted. `data_upstreams_disabled`: data placement\nis not enabled on this cluster.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/deployments": {
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "listDeployments",
        "summary": "List deployments across all apps on the account.",
        "description": "Paged backwards (newest first). `next_before` is an opaque cursor\n(RFC3339Nano of the `created_at`); pass it on the next request to\npage backwards. Empty `next_before` means end of list.\n",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            },
            "description": "Page size (1–200, default 50)."
          },
          {
            "name": "before",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "RFC3339Nano cursor from a previous response's `next_before`."
          }
        ],
        "responses": {
          "200": {
            "description": "A paginated list of deployments.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentListResponse",
                  "example": {
                    "items": [],
                    "next_before": null
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/deployments/latest-by-app": {
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "listLatestDeploymentsByApp",
        "summary": "List the latest deployment for each app on the account.",
        "description": "Returns at most one deployment for every non-deleted app owned by the\nauthenticated account. Items are ordered newest first by `created_at`,\nwith deployment ID as the stable tie-breaker.\n",
        "responses": {
          "200": {
            "description": "The latest deployment for each deployed app.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LatestDeploymentsByAppResponse"
                },
                "example": {
                  "items": []
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/deployments/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getDeployment",
        "summary": "Fetch one deployment.",
        "responses": {
          "200": {
            "description": "The deployment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentResponse",
                  "example": {
                    "id": "0123456789abcdef0123456789abcdef",
                    "app_id": "0123456789abcdef0123456789abcdef",
                    "image_digest": "sha256:0000000000000000000000000000000000000000000000000000000000000000",
                    "kind": "tarball",
                    "status": "active",
                    "traffic_percent": 100,
                    "created_at": "2026-08-29T11:25:00Z"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "tags": [
          "deployments"
        ],
        "operationId": "updateDeploymentMinInstances",
        "summary": "Set the per-deployment cold-wake floor.",
        "description": "Update the deployment's min_instances (closure). The only mutable field on a deployment post-create;\nimage / digest / overrides / sidecars stay immutable (a new\ndeployment is the canonical way to change them). Pass\nmin_instances=0 to inherit from the parent app's floor.\nValidated against the parent app's plan MaxMinInstances cap.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "min_instances"
                ],
                "properties": {
                  "min_instances": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Per-deployment cold-wake floor override. 0 = inherit from parent app."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated deployment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentResponse"
                }
              }
            }
          },
          "400": {
            "description": "`400 Bad Request` — request body failed JSON decode or\n`min_instances` was outside the inclusive `[0, plan_cap]`\nrange. Stable code `min_instances_invalid`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "description": "`422 Unprocessable Entity` — request was syntactically valid\nbut the parent app's plan refuses the override (e.g. a\nFree app PATCHing `min_instances=1`). Stable code\n`plan_min_instances_not_allowed`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "deployments"
        ],
        "operationId": "clearDeployment",
        "summary": "Soft-delete a deployment.",
        "description": "Deployment queue controls — soft-delete one deployment\nrow. Status is intentionally untouched (admin audit trail).\nLive deployments return 409 with the cancel-live hint pointing\nat `gregale deploys rollback`.\n",
        "responses": {
          "200": {
            "description": "Soft-deleted."
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Live deployments cannot be cleared."
          }
        }
      }
    },
    "/v1/deployments/{id}/reorder": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "post": {
        "tags": [
          "deployments"
        ],
        "operationId": "reorderDeployment",
        "summary": "Reorder a pending deployment.",
        "description": "Deployment queue controls — update the priority of a\nstill-pending deployment. 0 = deploy immediately (top of\nqueue), 100 = FIFO default, 1000 = background rebuild.\nPlan-gated (Hobby/Pro/Scale only); Free returns 402\n`plan_reorder_disabled`. 409 if the deployment has already\nmoved off the pending queue.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "priority"
                ],
                "properties": {
                  "priority": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Reordered.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "priority": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Plan does not allow reorder."
          },
          "409": {
            "description": "Row is past the pending queue."
          }
        }
      }
    },
    "/v1/apps/{slug}/deployments/{id}/cancel": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "post": {
        "tags": [
          "deployments"
        ],
        "operationId": "cancelDeployment",
        "summary": "Cancel a deployment.",
        "description": "Deployment queue controls — flip a deployment in\n{pending, building, imaging, snapshotting} to \"cancelled\"\nand cascade-cancel its in-flight builds. Live deployments\nreturn 409 `deployment_cancel_live_forbidden` with the\nrollback hint. Optional reason: user | auto_quota |\nauto_health | system.\n",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelDeploymentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Cancelled.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "cancelled_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "cancel_reason": {
                      "type": "string"
                    },
                    "cancelled_builds": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Live deployment cannot be cancelled."
          }
        }
      }
    },
    "/v1/apps/{slug}/deployments/clear-obsolete": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "deployments"
        ],
        "operationId": "clearObsoleteDeployments",
        "summary": "Bulk soft-delete terminal-but-not-current deployments.",
        "description": "Deployment queue controls — bulk soft-delete rows\nin {superseded, failed, cancelled} older than the cutoff\n(default 168h). Plan-gated (Free returns 402\n`plan_reorder_disabled`). Retention\ncap enforced inside the store so INV 3 stays satisfied.\n",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "older_than": {
                    "type": "string",
                    "description": "Go duration (e.g. 168h)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Cleared.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClearObsoleteReport"
                }
              }
            }
          },
          "402": {
            "description": "code: plan_reorder_disabled — this plan does not include deployment queue controls.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/deployments/{id}/traffic": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "patch": {
        "parameters": [
          {
            "name": "Deployment-Promotion-Attempt-ID",
            "in": "header",
            "required": false,
            "description": "Opaque durable identity for guarded 100 percent promotion. An accepted retry returns 409 deployment_promotion_attempt_accepted without changing traffic; read its receipt separately. Never reuse it with another body.",
            "schema": {
              "type": "string",
              "minLength": 32,
              "maxLength": 32,
              "pattern": "^[0-9a-f]{32}$"
            }
          }
        ],
        "tags": [
          "deployments"
        ],
        "operationId": "updateDeploymentTraffic",
        "summary": "Set the per-deployment traffic-split weight.",
        "description": "Update the deployment's traffic_percent.\nuses the zero-siblings rebalance form: setting row R's\ntraffic_percent to N forces every other live row in the same\napp to 0, keeping Σ = 100 by construction. Pro/Scale only —\nFree/Hobby are rejected at 403 `plan_traffic_split_not_allowed`.\nRange-check [0, 100] is enforced at the handler (422\n`invalid_traffic_percent`). The Σ invariant is asserted\npost-write as a defensive backstop (409\n`traffic_percent_sum_invalid`).\nGuarded MCP requests retain deploy.mcp_admission evidence in the deployment\naudit timeline. Accepted evidence commits with traffic; rejected evidence\nis saved after rollback. Audit-storage failure returns 503\nmcp_admission_evidence_unavailable.\nAn optional expected_serving_deployment_id is checked under the\nsame live-row locks before rebalance. A stale expectation returns\n409 `traffic_serving_changed` without changing traffic.\nAn in-flight managed canary owns the app's traffic weights; direct\ntraffic changes during `pending` or `rolling_out` return 409\n`traffic_change_during_canary` without changing traffic.\nPromoting a candidate to 100% also returns 409\n`mcp_task_compatibility_gate_blocked` when it lacks a live worker for\nan outstanding MCP task handler version.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateDeploymentTrafficRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated deployment with the new traffic_percent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentResponse"
                }
              }
            }
          },
          "400": {
            "description": "`400 Bad Request` — request body failed JSON decode.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`403 Forbidden` — the account's plan refuses traffic\nsplitting (Free / Hobby). Stable code\n`plan_traffic_split_not_allowed`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "`409 Conflict` — the post-write Σ invariant check tripped\n(`traffic_percent_sum_invalid`), the optional\nexpected_serving_deployment_id was stale\n(`traffic_serving_changed`), or an in-flight managed canary\nowns traffic (`traffic_change_during_canary`), or MCP task handler\ncompatibility blocks a 100% promotion\n(`mcp_task_compatibility_gate_blocked`). These checks run before\nmutation; a sum-invariant failure rolls back all tentative updates.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "`422 Unprocessable Entity` — `traffic_percent` was\noutside the inclusive `[0, 100]` range. Stable code\n`invalid_traffic_percent`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "MCP traffic admission evidence could not be committed (mcp_admission_evidence_unavailable). Inspect traffic before retrying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/deployments/{id}/promote": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^(?:[a-fA-F0-9]{32}|[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})$"
          },
          "description": "Deployment UUID in canonical or 32-hex form."
        }
      ],
      "post": {
        "tags": [
          "deployments"
        ],
        "operationId": "promoteDeploymentWithBindings",
        "summary": "Promote a deployment after an atomic bindings check.",
        "description": "Available on all supported plans. Evaluate the exact live, materialized candidate using\nthe bindings preflight policy, then compare its binding/configuration,\nprobe and runtime revision inside the traffic transaction. Blockers,\nexpired evidence or changed observations return 409 without changing\ntraffic. No probes or restarts are scheduled. Queue/outbound probe\ncoverage requires an explicit allow_unsupported waiver and remains\npartial. A successful receipt confirms the applied policy and check.\nAn optional serving expectation is checked under the traffic locks.\nAn already promoted target still requires a passed bindings check;\nit returns an idempotent receipt without requiring the previous\ndeployment to remain at 100%. Active managed canaries cannot be bypassed.\nThis dedicated route prevents older servers from ignoring the bindings gate.\nFor require_application_ack use promote-with-application-ack so an older\nserver cannot silently ignore the new policy field.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BindingPromotionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Promoted deployment and the server-enforced bindings check.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BindingPromotionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON request.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Traffic promotion is not allowed by the account plan or token scope.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Bindings check failed or changed, target is unavailable, serving expectation changed, or a managed canary owns traffic. Binding failures include a structured bindings_check report.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid policy duration or deployment identifier.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "description": "The check or transaction could not complete; traffic is unchanged.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The binding catalogs cannot enforce the promotion fence.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/deployments/{id}/promote-with-prepared-cache": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "deployments"
        ],
        "operationId": "promoteDeploymentWithPreparedCache",
        "summary": "Prepare saved GET routes and move all production traffic to the candidate.",
        "description": "Requires deployment and cache permissions. After release and binding checks pass, captures the saved routes from the running zero-traffic candidate. Every serving gateway stages the responses before the traffic change and prepared cache publication commit together.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreparedCachePromotionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Promotion committed with the prepared cache publication.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BindingPromotionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Preparation or a release check blocked promotion. Cache-specific failures have code cache_prepared_promotion_blocked.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "description": "The release checks or traffic transaction could not complete.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/deployments/{id}/promote-with-application-ack": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^(?:[a-fA-F0-9]{32}|[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})$"
          },
          "description": "Candidate UUID for strict adoption promotion; canonical and compact hexadecimal forms are accepted."
        }
      ],
      "post": {
        "tags": [
          "deployments"
        ],
        "operationId": "promoteDeploymentWithApplicationAck",
        "summary": "Promote after atomic bindings and application acknowledgement checks.",
        "description": "Always require current version-bound application acknowledgements from\nevery authorized resident workload of PostgreSQL and object-storage\nbindings in the candidate scope, including a resident candidate target\nfor each binding. Missing, stale, failed, disabled or unknown receipts\nblock promotion. Application receipts are self-attestations, distinct\nfrom connectivity probes and guest projection/signal outcomes.\nrequire_application_ack is forced true even if the request omits it or\nsupplies false. All normal bindings checks, permissions and atomic\ntraffic fences also apply. Changes to credentials, authorized workload\nrosters, reload support or receipts invalidate the check at the write.\nUse this route for strict promotion; older servers return 404 before\nchanging traffic. Never fall back to the ordinary promotion route.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BindingPromotionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Traffic receipt confirming bindings checks and required current application acknowledgements.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BindingPromotionResponse"
                }
              }
            }
          },
          "400": {
            "description": "The strict promotion policy body could not be decoded.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Strict adoption promotion requires an eligible account and deployment write permission.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The strict binding/application policy failed or changed, or the candidate, serving expectation or managed canary prevents promotion. A bindings_check report accompanies adoption failures.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The strict promotion request supplied an invalid evidence age or deployment expectation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "description": "Application adoption promotion could not finish its observation read or traffic transaction.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Strict promotion cannot share a transaction fence across its binding catalogs and traffic backend.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/deployments/{id}/canary/profile-gate": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getDeploymentProfileCanaryGate",
        "summary": "Read the current stage's profiling gate and retained evidence.",
        "description": "Read-only owned-deployment decision. Source links are derived from deployment commits; this request never queries the profiling backend.",
        "responses": {
          "200": {
            "description": "Current profiling gate decision, frozen windows and route code evidence.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileCanaryGateDecision"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/deployments/{id}/approvals": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getReleaseApproval",
        "summary": "Show a release's approvals.",
        "description": "The release's approval state, the decisions so far, and when its wait expires.",
        "responses": {
          "200": {
            "description": "The release's approval status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReleaseApprovalStatus"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "deployments"
        ],
        "operationId": "decideReleaseApproval",
        "summary": "Approve or reject a release.",
        "description": "Records one decision per person. An approval needs a signed-in dashboard session: 403 `release_approval_session_required` to an API key or token, with the release's approval page as the hint; a rejection is accepted from either. A rejection is final and aborts the rollout, restoring the previous release. 403 `release_approval_self` when the deployer approves their own release and the policy does not allow it; 409 `release_approval_decided` for a second decision or a release that no longer accepts one.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DecideReleaseApprovalRequest"
              },
              "example": {
                "decision": "approve",
                "comment": "canary looks clean"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The release's approval status after the decision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReleaseApprovalStatus"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/deployments/{id}/release-outcome": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "post": {
        "tags": [
          "deployments"
        ],
        "operationId": "recordReleaseOutcomeCheck",
        "summary": "Record a database check after a release command with an unknown outcome.",
        "description": "A release command that started but ended without an exit code (its worker was lost, it timed out or it was cancelled while running) may have changed the database partly. Until a person checks the database and records it here, or a later release command of the same scope succeeds, the app's next release fails with `release_outcome_uncertain` before its own command runs. 409 when this release's command never ran, ended with a known exit, or was checked already.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecordReleaseOutcomeCheckRequest"
              },
              "example": {
                "note": "migration 0042 applied completely; schema matches"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The recorded check.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReleaseOutcomeCheck"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/deployments/{id}/diff": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        },
        {
          "name": "against",
          "in": "query",
          "required": false,
          "description": "The release to compare with; defaults to the release of the same scope that served before this one.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getReleaseDiff",
        "summary": "Show what changed between two releases.",
        "description": "Compares the code, configuration keys, packages, runtime settings and release command of two releases of one app. Never returns variable values, secret fingerprints or SBOM files. A section whose history is missing reports known=false with a note.",
        "responses": {
          "200": {
            "description": "The release diff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReleaseDiff"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/deployments/{id}/timeline": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getReleaseTimeline",
        "summary": "Show a release's phase and history.",
        "description": "Composes what Gregale recorded about one release into a phase, a one-line summary and its events, oldest first: creation, schedule, approvals, rollout start, each canary step with the decision and gate results behind it, holds, completion, the post-release watch, abort or rollback, and the release that replaced it. Reads at most 500 audit rows; truncated=true means older history was left out.",
        "responses": {
          "200": {
            "description": "The release timeline.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReleaseTimeline"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/deployments/{id}/schedule": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getDeploymentSchedule",
        "summary": "Show a release's schedule.",
        "description": "The release's newest schedule: pending, or how it ended. 404 `scheduled_release_not_found` when the release was never scheduled.",
        "responses": {
          "200": {
            "description": "The schedule.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScheduledRelease"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "put": {
        "tags": [
          "deployments"
        ],
        "operationId": "scheduleDeployment",
        "summary": "Schedule, or move, the start of a release waiting without traffic.",
        "description": "The release must be live without traffic and without a canary ladder, or still building to go live without traffic; otherwise 409 `release_not_parked`. A release_at that has passed starts it on the API's next pass. Freezes active at release_at refuse the schedule with 409 `release_frozen` unless override_freeze gives a reason. An app that requires approvals needs a canary: 409 `release_approval_canary_required`. An app's earlier pending schedule is cancelled.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ScheduleReleaseRequest"
              },
              "example": {
                "release_at": "2026-10-22T02:00:00Z",
                "notify_channels": [
                  "releases"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The pending schedule.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScheduledRelease"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "deployments"
        ],
        "operationId": "cancelDeploymentSchedule",
        "summary": "Cancel a release's pending schedule.",
        "description": "The release stays live without traffic. 404 `scheduled_release_not_found` when it has no pending schedule.",
        "responses": {
          "200": {
            "description": "The cancelled schedule.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScheduledRelease"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/deployments/{id}/canary/advance": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "post": {
        "tags": [
          "deployments"
        ],
        "operationId": "advanceDeploymentCanary",
        "summary": "Advance one persisted canary stage.",
        "description": "Atomically advances the deployment's canary ladder by one stage.\nThe caller supplies the canary_step it observed; APID resolves the\nnext percentage from the deployment's persisted preset and rejects\nstale workers with `409 canary_step_conflict`. The state transition,\nsibling traffic rebalance, terminal promotion, and deployment audit\nrow are committed together. Pro/Scale only — Free/Hobby are rejected\nat 403 `plan_traffic_split_not_allowed`.\nEnforced route gates require complete, current, satisfied evidence for\nthis candidate under policy, intent and capture locks. Missing or stale\nevidence durably requests a fresh check without increasing traffic.\nA blocked route gate returns 409 `route_gate_blocked` with reason codes in detail.\nAn opt-in profiling gate returns 409 `profile_gate_blocked` while evidence\nis collecting, regressed or timed out with hold configured. Customer\noverrides require a current profile policy revision and bounded reason;\nother rollout gates still apply. Worker-only opt-in profiling rollback\natomically aborts the candidate and restores the exact stable predecessor\nafter lease, stage, policy, evidence and binding checks.\nA cache recovery choice applies to the exact hold_id from this release.\nIt returns 202 without moving traffic. Regular refresh is applied only\nwhen Safe Deploy can advance the same release through its usual checks.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdvanceCanaryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The atomically advanced deployment and audit row id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CanaryAdvanceResponse"
                }
              }
            }
          },
          "202": {
            "description": "Cache recovery recorded for this release at its current traffic split.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "deployment"
                  ],
                  "properties": {
                    "deployment": {
                      "$ref": "#/components/schemas/DeploymentResponse"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Plan tier gate tripped (Hobby / Free).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Stale canary step, invalid rollout state, changed or pending cache hold, traffic sum conflict or enforced route gate blocked.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/deployments/{id}/logs": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "streamDeploymentLogs",
        "summary": "Stream build logs (SSE).",
        "description": "Server-Sent Events stream of build logs. `follow=1` holds the\nconnection open until the build completes.\n\nthe stream also publishes one `event: stage` frame\nper named pipeline stage the customer's deploy passes\nthrough. The frame shape is:\n\n    event: stage\n    data: {\"name\":\"<StageName>\",\"started_at\":\"<RFC3339Nano>\",\"duration_ms\":<int64>,\"status\":\"in_progress\"|\"completed\"|\"failed\"[,\"reason\":\"<string>\"]}\n\n`name` is one of the closed 6-stage vocabulary:\n`source_download`, `dependency_restore`, `image_build`,\n`security_scan`, `snapshot_prepare`, `readiness`. The CLI\nrenders the stream as a live ticker on a TTY (ANSI cursor-up\nredraw) with a static one-line-per-frame fallback when\nstdout is not a TTY / `--json` is set / `NO_COLOR` is\nnon-empty. Customers wiring their own consumer should treat\nthe frame as additive — the existing `event: log` /\n`event: status` / `event: end` shapes are unchanged.\n",
        "parameters": [
          {
            "name": "before_seq",
            "in": "query",
            "schema": {
              "type": "integer"
            },
            "description": "Stream cursor — return only log entries with seq strictly less than this value."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer"
            },
            "description": "Maximum number of log entries to return in the initial burst before streaming."
          },
          {
            "name": "follow",
            "in": "query",
            "schema": {
              "type": "integer",
              "enum": [
                0,
                1
              ],
              "default": 0
            },
            "description": "If 1, hold the connection open and stream new build log entries as they arrive."
          }
        ],
        "responses": {
          "200": {
            "description": "A text/event-stream of build log entries, terminated by an empty SSE frame when the build finishes.",
            "content": {
              "text/event-stream": {}
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/deployments/{id}/audit": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "listDeploymentAudit",
        "summary": "List deployment audit timeline.",
        "description": "Returns the deployment_audit rows for one deployment in\nreverse-chronological order (E.2 + production-leveling Stream A).\n\nThe wire surface is a paginated JSON list\n(ListDeploymentAuditResponse); for the SSE-streaming\nvariant of the build log itself see\n`/v1/deployments/{id}/logs`.\n\nIDOR posture: the handler resolves the deployment ID\nand its app and checks the account BEFORE returning rows. A\ncross-account probe returns 404 (no\naccount-existence leak).\n\nLimit defaults to 50, clamped to [1, 500]; the\nserver-applied limit is echoed back in the response so\na paging consumer can distinguish \"limit was clamped\"\nfrom \"no more rows\" (both yield Items of length <\nlimit).\n",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 50
            },
            "description": "Maximum number of audit rows to return. Clamped to [1, 500]; the server-applied limit is echoed back in the response."
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated deployment_audit rows in reverse-chronological order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListDeploymentAuditResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "Deployment row missing or cross-account probe (no account-existence leak).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/deployments/{id}/status": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getDeploymentStatus",
        "summary": "Read a deployment's conditions.",
        "description": "Preview (resource-conditions capability). The deployment's Ready,\nProgressing and RolledOut conditions, mapped from\nthe response GET /v1/deployments/{id} returns and never stored.\nFailed, cancelled and superseded deployments report terminal\nconditions. Cache-Control no-store.\n",
        "responses": {
          "200": {
            "description": "The deployment's conditions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResourceStatus"
                }
              }
            }
          },
          "default": {
            "description": "Missing sign-in, read scope or MFA, a deployment this account does not own, the capability turned off, or the rate limit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/deployments/{id}/scan": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getDeploymentScan",
        "summary": "Get per-deploy grype scan.",
        "description": "Returns the per-deploy grype CVE scan payload. The scan runs on the per-app layer ext4 in the image service's\ndeploy-complete path (after `SetDeploymentRootfs`, before the\npending→snapshotting transition) and lands on the\n`deployments` row.\n\nStatus field is the closed enum:\n  - `complete` — full payload (SeverityCounts + Vulnerabilities).\n  - `failed` — payload carries `error` only; SeverityCounts is\n    all-zero, Vulnerabilities is nil. Rendered as the\n    \"scan failed\" chip on the dashboard.\n  - `skipped` — pre-feature backfill row\n    (rows created before scanning existed are stamped\n    `scan_status='skipped'`). Payload carries the reason sentinel.\n\nA 404 is returned when:\n  - the deployment row does not exist,\n  - the deployment belongs to a different account (IDOR-safe;\n    no account-existence leak),\n  - no scan has run yet (the deploy is still mid-pipeline or\n    the row predates entirely).\n",
        "responses": {
          "200": {
            "description": "The typed scan payload. The shape mirrors the `deployments.scan_result` jsonb column (with the Status re-pinned from the authoritative `scan_status` column).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScanResult"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "Deployment row missing, cross-account probe, or scan has not run yet.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/deployments/{id}/secret-scan": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getDeploymentSecretScan",
        "summary": "Get per-deploy image-layer secret scan.",
        "description": "Returns the per-deploy secret-scan audit row. The scan runs on the per-app ext4 in the image service's\ndeploy-complete path (after `SetDeploymentRootfs`, before\nthe pending→snapshotting transition) using the same\nsecret-scan engine the API source-tree rejection\npath uses — same patterns, same providers, same Severity\ntable, same snippet policy.\n\nStatus field is the closed enum:\n  - `complete` — image layer walked clean; `findings=[]`.\n    Stamped on every scan (clean OR hit) so the dashboard\n    renders the audit row immediately after the build.\n  - `complete_with_redactions` — at least one finding\n    landed in the audit row; `error_code =\n    'image_secret_detected'` on the deployment. The\n    deploy's pending→snapshotting transition does NOT\n    fire.\n\nA 404 is returned when:\n  - the deployment row does not exist,\n  - the deployment belongs to a different account\n    (IDOR-safe; no account-existence leak),\n  - no scan has run yet (the deploy is still\n    mid-pipeline or the row predates entirely).\n\nEach finding carries a `layer` label that attributes the\nfinding to the per-walk source (`app` for the main image,\n`sidecar-<slug>` for each sidecar). Older rows\n(rejected source-tree bytes via the v2 422 path) carry\n`layer` empty or absent.\n",
        "responses": {
          "200": {
            "description": "The typed secret-scan payload. Shape mirrors the `deployments.secret_findings` jsonb column.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SecretScanResult"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "Deployment row missing, cross-account probe, or secret scan has not been stamped for this deploy yet (older rows return 404 because the `secret_findings` jsonb has never been written).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/deployments/{id}/runtime": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getDeploymentRuntime",
        "summary": "Inspect immutable runtime base identity.",
        "description": "Read-only artifact evidence for Gregale-managed function runtimes.\nOlder artifacts return unknown rather than inferring their base from builder\nprovenance. Published candidates are limited to the same family and architecture,\nat most 50 newest publications. Publication does not establish upgrade compatibility.\nNo VM is booted and no deployment, traffic or environment setting is changed.\n",
        "responses": {
          "200": {
            "description": "Current binding and published candidates.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentRuntimeResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Runtime evidence is temporarily unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/deployments/{id}/runtime/upgrade-preview": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "previewRuntimeUpgrade",
        "summary": "Preview a runtime base change without applying it.",
        "description": "Compares exact published component identities. This planning-only\nresponse cannot authorize an update. Runtime family changes, architecture changes\nand unknown current provenance block the plan. Same-family changes still require\nnative qualification, a rebuilt candidate, fresh readiness and guarded rollout.\nExecution is unavailable; publication order does not prove a newer interpreter\npatch or a compatible update. Existing health history is advisory evidence.\n",
        "parameters": [
          {
            "name": "target",
            "in": "query",
            "required": true,
            "description": "Exact published runtime release identity to compare.",
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Read-only component comparison and required steps.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeUpgradePreviewResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "The runtime preview could not read its evidence.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/deployments/{id}/stages": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getDeploymentStages",
        "summary": "Get per-deploy closed-stage summary.",
        "description": "Returns the closed 6-stage summary for a deployment. Companion\nto `/v1/deployments/{id}/logs` (which streams `event: stage`\nframes during a live deploy) and `/v1/deployments/{id}` (which\nreturns the typed deployment row). This endpoint serves the\npost-stream summary use case — `gregale deploys show <id>` and\nthe future dashboard widget.\n\nThe body is the same JSON shape already stored on\n`deployments.stage_state`. The\nhandler does NOT add a typed DTO — the column's jsonb IS the\nwire. The closed vocabulary (`source_download` /\n`dependency_restore` / `image_build` / `security_scan` /\n`snapshot_prepare` / `readiness`) is enforced at the\ndatabase layer by `deployments_stage_state_current_check`,\nso a malformed row would never reach the wire. The\n`current` field is the stage the deploy is in right now\n(empty once the deployment is live, failed or cancelled);\n`history` lists the closed rows in transition order\n(oldest → newest), each carrying server-measured\n`duration_ms` so the CLI / dashboard don't have to trust\na 2s-tick reconstruction.\n\nA 404 is returned when:\n  - the deployment row does not exist,\n  - the deployment belongs to a different account (IDOR-safe;\n    no account-existence leak).\n",
        "responses": {
          "200": {
            "description": "The deployment's stored `stage_state` document, served verbatim.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentStageState"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "Deployment row missing or cross-account probe (IDOR-safe; never 403).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/deployments/{id}/mcp-task-hold/retry": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "post": {
        "tags": [
          "deployments"
        ],
        "operationId": "retryDeploymentMCPTaskHold",
        "summary": "Schedule another recovery attempt for an active MCP compatibility hold.",
        "description": "Requires deployment write scope and MFA policy. Returns 202 when recovery is already due or a new retry is scheduled. An active lease is preserved and schedules a follow-up. The worker repeats compatibility, readiness, smoke and lifecycle checks; this action does not grant a migration override.",
        "responses": {
          "202": {
            "description": "Current deployment status after scheduling; promotion remains asynchronous.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Deployment write scope or MFA is missing.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No deployment owned by this account.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The candidate has no active queued hold or is no longer eligible.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "description": "Recovery scheduling or status refresh failed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/deployments/{id}/retry": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "post": {
        "tags": [
          "deployments"
        ],
        "operationId": "retryDeployment",
        "summary": "Retry a failed deployment from a named stage (production-ready follow-on C2).",
        "description": "A\ndeployment that fails partway is restorable via\n`POST /v1/deployments/{id}/retry` with a `from_stage` field.\nThe deployment row is duplicated (NOT mutated); the new\nrow carries a fresh `stage_state.current` and a fresh\n`stage_state.history` so the dashboard's stage-progression\ntimeline (and the CLI's `gregale deploys show <id>` summary)\nreflects the retry as a separate event.\n\nThe closed-6 vocabulary mirrors `state.AllStageNames`; the API rejects unknown values with 400.\nEmpty strings are rejected for the same reason.\n\nAuth chain mirrors `POST /v1/apps/{slug}/deployments`:\n`authLimited → requireMFA → requireScope(ScopesDeployWriteSurface)`.\nReturns 202 Accepted with the new deployment row (same\nshape as `POST /v1/apps/{slug}/deployments`).\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RetryDeploymentRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The new deployment row (same shape as a fresh deploy).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentResponse"
                }
              }
            }
          },
          "400": {
            "description": "`400 Bad Request` — `from_stage` is empty or\nnot in the closed-6 vocabulary.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`403 Forbidden` — the caller's MFA factor or scope\ndoes not satisfy the deploy-write surface.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Retry requested on a missing or cross-account deployment (IDOR-safe; never 403).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/deployments/{id}/url": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getDeploymentURL",
        "summary": "Get per-deployment preview URL.",
        "description": "Returns the per-deployment preview URL shape\n`deploy-{N}-{slug}.gregale.dev` that the cert allowlist will\nmint under for a single deployment.\n`N` is the per-app 1-based ordinal of the deployment row,\nresolved from state.DeploymentOrdinal — the order is\nstable so a previously-issued URL doesn't silently rot when\na later deploy lands.\n\nThe `alive` field is the same predicate the cert allowlist\nconsults (state.Deployment.DeploymentPreviewActive):\n`true` iff the deployment's status is in\n`{pending, building, imaging, snapshotting, live}`. When\n`alive=false` the handler returns 200 with `host=\"\"` and\n`url=\"\"` so the dashboard renders a \"preview closed\" chip\nwithout round-tripping again. When the per-deployment\npreview zone is disabled (`wire.DeployWildcardSuffix == \"\"`)\nthe handler returns the same 200 + Alive=false shape so\nenvelopes stay stable across environments.\n\nA 404 is returned when:\n  - the deployment row does not exist,\n  - the deployment belongs to a different account\n    (IDOR-safe; no account-existence leak).\n",
        "responses": {
          "200": {
            "description": "The resolved per-deployment preview URL.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentPreviewURL"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "Deployment row missing or cross-account probe on the preview URL seam (IDOR-safe; never 403).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/builds": {
      "parameters": [
        {
          "name": "app",
          "in": "query",
          "schema": {
            "type": "string"
          },
          "required": false,
          "description": "Filter to a single app slug. Cross-account slug renders 404."
        },
        {
          "name": "status",
          "in": "query",
          "schema": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "succeeded",
              "failed"
            ]
          },
          "required": false,
          "description": "Filter to a single status. Omit for any status."
        },
        {
          "name": "before",
          "in": "query",
          "schema": {
            "type": "string"
          },
          "required": false,
          "description": "Opaque cursor token from a previous response's `next_before`. Format: `<rfc3339nano>|<id_hex>` (pipe-separated). Empty started_at segment encodes a queued-tail cursor (the `<id_hex>` part alone). Round-trip verbatim — do NOT re-parse or re-encode."
        },
        {
          "name": "limit",
          "in": "query",
          "schema": {
            "type": "integer",
            "minimum": 1,
            "maximum": 200,
            "default": 50
          },
          "required": false,
          "description": "Page size (default 50, capped at 200)."
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getBuilds",
        "summary": "List builds (operator view).",
        "description": "Returns every build the authenticated account owns, ordered\nstarted_at DESC (nulls last — queued builds stay at the\nbottom of the first page). Optional ?app=<slug> narrows to\none app; optional ?status=<s> filters to the 4-value status\nenum (queued|running|succeeded|failed; omit for any status).\nCursor pagination via ?before=<opaque token>; limit defaults\nto 50, capped at 200.\n\nThe response shape mirrors /v1/deployments: items + a\nnext_before cursor (empty when end of list). The cursor is\nthe opaque tuple `<rfc3339nano>|<id_hex>` of the LAST row\non this page — server-emitted, round-tripped verbatim. The\nid tiebreaker makes the keyset deterministic for queued\ntails (started_at IS NULL) and for sub-second collisions\non started_at.\n\nBuildResponse.started_at (the per-row wire field) is\nRFC3339 (whole-second) for backward compatibility with\n`GET /v1/builds/{id}`. The cursor's started_at segment is\nRFC3339Nano (sub-second preserved) so the keyset\nsub-second clause is reachable on rows whose started_at\nfalls in the same wall-clock second. The two are\ndeliberately different and the cursor's higher precision\nis intentional.\n",
        "responses": {
          "200": {
            "description": "A page of builds (ordered started_at DESC, nulls last).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BuildListResponse"
                }
              }
            }
          },
          "400": {
            "description": "`400 Bad Request` — bad cursor (not RFC3339), bad status\nfilter (not one of queued|running|succeeded|failed), or\nbad limit (non-numeric / out of range). Stable code\n`validation_failed`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "`404 Not Found` — only raised when ?app=<slug> is set\nand the slug is unknown OR belongs to another account\n(uniform 404 so cross-account probes can't enumerate).\nStable code `app_not_found`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/builds/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getBuild",
        "summary": "Get build status.",
        "description": "Returns the lifecycle row for a build id — current status,\nenqueued/started/finished timestamps, failure_class (when\nstatus='failed'), and a server-computed duration_seconds\n(only set when both started_at and finished_at are\npopulated). Companion to /v1/builds/{id}/provenance (post-\nmortem export) and /v1/builds/{id}/sbom (post-mortem\nblob); this one is the LIFECYCLE surface CI scripts call\nto fail-fast on build error without scraping SSE.\n\nThe status enum is `queued|running|succeeded|failed` (the\nbuilds_status_check CHECK constraint; no 'cancelled' value).\nfailure_class, when present, is one of `oom|timeout|\nuser_error|infra` (the builds_failure_class_check CHECK\nconstraint). error_message is intentionally NOT in the\nresponse — it lives on deployments; call GET\n/v1/deployments/{id} for the per-failure string.\n",
        "responses": {
          "200": {
            "description": "Build lifecycle row.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BuildResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "`404 Not Found` — the build id does not exist OR\nbelongs to another account. Stable code\n`build_not_found`. The 404 surface is uniform so\ncross-account probes can't enumerate.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/builds/{id}/provenance": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getBuildProvenance",
        "summary": "Get build provenance.",
        "description": "Returns the `build_provenance` row for a single build.\nEach successful build produces exactly one provenance row\n(the build service's populator runs at the `markSucceeded` sites); the\nrow is the customer-visible \"what ran?\" record: buildkit /\nrailpack version, base / runner digests, source URL + commit\nSHA, plan, builder node ID, and the build's started_at /\nfinished_at timestamps.\n\nA 404 with `code=build_provenance_not_found` is returned when\nthe build exists but no provenance row landed (the populator\nlogs a WARN inside the build service on a failed INSERT — the build\nitself still succeeded). A 404 with `code=not_found` is\nreturned when no build row matches the id, or when the\nbuild's owning app belongs to a different account.\n",
        "responses": {
          "200": {
            "description": "The build provenance row, with every field populated. Empty strings indicate a column the populator hasn't filled yet (the schema half of is in this PR; cosign / SBOM populate the rest).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BuildProvenanceResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "Either the build row is missing, OR the build exists but the populator INSERT failed (code=build_provenance_not_found).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/builds/{id}/sbom": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getBuildSbom",
        "summary": "Get build SBOM (CycloneDX JSON).",
        "description": "Streams the CycloneDX 1.5 SBOM JSON generated by the image service's\npost-build syft pass. The body is the raw SBOM\ndocument; the response content-type is\n`application/vnd.cyclonedx+json` so external tooling\n(cyclonedx-cli validate, jq with `@cyclonedx-json`, Grype's\n`--from-file=cyclonedx-json`) can dispatch on header alone.\n\nThree failure modes, each with its own code so the SDK and\n`faas build sbom <id>` can branch:\n\n  - `404 not_found` — the build id does not exist, OR the build\n    belongs to another account (the handler returns the same\n    surface on both so account-existence isn't probeable).\n  - `503 build_sbom_unavailable` — the build row exists for this\n    account but the image service's syft populator did not persist a\n    CycloneDX document (pre-PR build, or best-effort WARN).\n    The CLI prints \"no SBOM for this build\" and exits 1; the\n    operator's job is to re-deploy the image service with active.\n  - `503 capacity_unavailable` — the SBOM exists but the file\n    was unreadable from disk (storage backend returned a\n    transient error). The customer retries once.\n",
        "responses": {
          "200": {
            "description": "The CycloneDX SBOM JSON document, served verbatim from the storage backend.",
            "content": {
              "application/vnd.cyclonedx+json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "description": "Raw CycloneDX 1.5 JSON. The schema is not pinned\nbecause CycloneDX extends over time (CSAF/NTIA\nfields may appear); consumers should treat the\ndocument as opaque JSON and pass it to a CycloneDX-\naware validator.\n"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "Either the build row is missing, OR the build exists but belongs to a different account (code=not_found on every negative path so account-existence isn't probeable).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "The SBOM populator has not produced an artefact for this build (code=build_sbom_unavailable), or the storage backend failed (code=capacity_unavailable).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/domains": {
      "get": {
        "tags": [
          "domains"
        ],
        "operationId": "listDomains",
        "summary": "List custom domain bindings.",
        "responses": {
          "200": {
            "description": "Custom-domain bindings on the account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CustomDomainResponse"
                  }
                },
                "example": [
                  {
                    "id": "0123456789abcdef0123456789abcdef",
                    "domain": "app.example.com",
                    "app_id": "0123456789abcdef0123456789abcdef",
                    "verified": true,
                    "tls_state": "active",
                    "created_at": "2026-07-23T11:25:00Z"
                  }
                ]
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "domains"
        ],
        "operationId": "createDomain",
        "summary": "Bind a custom domain.",
        "requestBody": {
          "required": true,
          "description": "Domain-bind payload — domain string + target app slug. See CreateCustomDomainRequest.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCustomDomainRequest",
                "example": {
                  "domain": "app.example.com",
                  "app_id": "0123456789abcdef0123456789abcdef"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "201": {
            "description": "The new custom-domain binding.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomDomainResponse",
                  "example": {
                    "id": "0123456789abcdef0123456789abcdef",
                    "domain": "app.example.com",
                    "app_id": "0123456789abcdef0123456789abcdef",
                    "verified": true,
                    "tls_state": "active",
                    "created_at": "2026-07-23T11:25:00Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/domains/plan": {
      "post": {
        "tags": [
          "domains"
        ],
        "operationId": "planDomains",
        "summary": "Review a declarative set of domain bindings.",
        "description": "Reads one consistent snapshot without DNS probes or writes. Lists creates,\nmoves and unchanged bindings, serving destination deployments, and default\nselections that a move clears. Omitted domains remain attached. All apps\nmust share an account namespace and organization and the caller needs\ndeployment-write access to every source and destination. A move requires\nverified ownership and a serving destination; it does not smoke-test the\napplication. Traffic publication is validated again during atomic apply.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DomainManifest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Proposed binding changes and their private-identity-bound fingerprint.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DomainPlan"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/domains/apply": {
      "post": {
        "tags": [
          "domains"
        ],
        "operationId": "applyDomains",
        "summary": "Atomically apply reviewed domain bindings.",
        "description": "Reauthorizes every binding, captures its current claim and serving\ndeployment set under routing and billing-subject locks, and requires the\nexact reviewed fingerprint. A stale plan returns 409 without changes.\nMoves retain TXT proof, verification, certificate state, wildcard host\nallowlists and issuance budgets; source default-domain selections are\ncleared. New claims follow normal DNS verification and pending quotas.\nNo provider DNS, deployment traffic, or application policy is changed.\nUse the returned rollback manifest to review a move back. Rollback does\nnot detach new claims or restore default selections. Reuse the plan\nfingerprint as Idempotency-Key for request-bound response replay.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DomainApplyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Committed bindings, the reviewed plan and previous binding manifest.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DomainApplyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/domains/{domain}": {
      "parameters": [
        {
          "name": "domain",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9.\\-]+$"
          },
          "description": "The custom domain string (e.g. `app.example.com`)."
        }
      ],
      "get": {
        "tags": [
          "domains"
        ],
        "operationId": "getDomain",
        "summary": "Show a custom domain's cert details.",
        "description": "Returns the durable domain row + the live cert chain\n(NotAfter, SANs) by dialing port-443 and reading the leaf\ncert. Used by `gregale domains show <domain>`.\n",
        "responses": {
          "200": {
            "description": "The domain row + cert details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomDomainResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "domains"
        ],
        "operationId": "deleteDomain",
        "summary": "Remove a custom domain binding.",
        "responses": {
          "204": {
            "description": "No body. The binding was removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/domains/{domain}/status": {
      "parameters": [
        {
          "name": "domain",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9.\\-]+$"
          },
          "description": "The custom domain whose conditions are read."
        }
      ],
      "get": {
        "tags": [
          "domains"
        ],
        "operationId": "getDomainStatus",
        "summary": "Read a custom domain's conditions.",
        "description": "Preview (resource-conditions capability). The domain's Ready,\nVerified and CertificateReady conditions, from the domain's recorded\nverification and certificate state and never stored. Unlike\nGET /v1/domains/{domain} it never connects to the domain, so it is\nsafe to poll. None of its conditions is terminal: DNS can change\noutside Gregale. Cache-Control no-store.\n",
        "responses": {
          "200": {
            "description": "The custom domain's conditions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResourceStatus"
                }
              }
            }
          },
          "default": {
            "description": "Missing sign-in, read scope or MFA, a domain this account does not own, the capability turned off, or the rate limit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/domains/{domain}/verify": {
      "parameters": [
        {
          "name": "domain",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9.\\-]+$"
          },
          "description": "The custom domain to re-verify (e.g. `app.example.com`). The same shape as the GET path; verify walks DNS + cert while show returns the durable row."
        }
      ],
      "post": {
        "tags": [
          "domains"
        ],
        "operationId": "verifyDomain",
        "summary": "Re-verify a domain's DNS + cert.",
        "description": "Runs a bounded ownership TXT check and routing/TLS probes using the\nbackground verifier's claim-bound logic. Concurrent checks for the same\nclaim are coalesced; a durable 15-second cooldown limits repeated probes\nacross API processes. Returns CustomDomainResponse with independent\nreadiness states, DNS diagnostics, and retry scheduling. DNS or TLS that\nis not ready is a successful check with a non-ready response, not a\ntransport failure. Expired claims require recreation. The same\nIdempotency-Key replays its original response; use a new key to recheck.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Current ownership, routing and TLS readiness with fresh diagnostic checks. Retry-After indicates the minimum manual-check interval.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomDomainResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "description": "Older servers report domain_verification_failed or\ndomain_cert_not_issued for TLS probe failures. Current servers\nreturn a non-ready CustomDomainResponse with HTTP 200 for DNS\nand certificate configuration problems.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/domains/{domain}/default": {
      "parameters": [
        {
          "name": "domain",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9.\\-]+$"
          },
          "description": "The verified custom domain to make the app's canonical host."
        }
      ],
      "post": {
        "tags": [
          "domains"
        ],
        "operationId": "setDefaultDomain",
        "summary": "Set a verified custom domain as the app default.",
        "description": "Atomically replaces the app's previous default custom domain.\nThe domain must be verified and belong to the authenticated account.\nUsed by `gregale domains set-default <domain>`.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "The selected domain binding with `default=true`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomDomainResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The domain is unverified, routes to another app, or belongs to a suspended tenant and cannot be selected.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/domains/{domain}/retry": {
      "parameters": [
        {
          "name": "domain",
          "in": "path",
          "required": true,
          "description": "Customer-owned custom domain to re-arm for TXT verification.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9.\\-]+$"
          }
        }
      ],
      "post": {
        "tags": [
          "domains"
        ],
        "operationId": "retryDomainVerification",
        "summary": "Re-arm an expired or backed-off TXT verification challenge.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "202": {
            "description": "Verification was queued for the next bounded poller cycle."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The domain is already verified."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/domains/{domain}/doctor": {
      "parameters": [
        {
          "name": "domain",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9.\\-]+$"
          },
          "description": "The custom domain to diagnose (e.g. `app.example.com`)."
        }
      ],
      "get": {
        "tags": [
          "domains"
        ],
        "operationId": "getDomainDoctor",
        "summary": "Run the 5-check domain doctor.",
        "description": "Returns the per-domain doctor report. The five checks map\n1:1 to the Render-style custom-domain check: dns_record,\npoints_to_gregale, tls_certificate, caa_permits,\nipv6_conflict. Each check carries a Status (ok / fail /\npending / na), Detail, Observed, Remediation, and a\nper-probe CheckedAt. Used by `gregale domains doctor\n<domain>`.\n\nThe handler reads the latest observation row from\n`domain_doctor_observations` (the dns_poller writes a\nrow every 30s). When the row is older than\nFAAS_DOMAIN_DOCTOR_TTL_SECONDS (default 300) or missing,\nthe handler triggers a synchronous re-probe with a 5s\nbudget. Stale=true is the visible degradation; the\nresponse is still 200 with the per-check Status.\n\n503 CodeDoctorDisabled is returned when the operator\nhasn't set FAAS_DOMAIN_DOCTOR_ENABLED. The route stays\nregistered so the CLI gets a deterministic error code\n(matches the pre-#911 pattern in `api/flags.go`).\n",
        "responses": {
          "200": {
            "description": "The doctor report. `stale:true` means the cached row was older than the TTL when the handler ran a synchronous re-probe.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DomainDoctorReport"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Doctor is dark-launched (CodeDoctorDisabled) or the probe pass failed (CodeDoctorUnavailable).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/domains/{domain}/hosts": {
      "parameters": [
        {
          "name": "domain",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^\\*\\.[a-z0-9.\\-]+$"
          },
          "description": "The wildcard custom domain (e.g. `*.example.com`)."
        }
      ],
      "get": {
        "tags": [
          "domains"
        ],
        "operationId": "getDomainHosts",
        "summary": "Read a wildcard domain's host allowlist.",
        "description": "Returns the names below the wildcard that may hold an on-demand\ncertificate. `restricted: false` means no\nallowlist is set and every name below the wildcard may.\n",
        "responses": {
          "200": {
            "description": "The host allowlist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomDomainHostsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "description": "Only a wildcard custom domain has a host allowlist to read."
          }
        }
      },
      "put": {
        "tags": [
          "domains"
        ],
        "operationId": "setDomainHosts",
        "summary": "Replace a wildcard domain's host allowlist.",
        "description": "Only the listed names below the wildcard get certificates; the edge\nrefuses every other server name, so random names cannot spend the\nwildcard's new-host budget. Names are the part of the host before\nthe wildcard's suffix (`eu.shop` for `eu.shop.example.com`), or the\nfull host. Routing is unchanged, and certificates the edge already\nholds for a removed name keep serving until their next reload or\nrenewal. The domain doctor's probe host is always allowed.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetCustomDomainHostsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The saved host allowlist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomDomainHostsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "description": "Not a wildcard domain, an invalid name, or more than 100 names (the problem carries `limit` and `observed`)."
          }
        }
      },
      "delete": {
        "tags": [
          "domains"
        ],
        "operationId": "clearDomainHosts",
        "summary": "Remove a wildcard domain's host allowlist.",
        "description": "Every name below the wildcard may hold a certificate again.",
        "responses": {
          "204": {
            "description": "The allowlist was removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "description": "Only a wildcard custom domain has a host allowlist to remove."
          }
        }
      }
    },
    "/v1/crons": {
      "get": {
        "tags": [
          "crons"
        ],
        "operationId": "listCrons",
        "summary": "List cron triggers.",
        "parameters": [
          {
            "name": "slug",
            "in": "query",
            "description": "App slug or id. Lists only that app's crons; without it, every cron on the account's apps.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cron triggers on the account, or on the app named by slug.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CronResponse"
                  }
                },
                "example": [
                  {
                    "id": "0123456789abcdef0123456789abcdef",
                    "app_id": "0123456789abcdef0123456789abcdef",
                    "schedule": "*/5 * * * *",
                    "path": "/cron",
                    "enabled": true,
                    "created_at": "2026-07-23T11:25:00Z",
                    "last_fired_at": "2026-07-23T11:20:00Z"
                  }
                ]
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "crons"
        ],
        "operationId": "createCron",
        "summary": "Create a scheduled HTTP request or deployment command.",
        "requestBody": {
          "required": true,
          "description": "Schedule plus exactly one target: an HTTP path or a deployment command. See CreateCronRequest.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCronRequest",
                "example": {
                  "app_id": "0123456789abcdef0123456789abcdef",
                  "schedule": "0 2 * * *",
                  "command": [
                    "bin/reindex",
                    "--delta"
                  ]
                }
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "201": {
            "description": "The new schedule.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CronResponse",
                  "example": {
                    "id": "0123456789abcdef0123456789abcdef",
                    "app_id": "0123456789abcdef0123456789abcdef",
                    "kind": "command",
                    "schedule": "0 2 * * *",
                    "command": [
                      "bin/reindex",
                      "--delta"
                    ],
                    "command_shell": false,
                    "timeout_seconds": 600,
                    "max_output_bytes": 1048576,
                    "enabled": true,
                    "timezone": "UTC",
                    "skip_if_running": false,
                    "created_at": "2026-07-23T11:20:00Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CronInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/CronInvalid"
          },
          "403": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      }
    },
    "/v1/crons/{id}/labels": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "patch": {
        "tags": [
          "crons"
        ],
        "operationId": "updateCronLabels",
        "summary": "Set and remove a cron's labels.",
        "description": "Preview (resource-labels capability). Sets and removes labels in one\natomic write and returns every label the cron carries after it, with\nthe same rules, codes and audit event as PATCH /v1/apps/{slug}/labels.\nRequires deploy:write or admin scope and MFA. While the capability is on,\nGET /v1/crons and GET /v1/crons/{id} include labels, and GET /v1/crons\ntakes ?selector=, a Kubernetes label selector.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LabelChange"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The cron's labels after the write.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LabelsResponse"
                }
              }
            }
          },
          "default": {
            "description": "An invalid change, missing sign-in, scope or MFA, a cron this account does not own, the capability turned off, or the rate limit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/crons/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "crons"
        ],
        "operationId": "getCron",
        "summary": "Get one cron trigger.",
        "description": "Single-row read for one cron (closure). Backs `gregale crons info <id>` and any dashboard\ndrill-down. The wire shape matches `CronResponse` so SDK\nclients decode it with the existing struct.\n",
        "responses": {
          "200": {
            "description": "The cron trigger.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CronResponse",
                  "example": {
                    "id": "0123456789abcdef0123456789abcdef",
                    "app_id": "0123456789abcdef0123456789abcde0",
                    "schedule": "*/5 * * * *",
                    "path": "/cleanup",
                    "enabled": true,
                    "last_fired_at": "2026-08-10T09:00:00Z",
                    "created_at": "2026-08-01T12:00:00Z"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "tags": [
          "crons"
        ],
        "operationId": "updateCron",
        "summary": "Partial-update a cron.",
        "requestBody": {
          "required": true,
          "description": "Cron patch — every field is optional. See UpdateCronRequest.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCronRequest",
                "example": {
                  "enabled": false,
                  "schedule": "0 * * * *"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated cron trigger.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CronResponse",
                  "example": {
                    "id": "0123456789abcdef0123456789abcdef",
                    "schedule": "*/5 * * * *",
                    "target_url": "https://hello-world.example.com/cron",
                    "enabled": true,
                    "last_run_at": "2026-07-23T11:20:00Z",
                    "next_run_at": "2026-07-23T11:25:00Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CronInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "crons"
        ],
        "operationId": "deleteCron",
        "summary": "Delete a cron.",
        "responses": {
          "204": {
            "description": "No body. The cron trigger was removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/crons/{id}/status": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "crons"
        ],
        "operationId": "getCronStatus",
        "summary": "Read a cron's conditions.",
        "description": "Preview (resource-conditions capability). The cron's Ready and\nLastRunSucceeded conditions, from the cron and its newest run as\nGET /v1/crons/{id}/runs reports it, and never stored. A disabled cron\nis terminally not ready; a suspended one is not ready until the\nsuspension clears. LastRunSucceeded describes the newest run, so it\nis never terminal. Cache-Control no-store.\n",
        "responses": {
          "200": {
            "description": "The cron's conditions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResourceStatus"
                }
              }
            }
          },
          "default": {
            "description": "Missing sign-in, read scope or MFA, a cron this account does not own, the capability turned off, or the rate limit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/crons/{id}/runs": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "crons"
        ],
        "operationId": "listCronRuns",
        "summary": "List recent runs of a cron.",
        "description": "Execution history for one cron, newest first. Each row reports\nwhen the fire started, how long it took (`duration_ms`,\ncomputed server-side), and a normalized `outcome` — so a\ntimeout is distinguishable from a generic failure without\nparsing `error`.\n\nPaginated by `?before=<id>` (the LAST id of the returned\nslice). Defaults to 10 per page; capped at 100. For a wider,\ncross-source view use `GET /v1/invocations`.\n",
        "parameters": [
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Cursor — return runs older than this run id. Omit for the most recent page."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 10
            },
            "description": "Page size; 1-100, default 10."
          }
        ],
        "responses": {
          "200": {
            "description": "A page of runs for this cron, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListCronRunsResponse",
                  "example": {
                    "runs": [
                      {
                        "id": "0123456789abcdef0123456789abcdef",
                        "started_at": "2026-08-10T09:00:00Z",
                        "completed_at": "2026-08-10T09:00:01.2Z",
                        "duration_ms": 1200,
                        "outcome": "success",
                        "attempts": 1
                      },
                      {
                        "id": "fedcba9876543210fedcba9876543210",
                        "started_at": "2026-08-09T21:00:00Z",
                        "completed_at": "2026-08-09T21:00:30Z",
                        "duration_ms": 30000,
                        "outcome": "timeout",
                        "attempts": 1,
                        "error": "invoke: gateway timeout"
                      }
                    ]
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/crons/{id}/occurrences": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "crons"
        ],
        "operationId": "listCronScheduleOccurrences",
        "summary": "List durable scheduled occurrence decisions for a cron.",
        "description": "Shows whether each nominal fire ran, was skipped, missed its start deadline, or was coalesced.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            },
            "description": "Maximum number of cron occurrence records to return."
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Cron occurrence id that starts the next older page."
          }
        ],
        "responses": {
          "200": {
            "description": "A newest-first page of durable occurrence outcomes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListScheduleOccurrencesResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/crons/{id}/runs/{run_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        },
        {
          "name": "run_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "The task id returned in the cron run history for a command cron."
        }
      ],
      "get": {
        "tags": [
          "crons"
        ],
        "operationId": "getCronCommandRun",
        "summary": "Get output and execution details for one command-cron run.",
        "description": "Returns the durable app-task receipt for one run belonging to this\ncommand cron, including captured stdout/stderr tails, exit status,\nretry count, and failure details. Use this endpoint on demand so\nhistory list pages remain compact. HTTP cron runs and task ids that\nbelong to another cron return 404.\n",
        "responses": {
          "200": {
            "description": "Detailed command-cron execution receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppTaskResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      }
    },
    "/v1/crons/{id}/runs/{run_id}/cancel": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        },
        {
          "name": "run_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Command-cron task identifier to cancel."
        }
      ],
      "post": {
        "tags": [
          "crons"
        ],
        "operationId": "cancelCronCommandRun",
        "summary": "Request cancellation of one command-cron run.",
        "description": "Requests cancellation of one queued or active command-cron run and\nreturns its current durable app-task receipt. A queued run becomes\ncancelled immediately; an active run records `cancel_requested_at`\nand is stopped by its worker. Repeating the request is safe. Runs\nbelonging to another cron, HTTP cron runs, and runs owned by another\naccount return the same 404.\n\nScoped to `deploy:write` (or `admin`) and subject to the app-task API\ncapability gate. An optional `Idempotency-Key` replays the stored\nresponse for the account/key pair.\n",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Replay token for a duplicate cancellation request."
          }
        ],
        "responses": {
          "202": {
            "description": "Cancellation accepted; the receipt may remain active while the worker stops.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppTaskResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      }
    },
    "/v1/crons/{id}/run": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          },
          "description": "The cron id (UUID hex, no dashes)."
        }
      ],
      "post": {
        "tags": [
          "crons"
        ],
        "operationId": "fireCron",
        "summary": "Manually fire a cron now (bypasses the schedule boundary).",
        "description": "Inserts a pending row into\n`cron_fire_now_requests` and emits `db.NotifyCronRunNow`;\nthe scheduler claims the row on the next LISTEN delivery. HTTP crons\ndispatch through `RunCronNow`; command crons enqueue a task\npinned to the current live deployment. Poll the request to\nobtain its invocation id or command task id.\n\nIdempotent: a replay with the same Idempotency-Key returns\nthe stored 202 without enqueuing a second fire.\n\nScoped to `deploy:write` (or `admin`); no new `cron:write`\nscope is added (decisions 1). The fire does\nNOT shift `last_fired_at` — the next scheduled boundary is\nunaffected. For a command cron, its saved command, timeout,\noutput limit, retry policy, skip_if_running behavior, and\ncurrent live deployment are used; no ad-hoc command may be\nsupplied here.\n",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Replay token. A duplicate (account, key) pair returns the\nstored 202 with the original request id.\n"
          }
        ],
        "responses": {
          "202": {
            "description": "Fire-now enqueued. The request_id is the durable handle.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FireCronResponse",
                  "example": {
                    "request_id": "0123456789abcdef0123456789abcdef",
                    "cron_id": "fedcba9876543210fedcba9876543210",
                    "status": "pending"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Plan tier does not include cron support (e.g. Free plan).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "410": {
            "description": "The cron is disabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/stored": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "listStoredWorkflows",
        "summary": "List drafts and published stored workflows, including YAML definitions.",
        "responses": {
          "200": {
            "description": "listStoredWorkflows result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListStoredWorkflowsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/StoredWorkflowInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/stored:simulate": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "simulateStoredWorkflow",
        "summary": "Simulate stored workflow data flow with sample input and successful action mocks.",
        "description": "Returns a deterministic hypothetical trace without saving a definition,\ncreating runs, invoking handlers, publishing events or calling integrations.\nRequires ownership, MFA and read scope. Works without a live deployment\nor enabled workflow runtime. Definition validation uses the account plan\nand checks managed integration bindings without opening credentials.\nMissing action results block dependent steps. Waits remain unresolved;\nfailure and timeout outcomes cannot be injected. Action mocks using the\nreserved exact {\"timeout\":true} output with an on_timeout route return\n400. Loop mocks form a\nsequential prefix. A complete trace means all roots resolved or skipped\nunder the supplied successful mocks, not that live execution will succeed.\nLimits: 3 MiB request, 1 MiB definition and each sample value, 128 roots,\n1024 trace entries and 4 MiB response, plus existing loop bounds.\nInvalid definitions return 200 with definition_valid=false and no trace.\n",
        "requestBody": {
          "description": "Candidate definition, workflow input and hypothetical successful action results.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SimulateStoredWorkflowRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Definition validation and the bounded hypothetical execution trace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimulateStoredWorkflowResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/stored:validate": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "validateStoredWorkflow",
        "summary": "Validate a definition without saving it or executing any steps.",
        "responses": {
          "200": {
            "description": "validateStoredWorkflow result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidateStoredWorkflowResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/StoredWorkflowInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ValidateStoredWorkflowRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/stored/{name}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Stored workflow name, shared with workflow run endpoints."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "getStoredWorkflow",
        "summary": "Read a stored workflow draft and its published definition.",
        "responses": {
          "200": {
            "description": "getStoredWorkflow result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoredWorkflowResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/StoredWorkflowInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "put": {
        "tags": [
          "workflows"
        ],
        "operationId": "saveStoredWorkflowDraft",
        "summary": "Save a draft with optimistic version checking; running definitions stay unchanged.",
        "responses": {
          "200": {
            "description": "saveStoredWorkflowDraft result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoredWorkflowResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/StoredWorkflowInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveStoredWorkflowDraftRequest"
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "workflows"
        ],
        "operationId": "deleteStoredWorkflow",
        "summary": "Remove a dashboard definition; restoring YAML ownership requires explicit confirmation.",
        "responses": {
          "204": {
            "description": "deleteStoredWorkflow result."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/StoredWorkflowInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "parameters": [
          {
            "name": "expected_version",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            },
            "description": "Revision returned by the most recent read or save."
          },
          {
            "name": "restore_manifest",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "Explicitly return ownership to the current YAML definition after deletion."
          }
        ]
      }
    },
    "/v1/apps/{slug}/workflows/stored/{name}/failure-policy": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Published stored workflow whose failure admission guard is inspected or changed."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "getStoredWorkflowFailurePolicy",
        "summary": "Inspect failure pause policy and resume preview.",
        "description": "Returns aggregate terminal outcomes since monitoring began or resumed, current pause generation, active run counts, retained event count and the latest 100 pause/resume transitions. Counts are advisory; no run payloads or error messages are included.",
        "responses": {
          "200": {
            "description": "Current monitoring policy, failure pause, retained work preview and recent transitions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoredWorkflowFailurePolicyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "code stored_workflow_failure_policy_conflict; reload failure guard state before a conflicting operation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/StoredWorkflowInvalid"
          }
        }
      },
      "put": {
        "tags": [
          "workflows"
        ],
        "operationId": "setStoredWorkflowFailurePolicy",
        "summary": "Configure automatic pausing after repeated failures.",
        "description": "Opt-in policy for a published YAML or dashboard stored workflow; requires deploy write scope. Compare-and-set expected_version starts at zero. Scheduler ticks latch a runtime pause when both failure count and minimum completed-run count are met. Policy edits, disabling monitoring, publishing, and ordinary enabled changes do not clear an existing failure pause.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetStoredWorkflowFailurePolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated failure monitoring configuration with the current independent admission guard.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoredWorkflowFailurePolicyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "code stored_workflow_failure_policy_conflict; the expected failure policy version changed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/StoredWorkflowInvalid"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/stored/{name}/failure-policy/resume": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Published stored workflow whose current failure pause is explicitly resumed."
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "resumeStoredWorkflowFailurePause",
        "summary": "Explicitly clear a failure pause after inspecting retained work.",
        "description": "Requires deploy write scope and the current positive pause generation. Starts a fresh monitoring epoch and re-arms schedules without catch-up for the paused interval. Existing runs continue and captured events remain subject to their routing retention; events received without an eligible recipient are not replayed. This action does not change manual pause intent.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResumeStoredWorkflowFailurePauseRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Explicitly resumed guard state with fresh monitoring counts and transition history.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoredWorkflowFailurePolicyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "code stored_workflow_failure_policy_conflict; the reviewed pause generation is stale or no pause remains.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/StoredWorkflowInvalid"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/stored/{name}/health": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Stored workflow whose recent execution health is summarized."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "getStoredWorkflowHealth",
        "summary": "Get bounded execution health for one stored workflow.",
        "description": "Returns run counts by status, the completed-run success rate, median\nand p95 duration, recent run identities and the most common failed\nsteps. Inputs, outputs, and error text are never included. The default\nwindow is the previous seven days; the maximum window is 30 days.\ncreated_after and created_before are inclusive RFC3339 timestamps, and\ncreated_before may not be in the future. Failed loop items are grouped\nunder their parent step; at most ten failed steps are returned.\n",
        "parameters": [
          {
            "name": "created_after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Inclusive start of the summary window; defaults to seven days before created_before or now."
          },
          {
            "name": "created_before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Inclusive end of the summary window; defaults to now."
          }
        ],
        "responses": {
          "200": {
            "description": "Safe operational summary for the selected stored workflow and time window.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoredWorkflowHealthResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/stored/{name}/revisions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Stored workflow whose immutable published revisions are listed."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "listStoredWorkflowRevisions",
        "summary": "List published stored workflow revisions, newest first.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Maximum number of revisions to return (1–100; defaults to 50)."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0,
              "maximum": 2147483647,
              "default": 0
            },
            "description": "Number of newest revisions to skip before returning results (maximum 2147483647)."
          }
        ],
        "responses": {
          "200": {
            "description": "Immutable published definitions and pagination metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListStoredWorkflowRevisionsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/stored/{name}/revisions/{version}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Stored workflow that owns the requested published revision."
        },
        {
          "name": "version",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "description": "Published revision identifier returned by the revision list."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "getStoredWorkflowRevision",
        "summary": "Read one immutable published stored workflow revision.",
        "responses": {
          "200": {
            "description": "The selected published definition and its canonical hash.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoredWorkflowRevisionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/stored/{name}/revisions/{version}/restore": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Stored workflow that receives the restored draft."
        },
        {
          "name": "version",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "description": "Published revision to copy into the current draft."
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "restoreStoredWorkflowRevision",
        "summary": "Restore a published revision as a new draft using optimistic version checking.",
        "description": "Copies the selected immutable revision into the stored workflow's draft. It\ndoes not publish the copy or change running and accepted workflows.\nSend expected_version from the latest stored workflow read; use zero when\ncreating a draft after the stored workflow was deleted. YAML ownership still\nrequires explicit takeover when the restored draft is later published.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RestoreStoredWorkflowRevisionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated stored workflow draft; publishing remains a separate operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoredWorkflowResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/StoredWorkflowInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/stored:publish-policy": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "getStoredWorkflowPublishPolicy",
        "summary": "Inspect required publishing checks.",
        "responses": {
          "200": {
            "description": "Publishing policy currently configured for this app.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoredWorkflowPublishPolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/StoredWorkflowInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "put": {
        "tags": [
          "workflows"
        ],
        "operationId": "setStoredWorkflowPublishPolicy",
        "summary": "Set required publishing checks using admin scope and the current policy version.",
        "responses": {
          "200": {
            "description": "Publishing policy after the requested versioned update.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoredWorkflowPublishPolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/StoredWorkflowInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetStoredWorkflowPublishPolicyRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/stored/{name}/tests": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Stored workflow whose reusable test suite is replaced or cleared."
        }
      ],
      "put": {
        "tags": [
          "workflows"
        ],
        "operationId": "saveStoredWorkflowTestSuite",
        "summary": "Save or clear reusable test data using the current draft version.",
        "responses": {
          "200": {
            "description": "Versioned saved test data.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoredWorkflowResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/StoredWorkflowInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveStoredWorkflowTestSuiteRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/stored/{name}/tests/run": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Stored workflow whose saved test cases are simulated."
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "runStoredWorkflowTests",
        "summary": "Simulate all saved cases against the saved draft and retain safe results.",
        "responses": {
          "200": {
            "description": "Case and assertion summaries without payloads or publishing authority.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoredWorkflowTestReport"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/StoredWorkflowInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RunStoredWorkflowTestsRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/stored/{name}/publish-check": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Saved stored workflow draft to check."
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "checkStoredWorkflowPublication",
        "summary": "Evaluate scenario assertions and coverage on the server and issue a bound receipt.",
        "responses": {
          "200": {
            "description": "Server-issued publishing receipt and verified check metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckStoredWorkflowPublicationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/StoredWorkflowInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckStoredWorkflowPublicationRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/stored/{name}/publish": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Stored workflow whose saved draft will be published."
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "publishStoredWorkflow",
        "summary": "Validate and publish the saved draft; taking over a YAML name requires explicit confirmation.",
        "responses": {
          "200": {
            "description": "publishStoredWorkflow result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoredWorkflowResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/StoredWorkflowInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublishStoredWorkflowRequest"
              }
            }
          }
        },
        "description": "Published definitions survive future YAML deployments. A live default deployment is required. Runtime execution also requires workflows to be enabled on the platform. Events accepted before publication retain their captured definition.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/v1/apps/{slug}/workflows/stored/{name}/enabled": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Stored workflow whose automatic starts will be paused or resumed."
        }
      ],
      "put": {
        "tags": [
          "workflows"
        ],
        "operationId": "setStoredWorkflowEnabled",
        "summary": "Pause or resume automatic starts without cancelling existing runs.",
        "responses": {
          "200": {
            "description": "setStoredWorkflowEnabled result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoredWorkflowResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/StoredWorkflowInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetStoredWorkflowEnabledRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/schedules/occurrences": {
      "get": {
        "tags": [
          "workflows"
        ],
        "summary": "Inspect scheduled workflow admission history",
        "description": "Started and skipped due minutes retained for 30 days. Requires app read access. History includes all linked tenants; optionally filter by tenant. No missed-minute catch-up is inferred.",
        "operationId": "listWorkflowScheduleOccurrences",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "platform_tenant_id",
            "in": "query",
            "description": "Only occurrences for this platform tenant within the app.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "next_cursor from the previous page. An expired cursor returns an empty page.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum occurrences returned per page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Newest nominal minutes first",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListWorkflowScheduleOccurrencesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/schedules/occurrences:replay-preview": {
      "post": {
        "tags": [
          "workflows"
        ],
        "summary": "Preview selected skipped schedule occurrence replays",
        "description": "Read-only advisory check of up to 20 retained skipped occurrences against the current live deployment, workflow definition, tenant schedule settings, overlap state, and app quota. Replay rechecks every condition.",
        "operationId": "previewWorkflowScheduleReplays",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkflowScheduleReplayRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Preview outcomes in chronological order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowScheduleReplayResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/schedules/occurrences:replay": {
      "post": {
        "tags": [
          "workflows"
        ],
        "summary": "Replay selected skipped schedule occurrences",
        "description": "Starts at most 20 selected skipped occurrences in chronological order, using the same live deployment and matching workflow definition, and the ordinary app quota and overlap checks. Each occurrence can create at most one replay run; blocked items are returned with their outcome.",
        "operationId": "replayWorkflowScheduleOccurrences",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkflowScheduleReplayRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Replay outcomes in chronological order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowScheduleReplayResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/schedules": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "listWorkflowSchedules",
        "summary": "Inspect deployed workflow schedules and their latest admission outcome.",
        "description": "Returns schedules from the default-scope live deployment, their next\nnominal fire time and the most recent durable admission outcome.\nWhen scheduling is unavailable, unavailable_reason explains why and\nnext_fire_at is omitted. Runtime availability reflects the API configuration;\noperators must enable the same workflow gate on the scheduler.\nDisabling or redeploying a schedule does not cancel existing runs.\nNo live default deployment returns an empty schedules array.\n",
        "responses": {
          "200": {
            "description": "Deployed schedules and runtime availability.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListWorkflowSchedulesResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Caller lacks the required read scope.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/schedules/{name}/preview": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "Schedule workflow name from the effective live deployment.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "getWorkflowSchedulePreview",
        "summary": "Preview a deployed workflow schedule.",
        "description": "Read-only simulation of upcoming local fire times and the next catch-up decision using the durable cursor. Fire times follow Gregale daylight-saving rules. No run is admitted or cursor changed.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "at",
            "in": "query",
            "description": "RFC3339 time for evaluating future fire times and catch-up; defaults to the current time and is limited to five years from now.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "since",
            "in": "query",
            "description": "Simulated prior evaluation time, useful for reviewing missed-fire catch-up. Defaults to the durable cursor.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "count",
            "in": "query",
            "description": "Maximum number of future local fire times to include.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 20,
              "default": 5
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Preview evaluated for this app's active deployment.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowSchedulePreviewResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict",
            "description": "Tenant-required apps must use the tenant-self preview."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/{name}/runs": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "Workflow name from the app's effective published definitions."
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "createWorkflowRun",
        "summary": "Start a durable workflow run.",
        "description": "Snapshots the named effective workflow definition from the app's live\ndefault deployment and dashboard publications and creates a pending run. The optional request body is\nretained as the workflow input and may be any valid JSON value. An\noptional Idempotency-Key binds this request to its original run for as\nlong as that run is retained. A matching retry returns the original\nrun, including its original definition snapshot; reusing the key with\ndifferent input returns 409.\n",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "description": "Stable caller key for retrying this run creation. Reuse only with the same workflow input."
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {}
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new pending workflow run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRunResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "code: plan_workflows_not_allowed — this plan does not include durable workflows.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "code: plan_workflows_quota | forbidden — the concurrent-run cap is exhausted or the caller lacks scope.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "code: workflow_definition_not_found | app_not_found — the app or named live workflow definition does not exist.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Tenant-required apps need a tenant-scoped run route, or the Idempotency-Key was already used with different workflow input.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{tenant_id}/apps/{slug}/workflows/{name}/runs": {
      "parameters": [
        {
          "name": "tenant_id",
          "in": "path",
          "required": true,
          "description": "Customer record to bind to the new workflow execution.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "Name of the published workflow definition to run.",
          "schema": {
            "type": "string",
            "minLength": 1
          }
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "createTenantWorkflowRun",
        "summary": "Start a durable workflow run for an account-owned tenant.",
        "description": "Account owners can start a run for a tenant linked to the app through an\nactive API consumer or active tenant surface. The tenant ID is persisted\nand propagated through trusted internal step dispatch metadata. Managed\noperation steps may deliver effects only to an explicitly subscribed\nreceiver owned by that same tenant. Outbound steps can use an existing\napp-bound customer-managed integration; the signed run identity and\nactive tenant-to-app link are checked at dispatch and outbound\nauthorization. Integration credentials and route policies remain\napp-scoped and shared across tenants. Tenant-bound runs can wait for\nexternally supplied events and callbacks through the authenticated\ntenant-self continuation routes. Schedule-triggered workflows on tenant-required apps\nare admitted once per active linked tenant from the live default publication.\n",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {}
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new pending tenant-scoped workflow run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRunResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "The account plan does not include tenant-scoped durable workflow runs.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The app is not configured to accept tenant-scoped workflow runs.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/platform-tenant-self/apps/{slug}/workflows/{name}/runs": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "Identifier of the workflow definition to start for this tenant.",
          "schema": {
            "type": "string",
            "minLength": 1
          }
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "createPlatformTenantSelfWorkflowRun",
        "summary": "Start a durable workflow run as the authenticated platform tenant.",
        "description": "Uses the tenant ID from the authenticated platform tenant access token.\nThe tenant must be actively linked to the app. Requires the\nplatform_tenant:invocations:manage scope. Managed operation effects are\ndelivered only to an explicitly subscribed receiver owned by this\ntenant. Outbound steps can use an existing app-bound customer-managed\nintegration; the signed run identity and active tenant-to-app link are\nchecked at dispatch and outbound authorization. Integration credentials\nand route policies remain app-scoped and shared across tenants. This\ntenant-self API also supports authenticated event waits and callbacks.\nSchedule-triggered workflows are admitted independently for each active\ntenant link. The published cadence is the default; triggers marked\ntenant_configurable can be overridden through the tenant-self schedule\nAPI without changing workflow input or steps.\n",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {}
            }
          }
        },
        "responses": {
          "201": {
            "description": "A pending workflow run created with the authenticated tenant identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRunResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The app does not accept workflow runs for this authenticated tenant identity.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/platform-tenant-self/apps/{slug}/workflows/runs": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "listPlatformTenantSelfWorkflowRuns",
        "summary": "List durable workflow runs for the authenticated tenant in an app.",
        "description": "Requires platform_tenant:invocations:read. The tenant must be actively\nlinked to the app. Results are filtered by the authenticated tenant in\nstorage, include only that tenant's runs, and use the same filters and\noffset pagination as the account-owned app run history endpoint.\nForeign or unbound apps return 404.\n",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "running",
                "awaiting_event",
                "succeeded",
                "failed",
                "dead"
              ]
            },
            "description": "Return only runs in this lifecycle state."
          },
          {
            "name": "workflow_name",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "description": "Restrict results to one workflow name."
          },
          {
            "name": "created_after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Keep runs created at or after this RFC3339 timestamp."
          },
          {
            "name": "created_before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Keep runs created at or before this RFC3339 timestamp."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Maximum tenant-owned runs to include in this response."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "Number of matching tenant-owned runs to skip."
          }
        ],
        "responses": {
          "200": {
            "description": "A page of workflow runs owned by the authenticated tenant.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListWorkflowRunsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflows/runs/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Tenant-owned workflow run returned when starting the workflow.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "getPlatformTenantSelfWorkflowRun",
        "summary": "Read this tenant's workflow run status and result.",
        "description": "Requires a tenant-bound token with platform_tenant:invocations:read. Foreign, unbound, and missing runs return the same 404.",
        "responses": {
          "200": {
            "description": "Workflow status and result for the authenticated tenant.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRunResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/WorkflowRunNotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflows/runs/{id}/callbacks": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Run whose callback waits are visible to the authenticated tenant.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "listPlatformTenantSelfWorkflowCallbacks",
        "summary": "List callback handles for this tenant's workflow run.",
        "description": "Requires platform_tenant:invocations:read. Callback IDs identify waits but are not bearer credentials. Foreign, unbound, inactive-link, and missing runs return the same 404.",
        "responses": {
          "200": {
            "description": "The run's declared callback waits and their handles.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListWorkflowCallbacksResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/WorkflowRunNotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflows/runs/{id}/callbacks/{callback_id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Tenant-owned run receiving this callback.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "callback_id",
          "in": "path",
          "required": true,
          "description": "UUID handle for the declared callback wait in this run.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "completePlatformTenantSelfWorkflowCallback",
        "summary": "Complete a callback wait for this tenant's workflow run.",
        "description": "Requires platform_tenant:invocations:manage. The callback ID is not a\ncredential; the authenticated tenant identity and active tenant-to-app\nlink are checked at the durable write. An identical retry returns\nduplicate=true, including after the run finishes; a different payload\nconflicts. Completion may arrive before the step parks and will be\nconsumed when the step becomes runnable. Foreign, unbound, inactive-link,\nand missing runs return the same 404.\n",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {}
            }
          }
        },
        "responses": {
          "200": {
            "description": "Receipt for a new callback value or an identical retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompleteWorkflowCallbackResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "code: workflow_run_not_found | workflow_step_not_found — the tenant cannot access the run or its callback handle is not declared.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The wait is closed or this handle already contains a different JSON value.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "The configured callback wait timeout has elapsed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflows/runs/{id}/events": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Tenant-owned run receiving the event.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "injectPlatformTenantSelfWorkflowEvent",
        "summary": "Deliver an external event to this tenant's waiting workflow run.",
        "description": "Requires platform_tenant:invocations:manage. The authenticated tenant identity and active tenant-to-app link are checked at the durable write. Foreign, unbound, inactive-link, and missing runs return the same 404. A matching retained event may be retried after the run finishes; reusing its key with different content conflicts.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Preserve this key and event content when retrying a retained tenant workflow event."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InjectWorkflowEventRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The run accepted the event for processing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InjectWorkflowEventResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/WorkflowRunNotFound"
          },
          "409": {
            "description": "code: workflow_not_running for a new event on an inactive tenant run, or conflict when a retained event key has different content.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflows/runs/{id}/cancel": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Tenant-owned workflow run to cancel.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "cancelPlatformTenantSelfWorkflowRun",
        "summary": "Cancel this tenant's active workflow run.",
        "description": "Requires a tenant-bound token with platform_tenant:invocations:manage. Repeating the request on a terminal run returns its current state.",
        "responses": {
          "200": {
            "description": "Workflow status after the cancellation request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRunResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/WorkflowRunNotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflows/runs/{id}/diagnostics": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Workflow-run identifier restricted to the authenticated tenant."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "getPlatformTenantSelfWorkflowRunDiagnostics",
        "summary": "Inspect this tenant's workflow run and preview its safe continuation.",
        "description": "Requires a tenant-bound token with platform_tenant:invocations:read.\nForeign, unbound and missing runs return the same 404.\nReturns a consistent read-only snapshot with queue reason, step states,\ncode identity and the existing resume planner. No actions, admission\nreservations or audit mutations occur. Capacity and resume generation\nare checked again by POST resume. Inputs, outputs, error text, tenant\nidentities and credentials are omitted. Responses use Cache-Control: no-store.\n",
        "responses": {
          "200": {
            "description": "Diagnostics and continuation blockers for the authenticated tenant's run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRunDiagnosticsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/WorkflowRunNotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflows/runs/{id}/resume": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Failed or dead workflow run owned by the authenticated tenant.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "resumePlatformTenantSelfWorkflowRun",
        "summary": "Resume eligible failed actions in this tenant's workflow run.",
        "description": "Requires a tenant-bound token with platform_tenant:invocations:manage.\nSend the current resume_count. The platform preserves completed work and\nonly reopens actions accepted by the workflow's safe-resume rules.\nForeign, unbound, and missing runs return the same 404.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResumeWorkflowRunRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The queued run with its incremented resume_count.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRunResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "The account plan does not include durable workflows.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/WorkflowRunNotFound"
          },
          "409": {
            "description": "The run is stale, unsafe to resume, or has reached its resume limit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "Resume requests are limited to 4096 bytes.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/runs": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "listWorkflowRuns",
        "summary": "List durable workflow runs for an app.",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "running",
                "awaiting_event",
                "succeeded",
                "failed",
                "dead"
              ]
            },
            "description": "Optional exact status filter."
          },
          {
            "name": "workflow_name",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "description": "Optional exact workflow name filter."
          },
          {
            "name": "created_after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Include runs created at or after this RFC3339 timestamp."
          },
          {
            "name": "created_before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Include runs created at or before this RFC3339 timestamp."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Maximum runs to return in this page."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "Number of runs to skip before returning results."
          }
        ],
        "responses": {
          "200": {
            "description": "A page of workflow runs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListWorkflowRunsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/runs:cancel-preview": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "previewUnstartedWorkflowRunCancellations",
        "summary": "Preview cancellation eligibility for selected queued workflow runs.",
        "description": "Classifies up to 20 selected runs without changing them. A run is\neligible only while it is pending and has never started. This is an\nadvisory snapshot; the cancellation action rechecks eligibility while\nholding the same run lock used by dispatch claims. Runs outside the app\nare reported as not_found.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkflowQueuedRunCancelRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "One preview classification per selected run, in request order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowQueuedRunCancelResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/runs:cancel-queued": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "cancelUnstartedWorkflowRuns",
        "summary": "Cancel selected queued workflow runs that have never started.",
        "description": "Atomically rechecks and cancels the selected runs that remain pending\nand have no started_at timestamp. A run claimed after preview is\nreported as already_started or not_queued and is left alone. Started\nruns and retries are never cancelled by this bulk action. Eligible\nruns transition to failed with cancelled_at set. The bounded batch is\ncommitted as one transaction.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkflowQueuedRunCancelRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "One final outcome per selected run, in request order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowQueuedRunCancelResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/workflows/runs/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Workflow-run identifier to retrieve."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "getWorkflowRun",
        "summary": "Get a durable workflow run.",
        "responses": {
          "200": {
            "description": "The workflow run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRunResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/WorkflowRunNotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/workflows/runs/{id}/steps": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Workflow-run identifier whose step attempts are returned."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "listWorkflowSteps",
        "summary": "List the step attempts for a workflow run.",
        "responses": {
          "200": {
            "description": "Ordered workflow step attempts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListWorkflowStepsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/WorkflowRunNotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/workflows/runs/{id}/steps/{step}/attempts": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Parent run for the requested executor-attempt history."
        },
        {
          "name": "step",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Workflow step name whose executor attempts are returned."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "listWorkflowStepAttempts",
        "summary": "List executor attempts for one workflow step.",
        "responses": {
          "200": {
            "description": "Ordered executor attempts, including retry and condition-check outcomes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListWorkflowStepAttemptsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/WorkflowStepAttemptsNotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/workflows/runs/{id}/steps/{step}/retry": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Workflow run whose failed step should be retried."
        },
        {
          "name": "step",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Failed HTTP step to resume in the existing run."
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "retryWorkflowStep",
        "summary": "Retry one failed or dead HTTP step in its existing workflow run.",
        "description": "Requeues the same run and preserves the failed step's persisted input\nand attempt history. Only terminal failed or dead HTTP steps are eligible. The\nrequest conflicts if another step is active, failed, or dead, a downstream\nstep already succeeded, or the run was cancelled. Skipped dependent\nsteps are reopened so ordinary DAG evaluation can continue. Each manual\nretry grants one new dispatch and does not reset the manifest's\nautomatic retry budget.\n",
        "responses": {
          "200": {
            "description": "The workflow run has been requeued at the requested step.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRunResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "The account plan does not include workflows.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The account has reached its concurrent workflow run limit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/WorkflowRunNotFound"
          },
          "409": {
            "description": "The run or step is not in a state that can be safely retried.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/workflows/runs/{id}/callbacks": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Workflow-run identifier."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "listWorkflowCallbacks",
        "summary": "List callback handles for a workflow run.",
        "description": "Callback IDs identify waits but are not bearer credentials; completion requires authorization for the run owner.",
        "responses": {
          "200": {
            "description": "Callback handles from the run's snapshotted definition.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListWorkflowCallbacksResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/WorkflowRunNotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/workflows/runs/{id}/callbacks/{callback_id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Workflow run whose callback will be completed."
        },
        {
          "name": "callback_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Stable callback handle returned by the callback list endpoint."
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "completeWorkflowCallback",
        "summary": "Complete one callback wait.",
        "description": "Requires the run owner's workflow-write authorization. An identical\nretry returns duplicate=true, including after the run finishes; a\ndifferent payload conflicts. Completion may arrive before the step\nparks and will be consumed when the step becomes runnable.\n",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {}
            }
          }
        },
        "responses": {
          "200": {
            "description": "The callback was durably received or was an identical retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompleteWorkflowCallbackResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "code: workflow_run_not_found | workflow_step_not_found — the caller does not own the run or its callback handle is not declared.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Callback is closed or the ID was completed with different JSON.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "Callback wait has expired.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/workflows/runs/{id}/callbacks/{callback_id}/webhook-binding": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Workflow run that owns the callback binding."
        },
        {
          "name": "callback_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Stable callback handle to bind to one verified provider event."
        }
      ],
      "put": {
        "tags": [
          "workflows"
        ],
        "operationId": "putWorkflowCallbackWebhookBinding",
        "summary": "Bind one verified Stripe object event to a workflow callback.",
        "description": "Requires account workflow-write authorization and a Stripe inbound\nwebhook endpoint owned by the same app. Repeating the identical\nbinding is safe; another callback cannot claim the same endpoint,\nevent type, and object ID. The endpoint's existing URL and signing\nsecret are reused.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWorkflowCallbackWebhookBindingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The durable binding, whether newly created or already present.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowCallbackWebhookBindingResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/WorkflowRunNotFound"
          },
          "409": {
            "description": "The callback is closed, or the callback/provider event already has a different binding.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "getWorkflowCallbackWebhookBinding",
        "summary": "Read the callback's verified webhook binding.",
        "responses": {
          "200": {
            "description": "The bound provider event. No endpoint URL or secret is returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowCallbackWebhookBindingResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/WorkflowRunNotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "delete": {
        "tags": [
          "workflows"
        ],
        "operationId": "deleteWorkflowCallbackWebhookBinding",
        "summary": "Stop routing the provider event to this callback.",
        "description": "Later verified provider events resume ordinary app delivery; an already verified in-flight request may still complete the callback.",
        "responses": {
          "204": {
            "description": "Binding deleted."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/WorkflowRunNotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/workflows/runs/{id}/events": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Workflow-run identifier that receives the event."
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "injectWorkflowEvent",
        "summary": "Deliver an external event to a waiting workflow run.",
        "description": "A matching retained event may be retried after the run finishes. Reusing an event key with different content conflicts.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Reuse the same key and event content to retry while the event is retained."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InjectWorkflowEventRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The event was recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InjectWorkflowEventResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/WorkflowRunNotFound"
          },
          "409": {
            "description": "code: workflow_not_running for a new event on an inactive run, or conflict when a retained event key has different content.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/workflows/runs/{id}/diagnostics": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Durable workflow-run identifier."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "getWorkflowRunDiagnostics",
        "summary": "Inspect a workflow run and preview its safe continuation.",
        "description": "Requires the normal account read scope and MFA.\nReturns a consistent read-only snapshot with queue reason, step states,\ncode identity and the existing resume planner. No actions, admission\nreservations or audit mutations occur. Capacity and resume generation\nare checked again by POST resume. Inputs, outputs, error text, tenant\nidentities and credentials are omitted. Responses use Cache-Control: no-store.\n",
        "responses": {
          "200": {
            "description": "Current diagnostics and an advisory resume preview, including blockers for ineligible runs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRunDiagnosticsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/WorkflowRunNotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/workflows/runs/{id}/resume": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Failed or dead workflow-run identifier to resume."
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "resumeWorkflowRun",
        "summary": "Resume eligible failed actions in a durable workflow run.",
        "description": "Reopens eligible failed actions with a fresh retry budget while preserving\nthe original definition, inputs, successful steps, batch results, guard\ndecisions, action idempotency keys and attempt history. Requires the\ncurrent resume_count and honors Idempotency-Key for request replay.\nCancelled runs, active calls or waits, executed failure/timeout handlers,\nfailed control steps and replay-unsafe integration mutations are rejected.\nA live default deployment and valid integration bindings are required.\nEach run permits at most 16 resumptions and counts against active-run quotas.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResumeWorkflowRunRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The queued workflow run with its incremented resume_count.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRunResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "code: plan_workflows_not_allowed — this plan does not include workflows.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "code: plan_workflows_quota | forbidden — active-run quota exhausted or required scope missing.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/WorkflowRunNotFound"
          },
          "409": {
            "description": "code: workflow_resume_conflict, workflow_resume_unsafe, or workflow_resume_limit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "code: request_body_too_large — resume requests are limited to 4096 bytes.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/workflows/runs/{id}/resumes": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Workflow-run identifier whose continuation history is requested."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "listWorkflowResumes",
        "summary": "List the recorded resumptions of a workflow run.",
        "responses": {
          "200": {
            "description": "Resume history in increasing resume_number order, bounded to 16 records.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListWorkflowResumesResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/WorkflowRunNotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/workflows/runs/{id}/cancel": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Workflow-run identifier to cancel."
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "cancelWorkflowRun",
        "summary": "Cancel a durable workflow run.",
        "description": "Marks a non-terminal run failed with an operator-cancelled error and\nskips its pending, running, and waiting steps. Repeating the request on\na terminal run returns the existing run.\n",
        "responses": {
          "200": {
            "description": "The terminal workflow run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRunResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/WorkflowRunNotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/image-runs": {
      "post": {
        "tags": [
          "jobs"
        ],
        "operationId": "createImageRun",
        "summary": "Run one command from an OCI image.",
        "description": "`docker run`-shaped entry point. The API keeps one platform-managed\nrunner job (kind `image_run`) per account and normalized image, so\nthe image is pulled once and later runs start from the cached\nartifact. While the image is being pulled the call returns 202\n`pulling`; call again once `GET /v1/jobs/{job}` reports\n`image_materialization_status: ready` to create a one-task run\n(201 `queued`). The command follows Docker's rules: `entrypoint`\nreplaces the image ENTRYPOINT (and drops its CMD unless `args` is\nset) and `args` replaces the image CMD. Runs, logs and cancellation\nuse `/v1/jobs/{job}/runs`. Free accounts get 402\n`jobs_not_allowed`; the route returns 404 until the operator sets\n`FAAS_IMAGE_RUNS=1`. With `interactive: true` the 201\nresponse carries a one-time `attach` credential for\n`GET /v1/jobs/{job}/runs/{run_id}/tasks/0/attach` and is never stored\nfor Idempotency-Key replay.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateImageRunRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "A one-task run was queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImageRunResponse"
                }
              }
            }
          },
          "202": {
            "description": "The image is being pulled; call again when the runner job's image is ready.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImageRunResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Image runs need a plan with Jobs (not Free).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "description": "Interactive image runs are not enabled on this control-plane host.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/jobs": {
      "get": {
        "tags": [
          "jobs"
        ],
        "operationId": "listJobs",
        "summary": "List jobs on the account.",
        "description": "Page-based pagination via ?limit / ?offset. NextOffset=-1\nsignals the last page. Free accounts return an empty\nlist (read gate is not in the plan).\n",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            },
            "description": "Maximum number of jobs to return in this page (1–200, default 50)."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "Number of jobs to skip before returning results. NextOffset=-1 in the body signals the last page."
          }
        ],
        "responses": {
          "200": {
            "description": "A page of jobs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListJobsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "jobs"
        ],
        "operationId": "createJob",
        "summary": "Create a job template.",
        "description": "Plan-tier gate (Free → 402 jobs_not_allowed) precedes\nper-plan cap clamping (RAM, task_timeout, parallelism,\nretry_max). The per-account JobMaxPerAccount quota is\nenforced atomically.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateJobRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new job.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Plan tier does not include job support (Free plan).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/jobs/{name}/labels": {
      "parameters": [
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$"
          },
          "description": "Slug of the job whose labels change."
        }
      ],
      "patch": {
        "tags": [
          "jobs"
        ],
        "operationId": "updateJobLabels",
        "summary": "Set and remove a job's labels.",
        "description": "Preview (resource-labels capability). Sets and removes labels in one\natomic write and returns every label the job carries after it, with\nthe same rules, codes and audit event as PATCH /v1/apps/{slug}/labels.\nRequires deploy:write or admin scope and MFA. While the capability is on,\nGET /v1/jobs and GET /v1/jobs/{name} include labels, and GET /v1/jobs\ntakes ?selector=, a Kubernetes label selector.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LabelChange"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The job's labels after the write.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LabelsResponse"
                }
              }
            }
          },
          "default": {
            "description": "An invalid change, missing sign-in, scope or MFA, a job this account does not own, the capability turned off, or the rate limit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/jobs/{name}": {
      "parameters": [
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$"
          },
          "description": "The job slug (3-40 chars, lowercase letters/digits/hyphens)."
        }
      ],
      "get": {
        "tags": [
          "jobs"
        ],
        "operationId": "getJob",
        "summary": "Get one job.",
        "responses": {
          "200": {
            "description": "The job.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "tags": [
          "jobs"
        ],
        "operationId": "updateJob",
        "summary": "Partial-update a job.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateJobRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated job.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "403": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "jobs"
        ],
        "operationId": "deleteJob",
        "summary": "Soft-delete a job.",
        "description": "Returns 409 job_has_live_instances when at least one\nkind='job_task' AND status NOT IN ('parked','destroyed')\ninstance still references the job. Cancel pending runs\nfirst or wait for them to drain.\n",
        "responses": {
          "204": {
            "description": "No body. The job was soft-deleted."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Job has live instances.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/jobs/{name}/registry-credentials": {
      "parameters": [
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$"
          },
          "description": "The job slug."
        }
      ],
      "get": {
        "tags": [
          "jobs"
        ],
        "operationId": "listJobRegistryCredentials",
        "summary": "List sealed private-registry credentials on a job.",
        "description": "Returns registry, username, and timestamps only. Plaintext\npasswords are never returned. Quota metadata is included for CLI\nand dashboard rendering.\n",
        "responses": {
          "200": {
            "description": "Job registry credential metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobRegistryCredentialListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "put": {
        "tags": [
          "jobs"
        ],
        "operationId": "setJobRegistryCredential",
        "summary": "Set or replace a sealed private-registry credential for a job.",
        "description": "Seals the plaintext password under namespace `registry_creds` and\nstores it against the job and registry host. Replacements do not\nconsume another per-job quota slot.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutJobRegistryCredentialRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The stored credential metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobRegistryCredentialResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRegistryHost"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlanJobRegistryCredentialsNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/PlanJobRegistryCredentialQuota"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "jobs"
        ],
        "operationId": "deleteJobRegistryCredential",
        "summary": "Delete a sealed private-registry credential from a job.",
        "parameters": [
          {
            "name": "registry",
            "in": "query",
            "required": true,
            "description": "Registry host to delete, URL-encoded.",
            "schema": {
              "type": "string",
              "maxLength": 253
            }
          }
        ],
        "responses": {
          "204": {
            "description": "The job credential row was removed."
          },
          "400": {
            "description": "Invalid registry host or no credential exists for the host.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/jobs/{name}/runs": {
      "parameters": [
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$"
          },
          "description": "Unique job name. DNS-label safe (`^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$`). Anchors path `/v1/jobs/{name}/runs`."
        }
      ],
      "get": {
        "tags": [
          "jobs"
        ],
        "operationId": "listJobRuns",
        "summary": "List runs of a job.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            },
            "description": "Maximum number of runs to return in this page (1–200, default 50)."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "Number of runs to skip before returning results. NextOffset=-1 in the body signals the last page."
          }
        ],
        "responses": {
          "200": {
            "description": "A page of runs for this job.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListJobRunsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "jobs"
        ],
        "operationId": "createJobRun",
        "summary": "Fan out N tasks of a job.",
        "description": "Atomic fan-out via `generate_series` CTE in pgstore.\n`tasks` clamped against Plan.JobMaxTasksPerRun\n(Hobby=100, Pro=1000, Scale=5000). Per-account\nJobConcurrentPerAccount gate refuses if too many\nlive job_task instances exist. External input manifests are read from\naccount-authorized obj:// storage; missing objects return 404 and\nunavailable storage returns 503.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateJobRunRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new run + fan-out.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobRunResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "403": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Job is paused.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/jobs/{name}/occurrences": {
      "parameters": [
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$"
          },
          "description": "Customer-visible name of the recurring job."
        }
      ],
      "get": {
        "tags": [
          "jobs"
        ],
        "operationId": "listJobScheduleOccurrences",
        "summary": "List durable scheduled occurrence decisions for a job.",
        "description": "Shows whether each nominal run started, was skipped, missed its start deadline, or was coalesced.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            },
            "description": "Maximum number of job occurrence records to return."
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Job occurrence id that starts the next older page."
          }
        ],
        "responses": {
          "200": {
            "description": "A newest-first page of job occurrence outcomes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListScheduleOccurrencesResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/jobs/{name}/operations": {
      "post": {
        "tags": [
          "jobs"
        ],
        "operationId": "submitExclusiveJobOperation",
        "summary": "Submit a Job run through managed exclusive ownership.",
        "description": "The account and Job identity come from the authenticated route. The key is namespaced by the selected policy and is not an authorization boundary.",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$"
            },
            "description": "Account-owned Job name."
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExclusiveJobOperationRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Job run accepted for managed ownership or joined to an equivalent operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExclusiveOperationAccepted"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "403": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The policy rejected the request, the Job is paused, or the policy does not include this Job.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/jobs/{name}/runs/{id}": {
      "parameters": [
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Job name (path). DNS-label safe. Body creates a run against this template. Anchors path `/v1/jobs/{name}/runs/{id}`."
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "The job_run id (UUID)."
        }
      ],
      "get": {
        "tags": [
          "jobs"
        ],
        "operationId": "getJobRun",
        "summary": "Get one run of a job.",
        "responses": {
          "200": {
            "description": "The run aggregate.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobRunResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/jobs/{name}/runs/{id}/status": {
      "parameters": [
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Name of the job the run belongs to."
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "The id of the run whose conditions are read."
        }
      ],
      "get": {
        "tags": [
          "jobs"
        ],
        "operationId": "getJobRunStatus",
        "summary": "Read a job run's conditions.",
        "description": "Preview (resource-conditions capability). The run's Succeeded and\nProgressing conditions, mapped from the response\nGET /v1/jobs/{name}/runs/{id} returns and never stored. A job run has\nno Ready condition: it runs to completion. Failed, cancelled and\ndead-letter runs report terminal conditions. Cache-Control no-store.\n",
        "responses": {
          "200": {
            "description": "The job run's conditions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResourceStatus"
                }
              }
            }
          },
          "default": {
            "description": "Missing sign-in, read scope or MFA, a run this account does not own or under another job's name, the capability turned off, or the rate limit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/jobs/{name}/runs/{id}/cancel": {
      "parameters": [
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Unique job name. DNS-label safe (`^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$`). Anchors path `/v1/jobs/{name}/runs/{id}/cancel`."
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Job-run identifier (UUIDv4, path). Returns the run + aggregated counters. Anchors path `/v1/jobs/{name}/runs/{id}/cancel`."
        }
      ],
      "post": {
        "tags": [
          "jobs"
        ],
        "operationId": "cancelJobRun",
        "summary": "Cancel a run.",
        "description": "Transitions every non-terminal task of the run to\nstatus='cancelled'. For claimed (running) tasks,\nthe scheduler SIGTERMs the guest; the supervisor catches\nSIGTERM, writes job_exit{error_class='cancelled',\nexit_code=143}, then poweroff.\n",
        "responses": {
          "200": {
            "description": "The cancelled run aggregate.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobRunCancelledResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/jobs/{name}/runs/{id}/replay-failed": {
      "parameters": [
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Job name owned by the authenticated account."
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Terminal source run identifier."
        }
      ],
      "post": {
        "tags": [
          "jobs"
        ],
        "operationId": "replayFailedJobRun",
        "summary": "Create a linked run from failed inputs of a terminal run.",
        "description": "The ready job image must still resolve to the source image digest. New task indexes are dense; source_task_index preserves the old index.",
        "responses": {
          "201": {
            "description": "The linked run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobRunResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/jobs/{name}/runs/{id}/tasks": {
      "parameters": [
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Unique job name. DNS-label safe (`^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$`). Anchors path `/v1/jobs/{name}/runs/{id}/tasks`."
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Job-run identifier (UUIDv4, path). Body cancels this run. Anchors path `/v1/jobs/{name}/runs/{id}/tasks`."
        }
      ],
      "get": {
        "tags": [
          "jobs"
        ],
        "operationId": "listJobRunTasks",
        "summary": "List tasks of a run.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            },
            "description": "Maximum number of tasks to return in this page (1–200, default 50)."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "Number of tasks to skip before returning results. NextOffset=-1 in the body signals the last page."
          }
        ],
        "responses": {
          "200": {
            "description": "A page of tasks for this run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListJobTasksResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/jobs/{name}/runs/{id}/tasks/{idx}/logs": {
      "parameters": [
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Unique job name. DNS-label safe (`^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$`). Anchors path `/v1/jobs/{name}/runs/{id}/tasks/{idx}/logs`."
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Job-run identifier (UUIDv4, path). Returns a page of tasks. Anchors path `/v1/jobs/{name}/runs/{id}/tasks/{idx}/logs`."
        },
        {
          "name": "idx",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer",
            "minimum": 0
          },
          "description": "The task index within the run (zero-indexed)."
        },
        {
          "name": "max_bytes",
          "in": "query",
          "required": false,
          "schema": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1048576,
            "default": 65536
          },
          "description": "Maximum log payload size to return. Default 64 KiB; capped at 1 MiB."
        }
      ],
      "get": {
        "tags": [
          "jobs"
        ],
        "operationId": "getJobTaskLogs",
        "summary": "Get tail logs of a task.",
        "description": "Returns the durable combined stdout/stderr tail captured before\nthe terminal task microVM is destroyed. Empty LogContent with\nTruncated=false means the task never produced output\n(process exited before writing anything — common for\nOOM-killed tasks).\n",
        "responses": {
          "200": {
            "description": "The tail log + truncated flag.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobTaskLogResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/jobs/{name}/runs/{id}/tasks/{idx}/logs/stream": {
      "parameters": [
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Job whose task output is streamed."
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Job-run identifier (UUIDv4) owning the task."
        },
        {
          "name": "idx",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer",
            "minimum": 0
          },
          "description": "Zero-based index of the task within the run."
        },
        {
          "name": "since_seq",
          "in": "query",
          "required": false,
          "schema": {
            "type": "integer",
            "minimum": 0,
            "format": "int64"
          },
          "description": "Resume the current attempt after this line sequence; 0 replays the attempt from its first line."
        }
      ],
      "get": {
        "tags": [
          "jobs"
        ],
        "operationId": "streamJobTaskLogs",
        "summary": "Stream a task's output live (SSE).",
        "description": "Served by the compute gateway, not the API. Waits while the\ntask is queued, then relays the task VM's console output as it is\nwritten, including each retry attempt in turn. Frames match the app\nlog stream: `event: log` (seq, instance, stream, line, written_at),\n`event: gap` when the VM already dropped older lines, heartbeat\ncomments, and one final `event: end` whose `reason` is\n`task_finished` (all output relayed), `stored_output` (the task ended\nbefore its last VM's output could be streamed; read `GET .../logs`),\n`timeout`, `node_unreachable` or `not_found`. Read the task for its\noutcome; the stored output from `GET .../logs` remains available.\n",
        "responses": {
          "200": {
            "description": "A text/event-stream of the task's output lines, ending with one `end` frame.",
            "content": {
              "text/event-stream": {}
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Live task output needs a plan with Jobs (not Free).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/jobs/{name}/runs/{id}/tasks/{idx}/attach": {
      "parameters": [
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Runner job of the interactive image run."
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Job-run identifier (UUIDv4) of the interactive image run."
        },
        {
          "name": "idx",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer",
            "minimum": 0
          },
          "description": "Zero-based index of the task; an interactive run has only task 0."
        }
      ],
      "get": {
        "tags": [
          "jobs"
        ],
        "operationId": "attachJobTask",
        "summary": "Attach to an interactive image run's task (WebSocket).",
        "description": "Served by the compute gateway, not the API. The session uses\nthe interactive app-task wire contract: the account\ncredential, deploy-write scope, the `X-Gregale-Attach-Token` from the\nimage run's create response, and the `gregale-app-task-attach-v1`\nWebSocket subprotocol. Optional `rows`/`cols` set the initial terminal\nsize. The run's VM holds the command until the first successful\nattach, which consumes the token.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "rows",
            "in": "query",
            "required": false,
            "description": "Initial height of the run's terminal when tty was requested; defaults to 24.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            }
          },
          {
            "name": "cols",
            "in": "query",
            "required": false,
            "description": "Initial width of the run's terminal when tty was requested; defaults to 80.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            }
          }
        ],
        "responses": {
          "101": {
            "description": "Switching to the run's attach WebSocket; the held command starts."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Interactive image runs need a plan with Jobs (not Free).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The task VM is still queued or starting; retry after the Retry-After interval.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "The task finished, already has a client, or its attach window closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/jobs/{name}/runs/{id}/tasks/{idx}/attempts": {
      "parameters": [
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Job whose task attempt history is requested."
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Run containing the task attempt history."
        },
        {
          "name": "idx",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer",
            "minimum": 0
          },
          "description": "Zero-based index of the task whose attempts are listed."
        }
      ],
      "get": {
        "tags": [
          "jobs"
        ],
        "operationId": "listJobTaskAttempts",
        "summary": "List immutable terminal attempts of a task.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            },
            "description": "Maximum number of attempts to return."
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "Number of attempts to skip."
          }
        ],
        "responses": {
          "200": {
            "description": "Attempts ordered by attempt number.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListJobTaskAttemptsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/jobs/{name}/runs/{id}/tasks/{idx}/artifacts/{artifact}/download": {
      "parameters": [
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Job whose output artifact is requested."
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Run containing the successful task."
        },
        {
          "name": "idx",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer",
            "minimum": 0
          },
          "description": "Zero-based index of the successful task."
        },
        {
          "name": "artifact",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Artifact name from the successful task's output manifest."
        }
      ],
      "get": {
        "tags": [
          "jobs"
        ],
        "operationId": "downloadJobArtifact",
        "summary": "Verify a Gregale managed result and obtain a download URL.",
        "description": "Reads the current obj:// object, checks its size and SHA-256 against the task output manifest, then returns a 5-minute signed GET URL. Missing objects return 404; changed bytes return 422.",
        "responses": {
          "200": {
            "description": "Verified artifact and download capability.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobArtifactDownloadResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/jobs/{name}/runs/{id}/tasks/{idx}/retry": {
      "parameters": [
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Unique job name. DNS-label safe. Anchors path `/v1/jobs/{name}/runs/{id}/tasks/{idx}/retry`."
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "The job-run id (UUIDv4)."
        },
        {
          "name": "idx",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer",
            "minimum": 0
          },
          "description": "The zero-based task index within the run."
        }
      ],
      "post": {
        "tags": [
          "jobs"
        ],
        "operationId": "retryJobTask",
        "summary": "Retry one failed job task.",
        "description": "Re-queues a failed, timeout, OOM, or cancelled task while its\nconfigured retry budget remains. The server applies the same capped\nexponential backoff as automatic retries and reopens a dead-letter run.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "The task has been queued for another attempt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobTaskRetryResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The task is not retriable or its retry budget is exhausted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/cron-fire-now-requests/{request_id}": {
      "get": {
        "operationId": "getFireCronRequest",
        "summary": "Get fire-now request state",
        "description": "Polling surface for the row that `POST /v1/crons/{id}/run`\ninserted (decision 7).\n",
        "parameters": [
          {
            "name": "request_id",
            "in": "path",
            "required": true,
            "description": "Fire-now request identifier returned by `POST /v1/crons/{id}/run`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current state of the fire-now request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FireCronRequestResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/triggers": {
      "get": {
        "tags": [
          "triggers"
        ],
        "operationId": "listTriggers",
        "summary": "List triggers on the account.",
        "description": "Returns every trigger owned by the calling account, optional\n?app_id filter to scope to one app, ?kind to scope to one\nkind. Newest-first by created_at; result is unbounded but\nthe typical account has well under 200. Cron schedules are\nnot triggers: list them with GET /v1/crons.\n",
        "parameters": [
          {
            "name": "app_id",
            "in": "query",
            "required": false,
            "description": "Optional app UUID to scope the listing to one app; the\ncaller's account is still the authorization boundary.\n",
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{32}$"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "description": "Optional trigger kind filter (kafka / nats / redis_streams\n/ sqs_compat / queue / realtime). kind=cron answers 400\nvalidation_failed pointing at GET /v1/crons; any other\nunknown value produces an empty list.\n",
            "schema": {
              "$ref": "#/components/schemas/TriggerKind"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The trigger list.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Trigger"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "triggers"
        ],
        "operationId": "createTrigger",
        "summary": "Create a trigger.",
        "description": "Idempotent via Idempotency-Key header. Returns 402\n`plan_triggers_not_allowed` for Free plan. A 403 may be\n`trigger_kind_not_allowed`, `plan_trigger_quota`,\n`trigger_batch_window_too_large`, or\n`trigger_tls_skip_verify_not_allowed`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTriggerRequest"
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "201": {
            "description": "The new trigger.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Trigger"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/TriggerInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/TriggerNotAllowed"
          },
          "403": {
            "$ref": "#/components/responses/TriggerQuotaExceeded"
          },
          "422": {
            "$ref": "#/components/responses/TriggerImmutable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/TriggerSecretUnavailable"
          }
        }
      }
    },
    "/v1/triggers:batch_create": {
      "post": {
        "tags": [
          "triggers"
        ],
        "operationId": "batchCreateTriggers",
        "summary": "Bulk-create triggers from a gregale.yaml fragment.",
        "description": "Fires a `triggers:` and `event_triggers:` fragment at the server,\nvalidates via the same path the CLI uses, and returns per-row ids\nand any per-row RFC 7807 codes. Event triggers for the target app\nare applied the way a source deploy applies them:\nexisting subscriptions are kept, and a failure is one `errors`\nrow after its changes are rolled back.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTriggerBatchRequest"
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Per-row outcome.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateTriggerBatchResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/TriggerInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/TriggerNotAllowed"
          },
          "403": {
            "$ref": "#/components/responses/TriggerQuotaExceeded"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/triggers/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "triggers"
        ],
        "operationId": "getTrigger",
        "summary": "Get one trigger.",
        "responses": {
          "200": {
            "description": "The trigger.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Trigger"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "tags": [
          "triggers"
        ],
        "operationId": "updateTrigger",
        "summary": "Partial-update a trigger.",
        "description": "Queue binding consumers are managed through the queue-binding API.\nDirect mutations of those private projections return 409.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateTriggerRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated trigger.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Trigger"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/TriggerInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/TriggerImmutable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/TriggerSecretUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "triggers"
        ],
        "operationId": "deleteTrigger",
        "summary": "Delete a trigger.",
        "description": "Delete an independent trigger. A private queue consumer must be removed\nthrough its queue binding; direct deletion of that projection returns 409.\n",
        "responses": {
          "204": {
            "description": "No body. The trigger was removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/triggers/{id}/work-binding": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "triggers"
        ],
        "operationId": "getTriggerWorkBinding",
        "summary": "Get the broker trigger's application work-policy binding.",
        "responses": {
          "200": {
            "description": "The configured broker work binding.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TriggerWorkBinding"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "tags": [
          "triggers"
        ],
        "operationId": "putTriggerWorkBinding",
        "summary": "Set the broker trigger's application work-policy binding.",
        "description": "An initial binding requires a disabled external trigger with no\nexisting record receipts. Resume the trigger after binding it.\nUpdating an existing binding is allowed while the trigger is enabled;\nrecords already admitted keep their captured policy and key.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TriggerWorkBinding"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated broker work binding.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TriggerWorkBinding"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/TriggerInvalid"
          }
        }
      },
      "delete": {
        "tags": [
          "triggers"
        ],
        "operationId": "deleteTriggerWorkBinding",
        "summary": "Remove the broker trigger's application work-policy binding.",
        "responses": {
          "204": {
            "description": "The broker work binding was removed."
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/triggers/{id}/pause": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "post": {
        "tags": [
          "triggers"
        ],
        "operationId": "pauseTrigger",
        "summary": "Disable a trigger without deleting it.",
        "description": "Sets `enabled=false` and pg_notify's `trigger_changed`. Schedd\nstops the broker poller on the next tick; in-flight records\ndrain normally.\nQueue binding consumers are managed through the queue-binding API;\ndirect pause/resume of those private projections returns 409.\n",
        "responses": {
          "200": {
            "description": "The paused trigger with enabled set to false.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Trigger"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/triggers/{id}/resume": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "post": {
        "tags": [
          "triggers"
        ],
        "operationId": "resumeTrigger",
        "summary": "Re-enable a paused trigger.",
        "description": "Sets `enabled=true` and pg_notify's `trigger_changed`.\nSchedd restarts the broker poller on the next tick.\nQueue binding consumers are managed through the queue-binding API;\ndirect pause/resume of those private projections returns 409.\n",
        "responses": {
          "200": {
            "description": "The resumed trigger with enabled set to true.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Trigger"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/triggers/{id}/records": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "triggers"
        ],
        "operationId": "listTriggerRecords",
        "summary": "List records for one trigger.",
        "description": "Newest-first by `received_at`. The dashboard uses this to\nbuild the \"Recent fires\" view; the CLI uses it for `--tail`.\n",
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "Optional state filter — pending / claimed / succeeded /\nretry / dead_letter. Lets the dashboard narrow to\nin-flight or DLQ rows.\n",
            "schema": {
              "$ref": "#/components/schemas/TriggerRecordState"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size; default 50, capped at 200.\n",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Records for this trigger.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListTriggerRecordsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/triggers/{id}/records/{rid}/retry": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        },
        {
          "name": "rid",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "description": "Record id (UUID hex, no dashes) — used by retry/drop."
        }
      ],
      "post": {
        "tags": [
          "triggers"
        ],
        "operationId": "retryTriggerRecord",
        "summary": "Force a record back into the dispatch queue.",
        "description": "Resets state to `pending`, attempts to 0. Operator-only scope\n— the dashboard surfaces this as \"Re-drive from DLQ\".\n",
        "responses": {
          "204": {
            "description": "Record re-driven (no body)."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/TriggerRecordRetryFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/triggers/{id}/records/{rid}/drop": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        },
        {
          "name": "rid",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "description": "Record id (UUID hex, no dashes) — used by drop."
        }
      ],
      "post": {
        "tags": [
          "triggers"
        ],
        "operationId": "dropTriggerRecord",
        "summary": "Drop a record without re-firing.",
        "description": "Marks a dead-letter row `routed_to='drop'` (already the\ndefault; this is the explicit acknowledgement). Operator-only\nscope.\n",
        "responses": {
          "204": {
            "description": "Record dropped (no body)."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/triggers/{id}/dlq": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "triggers"
        ],
        "operationId": "listTriggerDeadLetter",
        "summary": "List dead-letter rows for one trigger.",
        "parameters": [
          {
            "name": "reason",
            "in": "query",
            "required": false,
            "description": "Optional DLQ reason filter (poison_record / max_attempts /\nbroker_error / rate_limited / payload_too_large /\nexclusive_operation_rejected).\n",
            "schema": {
              "$ref": "#/components/schemas/TriggerDeadLetterReason"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "DLQ page size; default 50, capped at 200.\n",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Dead-letter rows for this trigger.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListTriggerDeadLetterResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/triggers/{id}/metrics": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "triggers"
        ],
        "operationId": "getTriggerMetrics",
        "summary": "Per-state aggregate counts for one trigger.",
        "description": "Counter roll-up by state. Not a Prometheus surface — that\nis /v1/metrics.\n",
        "responses": {
          "200": {
            "description": "Aggregated counts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TriggerMetricsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/invocations:dispatch_batch": {
      "post": {
        "tags": [
          "triggers",
          "internal"
        ],
        "operationId": "dispatchInvocationBatch",
        "summary": "Internal — the scheduler posts a batch envelope to the gateway.",
        "description": "Internal-only route. Schedd invokes this once per closed\nbatch. The gateway delivers records sequentially and returns one\nresult per item. Each function response may include\n`{\"batchItemFailures\":[{\"itemIdentifier\":\"...\"}]}`.\nDurable queue records include an invocation ID and current claim\nattempt; source must be esm for these records.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "invocation_id",
                  "app_id",
                  "trigger_id",
                  "records"
                ],
                "properties": {
                  "invocation_id": {
                    "type": "string",
                    "description": "Synthetic batch identity, typically trigger- followed by the trigger UUID."
                  },
                  "trigger_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "app_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "source": {
                    "type": "string",
                    "description": "Internal dispatch source; esm for trigger and durable queue batches."
                  },
                  "records": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "item_identifier",
                        "payload_b64"
                      ],
                      "properties": {
                        "item_identifier": {
                          "type": "string"
                        },
                        "invocation_id": {
                          "type": "string",
                          "format": "uuid",
                          "description": "Internal durable queue invocation ID; must equal item_identifier and have a current claimed lease."
                        },
                        "invocation_attempt": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Required with invocation_id; fences delivery to the current durable queue claim attempt."
                        },
                        "payload_b64": {
                          "type": "string"
                        },
                        "headers": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "string"
                          }
                        },
                        "metadata": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Batch accepted; per-record status derived from response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "results"
                  ],
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "item_identifier",
                          "status"
                        ],
                        "properties": {
                          "item_identifier": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "succeeded",
                              "retry",
                              "dead_letter"
                            ]
                          },
                          "error": {
                            "type": "string"
                          },
                          "code": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/projects/scan": {
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "scanProject",
        "summary": "Scan an uploaded tarball and return a deploy plan.",
        "description": "Dry-run. Accepts a multipart upload (`source=<tar.gz>`,\n`project_slug`, `production_branch`, `install_id`, `only`)\nand returns a PlanResponse with the discovered workloads,\nmanaged services, derived scan_source, and a plan_token\nthat the apply endpoint can echo back to skip the\nsecond extract.\n\nOn over-quota the response carries `can_apply=false`\n(and `crons_not_allowed=true` for Free plan) so the CLI\ncan branch without a second request.\n",
        "parameters": [
          {
            "name": "Project-Add-Services",
            "in": "header",
            "required": false,
            "description": "Require planned HTTP source service additions; disabled until native qualification. No removals or configuration changes.",
            "schema": {
              "type": "string",
              "enum": [
                "required"
              ]
            }
          },
          {
            "name": "Project-Stabilization",
            "in": "header",
            "required": false,
            "description": "Plan a progressive release with ten minutes of monitoring after rollout success.",
            "schema": {
              "type": "string",
              "enum": [
                "required"
              ]
            }
          },
          {
            "name": "Project-Progressive",
            "in": "header",
            "required": false,
            "description": "Preview a progressive project rollout with immutable paired configuration and verified health.",
            "schema": {
              "type": "string",
              "enum": [
                "required"
              ]
            }
          },
          {
            "name": "Project-Worker-Health",
            "in": "header",
            "required": false,
            "description": "Require real worker job outcomes in an atomic verified worker release.",
            "schema": {
              "type": "string",
              "enum": [
                "required"
              ]
            }
          },
          {
            "name": "Project-Release-Mode",
            "in": "header",
            "description": "Set atomic to preview a source-only safe project release against the active production graph.",
            "schema": {
              "type": "string",
              "enum": [
                "atomic",
                "atomic-verify",
                "atomic-config-verify",
                "atomic-migrate-verify",
                "atomic-config-migrate-verify",
                "atomic-verify-workers",
                "atomic-config-verify-workers",
                "atomic-migrate-verify-workers",
                "atomic-config-migrate-verify-workers"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ProjectScanRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The deploy plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlanResponse"
                },
                "example": {
                  "project_slug": "my-app",
                  "scan_source": "compose",
                  "tier": "compose",
                  "workloads": [
                    {
                      "name": "api",
                      "root_dir": "",
                      "command": [],
                      "ports": [
                        8080
                      ]
                    },
                    {
                      "name": "worker",
                      "root_dir": "",
                      "command": [],
                      "ports": []
                    }
                  ],
                  "managed": [
                    {
                      "name": "db",
                      "kind": "postgres",
                      "env_hint": "DATABASE_URL"
                    }
                  ],
                  "crons": [
                    {
                      "workload_name": "nightly",
                      "schedule": "0 3 * * *",
                      "path": "/",
                      "enabled": true
                    }
                  ],
                  "observed_apps": 3,
                  "observed_crons": 1,
                  "limit_apps": 5,
                  "limit_crons": 5,
                  "can_apply": true,
                  "plan_token": "eyJoYXMiOiI...",
                  "will_deploy": [
                    {
                      "name": "api",
                      "root_dir": "",
                      "class": "http",
                      "action": "create"
                    },
                    {
                      "name": "worker",
                      "root_dir": "",
                      "class": "http",
                      "action": "update"
                    }
                  ],
                  "unaffected": [
                    {
                      "name": "legacy-job",
                      "root_dir": "jobs/legacy",
                      "class": "http",
                      "action": "noop",
                      "id": "0123456789abcdef0123456789abcdef"
                    }
                  ],
                  "skipped": [
                    {
                      "name": "risky-migration",
                      "root_dir": "jobs/migrate",
                      "class": "http",
                      "action": "noop"
                    }
                  ],
                  "removed": []
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/CronInvalid"
          },
          "403": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "413": {
            "$ref": "#/components/responses/SourceTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/scan/source-ref": {
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "scanProjectSourceRef",
        "summary": "Scan a connected GitHub repository and return a deploy plan.",
        "description": "Resolves a durable GitHub App installation owned by the authenticated\naccount, fetches the selected ref through the GitHub integration, and runs the same\nread-only scanner as the multipart upload endpoint. The installation\ntoken remains inside the control plane. When `install_id` is omitted,\nexactly one connected installation must be able to access `repo`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectSourceRefScanRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The deploy plan generated from the fetched repository.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlanResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "413": {
            "$ref": "#/components/responses/SourceTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/project-submissions/{attempt_id}": {
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getProjectSubmission",
        "summary": "Read a durable project apply acceptance receipt.",
        "description": "Recover the selected workload set and accepted deployment identities for an owned attempt. Reads do not enqueue builds, change configuration, or restart interrupted submissions.",
        "parameters": [
          {
            "name": "attempt_id",
            "description": "The opaque project apply attempt recorded before submission.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current project submission and accepted workload identities. Reads never enqueue builds.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectSubmissionReceipt"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/project-submissions/{attempt_id}/{action}": {
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "controlProjectRelease",
        "summary": "Control an owned progressive deployment or admit planned schema cleanup.",
        "description": "Persist a generation-fenced operator decision. Before full activation abort preserves the unchanged baseline. At full traffic new unassigned work is blocked while fresh baseline health permits paired graph/config restoration. Recovery retries that bounded verification without forcing health or overwriting newer intent. Reusing the same request identity and generation is idempotent. Contract admission additionally requires fresh current health and drained retained versions and work; it permanently fences retired deployments before queuing the source-declared cleanup task.",
        "parameters": [
          {
            "name": "attempt_id",
            "in": "path",
            "required": true,
            "description": "Durable project deployment attempt.",
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{32}$"
            }
          },
          {
            "name": "action",
            "in": "path",
            "required": true,
            "description": "Abort a running canary, retry baseline recovery, or run declared schema cleanup after stabilization and drain barriers.",
            "schema": {
              "type": "string",
              "enum": [
                "abort",
                "recover",
                "contract",
                "resolve-contract"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ProjectReleaseControlRequest"
                  },
                  {
                    "$ref": "#/components/schemas/ProjectMigrationRecoveryRequest"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Durable decision and current receipt; acceptance does not imply restoration has completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectSubmissionReceipt"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "410": {
            "description": "Retained rollback baseline expired; deploy a compatible replacement.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/projects/safe-deploy": {
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "safeApplyProject",
        "summary": "Build an existing HTTP project and atomically publish its ready release.",
        "description": "Requires an active production release set, the complete project, no_triggers=true, and a durable attempt. Candidates receive zero traffic and publish only after every candidate completes readiness. Project-Add-Services opts into independent HTTP source additions behind native qualification admission. All serving services must remain unchanged. Additions cannot combine with configuration, secrets, migrations, workers or progressive rollout. Verified releases probe existing critical routes and restore the original membership on regression; new services are checked by startup readiness. Failed or withdrawn additions remain quota-counted reservations without a default route and may be retried with identical settings.",
        "parameters": [
          {
            "name": "Project-Add-Services",
            "in": "header",
            "required": false,
            "description": "Apply the scanned independent HTTP service additions after native qualification; preserve existing membership and configuration.",
            "schema": {
              "type": "string",
              "enum": [
                "required"
              ]
            }
          },
          {
            "name": "Project-Stabilization",
            "in": "header",
            "required": false,
            "description": "Require ten minutes of guarded health monitoring after progressive rollout success.",
            "schema": {
              "type": "string",
              "enum": [
                "required"
              ]
            }
          },
          {
            "name": "Project-Progressive",
            "in": "header",
            "required": false,
            "description": "Submit a progressive project rollout behind native qualification admission.",
            "schema": {
              "type": "string",
              "enum": [
                "required"
              ]
            }
          },
          {
            "name": "Project-Worker-Health",
            "in": "header",
            "required": false,
            "description": "Keep the required worker delivery health policy when applying the scanned release.",
            "schema": {
              "type": "string",
              "enum": [
                "required"
              ]
            }
          },
          {
            "name": "Project-Release-Mode",
            "in": "header",
            "description": "atomic-verify enables durable probes; atomic-config-verify pairs configuration; atomic-migrate-verify and atomic-config-migrate-verify also admit one backward-compatible migration.",
            "schema": {
              "type": "string",
              "enum": [
                "atomic",
                "atomic-verify",
                "atomic-config-verify",
                "atomic-migrate-verify",
                "atomic-config-migrate-verify",
                "atomic-verify-workers",
                "atomic-config-verify-workers",
                "atomic-migrate-verify-workers",
                "atomic-config-migrate-verify-workers"
              ]
            }
          },
          {
            "name": "Deployment-Attempt-ID",
            "in": "header",
            "required": true,
            "description": "Durable identity for this safe project submission and release operation.",
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{32}$"
            }
          },
          {
            "name": "plan_token",
            "in": "query",
            "description": "Scan token bound to the safe release baseline.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ProjectApplyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Accepted candidate deployments and durable safe release state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/projects": {
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "listProjects",
        "summary": "List durable projects owned by the current account.",
        "responses": {
          "200": {
            "description": "Account-scoped project summaries.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ProjectSummaryResponse"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "applyProject",
        "summary": "Apply a deploy plan in one transaction.",
        "description": "Accepts the same multipart body as /scan plus an optional\n`plan_token` query parameter echoing the dry-run token. On\nsuccess the response carries the inserted project_id and\nper-app IDs so the CLI's `--yes` flow can render\n`applied: <slug> → <app_id>`. On quota the response is\nthe matching RFC 7807 problem (402 Free crons, 403 apps\nor cron cap) with zero rows inserted.\n\nThe apply handler resolves workload-name → app_id from\nthe just-inserted apps and inserts crons in a follow-up\npass; the quota check ran inside ApplyProjectPlan's Tx.\n",
        "parameters": [
          {
            "name": "Project-Retry-Targets",
            "in": "header",
            "description": "JSON object mapping selected app IDs to their latest failed deployment IDs. Requires Deployment-Attempt-ID, exact only selection, no_triggers=true, and no secret or exclusion changes. Forces unchanged workloads to rebuild; rejects stale targets. Acceptance checks the target under the app lock.",
            "schema": {
              "type": "string",
              "maxLength": 32768
            }
          },
          {
            "name": "Deployment-Attempt-ID",
            "in": "header",
            "description": "Durable project submission identity. Reuse only for the same request; inspect its receipt after an uncertain response.",
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{32}$"
            }
          },
          {
            "name": "plan_token",
            "in": "query",
            "required": false,
            "description": "Echo of the dry-run plan_token (base64-JSON). Omit to skip the cache.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ProjectApplyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The applied project + apps + crons.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplyResponse"
                },
                "example": {
                  "project_id": "0123456789abcdef0123456789abcdef",
                  "apps": [
                    {
                      "slug": "api",
                      "id": "0123456789abcdef0123456789abcdef"
                    },
                    {
                      "slug": "worker",
                      "id": "0123456789abcdef0123456789abcdef"
                    }
                  ],
                  "scan_source": "compose",
                  "can_apply": true,
                  "will_deploy": [
                    {
                      "name": "api",
                      "root_dir": "",
                      "class": "http",
                      "action": "create"
                    },
                    {
                      "name": "worker",
                      "root_dir": "",
                      "class": "http",
                      "action": "update"
                    }
                  ],
                  "unaffected": [],
                  "skipped": [],
                  "removed": [],
                  "persisted_exclusions": []
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/CronInvalid"
          },
          "403": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "409": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "413": {
            "$ref": "#/components/responses/SourceTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/release-secrets": {
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "stageProjectReleaseSecrets",
        "summary": "Stage encrypted application secret versions for an atomic HTTP release.",
        "description": "Requires MFA and secrets write permission. Admission defaults off pending native qualification. Values are encrypted before persistence; the response contains opaque version IDs. Request replay is bounded to the staging window. Existing production keys only; managed credentials are unsupported.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Existing project slug owning the proposed secret snapshots.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectReleaseSecretStageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Immutable staged version references, without encrypted or plaintext values.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectReleaseSecretStageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/projects/{slug}/deployment-readiness": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project slug in the authenticated account; a missing project can be checked as a proposed first deployment.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          }
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "checkProjectDeployment",
        "summary": "Check project deployment or environment promotion readiness without submitting work.",
        "description": "Evaluates declared metadata and current account/project state without source\nuploads, credential staging, probe execution, builds, approvals or writes.\nOnly key names and bounded remedies appear in the report. Status is blocked\nwhen a definite blocker exists, otherwise unknown when a required read fails,\notherwise ready. Ready applies to control-plane prerequisites; deployment\nstill validates source bytes and runtime health. A state hash is provided\nonly when required state was readable. It is a comparison identity, not\nan approval or an apply token. Deployment admission remains authoritative.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectDeploymentCheckRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Current prerequisite report, including blocked and unknown outcomes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectDeploymentReadiness"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project slug to inspect, update, or delete in the authenticated account.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          }
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getProject",
        "summary": "Inspect a project, its workloads, exclusions, and latest status.",
        "responses": {
          "200": {
            "description": "Project recovery and workload state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "tags": [
          "projects"
        ],
        "operationId": "updateProject",
        "summary": "Update a project's repository binding or production branch.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateProjectRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated project state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "projects"
        ],
        "operationId": "deleteProject",
        "summary": "Delete a project and detach its live workloads.",
        "description": "The apps remain live. Their project_id is cleared by the database\nforeign-key action. While the project's services call each other by\nservice name, deletion is refused with 409\nproject_services_call_each_other, because detached services no longer\nresolve those names; pass detach_services=true once they do not.\n",
        "parameters": [
          {
            "name": "detach_services",
            "in": "query",
            "required": false,
            "description": "Confirms the project's services no longer call each other by service name.",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Project deleted."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environment-clones": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project whose production or stage environment will be cloned.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "createFullProjectEnvironmentClone",
        "summary": "Request a complete isolated environment clone.",
        "description": "This dedicated route never falls back to partial cloning. While full\nadmission is closed it returns environment_full_clone_unavailable with\nnamed blockers. When open, a source whose every used resource has an\nisolated strategy, including managed databases with point-in-time\nrestore, is captured and a durable clone operation is returned; any\nother source is refused with each uncopyable resource named under\nresource_coverage.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateProjectEnvironmentRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The source was captured; poll the clone operation until it is ready or compensated.",
            "headers": {
              "Location": {
                "description": "The clone operation status URL.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Full-copy capability unavailable; no partial target is created.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environment-clones/{clone}": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project owning the durable environment clone operation.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "clone",
          "in": "path",
          "required": true,
          "description": "Durable clone operation identifier returned when capture begins.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getProjectEnvironmentCloneOperation",
        "summary": "Read account- and project-scoped durable clone progress.",
        "description": "Status is available before the target environment is registered. Private captures, values and worker lease tokens are excluded.",
        "responses": {
          "200": {
            "description": "Non-secret clone operation receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentCloneOperationResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/automation/resume": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project whose stage automation is resumed.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Stage whose paused automation is enabled; production is refused.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          }
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "resumeEnvironmentAutomation",
        "summary": "Enable the crons a full environment clone copied paused.",
        "description": "Enables only the copied crons the source environment ran. A cron the source had disabled, or one enabled or disabled since, stays as it is.",
        "responses": {
          "200": {
            "description": "Crons enabled in the environment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumeEnvironmentAutomationResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project slug whose environment registry is addressed.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          }
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "listProjectEnvironments",
        "summary": "List durable environments for a project.",
        "responses": {
          "200": {
            "description": "Account-scoped project environments.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ProjectEnvironmentResponse"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "createProjectEnvironment",
        "summary": "Create a durable project environment.",
        "description": "When from_environment is supplied, the create is atomic and copies the\nlatest non-secret configuration, runtime variables, and already-sealed\ncustomer secrets. Managed PostgreSQL and object-storage bindings receive\nfresh target-scoped credentials and isolated data by default. Set\nshare_resources to attach fresh credentials to the source resources\ninstead. Provider-issued credential bytes are never copied. Domains,\nroutes, and policies remain application-scoped and are shared.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateProjectEnvironmentRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Project environment created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project slug owning the environment.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Environment slug.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$"
          }
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getProjectEnvironment",
        "summary": "Inspect one project environment.",
        "responses": {
          "200": {
            "description": "Project environment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "tags": [
          "projects"
        ],
        "operationId": "updateProjectEnvironment",
        "summary": "Update a project's environment protection policy.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateProjectEnvironmentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated project environment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "projects"
        ],
        "operationId": "deleteProjectEnvironment",
        "summary": "Delete an unused project environment.",
        "description": "Deletes only an unprotected, non-production environment that has no\nlive releases. Configuration, approval history, and owned pending or\nfinished asynchronous work are removed atomically. Production, protected\nenvironments, and environments still serving a live release return 409.\nRunning work or an unreleased execution reservation returns 409 with\ncode environment_work_busy; wait for completion or claim recovery and\nretry. Inconsistent work ownership returns environment_work_ownership_conflict\nwithout deleting the environment. Cancellation receipts are retained.\nIf managed resources cannot be revoked immediately, cleanup is durably queued and\nretried; the deleted environment returns 202 while cleanup is pending.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "202": {
            "description": "Project environment deleted; managed-resource cleanup is queued for retry."
          },
          "204": {
            "description": "Project environment deleted."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/branches": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project that owns the environment.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Parent environment to branch from or list branches of.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "createProjectEnvironmentBranch",
        "summary": "Branch a project environment.",
        "description": "Creates a new environment that copies the parent's configuration and\npublishes each of the parent's live workloads from its existing build.\nNothing starts until a workload is called: its first request starts it\ncold. Each managed PostgreSQL database the parent binds is copied as of\nthe branch point and bound to the branch with new credentials; while\n`branch.data` is `pending`, the branch's workloads wait for the copies.\nThe branch is deleted when its time to live ends. Parents that bind\nmanaged object storage cannot be branched yet.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateProjectEnvironmentBranchRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The branch exists and its workloads are published.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The plan's environment branch limit is reached.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Branches are unavailable, the slug is taken, the branch would be too deep, or the parent binds managed object storage.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "listProjectEnvironmentBranches",
        "summary": "List the branches of a project environment.",
        "responses": {
          "200": {
            "description": "The environment's direct branches.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentBranchListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Branches are unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/branch": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project that owns the branch to show.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "The environment branch to show.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getProjectEnvironmentBranch",
        "summary": "Show an environment branch.",
        "description": "Reports the branch's parent, branch point, expiry, data state, the\nmanaged PostgreSQL copies it owns, and each workload with its URL in\nthe branch and its deployment there. A workload with no live\ndeployment in the branch reports `starting`.\n",
        "responses": {
          "200": {
            "description": "The branch.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Branches are unavailable, so the branch cannot be shown.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/branch/extend": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project that owns the branch to extend.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "The environment branch to extend.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "extendProjectEnvironmentBranch",
        "summary": "Move an environment branch's expiry.",
        "description": "Sets the branch's expiry to now plus `ttl`, earlier or later. A branch\nlives at most 30 days after its creation; a branch with managed\nPostgreSQL copies at most 7 days, so its copies stay in the plan's\nPostgreSQL branch allowance. The copies' expiry moves with the\nbranch. A branch whose data is still being copied cannot be extended\nuntil its data is ready.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExtendProjectEnvironmentBranchRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The branch with its new expiry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Branches are unavailable, the expiry is past the branch's longest lifetime, or its data is still being copied.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/branch/reset": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project that owns the branch to reset.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "The environment branch to reset.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "resetProjectEnvironmentBranch",
        "summary": "Make an environment branch again from its parent.",
        "description": "Deletes the branch and creates it again from its parent with the same\nslug, egress, private-network mode and time to live. Its workloads\nare published from the parent's current builds and its data is copied\nagain as of now. Work done in the branch is discarded, and its\nworkloads get new URLs. A branch with branches of its own cannot be\nreset.\n",
        "responses": {
          "200": {
            "description": "The new branch and its workloads.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The caller may not branch the parent.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Branches are unavailable, or the branch has branches of its own.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/gitops": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EnvironmentGitOpsProjectSlug"
        },
        {
          "$ref": "#/components/parameters/EnvironmentGitOpsEnvironment"
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getEnvironmentGitOps",
        "summary": "Inspect Git source authority and reconciliation history.",
        "responses": {
          "200": {
            "description": "Inspect Git source authority and reconciliation history. result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvironmentGitOpsStatusResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/gitops/source": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EnvironmentGitOpsProjectSlug"
        },
        {
          "$ref": "#/components/parameters/EnvironmentGitOpsEnvironment"
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "createEnvironmentGitSource",
        "summary": "Bind a verified project repository to an environment definition.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Bind a verified project repository to an environment definition. request.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateEnvironmentGitSourceRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Bind a verified project repository to an environment definition. result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvironmentGitSource"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "patch": {
        "tags": [
          "projects"
        ],
        "operationId": "updateEnvironmentGitSource",
        "summary": "Update report, pruning, and suspension controls. Enforce is unavailable in preview.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Update report, enforce, pruning, and suspension controls. request.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnvironmentGitSourceUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Update report, enforce, pruning, and suspension controls. result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvironmentGitSource"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "projects"
        ],
        "operationId": "detachEnvironmentGitSource",
        "summary": "Release Git ownership while preserving values and retired binding history.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DetachEnvironmentGitSourceRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "The binding was retired; values and audit evidence are preserved."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/gitops/source/rebind": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EnvironmentGitOpsProjectSlug"
        },
        {
          "$ref": "#/components/parameters/EnvironmentGitOpsEnvironment"
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "rebindEnvironmentGitSource",
        "summary": "Retire the binding and create a verified report source requiring fresh approval.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RebindEnvironmentGitSourceRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Replacement source requiring a new definition review and ownership adoption.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvironmentGitSource"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/environment-field-ownership": {
      "put": {
        "tags": [
          "projects"
        ],
        "operationId": "claimEnvironmentFieldOwnership",
        "summary": "Reserve scoped Terraform variable, source or configuration fields against Git adoption.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnvironmentFieldOwnershipRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Scoped fields were reserved, or the request targets legacy unscoped intent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvironmentFieldOwnershipResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "projects"
        ],
        "operationId": "releaseEnvironmentFieldOwnership",
        "summary": "Release scoped Terraform field ownership without changing values.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnvironmentFieldOwnershipRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The specified ownership claims were released; values were preserved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvironmentFieldOwnershipResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/gitops/plan": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EnvironmentGitOpsProjectSlug"
        },
        {
          "$ref": "#/components/parameters/EnvironmentGitOpsEnvironment"
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "previewEnvironmentGitPlan",
        "summary": "Preview field changes for an immutable commit without approval or writes.",
        "description": "Requires environment read scope and a bound Git source. Verifies the immutable commit, repository identity and definition scope, then observes current intent and ownership. Values are redacted. The candidate plan cannot approve, adopt, deploy or certify runtime readiness. Request a fresh plan after source or environment changes.",
        "requestBody": {
          "required": true,
          "description": "Immutable commit to assess using the bound Git source.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreviewEnvironmentGitRevisionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Read-only field plan with redacted values and current observation metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreviewEnvironmentGitPlanResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/gitops/promotion-plan": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EnvironmentGitOpsProjectSlug"
        },
        {
          "$ref": "#/components/parameters/EnvironmentGitOpsEnvironment"
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "previewEnvironmentGitPromotion",
        "summary": "Preview image promotion from a proven serving environment release.",
        "description": "Read-only, value-redacted proposal. Reads both bound sources, source release, current graph evidence, artifacts, target intent and ownership on one snapshot. Source builds without a portable artifact reference are blocked. The hash grants no approval or execution authority; expected_plan_hash rejects changed observations. Target review and fresh qualification remain required.",
        "requestBody": {
          "required": true,
          "description": "Source environment, immutable target-manifest commit, and optional previously reviewed observation hash.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreviewEnvironmentGitPromotionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Read-only promotion proposal; blockers prevent patch and manifest export.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreviewEnvironmentGitPromotionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/gitops/releases": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EnvironmentGitOpsProjectSlug"
        },
        {
          "$ref": "#/components/parameters/EnvironmentGitOpsEnvironment"
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "listEnvironmentGitReleases",
        "summary": "List retained GitOps serving releases and current rollback eligibility.",
        "description": "Verifies the immutable target manifest commit through the bound provider and assesses each release using the rollback planner on one scoped observation snapshot per page. Only completed serving history of the current source is listed. Eligibility can change after observation. Release compatibility deadlines do not guarantee artifact retention. This read-only catalog never pins artifacts or authorizes rollback execution.",
        "parameters": [
          {
            "name": "target_commit_sha",
            "in": "query",
            "required": true,
            "description": "Immutable commit containing the target manifest whose configuration will be preserved.",
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{40}$"
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "description": "next_before release UUID from the previous recovery page in this Git source scope.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded recovery catalog with current eligibility and public artifact identities.",
            "headers": {
              "Cache-Control": {
                "description": "Recovery observations must always be refreshed before use.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListEnvironmentGitReleasesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/gitops/rollback-plan": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EnvironmentGitOpsProjectSlug"
        },
        {
          "$ref": "#/components/parameters/EnvironmentGitOpsEnvironment"
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "previewEnvironmentGitRollback",
        "summary": "Propose a code rollback from a retained GitOps serving release.",
        "description": "Read-only, value-redacted proposal selecting exact retained artifacts in this environment. Rechecks historical serving evidence, current artifact trust, identity mappings, target intent and ownership on one snapshot. It preserves current configuration and changes only compatible workload sources. Review the observation hash before export; normal Git approval and fresh qualification remain required.",
        "requestBody": {
          "required": true,
          "description": "Retained release UUID, immutable target-manifest commit, and optional previously reviewed observation hash.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreviewEnvironmentGitRollbackRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Read-only rollback proposal; blockers prevent patch and manifest export.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreviewEnvironmentGitRollbackResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/gitops/revisions/preview": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EnvironmentGitOpsProjectSlug"
        },
        {
          "$ref": "#/components/parameters/EnvironmentGitOpsEnvironment"
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "previewEnvironmentGitRevision",
        "summary": "Fetch an immutable commit and review its definition digest.",
        "requestBody": {
          "required": true,
          "description": "Fetch an immutable commit and review its definition digest. request.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreviewEnvironmentGitRevisionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Fetch an immutable commit and review its definition digest. result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreviewEnvironmentGitRevisionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/gitops/revisions/approve": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EnvironmentGitOpsProjectSlug"
        },
        {
          "$ref": "#/components/parameters/EnvironmentGitOpsEnvironment"
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "approveEnvironmentGitRevision",
        "summary": "Approve reviewed Git bytes and enqueue durable reconciliation.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Approve reviewed Git bytes and enqueue durable reconciliation. request.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApproveEnvironmentGitRevisionRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Approve reviewed Git bytes and enqueue durable reconciliation. result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApproveEnvironmentGitRevisionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/gitops/adoption-preview": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EnvironmentGitOpsProjectSlug"
        },
        {
          "$ref": "#/components/parameters/EnvironmentGitOpsEnvironment"
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "previewEnvironmentGitOpsAdoption",
        "summary": "Preview adoption without changing ownership or resource values.",
        "responses": {
          "200": {
            "description": "Preview adoption without changing ownership or resource values. result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvironmentGitOpsPlan"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/gitops/adopt": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EnvironmentGitOpsProjectSlug"
        },
        {
          "$ref": "#/components/parameters/EnvironmentGitOpsEnvironment"
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "adoptEnvironmentGitOps",
        "summary": "Adopt fields from a current reviewed plan while preserving their values.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Adopt fields from a current reviewed plan while preserving their values. request.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdoptEnvironmentGitOpsRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Adopt fields from a current reviewed plan while preserving their values. result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdoptEnvironmentGitOpsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/gitops/overrides": {
      "parameters": [
        {
          "$ref": "#/components/parameters/EnvironmentGitOpsProjectSlug"
        },
        {
          "$ref": "#/components/parameters/EnvironmentGitOpsEnvironment"
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "createEnvironmentGitOpsOverride",
        "summary": "Permit a temporary edit to one Git-owned field.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Permit a temporary edit to one Git-owned field. request.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnvironmentGitOpsOverrideRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Permit a temporary edit to one Git-owned field. result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvironmentGitOpsOverrideRequest"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "projects"
        ],
        "operationId": "removeEnvironmentGitOpsOverride",
        "summary": "Revoke a temporary field override and enqueue reconciliation.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Revoke a temporary field override and enqueue reconciliation. request.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RemoveEnvironmentGitOpsOverrideRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Revoke a temporary field override and enqueue reconciliation. result."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/config": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project slug owning the environment configuration.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Environment slug whose configuration is addressed.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$"
          }
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getProjectEnvironmentConfig",
        "summary": "Get the latest non-secret environment configuration.",
        "responses": {
          "200": {
            "description": "Latest immutable configuration version, or the implicit empty configuration.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentConfigResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "put": {
        "tags": [
          "projects"
        ],
        "operationId": "updateProjectEnvironmentConfig",
        "summary": "Append a non-secret environment configuration version.",
        "description": "Secret-shaped keys are rejected; sensitive values belong in the secrets surface.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateProjectEnvironmentConfigRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Stored immutable configuration version.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentConfigResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/secrets": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project slug whose environment shares the listed secrets.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Environment whose shared secrets are addressed.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$"
          }
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "listProjectEnvironmentSecrets",
        "summary": "List the secrets shared by every service of a project environment.",
        "description": "Metadata only: key, version, sealing key id and value\nfingerprint. Values are write-only and never returned.\n",
        "responses": {
          "200": {
            "description": "The environment's shared secrets and the plan's limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentSharedSecretsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/secrets/{key}": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project slug whose environment shares the secret.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Environment whose shared secret is addressed.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$"
          }
        },
        {
          "$ref": "#/components/parameters/SecretKey"
        }
      ],
      "put": {
        "tags": [
          "projects"
        ],
        "operationId": "setProjectEnvironmentSecret",
        "summary": "Set a secret shared by every service of a project environment.",
        "description": "Seals the value for the fleet and stores it once for the environment. Each service receives it at its next boot unless it sets\nthe same key itself; services' snapshots in the environment are\ninvalidated. Platform identity keys are rejected.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetProjectEnvironmentSharedSecretRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The stored secret's metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentSharedSecretResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlanLimitProjectSecrets"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/SecretValueTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "projects"
        ],
        "operationId": "deleteProjectEnvironmentSecret",
        "summary": "Delete a secret shared by a project environment.",
        "description": "Services stop receiving it at their next boot.",
        "responses": {
          "204": {
            "description": "The shared secret was removed."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/secrets/{key}/rotate": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project slug whose environment shares the rotated secret.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Environment whose shared secret is rotated.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$"
          }
        },
        {
          "$ref": "#/components/parameters/SecretKey"
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "rotateProjectEnvironmentSecret",
        "summary": "Replace the value of an existing shared secret.",
        "description": "Like PUT, but an unknown key is 404 instead of being created.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetProjectEnvironmentSharedSecretRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The rotated secret's metadata, with its new version.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentSharedSecretResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/SecretValueTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/releases": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project slug owning the environment release inventory.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Environment whose current live releases are requested.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$"
          }
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getProjectEnvironmentReleases",
        "summary": "Get current live releases for a project environment.",
        "description": "Returns one non-secret release record for every project workload.\nWorkloads without a live deployment are returned with\n`status=not_deployed`. Configuration values and secret material are\nnever included.\n",
        "responses": {
          "200": {
            "description": "Current environment release inventory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentReleaseListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/release-sets": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project slug owning the release set.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Target project environment.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$"
          }
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "listProjectReleaseSets",
        "summary": "List active, retired, and expired project release sets.",
        "description": "Returns newest first, ordered by created_at and ID descending. Pass next_before as before for the next page.",
        "parameters": [
          {
            "name": "before",
            "in": "query",
            "description": "Continue release-set history from the next_before cursor returned by the preceding page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum number of release sets to return.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Page of release graphs owned by the requested project environment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectReleaseSetListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "publishProjectReleaseSet",
        "summary": "Atomically activate an immutable project deployment graph.",
        "description": "Every project workload must have one live deployment and revision pinning enabled for at least the requested TTL. Previous release sets remain addressable until expiry.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublishProjectReleaseSetRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Published release set.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectReleaseSetResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/qualifications": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project whose source environment release is being qualified.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Source environment containing the exact active release set.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$"
          }
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "createProjectEnvironmentQualification",
        "summary": "Record health and smoke results for an active release set.",
        "description": "Records a closed-schema qualification receipt for the exact active\nrelease-set ID, non-secret source configuration version/hash, and\nper-workload secret revision fingerprints. Fingerprints include only\nrevision metadata and managed credential generations, never secret\nvalues or value hashes.\nEach health and smoke result identifies every workload's exact\ndeployment and contains only its HTTP status or a bounded error code;\nresponse bodies and secrets are never stored. The API rejects probes\nif the release set, configuration, or secret revisions change before\nreceipt creation.\nReceipts expire after 24 hours and cannot qualify a later release set\nor configuration or secret revision.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateProjectEnvironmentQualificationRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Qualification receipt, expiring 24 hours after creation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentQualificationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/release-sets/active": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project whose active release is requested.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Environment whose active graph should be returned.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getActiveProjectReleaseSet",
        "summary": "Get the active project release graph.",
        "description": "Returns 404 when no active release exists in this project environment.",
        "responses": {
          "200": {
            "description": "Currently active release graph and its immutable deployment membership.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectReleaseSetResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/release-sets/{release}": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project owning the specific release being inspected.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Environment that originally published the requested release.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "release",
          "in": "path",
          "required": true,
          "description": "Release-set UUID.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getProjectReleaseSet",
        "summary": "Inspect a specific project release graph.",
        "description": "Includes retired and expired graphs for diagnosis; this read does not make them routable.",
        "responses": {
          "200": {
            "description": "Requested historical release graph, including its activation and expiry metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectReleaseSetResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/state": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project whose environment state is requested.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Target environment whose effective state is returned.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$"
          }
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getProjectEnvironmentState",
        "summary": "Get effective state for a project environment.",
        "description": "Returns configuration, live releases, non-secret runtime variables,\nsecret fingerprints, and managed binding metadata. Secret plaintext,\nciphertext, and sealing-key identifiers are never returned. Resources\nthat remain application-scoped are identified under shared_resources.\n",
        "responses": {
          "200": {
            "description": "Effective environment state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentStateResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/workloads/{workload}/routes": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project owning the environment.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Registered environment whose route contract is replaced.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "workload",
          "in": "path",
          "required": true,
          "description": "Workload application slug in the project.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "put": {
        "tags": [
          "projects"
        ],
        "operationId": "updateProjectEnvironmentRoutes",
        "summary": "Replace a workload's declared-route contract in one environment.",
        "description": "Scoped deployment URLs use this contract; the ordinary application hostname retains its application-wide contract.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateProjectEnvironmentRoutePolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Stored environment-owned route contract.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentRoutePolicyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/workloads/{workload}/policies": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project containing the environment-specific edge policy.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Registered environment whose headers/CORS policy is replaced.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "workload",
          "in": "path",
          "required": true,
          "description": "Workload slug whose environment-specific edge policy is replaced.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "put": {
        "tags": [
          "projects"
        ],
        "operationId": "updateProjectEnvironmentPolicies",
        "summary": "Replace headers and CORS rules for a workload in one environment.",
        "description": "An explicit empty list disables inherited headers/CORS rules on the stable environment URL. Other edge-rule kinds and ordinary application hosts are unchanged.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateProjectEnvironmentEdgePolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Stored environment-owned headers/CORS policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentEdgePolicyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/workloads/{workload}/queue-bindings": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project containing the workload and stage.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Registered stage. Production is managed through the app queue-bindings API.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "workload",
          "in": "path",
          "required": true,
          "description": "Workload application slug belonging to this project.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getProjectEnvironmentQueueBindings",
        "summary": "Read a stage workload's complete desired queue configuration.",
        "description": "Returns logical definitions and the current workload revision. A missing\ncollection returns 409 environment_queue_collection_unavailable and never\ninherits production queues. X-Gregale-Workload-Revision identifies the\nhead to use when initializing or replacing the collection.\nConsumer activation is currently unavailable; saved definitions do not\nactivate delivery or qualify the stage for promotion.\n",
        "responses": {
          "200": {
            "description": "Complete stage-owned desired queue collection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentQueueBindingsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "put": {
        "tags": [
          "projects"
        ],
        "operationId": "replaceProjectEnvironmentQueueBindings",
        "summary": "Replace a stage workload's complete desired queue configuration.",
        "description": "Requires expected_revision to match the complete workload settings head,\nwith zero for an uninitialized workload. An explicit empty bindings list\nremoves all stage definitions. Stale revisions and protected stages\nreturn 409, including protected no-op writes. Definitions have logical\nnames and no production consumer IDs. Existing deployments retain their\npinned definitions. Consumer activation is currently unavailable.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReplaceProjectEnvironmentQueueBindingsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Stored desired queue definitions and their workload revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentQueueBindingsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/diff": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project slug whose environments are compared.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Target environment.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$"
          }
        },
        {
          "name": "from",
          "in": "query",
          "required": true,
          "description": "Source environment being compared with the target environment.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$"
          }
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getProjectEnvironmentDiff",
        "summary": "Compare two effective project environments.",
        "description": "Compares configuration, releases, runtime variables, secret\nfingerprints and credential generations, and managed bindings. Secret\nvalues are never returned. A secret without a fingerprint is reported\nas unknown rather than incorrectly reported as equal.\n",
        "responses": {
          "200": {
            "description": "Unified effective-state diff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentDiffResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/config/diff": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project slug whose environment configurations are compared.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Destination environment for the configuration comparison.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$"
          }
        },
        {
          "name": "from",
          "in": "query",
          "required": true,
          "description": "Baseline environment for the configuration snapshot comparison.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$"
          }
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getProjectEnvironmentConfigDiff",
        "summary": "Compare two environment configuration snapshots.",
        "responses": {
          "200": {
            "description": "Stable key-level configuration diff ordered by key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentConfigDiffResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/approval-requests": {
      "parameters": [
        {
          "name": "slug",
          "description": "Project slug for promotion browser approval request.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "environment",
          "description": "Target registered environment slug for promotion browser approval request.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "requestBrowserPromotionApproval",
        "summary": "Request signed-in human review of an exact protected promotion.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BrowserPromotionApprovalRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Private bridge response; credentials must never be returned to an agent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrowserPromotionApprovalResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/approval-requests/exchange": {
      "parameters": [
        {
          "name": "slug",
          "description": "Project slug for authorized promotion ticket exchange.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "environment",
          "description": "Target registered environment slug for authorized promotion ticket exchange.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "exchangeBrowserPromotionApproval",
        "summary": "Privately poll a browser-approved promotion; retry returns the same unconsumed credential.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BrowserPromotionApprovalExchange"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Existing promotion approval bound to the reviewed plan, after human authorization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentApprovalResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/approvals": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project slug owning the protected environment.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Protected environment slug to approve.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$"
          }
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "approveProjectEnvironment",
        "summary": "Approve one exact plan for a protected project environment.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateProjectEnvironmentApprovalRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Short-lived approval credential.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentApprovalResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/approvals/{approval}": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project slug owning the approval lookup.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Protected environment slug containing the approval.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$"
          }
        },
        {
          "name": "approval",
          "in": "path",
          "required": true,
          "description": "Durable approval identifier returned when the approval is created.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getProjectEnvironmentApprovalStatus",
        "summary": "Get the lifecycle status of a project environment approval.",
        "description": "The raw approval token is never returned by this endpoint.",
        "responses": {
          "200": {
            "description": "Durable approval lifecycle status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentApprovalStatusResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/promotion-preview": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project slug owning the environment promotion preview.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Target environment receiving the promotion preview.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$"
          }
        }
      ],
      "get": {
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "description": "Source environment whose live releases are compared with the target.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$"
            }
          },
          {
            "name": "sync_config",
            "in": "query",
            "required": false,
            "description": "Opt in to copying the source's non-secret configuration atomically with the target release graph.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "verify",
            "in": "query",
            "required": false,
            "description": "Require destination HTTP probes before cutover and success; requires snapshot-aware sync_config and qualified operator admission.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "migrate",
            "in": "query",
            "required": false,
            "description": "Run exactly one source release command as a backward-compatible destination migration before health probes. Requires sync_config, verify and qualified migration admission. Schema changes remain after code/config rollback.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "workers",
            "in": "query",
            "required": false,
            "description": "Promote HTTP services and one existing production push worker with coordinated job admission and delivery health. Requires sync_config and verify; migration combinations are unsupported.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "tags": [
          "projects"
        ],
        "operationId": "getProjectEnvironmentPromotionPreview",
        "summary": "Preview promotion of live workloads between project environments.",
        "description": "Read-only comparison of the source and target environment. The\nresponse includes non-secret configuration changes, live deployment\nidentities, target protection state, and an opaque promotion token\nbound to those identities. It does not create deployments or audit\nmutations. Configuration remains target-scoped by default;\n`sync_config=true` opts into applying the source's non-secret\nconfiguration snapshot with the release graph, and is blocked unless\nthe target already has an active release graph for atomic cutover.\nProtected-target promotions from an active source release set also\nrequire the latest passing health and smoke qualification, which is\nbound to that immutable release-set ID and expires after 24 hours.\nWith `verify=true`, the exact GET/HEAD critical probe policy is also\ncaptured in the approval identity. The first milestone requires pinned\nHTTP configuration, a probe for every HTTP workload, at most five probes,\nand at least 21 minutes of revision retention. With `workers=true`, one\nexisting production push worker participates in the same cutover. Its\ndestination binding and credentials remain unchanged; startup proof and\nreal delivery health gate promotion.\n",
        "responses": {
          "200": {
            "description": "Promotion preview and immutable promotion identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentPromotionPreviewResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "previewProjectEnvironmentPromotionSecrets",
        "summary": "Preview promotion with destination production secret changes.",
        "description": "Read-only, bounded preview containing immutable secret version references\nfrom the authenticated release-secrets staging endpoint. Requires MFA,\nsecrets write permission, sync_config, verify, complete HTTP release graphs\nand production as the destination. Existing application-owned persistent\nsecret keys only; workers, migrations, managed credentials, explicit grants\nand reload hooks are refused. Each mentioned workload supplies a complete\nsecret map; an empty map removes its serving secrets and omitted workloads\ninherit production versions. Source secrets are never copied. Approval and\nexecution revalidate the exact versions and destination baseline. New\nadmissions also require qualified operator rollout for the secrets scope.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectEnvironmentPromotionSecretPreviewRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Promotion preview with secret key changes and version references only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentPromotionPreviewResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Secret releases or destination verification are unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/promote": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project slug owning the environment promotion.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Target environment receiving the promotion.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$"
          }
        },
        {
          "name": "Idempotency-Key",
          "in": "header",
          "required": true,
          "description": "Stable key for retrying this promotion without duplicating deployments.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          }
        },
        {
          "$ref": "#/components/parameters/EnvironmentPromotionAttemptHeader"
        },
        {
          "$ref": "#/components/parameters/EnvironmentPromotionRequestHashHeader"
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "promoteProjectEnvironment",
        "summary": "Execute a guarded promotion between project environments.",
        "description": "Revalidates the supplied promotion token against current live\ndeployments and environment configuration before promoting immutable\nsource artifacts. Protected targets also require an approval token\nissued for that exact promotion. After cutover, every target artifact\nis verified against its source release and target environment. A\nfailed verification automatically rolls back the promotion. Target\nconfiguration remains target-scoped unless the token was created with\n`sync_config=true`; secrets are never copied from the source environment.\nA health-gated promotion returns 202 with status=running. A leased worker\nchecks dark candidates in the destination before atomic cutover, then\nrequires fresh post-cutover health. Check the promotion status endpoint\nfor phase, evidence, deadline and any guarded automatic rollback.\nExcess verified promotions wait durably with health.phase=queued and an\nadmission receipt for at most 15 minutes. Dispatch revalidates the approved\nintent before preparing workloads and starts a fresh health window.\nA full waiting queue returns 429 (project_promotion_queue_full) with\nRetry-After; no operation is accepted and approval remains available.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PromoteProjectEnvironmentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Promotion result for each project workload.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentPromotionResponse"
                }
              }
            }
          },
          "202": {
            "description": "Health-gated promotion accepted; destination health and cutover are pending.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentPromotionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/promotions": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project slug owning the promotion history.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Target environment whose promotion history is requested.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$"
          }
        },
        {
          "name": "before",
          "in": "query",
          "required": false,
          "description": "Opaque cursor returned as next_before.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "limit",
          "in": "query",
          "required": false,
          "description": "Page size, capped at 100.",
          "schema": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 50
          }
        },
        {
          "name": "from",
          "in": "query",
          "required": false,
          "description": "Restrict history to promotions from this source environment.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$"
          }
        },
        {
          "name": "status",
          "in": "query",
          "required": false,
          "description": "Restrict history to a promotion lifecycle status.",
          "schema": {
            "type": "string",
            "enum": [
              "running",
              "succeeded",
              "failed"
            ]
          }
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "listProjectEnvironmentPromotions",
        "summary": "List project environment promotion history.",
        "description": "Returns newest-first compact promotion history. Use the promotion status endpoint for per-workload checkpoints.",
        "responses": {
          "200": {
            "description": "Cursor-paginated promotion history.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentPromotionListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/promotions/{promotion}": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project slug owning the promotion status operation.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Target environment associated with the promotion status operation.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$"
          }
        },
        {
          "name": "promotion",
          "in": "path",
          "required": true,
          "description": "Durable promotion operation identifier.",
          "schema": {
            "type": "string",
            "minLength": 1
          }
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getProjectEnvironmentPromotionStatus",
        "summary": "Get durable project environment promotion status.",
        "description": "Returns the operation status, post-cutover verification result, and non-secret per-workload checkpoints for a promotion.",
        "responses": {
          "200": {
            "description": "Durable promotion status, including post-cutover verification and any automatic rollback.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentPromotionStatusResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/promotions/{promotion}/abort": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project slug owning the abort request.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Destination environment of the promotion being aborted.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "promotion",
          "in": "path",
          "required": true,
          "description": "Durable promotion identifier to abort.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "abortProjectEnvironmentPromotion",
        "summary": "Abort an in-progress environment promotion.",
        "description": "A durable generation-fenced operator decision. Before cutover, abort preserves destination intent and retires unused candidates. After cutover, abort or recover requires fresh server-owned baseline health and worker startup proof before atomic restoration. Recovery never rebuilds or extends retention. Migration incidents use recover-migration. Identical request replay returns that decision's durable receipt even after a newer decision.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectPromotionControlRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Terminal operator decision acknowledgement.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectPromotionControl"
                }
              }
            }
          },
          "202": {
            "description": "Restoration requested; fresh baseline checks are pending.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectPromotionControl"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Stale generation, reused request identity, unsupported phase, or changed destination intent; inspect promotion status."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/promotions/{promotion}/recover": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project slug owning the restoration recovery request.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Destination environment receiving the restored baseline.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "promotion",
          "in": "path",
          "required": true,
          "description": "Durable promotion identifier whose blocked restoration is being retried.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "recoverProjectEnvironmentPromotion",
        "summary": "Retry guarded restoration of a blocked environment promotion.",
        "description": "Retry a blocked restoration with a generation-fenced operator decision. Fresh server-owned baseline health and worker startup proof are required before atomic restoration. The retained baseline is reused without rebuilding or extending retention; migration incidents require recover-migration. An identical request replays its original durable receipt even after a newer decision.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectPromotionControlRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Terminal acknowledgement of the restoration recovery decision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectPromotionControl"
                }
              }
            }
          },
          "202": {
            "description": "Recovery accepted; baseline health and worker startup checks are pending.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectPromotionControl"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Recovery rejected because the inspected generation, request identity, phase or destination intent no longer permits restoration."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/promotions/{promotion}/recover-migration": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project slug owning the migration recovery request.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Destination environment whose migration was inspected.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "promotion",
          "in": "path",
          "required": true,
          "description": "Durable promotion identifier with the interrupted migration task.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "recoverProjectEnvironmentPromotionMigration",
        "summary": "Recover an interrupted promotion migration without replaying SQL.",
        "description": "Records explicit database inspection, requests scheduler-confirmed teardown of the original runtime, and either resumes the captured promotion's health checks or resolves the incident through a different verified active repair promotion. Original task outcomes remain unchanged. Same-request replay returns the durable acknowledgement.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectPromotionMigrationRecoveryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Existing terminal recovery acknowledgement.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectPromotionMigrationRecovery"
                }
              }
            }
          },
          "202": {
            "description": "Recovery accepted; scheduler teardown or server verification is pending.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectPromotionMigrationRecovery"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Task, generation, runtime or destination intent changed; inspect current promotion status."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/promotion-attempts/{attempt_id}": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project containing this original promotion.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Original promotion destination environment.",
          "schema": {
            "type": "string"
          }
        },
        {
          "$ref": "#/components/parameters/EnvironmentPromotionAttempt"
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getEnvironmentPromotionReceipt",
        "summary": "Read acceptance of an original environment promotion attempt.",
        "description": "Returns immutable admission evidence for the original project, source and target identities. Replacement environments cannot inherit receipts. Promotion completion, per-workload progress and health require separate observations. Missing evidence never proves non-commit. The read never retries a promotion or requires write permission.",
        "responses": {
          "200": {
            "description": "Original promotion acceptance; native completion is not inferred.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvironmentPromotionReceipt"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/promotions/{promotion}/rollback-attempts/{attempt_id}": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project owning the original rollback.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Original target environment slug.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "promotion",
          "in": "path",
          "required": true,
          "description": "Exact original promotion identifier.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "$ref": "#/components/parameters/EnvironmentRollbackAttempt"
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getEnvironmentRollbackReceipt",
        "summary": "Read acceptance of an original environment rollback attempt.",
        "description": "Returns immutable admission evidence for the original project, source and target identities. Replacement environments cannot inherit receipts. Restoration, per-workload progress and health require separate observations. Missing evidence never proves non-commit. The read never retries a rollback or requires write permission.",
        "responses": {
          "200": {
            "description": "Original rollback acceptance; native restoration is not inferred.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvironmentRollbackReceipt"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/promotions/{promotion}/rollback": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project slug owning the promotion rollback operation.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Target environment receiving the promotion rollback.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$"
          }
        },
        {
          "name": "promotion",
          "in": "path",
          "required": true,
          "description": "Durable promotion operation identifier to roll back.",
          "schema": {
            "type": "string",
            "minLength": 1
          }
        },
        {
          "name": "Idempotency-Key",
          "in": "header",
          "required": true,
          "description": "Stable key that makes this rollback replayable without repeating cutover.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          }
        },
        {
          "$ref": "#/components/parameters/EnvironmentRollbackAttemptHeader"
        },
        {
          "$ref": "#/components/parameters/EnvironmentRollbackRequestHashHeader"
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "rollbackProjectEnvironmentPromotion",
        "summary": "Roll back a completed or failed project environment promotion.",
        "description": "Restores each workload to the target deployment captured before the\npromotion. Workloads created by the promotion are failed and removed\nfrom traffic when there was no prior target. The operation refuses to\noverwrite a target changed after the promotion and records durable\nper-workload rollback checkpoints.\n",
        "responses": {
          "200": {
            "description": "Durable rollback status and per-workload restoration result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentPromotionStatusResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/delete-preview": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project slug whose deletion impact should be previewed.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          }
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "previewDeleteProject",
        "summary": "Preview the workloads and related state affected by project deletion.",
        "responses": {
          "200": {
            "description": "Deletion impact. Workloads and their related resources remain live after detachment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectDeletePreviewResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/exclusions/{slug2}": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Project slug (the (account, project) namespace owning the persisted exclusion).",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "slug2",
          "in": "path",
          "required": true,
          "description": "Excluded workload slug (the app slug persisted via a prior --persist-exclude deploy).",
          "schema": {
            "type": "string"
          }
        }
      ],
      "delete": {
        "tags": [
          "projects"
        ],
        "operationId": "deleteDeploymentScopeExclusion",
        "summary": "Drop a persisted --exclude row from deployment_scope_exclusions.",
        "description": "Operator escape hatch (code-review fix #2) for\nwhen a persisted slug no longer exists in the repo\n(workload was renamed or deleted) and is blocking\nsubsequent deploys via exclude_unknown_slug. Without\nthis endpoint the only option was psql + hand-DELETE;\nthe CLI's `gregale deployments exclude clear\n--slug=NAME --project-slug=SLUG` calls into here as the\noperator-grade path. Idempotent — DELETE on no row\nreturns 404 scope_exclusion_not_found so the CLI can\nrender \"already clear\" without surfacing a hard error.\n",
        "responses": {
          "200": {
            "description": "The exclusion was cleared.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "Either the project does not exist or no persisted\nexclusion matches the slug. Both surface as\nscope_exclusion_not_found so the existence of a\nproject is not leaked via the operator surface.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/alerts": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "alert_rules"
        ],
        "operationId": "listAlertRules",
        "summary": "List alert rules visible at this app.",
        "description": "Returns both app-scoped rules (app_id == <slug>) and\naccount-wide rules (app_id == \"\"). Account-wide rules\napply to every app on the account.\n",
        "responses": {
          "200": {
            "description": "Alert rules on the account, filtered to those visible at this app.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AlertRuleResponse"
                  }
                },
                "example": [
                  {
                    "id": "0123456789abcdef0123456789abcdef",
                    "app_id": "0123456789abcdef0123456789abcdef",
                    "name": "p99 > 500ms",
                    "enabled": true,
                    "metric": "latency_p99_ms",
                    "comparison": "gt",
                    "threshold": 500,
                    "window_spec": "5m",
                    "webhook_url": "https://example.com/hook",
                    "webhook_secret_sealed_masked": "***",
                    "cooldown_minutes": 15,
                    "state": "ok",
                    "created_at": "2026-07-28T10:00:00Z",
                    "updated_at": "2026-07-28T10:00:00Z"
                  },
                  {
                    "id": "fedcba9876543210fedcba9876543210",
                    "app_id": "",
                    "name": "error_rate > 1%",
                    "enabled": true,
                    "metric": "error_rate_pct",
                    "comparison": "gt",
                    "threshold": 1,
                    "window_spec": "15m",
                    "webhook_url": "https://example.com/acct",
                    "webhook_secret_sealed_masked": "***",
                    "cooldown_minutes": 30,
                    "state": "ok",
                    "created_at": "2026-07-28T09:00:00Z",
                    "updated_at": "2026-07-28T09:00:00Z"
                  }
                ]
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AlertRuleInvalid"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "alert_rules"
        ],
        "operationId": "createAlertRule",
        "summary": "Create an alert rule.",
        "description": "Plaintext webhook_secret arrives in the body, is sealed\nvia the host age recipient, and never appears in a\nresponse. webhook_url is SSRF-guarded at write time\n(loopback + metadata ranges denied).\n",
        "requestBody": {
          "required": true,
          "description": "Alert rule payload. See CreateAlertRuleRequest.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAlertRuleRequest"
              },
              "example": {
                "name": "p99 > 500ms",
                "metric": "latency_p99_ms",
                "comparison": "gt",
                "threshold": 500,
                "window_spec": "5m",
                "webhook_url": "https://example.com/hook",
                "webhook_secret": "shh",
                "cooldown_minutes": 15
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "201": {
            "description": "The new alert rule (carries the masked secret).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlertRuleResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/AlertRuleInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AlertRuleInvalid"
          },
          "403": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AlertRuleInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/alerts/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "alert_rules"
        ],
        "operationId": "getAlertRule",
        "summary": "Fetch one alert rule by id.",
        "responses": {
          "200": {
            "description": "The alert rule.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlertRuleResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "tags": [
          "alert_rules"
        ],
        "operationId": "updateAlertRule",
        "summary": "Partial-update an alert rule.",
        "description": "Every field is optional. metric cannot cross families\n(e.g. error_rate_pct → failed_invocations) — returns\n400 alert_rule_invalid.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAlertRuleRequest"
              },
              "example": {
                "name": "p99 > 750ms",
                "cooldown_minutes": 30
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated alert rule.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlertRuleResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/AlertRuleInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AlertRuleInvalid"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "alert_rules"
        ],
        "operationId": "deleteAlertRule",
        "summary": "Delete an alert rule.",
        "responses": {
          "204": {
            "description": "No body. The rule was removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AlertRuleInvalid"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/alerts/{id}/rotate-secret": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "post": {
        "tags": [
          "alert_rules"
        ],
        "operationId": "rotateAlertRuleSecret",
        "summary": "Install a new webhook HMAC secret.",
        "description": "Seals the caller-supplied replacement and overwrites the row in place.\nCutover is immediate with no old-key overlap; install the replacement\nin the receiver before calling. The plaintext is never returned.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RotateAlertRuleSecretRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Rotation succeeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RotateAlertRuleSecretResponse"
                },
                "example": {
                  "rotated_at": "2026-07-28T12:00:00Z",
                  "webhook_secret_sealed_masked": "***"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AlertRuleInvalid"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/alerts/{id}/deliveries": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        },
        {
          "in": "query",
          "name": "include_test",
          "schema": {
            "type": "boolean",
            "default": false
          },
          "required": false,
          "description": "When true, also surface rows written by Dispatcher.DispatchTest\n(the customer-facing \"send test alert\" path). Default false\nhides test rows so the customer's recent-deliveries pane is\nnot polluted by every \"send test alert\" click. Operators can\nflip the toggle for post-mortems; the production read stays\nindex-only via the partial index\nalert_deliveries_rule_fired_production_idx.\n"
        },
        {
          "in": "query",
          "name": "limit",
          "schema": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 50
          },
          "required": false,
          "description": "Max rows to return. Clamped to 100."
        }
      ],
      "get": {
        "tags": [
          "alert_rules"
        ],
        "operationId": "listAlertRuleDeliveries",
        "summary": "List recent alert_deliveries rows for one rule.",
        "description": "Returns the most-recent alert_deliveries rows for the rule,\nnewest-first. The default (include_test=false) hides test\nrows; the operator pane is reachable via ?include_test=true.\nIDOR-safe: a 404 is returned when the rule is on another\naccount (same posture as GET /v1/apps/{slug}/alerts/{id}).\n",
        "responses": {
          "200": {
            "description": "Recent deliveries, newest-first.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AlertDeliveryResponse"
                  }
                },
                "example": [
                  {
                    "id": "9b1c4f8e2d3a4b5c6d7e8f9012345678",
                    "rule_id": "rule-1",
                    "account_id": "acct-1",
                    "app_id": "app-1",
                    "idempotency_key": "rule-1:12345678",
                    "status": "delivered",
                    "attempt_count": 1,
                    "last_status_code": 200,
                    "observed_value": 5.1,
                    "fired_at": "2026-08-30T12:00:00Z",
                    "delivered_at": "2026-08-30T12:00:01Z",
                    "is_test": false
                  }
                ]
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/cors-presets": {
      "get": {
        "tags": [
          "cors_presets"
        ],
        "operationId": "listCorsPresets",
        "summary": "List CORS presets visible to the calling account.",
        "description": "Lists every cors_presets row the account owns — both\naccount-wide (app_id IS NULL) and app-scoped (app_id\nis set). The optional `app_id` query parameter filters\nto a single app's scoped presets; absent = union of\naccount-wide + every app-scoped row. No pagination —\nthe per-account quota caps the row count (see the\nplan_cors_preset_quota_reached error code).\n",
        "parameters": [
          {
            "name": "app_id",
            "in": "query",
            "required": false,
            "description": "Optional app filter. Absent = every preset on the\naccount. Set = only the app-scoped presets for that\napp. Cross-tenant IDs collapse to 404.\n",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The list of cors presets.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CorsPresetListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "cors_presets"
        ],
        "operationId": "createCorsPreset",
        "summary": "Create a CORS preset.",
        "description": "Creates a new cors_presets row owned by the caller's\naccount. AppID is optional (null = account-wide; UUID =\napp-scoped). The body validation mirrors the storage-\nside CHECK constraints: name 1..64, max_age 0..86400,\nat-least-one allow_origin + allow_method. The\n*+credentials footgun returns 422\ncors_wildcard_with_credentials when the create body\ncombines AllowCredentials: true with AllowOrigins:\n[\"*\"].\n\nPre-loadApp gates fire in this order: 402\nplan_cors_preset_not_allowed on the Free-tier cap-0 →\n422 cors_preset_invalid on the body shape → 404\ncors_preset_app_not_found on a cross-tenant app_id →\n403 plan_cors_preset_quota_reached on the per-account\n/ per-app cap → 409 cors_preset_name_conflict on a\nduplicate (account_id, COALESCE(app_id, '00..00'),\nname) tuple.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCorsPresetRequest"
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "201": {
            "description": "The created cors preset.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CorsPresetResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/CorsPresetInvalid"
          },
          "403": {
            "$ref": "#/components/responses/CorsPresetInvalid"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/CorsPresetInvalid"
          },
          "422": {
            "$ref": "#/components/responses/CorsPresetInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/cors-presets/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Preset UUID.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "cors_presets"
        ],
        "operationId": "getCorsPreset",
        "summary": "Get a single CORS preset by id.",
        "description": "Returns the canonical cors_presets row. Cross-tenant\nIDs collapse to 404 (no slug-leak). The response is\nthe same shape as POST /v1/cors-presets.\n",
        "responses": {
          "200": {
            "description": "The cors preset.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CorsPresetResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "tags": [
          "cors_presets"
        ],
        "operationId": "patchCorsPreset",
        "summary": "Partial-update a CORS preset.",
        "description": "Applies the partial-update (nil-skip convention) to\nthe cors_presets row. The PATCH body must include at\nleast one field (an empty body returns 422\ncors_preset_update_requires_field). The wire-level\nValidate enforces the same partial grammar as Create\n(CorsOriginPattern on allow_origins if provided,\nnon-empty allow_methods if provided, max_age bound\n0..86400). The handler additionally re-validates the\npost-update merged shape against the *+credentials\nfootgun (a PATCH that flips AllowCredentials to true\nwhile leaving AllowOrigins=[\"*\"] is rejected).\n\nThe pgstore trigger fires pg_notify\n('cors_preset_changed', account_id) AFTER the UPDATE\ncommits so the gateway listener reloads\nthe affected account's preset overlay.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCorsPresetRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated cors preset.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CorsPresetResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/CorsPresetInvalid"
          },
          "422": {
            "$ref": "#/components/responses/CorsPresetInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "cors_presets"
        ],
        "operationId": "deleteCorsPreset",
        "summary": "Delete a CORS preset.",
        "description": "Removes the cors_presets row. The FK ON DELETE SET\nNULL on edge_rules.cors_preset_id clears every\nreferencing rule's FK atomically with the preset's\ndeletion; the gateway compile path fails\nclosed (MergeCorsPresetIntoRule returns ErrNotFound)\nuntil the customer wires a new preset or inlines\nfallback values. The pgstore trigger fires\npg_notify('cors_preset_changed', account_id) AFTER\nthe DELETE commits.\n",
        "responses": {
          "204": {
            "description": "Deleted."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/alert-presets": {
      "get": {
        "tags": [
          "alert_rules"
        ],
        "operationId": "listAlertPresets",
        "summary": "List the alert-preset catalog.",
        "description": "The catalog is intentionally small and bounded, so no pagination.\nRows whose enabled_in_catalog=false are returned with the\nflag set so the dashboard can render \"coming soon\" — the\nenable endpoint rejects them with 400 alert_preset_disabled.\nRows whose minimum_plan is above the caller's plan are\nreturned with enabled_in_catalog unchanged so the dashboard\ncan render an \"upgrade to <plan>\" hint per row.\n",
        "responses": {
          "200": {
            "description": "The catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AlertPresetResponse"
                  }
                },
                "example": [
                  {
                    "id": "0123456789abcdef0123456789abcdef",
                    "name": "error_rate_2pct",
                    "display_name": "Error rate exceeds 2%",
                    "description": "Fires when the rolling 15-minute error rate exceeds 2%.",
                    "category": "reliability",
                    "metric": "error_rate_pct",
                    "comparison": "gt",
                    "threshold": 2,
                    "window_spec": "15m",
                    "default_cooldown_minutes": 15,
                    "minimum_plan": "hobby",
                    "enabled_in_catalog": true
                  },
                  {
                    "id": "fedcba9876543210fedcba9876543210",
                    "name": "api_down",
                    "display_name": "API is down",
                    "description": "Fires when the app has not served a successful invocation in 5 minutes.",
                    "category": "availability",
                    "metric": "api_up",
                    "comparison": "lt",
                    "threshold": 1,
                    "window_spec": "5m",
                    "default_cooldown_minutes": 5,
                    "minimum_plan": "pro",
                    "enabled_in_catalog": false
                  }
                ]
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/alert-presets/{name}/enable": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "Preset name (catalog key — see `listAlertPresets`).",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          }
        }
      ],
      "post": {
        "tags": [
          "alert_rules"
        ],
        "operationId": "enableAlertPreset",
        "summary": "Instantiate a preset as an alert rule.",
        "description": "Clones the catalog row into a real alert_rules row the\ncaller owns from then on. The (metric, comparison,\nthreshold, window_spec, default_cooldown_minutes)\nsextuple is pre-filled server-side; the caller supplies\nwebhook_url + webhook_secret (the delivery channel), an\noptional safe-release action, and cooldown_minutes / enabled\noverrides.\n\nPre-loadApp gates fire in this order: 404 on missing\npreset → 400 alert_preset_disabled on disabled-in-catalog\n→ 402 plan_alert_presets_not_allowed on below-minimum-plan\n→ 400 alert_preset_invalid on body shape → 400\nimage_egress_denied on the SSRF egress guard → 402\nplan_alert_rules_not_allowed on the per-plan cap → 403\nplan_alert_rule_quota on the per-app / per-account cap.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnableAlertPresetRequest"
              },
              "example": {
                "webhook_url": "https://hooks.example.com/alerts",
                "webhook_secret": "shh",
                "action": "rollback",
                "cooldown_minutes": 5,
                "enabled": true
              }
            }
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "201": {
            "description": "The instantiated alert rule (carries the masked secret).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlertRuleResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/AlertRuleInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AlertRuleInvalid"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AlertRuleInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/dashboard/apps/{slug}/alert-presets/{name}/enable": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "Preset name (catalog key — same value the JSON sibling accepts at /v1/apps/{slug}/alert-presets/{name}/enable).",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          }
        }
      ],
      "post": {
        "tags": [
          "alert_rules"
        ],
        "operationId": "dashboardEnableAlertPreset",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "summary": "Form-POST sibling of enableAlertPreset for the dashboard.",
        "description": "Receives application/x-www-form-urlencoded payload from the\npreset-grid form. Coerces the (webhook_url, webhook_secret)\npair into the same EnableAlertPresetRequest body the JSON\nsibling expects, runs the same plan-tier gate, then 302-redirects\nto /apps/{slug}?just_enabled={rule_id}. The web-cookie auth\npath is sufficient — no MFA challenge (the JSON sibling\nrequires MFA via the public-auth middleware).\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/EnableAlertPresetRequest"
              }
            }
          }
        },
        "responses": {
          "302": {
            "description": "Redirect to /apps/{slug}?just_enabled={rule_id}."
          },
          "400": {
            "$ref": "#/components/responses/AlertRuleInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AlertRuleInvalid"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/dashboard/apps/{slug}/debug/requests/{req_id}/replay": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "req_id",
          "in": "path",
          "required": true,
          "description": "Public x-faas-request-id, or the internal telemetry row UUID for compatibility.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      ],
      "post": {
        "tags": [
          "debugger"
        ],
        "operationId": "dashboardReplayAppDebugRequest",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "summary": "Queue a debugger replay from the dashboard.",
        "description": "Accepts the server-rendered dashboard form payload and queues the\nsame metadata-only replay as POST /v1/apps/{slug}/debug/requests/{req_id}/replay.\nThe response redirects to the request detail with a replay_id query\nparameter; request bodies, credentials, and customer headers are\nnever replayed.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "csrf_token": {
                    "type": "string"
                  },
                  "since": {
                    "type": "string"
                  },
                  "route": {
                    "type": "string",
                    "maxLength": 256
                  }
                },
                "required": [
                  "csrf_token"
                ]
              }
            }
          }
        },
        "responses": {
          "303": {
            "description": "Redirect to the request detail and replay status."
          },
          "400": {
            "description": "Invalid dashboard CSRF token or form payload.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "No enabled mirror rule targets the serving deployment.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/dashboard/failed-events/{slug}/{id}/replay": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Unified failed-event identifier to replay.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      ],
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "dashboardReplayFailedEvent",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "summary": "Replay a failed event from the dashboard.",
        "description": "Resets the source event to pending and redirects to the Failed Events inbox.",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "csrf_token"
                ],
                "properties": {
                  "csrf_token": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "303": {
            "description": "Redirect to the account-wide Failed Events inbox after replay."
          },
          "400": {
            "description": "Invalid dashboard CSRF token for account-event replay.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/dashboard/failed-events/{slug}/{id}/discard": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Unified failed-event identifier to discard.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      ],
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "dashboardDiscardFailedEvent",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "summary": "Discard a failed event from the dashboard.",
        "description": "Removes the ledger projection and redirects to the Failed Events inbox.",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "csrf_token"
                ],
                "properties": {
                  "csrf_token": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "303": {
            "description": "Redirect to the account-wide Failed Events inbox after discard."
          },
          "400": {
            "description": "Invalid dashboard CSRF token for account-event discard.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/dashboard/failed-events/account/{id}/replay": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Account-wide unified failed-event identifier to replay.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      ],
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "dashboardReplayAccountFailedEvent",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "summary": "Replay an account-owned failed event from the dashboard.",
        "description": "Resets an account-scoped source event to pending and redirects to the Failed Events inbox.",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "csrf_token"
                ],
                "properties": {
                  "csrf_token": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "303": {
            "description": "Redirect to the Failed Events inbox after replay."
          },
          "400": {
            "description": "Invalid dashboard CSRF token for replay.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/dashboard/failed-events/account/{id}/discard": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Account-wide unified failed-event identifier to discard.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      ],
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "dashboardDiscardAccountFailedEvent",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "summary": "Discard an account-owned failed event from the dashboard.",
        "description": "Removes the account-wide ledger projection and redirects to the Failed Events inbox.",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "csrf_token"
                ],
                "properties": {
                  "csrf_token": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "303": {
            "description": "Redirect to the Failed Events inbox after discard."
          },
          "400": {
            "description": "Invalid dashboard CSRF token for discard.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/alert-presets/{name}/test": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "Preset name (catalog key — same value the `listAlertPresets` and `enableAlertPreset` endpoints accept).",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          }
        }
      ],
      "post": {
        "tags": [
          "alert_rules"
        ],
        "operationId": "testAlertPreset",
        "summary": "Send a synthetic test alert to the instantiated rule's webhook.",
        "description": "Test-fires the customer's instantiated alert_preset rule\nagainst the webhook URL they configured at enable-time.\nThe synthetic Event body carries `payload.test = true`\nso the customer's verifier can branch on the discriminator\n(skip the production alert-write path, log to a quieter\nchannel, etc.) and a synthetic `observed` value JUST PAST\nthe preset's threshold — `threshold × 1.01` for `gt`\ncomparisons, `threshold × 0.99` for `lt` (a naive\nthreshold × 1.01 for `lt` would land on the wrong side of\nthe threshold; the handler's branch-swap is load-bearing).\n\nPre-loadApp gates fire in this order: 404 on missing\npreset → 400 alert_preset_disabled on disabled-in-catalog\n→ 402 plan_alert_presets_not_allowed on below-minimum-plan\n→ 404 preset_not_enabled when the customer has not yet\ninstantiated this preset for this app → 502 webhook\ndelivery failed after retry exhaustion.\n",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {}
            }
          }
        },
        "responses": {
          "200": {
            "description": "The test alert was delivered (any 2xx from the\ncustomer's receiver). Note: 2xx-from-the-receiver is\nthe contract — the dispatcher's retry budget may span\nmultiple attempts before reporting success.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TestAlertPresetResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/AlertRuleInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AlertRuleInvalid"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "502": {
            "description": "Webhook delivery failed after the dispatcher's retry\nbudget (5 attempts, 2s/8s/32s/128s backoff). The audit\nlog entry (`alert_preset.test_sent`) carries the\n`delivery_status_code` + `delivery_attempts` for the\ninvestigator; the customer's receiver likely rejected\nthe request, was unreachable, or returned 5xx.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Webhook delivery failed after the dispatcher's retry\nbudget (5 attempts, 2s/8s/32s/128s backoff). The audit\nlog entry (`alert_preset.test_sent`) carries the\n`delivery_status_code` + `delivery_attempts` for the\ninvestigator; the customer's receiver likely rejected\nthe request, was unreachable, or returned 5xx.\nSent as 503 by the public edge.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/dashboard/apps/{slug}/alert-presets/{name}/test": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "Preset name (catalog key — same value the JSON sibling accepts at /v1/apps/{slug}/alert-presets/{name}/test).",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          }
        }
      ],
      "post": {
        "tags": [
          "alert_rules"
        ],
        "operationId": "dashboardTestAlertPreset",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "summary": "Form-POST sibling of testAlertPreset for the dashboard.",
        "description": "Receives the per-card \"Send test alert\" form submission\nfrom the preset grid on /dashboard/apps/{slug}. No body\nfields — the instantiated rule already carries the\nwebhook URL + secret. On success 302-redirects to\n/apps/{slug}?test_alert=ok; on 4xx/5xx 302-redirects to\n/apps/{slug}?test_alert=error so the template's flash\nbanner can render. Web-cookie auth is sufficient — no\nMFA challenge.\n",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {}
            }
          }
        },
        "responses": {
          "302": {
            "description": "Redirect to /apps/{slug}?test_alert={ok|error}."
          },
          "400": {
            "$ref": "#/components/responses/AlertRuleInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AlertRuleInvalid"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/mirrors": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "mirror"
        ],
        "operationId": "listMirrorRules",
        "summary": "List every mirror rule for an app.",
        "description": "Per-app listing. At most\n`Limits.MirrorTargetsPerApp` rows are returned (Free/Hobby = 0\nblocked at the plan gate before reaching this surface; Pro = 1;\nScale = 3) — no pagination cursor in A2.\n",
        "responses": {
          "200": {
            "description": "Mirror rules for this app, ordered by created_at ASC.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MirrorRuleListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "mirror"
        ],
        "operationId": "createMirrorRule",
        "summary": "Create a mirror rule on an app.",
        "description": "Binds a source deployment to a mirror deployment for canary-shadow\ncomparison. Both\ndeployments must be `live` and belong to the same app. Plan gate\nfires 403 `plan_mirror_not_allowed` for Free/Hobby (cost: 1\nmirror VM per request, billed per running second, capped at\n`MirrorMaxLifetimeSeconds=5`). Per-app quota returns 422\n`mirror_rule_quota_exceeded` once `Limits.MirrorTargetsPerApp`\nis reached. Sampling defaults to 5%; only GET, HEAD, and OPTIONS\nare mirrored unless `allow_unsafe_methods` is explicitly enabled.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateMirrorRuleRequest"
              },
              "example": {
                "source_deployment_id": "0123456789abcdef0123456789abcdef",
                "mirror_deployment_id": "0123456789abcdef0123456789abcdf0",
                "percent": 5,
                "include_body": false,
                "allow_unsafe_methods": false,
                "redact_headers": [
                  "X-Tenant-Id"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Mirror rule created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MirrorRuleResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`403 Forbidden` — Free/Hobby plan; mirror is Pro/Scale only.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "`409 Conflict` — source or mirror deployment is not `live`.\nCode `mirror_deployment_not_live`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "`422 Unprocessable Entity` — `percent` out of [0, 100]\n(`invalid_mirror_percent`); source == mirror\n(`mirror_source_target_same`); source/mirror on different\napps (`mirror_cross_app_mismatch`); per-app quota\nexhausted (`mirror_rule_quota_exceeded`).\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/mirrors/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "mirror"
        ],
        "operationId": "getMirrorRule",
        "summary": "Fetch one mirror rule by id.",
        "description": "Cross-account access returns 404 (silent), never 403 — the\nIDOR posture matches traffic-split's deployment-id surface.\n",
        "responses": {
          "200": {
            "description": "The mirror rule.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MirrorRuleResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "tags": [
          "mirror"
        ],
        "operationId": "updateMirrorRule",
        "summary": "Patch a mirror rule.",
        "description": "Patch semantics — pointer fields distinguish \"absent\" from\n\"set to zero\". `percent=0` is a legal value (disable-without-\nremoving); a missing `percent` keeps the existing value. The\nplan gate is intentionally NOT enforced on update: a Pro\ncustomer's existing rule survives an upgrade to Hobby; the\nreaper disables the rule on the next read window so the mirror\nVM doesn't keep waking.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateMirrorRuleRequest"
              },
              "example": {
                "percent": 25,
                "enabled": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated mirror rule.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MirrorRuleResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "description": "`422 Unprocessable Entity` — `percent` out of [0, 100]\n(`invalid_mirror_percent`).\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "mirror"
        ],
        "operationId": "deleteMirrorRule",
        "summary": "Delete a mirror rule.",
        "description": "Idempotent at the wire level — second DELETE returns 404.\nCascades to `mirror_invocation_results` rows via FK ON DELETE\nCASCADE (migration 00384_mirror_rules.sql). Emits\n`mirror_rule.deleted` audit + pg_notify `kind=\"mirror\"`.\n",
        "responses": {
          "204": {
            "description": "Rule deleted (no body)."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/mirrors/{id}/summary": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        },
        {
          "in": "query",
          "name": "window",
          "required": false,
          "schema": {
            "type": "string",
            "enum": [
              "1h",
              "24h",
              "7d"
            ],
            "default": "1h"
          },
          "description": "Summary window. Defaults to 1h. Window is the inclusive trailing seconds the comparison ledger is aggregated over."
        }
      ],
      "get": {
        "tags": [
          "mirror"
        ],
        "operationId": "getMirrorRuleSummary",
        "summary": "Aggregate mirror drift counts over a window.",
        "description": "Read-only aggregate. Source: `mirror_invocation_results` rows\nwhose `completed_at >= now - window_seconds`. Returns:\ntotal invocations, complete changed-response count and percent,\nstatus/schema/body diff counts, incomplete comparisons, mean/p99\nlatency delta, and mirror crash count. Incomplete rows are excluded\nfrom the changed-response percentage denominator.\n",
        "responses": {
          "200": {
            "description": "Aggregated drift counts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MirrorSummaryResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "description": "`422 Unprocessable Entity` — `window` is not one of\n`1h | 24h | 7d` (`invalid_mirror_window`).\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/mirrors/{id}/replay": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "post": {
        "tags": [
          "mirror"
        ],
        "operationId": "replayMirrorRequests",
        "summary": "Replay a sanitized historical request corpus against the mirror deployment.",
        "description": "Queues 1–100 caller-sanitized JSON requests against this rule's mirror\ndeployment. Gregale strips credential, platform-owned, hop-by-hop, and\nrule-configured redact headers again before enqueueing. GET/HEAD/OPTIONS\nare accepted by default; POST/PUT/PATCH/DELETE require the explicit\n`allow_unsafe_methods` acknowledgement. Source response bodies are never\nuploaded: an optional SHA-256 expectation enables body comparison.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MirrorReplayBatchRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Sanitized requests queued for mirror replay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MirrorReplayBatchResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/edge-rules": {
      "get": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "listEdgeRules",
        "summary": "List every edge rule owned by the caller.",
        "description": "Account-wide listing. The dashboard overview pane uses this;\nthe CLI uses it for `gregale edge-rules list`. Free plans only\nsee rule kinds their plan unlocks — the server still lists\nthem.\n",
        "responses": {
          "200": {
            "description": "Every edge rule owned by the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/EdgeRuleResponse"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/edge-rule-lists": {
      "get": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "listEdgeRuleLists",
        "summary": "List the account's reusable edge-rule lists.",
        "description": "Items are omitted here; fetch one list for its items.\nreferenced_by names the rules whose match conditions use the list.\n",
        "responses": {
          "200": {
            "description": "The account's lists, by name.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListEdgeRuleListsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "createEdgeRuleList",
        "summary": "Create a reusable edge-rule list.",
        "description": "Items are validated for the list kind and stored\ncanonicalized, deduplicated and sorted. Lists per account and items\nper list are plan limits.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateEdgeRuleListRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created list.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EdgeRuleListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "code: plan_limit_edge_rule_lists | plan_limit_edge_rule_list_items",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "code: edge_rule_list_exists",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/edge-rule-lists/{name}": {
      "parameters": [
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "Edge-rule list name, unique within the account.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
          }
        }
      ],
      "get": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "getEdgeRuleList",
        "summary": "Get one edge-rule list with its items.",
        "responses": {
          "200": {
            "description": "The list.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EdgeRuleListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/EdgeRuleListNotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "updateEdgeRuleList",
        "summary": "Edit an edge-rule list.",
        "description": "`items` replaces the list; `add` and `remove` edit it in place\n(remove applies after add) and cannot be combined with `items`.\nGateways pick up the change for every referencing rule within a few\nseconds; no rule-set version is recorded.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateEdgeRuleListRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated list.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EdgeRuleListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "code: plan_limit_edge_rule_list_items",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/EdgeRuleListNotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "deleteEdgeRuleList",
        "summary": "Delete an unreferenced edge-rule list.",
        "responses": {
          "204": {
            "description": "The list was deleted."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/EdgeRuleListNotFound"
          },
          "409": {
            "description": "code: edge_rule_list_in_use (rules still reference the list)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/edge-rules": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "listEdgeRulesForApp",
        "summary": "List every edge rule bound to one app.",
        "parameters": [
          {
            "name": "covering",
            "in": "query",
            "required": false,
            "description": "When true, also return the rules written on the account's other\napps with the same owner whose host pattern (anything but `@app`)\ncan cover this app's hosts. The gateway applies those to this\napp's hosts too. Each rule carries its own `app_id`; the ETag\nstays this app's rule set.\n",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Edge rules for this app, ordered by priority ASC.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/EdgeRuleSetETag"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/EdgeRuleResponse"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "createEdgeRule",
        "summary": "Create an edge rule on an app.",
        "parameters": [
          {
            "$ref": "#/components/parameters/EdgeRuleSetIfMatch"
          }
        ],
        "description": "Kind is one of route, rewrite, redirect, headers, cors, jwt, ip,\nvalidate, limit, maintenance, geo, throttle, budget, cache, respond,\nretry, circuit_breaker, async, waf and challenge. `action` is the\nkind's action object (the EdgeRule*Action schemas). jwt, ip and async\nreturn 402 plan_edge_rule_kind_not_allowed on Free; a kind past its\nper-app quota returns 403 plan_edge_rule_kind_quota_reached, the per-app\ntotal 403 plan_limit_edge_rules, and a kind not enabled for the account\n403 capability_not_released. Reference:\nhttps://gregale.dev/docs/edge-rules\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateEdgeRuleRequest"
              },
              "example": {
                "kind": "rewrite",
                "match_host": "api.example.com",
                "match_path": "/api/*",
                "priority": 100,
                "enabled": true,
                "action": {
                  "from": "/api",
                  "to": "/v1"
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Rule created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EdgeRuleResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Plan-kind or per-app quota rejected the rule.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/EdgeRuleConflict"
          },
          "412": {
            "$ref": "#/components/responses/EdgeRulesVersionMismatch"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/edge-rules/{id}/cache-check": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "post": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "checkEdgeRuleCache",
        "summary": "Test the live response cache for an enabled rule.",
        "description": "Sends one anonymous GET or HEAD through Gregale's gateway. A miss\ncan reach or wake the app. The response includes only the upstream\nHTTP status and the cache decision for the selected rule when\nconfirmed. Redirects are returned without following them.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CacheCheckRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Cache check result, including results with no confirmed cache decision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CacheCheckResult"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "502": {
            "description": "The gateway request failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Live checks are unavailable on this installation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/cache-refresh-plan": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "getCacheDeployPlan",
        "summary": "Read the app's automatic cache refresh plan.",
        "parameters": [
          {
            "in": "query",
            "name": "refill_impact_rule_id",
            "schema": {
              "type": "string"
            },
            "description": "Compare two 24-hour windows around the current after-wake pause for this rule."
          }
        ],
        "responses": {
          "200": {
            "description": "Saved production refresh plan or a disabled plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CacheDeployPlan"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "setCacheDeployPlan",
        "summary": "Save or disable automatic cache refresh after a production cutover.",
        "description": "Saves one group for future full production cutovers. A refresh uses the promoted deployment and only wakes it if allow_wake is enabled.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CacheDeployPlan"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved production refresh plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CacheDeployPlan"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "patch": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "setCacheWakeRefillPause",
        "summary": "Pause or resume after-wake refill for one route in the production cache plan.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CacheWakeRefillPause"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated after-wake control and production cache plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CacheDeployPlan"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/deployments/{deployment}/cache-preflight": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "deployment",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "checkDeploymentCache",
        "summary": "Check whether the saved cache routes are eligible on a production candidate.",
        "description": "Runs anonymous GET checks against an already-running replica of the selected zero-traffic candidate or active production canary with final-step cache preparation enabled. Canary checks update the release’s advisory route results without waking the app or publishing responses.",
        "parameters": [
          {
            "in": "query",
            "name": "plan_version",
            "schema": {
              "type": "string"
            },
            "description": "Require this saved production cache plan version for the check."
          }
        ],
        "responses": {
          "200": {
            "description": "Advisory results for the candidate and saved cache refresh plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentCachePreflight"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/deployments/{deployment}/cache-preflight/start": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "deployment",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "startDeploymentCacheCandidate",
        "summary": "Start a production cache candidate and wait for a ready instance.",
        "description": "Explicitly starts the selected zero-traffic candidate when necessary. Starting a candidate may use billable compute. Follow a successful start with the cache check using the same plan version.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartDeploymentCacheCandidateRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "A ready instance of the selected candidate was confirmed."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          },
          "504": {
            "description": "The wait for a ready candidate expired.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/deployments/{deployment}/cache-preflight/edge-readiness": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "deployment",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "getDeploymentCacheStaging",
        "summary": "See how many serving gateways have staged a prepared promotion.",
        "parameters": [
          {
            "in": "query",
            "name": "attempt_id",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The cache_attempt_id of the in-flight promotion."
          }
        ],
        "responses": {
          "200": {
            "description": "Readiness counts for the prepared attempt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CacheStagingProgress"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/deployments/{deployment}/cache-preflight/prepare": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "deployment",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "prepareDeploymentCache",
        "summary": "Prepare the saved edge cache routes for a production candidate.",
        "description": "Captures anonymous GET responses from an already-running zero-traffic candidate. Responses become eligible for the shared edge cache only when that deployment takes all production traffic and the saved plan is current.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartDeploymentCacheCandidateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Route verdicts and, when preparation succeeded, when the captured responses expire.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentCachePreflight"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/deployments/{deployment}/cache-refresh": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "deployment",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "getDeploymentCacheRefresh",
        "summary": "Read an automatic cache refresh receipt for this deployment.",
        "parameters": [
          {
            "name": "receipt_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "A specific attempt. When omitted, returns the latest attempt or its undo."
          }
        ],
        "responses": {
          "200": {
            "description": "Receipt for the automatic refresh or its undo.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CacheRefreshReceipt"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "post": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "retryDeploymentCacheRefresh",
        "summary": "Retry a failed automatic cache refresh on the same production deployment.",
        "description": "Queues the same route group and wake policy while this deployment still serves all production traffic and the saved plan is current. Repeating a request for the same receipt returns its existing retry.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RetryDeploymentCacheRefreshRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Receipt for the retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CacheRefreshReceipt"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/edge-rules/{id}/cache-refresh": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "post": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "createCacheRefresh",
        "summary": "Refresh up to five public GET routes or undo a confirmed cache publish.",
        "description": "Queues a bounded anonymous GET for each selected cache rule. The URL\nrule is always included. Add up to four rules for distinct exact paths\non the same hostname. Existing copies retain their normal expiry while\nGregale validates all replacements. Each serving gateway applies the\ngroup together. The group can wake the app at most once when allow_wake\nis true.\nWhen an expected release ID is supplied, each origin response must\ninclude one matching X-Content-Version header before the group applies.\nSet retain_previous to keep an eligible verified snapshot. To restore\nit without contacting the origin, send only undo_receipt_id. The\nrestore gets its own receipt and requires gateway confirmation.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CacheRefreshRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Refresh or undo accepted. Read its receipt to confirm activation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CacheRefreshReceipt"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "A refresh overlaps another publication, or the undo snapshot is unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Cache publication is unavailable on the serving gateways.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "getCacheRefresh",
        "summary": "Read a refresh-on-publish receipt.",
        "parameters": [
          {
            "name": "receipt_id",
            "in": "query",
            "description": "The receipt ID from the POST. When omitted, returns the latest receipt for the rule.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Receipt with publication and gateway convergence evidence.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CacheRefreshReceipt"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Cache publication status is unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/edge-rules/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "getEdgeRule",
        "summary": "Fetch one edge rule by id.",
        "responses": {
          "200": {
            "description": "The edge rule.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EdgeRuleResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "updateEdgeRule",
        "summary": "Partial-update an edge rule.",
        "parameters": [
          {
            "$ref": "#/components/parameters/EdgeRuleSetIfMatch"
          }
        ],
        "description": "Every field is optional. `kind` is NOT patchable — rotating\nkind mid-life would break the action union. To change kind,\ndelete and recreate. `action` replaces the jsonb column\nwhole (no partial-update shape). The app's attack-mode rule\n(`managed_by: attack_mode`) is refused with 409; change it through\n`/v1/apps/{slug}/edge-protection/attack-mode`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateEdgeRuleRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated rule.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EdgeRuleResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/EdgeRuleConflict"
          },
          "412": {
            "$ref": "#/components/responses/EdgeRulesVersionMismatch"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "deleteEdgeRule",
        "summary": "Delete an edge rule.",
        "parameters": [
          {
            "$ref": "#/components/parameters/EdgeRuleSetIfMatch"
          }
        ],
        "responses": {
          "204": {
            "description": "The cors preset was deleted. Referencing edge_rules.cors_preset_id was atomically cleared via ON DELETE SET NULL; the gateway compile path fails closed until the customer wires a new preset or inlines fallback values."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "412": {
            "$ref": "#/components/responses/EdgeRulesVersionMismatch"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/edge-rules/{id}/waf-exclusions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "post": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "updateEdgeWAFExclusions",
        "summary": "Add or remove CRS rule IDs on a kind=waf rule's exclusions.",
        "description": "Changes exclude_rule_ids and keeps the rest of\nthe rule's action and its penalty, so silencing a false positive does\nnot mean restating the whole action. Recorded as a new rule-set\nversion like any PATCH.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/EdgeRuleSetIfMatch"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EdgeWAFExclusionsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated rule.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EdgeRuleResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/EdgeRuleConflict"
          },
          "412": {
            "$ref": "#/components/responses/EdgeRulesVersionMismatch"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/edge-rules/versions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "listEdgeRuleSetVersions",
        "summary": "List recorded versions of an app's edge-rule set, newest first.",
        "description": "Every committed change to an app's edge rules records the whole rule\nset as a new version. Up to the 50 newest versions are\nreturned, without rule bodies; the newest 100 are retained.\n",
        "responses": {
          "200": {
            "description": "Versions, newest first.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/EdgeRuleSetETag"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/EdgeRuleSetVersionResponse"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/edge-rules/versions/{version}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "version",
          "in": "path",
          "required": true,
          "description": "Rule-set version number, from the versions listing.",
          "schema": {
            "type": "integer",
            "minimum": 1
          }
        }
      ],
      "get": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "getEdgeRuleSetVersion",
        "summary": "Fetch one recorded edge-rule set version with its rules.",
        "responses": {
          "200": {
            "description": "The version and the rules it recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EdgeRuleSetVersionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/edge-rules/events": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "listEdgeRuleEvents",
        "summary": "Sampled requests each edge rule matched, newest first.",
        "description": "Gateways keep the first 10 matches of each rule per minute\nas full events (request ID, method, host, path without query string,\ntrusted client IP, country, user agent); hit counts (stats) cover\nevery match. Events are kept 7 days; how far back a plan can read is\na plan limit (Free 24 h, Hobby 72 h, Pro and Scale 7 days), and a\nlonger since is clamped (the response reports the effective start).\n",
        "parameters": [
          {
            "name": "rule",
            "in": "query",
            "required": false,
            "description": "Only events for this edge rule id.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "outcome",
            "in": "query",
            "required": false,
            "description": "Only events with this outcome; detected, warned and blocked are kind=waf detections; challenged, rejected, solved and failed are kind=challenge outcomes; boxed is a client put in a penalty box.",
            "schema": {
              "type": "string",
              "enum": [
                "matched",
                "logged",
                "detected",
                "warned",
                "blocked",
                "challenged",
                "rejected",
                "solved",
                "failed",
                "boxed"
              ]
            }
          },
          {
            "name": "request_id",
            "in": "query",
            "required": false,
            "description": "Only events for this request ID, such as the reference a visitor without JavaScript sees on the challenge page.",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "description": "Duration such as 1h, 24h or 7d.",
            "schema": {
              "type": "string",
              "default": "24h"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Events per page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "next_cursor from the previous page.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of events.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EdgeRuleEventsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/edge-rules/waf-review": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "getEdgeWAFReview",
        "summary": "The app's WAF detections grouped for a false-positive review.",
        "description": "Reads the app's sampled kind=waf detections\n(detected, warned and blocked events) and groups\nthem by edge rule, CRS rule and path, with id-like path segments read\nas {id}. Each group is assessed: likely_false_positive (a documented\nfalse positive, or at least 3 clients flagged on the path with none\nsending most of the detections), likely_attack (most detections from\nclients flagged on 5 or more paths), excluded (the rule already\nexcludes the CRS rule) or review. The newest 5,000 detections of each\noutcome are read and at most 50 groups returned, largest first.\nDetections are sampled, so counts are lower bounds. The window\ndefaults to 7 days and is clamped to the plan's event window.\n",
        "parameters": [
          {
            "name": "rule",
            "in": "query",
            "required": false,
            "description": "Only detections of this kind=waf edge rule id.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "description": "Duration such as 24h or 7d.",
            "schema": {
              "type": "string",
              "default": "7d"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The review.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EdgeWAFReviewResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/edge-rules/stats": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "getEdgeRuleStats",
        "summary": "Per-rule match counts for an app over a window.",
        "description": "Gateways count each rule's matches (matched for enforced\nrules, logged for log-mode rules), at most once per rule per request,\nand flush them into hourly buckets once a minute; buckets are kept\nfor 14 days. Rules with no matches in the window are omitted.\n",
        "parameters": [
          {
            "name": "window",
            "in": "query",
            "required": false,
            "description": "How far back to total hit counts.",
            "schema": {
              "type": "string",
              "enum": [
                "1h",
                "24h",
                "7d"
              ],
              "default": "24h"
            }
          },
          {
            "name": "series",
            "in": "query",
            "required": false,
            "description": "Also return each rule's hourly totals.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "cache_activity",
            "in": "query",
            "required": false,
            "description": "Include observed gateway cache activity by owned cache rule.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Per-rule counts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EdgeRuleStatsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/edge-rules/suggestions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "getEdgeRuleSuggestions",
        "summary": "Protection recipes suggested from an app's own traffic.",
        "description": "Reads the app's request telemetry over the last 7 days (or\nthe plan's telemetry retention when shorter) and recommends\nprotection recipes with the parameters to add them with:\nblocking unverified bots when bots are a noticeable share of\nrequests, rate-limiting busy or failing sign-in paths, and limiting\n/admin to known IPs. Recipes already added and paths an enabled rule\nof the same kind covers are skipped. Read-only; apply a suggestion\nwith the recipe (dashboard or `gregale edge-rules recipe`). Plans\nwithout request analytics get 402.\n",
        "responses": {
          "200": {
            "description": "Ranked suggestions, possibly empty.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EdgeRuleRecipeSuggestionsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/edge-rules/rollback": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "rollbackEdgeRules",
        "summary": "Restore an app's edge rules to a recorded version.",
        "description": "Replaces every current rule with the version's rules in one\ntransaction, preserving rule IDs, behind fleet convergence. The\nrestore is recorded as a new version. Refused when the version\nexceeds the current plan's edge-rule quotas or references a deleted\nCORS preset.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/EdgeRuleSetIfMatch"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RollbackEdgeRulesRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The rules now in force.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/EdgeRuleSetETag"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/EdgeRuleResponse"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The version references a CORS preset that no longer exists.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "412": {
            "$ref": "#/components/responses/EdgeRulesVersionMismatch"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/throttle-suggestions": {
      "get": {
        "tags": [
          "edge_rules"
        ],
        "operationId": "getAppThrottleSuggestions",
        "summary": "Per-route throttle recommender. Read-only: returns a suggested rps/burst per\nroute over the window, clamped to the customer's plan\nceiling so the suggestion is always settable.\n\nThe recommender is ADVICE-ONLY — it never auto-applies.\nCustomers confirm via POST /v1/apps/{slug}/edge-rules.\n",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 40
            },
            "description": "App slug (lowercase, kebab-case; per-account unique). The recommender walks the per-route rate() for this app's the gateway reader."
          },
          {
            "name": "range",
            "in": "query",
            "description": "Prometheus window. Closed vocabulary. Defaults to 5m.\n",
            "schema": {
              "type": "string",
              "default": "5m"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": [
              "admin"
            ]
          },
          {
            "bearerAuth": [
              "apps:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Suggestion payload. Source is `prometheus` on success\nor `degraded: <reason>` on Prometheus failure\n(response is still 200 with empty Suggestions — the\ndashboard's empty-state branch handles it).\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ThrottleSuggestionsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/outbox": {
      "post": {
        "tags": [
          "webhooks"
        ],
        "operationId": "deliverAppEvent",
        "summary": "Reliably deliver a custom event to a registered webhook.",
        "description": "Enqueues an explicitly addressed delivery in the app's durable webhook\nledger. `destination` is either a webhook id or its exact registered\ntarget URL. The destination's configured HMAC secret, delivery format,\ntimeout, and retry policy apply. Failed deliveries appear in the same\ndelivery history and unified DLQ and can be replayed there.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeliverAppEventRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The delivery was durably queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliverAppEventResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/AppWebhookInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanWebhooksNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/PlanSourceBytes"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/webhooks/{id}/realtime-channel": {
      "get": {
        "operationId": "getRealtimeChannelWebhookFilter",
        "tags": [
          "webhooks"
        ],
        "summary": "Get an exact realtime channel webhook binding",
        "description": "Requires app ownership and MFA. Explicit realtime.channel.published subscription required for writes. Metadata filters match all supplied key/value pairs; no backfill occurs.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for get an exact realtime channel webhook binding."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Realtime endpoint or webhook ID for get an exact realtime channel webhook binding."
          }
        ],
        "responses": {
          "200": {
            "description": "Current channel binding",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeChannelWebhookFilter"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "setRealtimeChannelWebhookFilter",
        "tags": [
          "webhooks"
        ],
        "summary": "Put an exact realtime channel webhook binding",
        "description": "Put an exact realtime channel webhook binding. Requires app ownership and MFA. Explicit realtime.channel.published subscription required for writes. Metadata filters match all supplied key/value pairs; no backfill occurs.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for put an exact realtime channel webhook binding."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Realtime endpoint or webhook ID for put an exact realtime channel webhook binding."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeChannelWebhookFilter"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Put an exact realtime channel webhook binding. Current channel binding",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeChannelWebhookFilter"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteRealtimeChannelWebhookFilter",
        "tags": [
          "webhooks"
        ],
        "summary": "Delete an exact realtime channel webhook binding",
        "description": "Delete an exact realtime channel webhook binding. Requires app ownership and MFA. Explicit realtime.channel.published subscription required for writes. Metadata filters match all supplied key/value pairs; no backfill occurs.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for delete an exact realtime channel webhook binding."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Realtime endpoint or webhook ID for delete an exact realtime channel webhook binding."
          }
        ],
        "responses": {
          "204": {
            "description": "Future capture stopped; queued deliveries remain."
          }
        }
      }
    },
    "/v1/apps/{slug}/webhooks": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "webhooks"
        ],
        "operationId": "listAppWebhooks",
        "summary": "List outbound webhook subscriptions for this app.",
        "responses": {
          "200": {
            "description": "The webhooks.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AppWebhookResponse"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanWebhooksNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "webhooks"
        ],
        "operationId": "createAppWebhook",
        "summary": "Create a new outbound webhook subscription.",
        "description": "target_url is SSRF-guarded at write time (loopback / RFC1918\n/ link-local / metadata IPs are rejected unless\nFAAS_EGRESS_ALLOW_LOOPBACK=1). webhook_secret arrives in\nthe body, is sealed with secretbox.SealBytes under the\nAPP_WEBHOOK namespace, and is NEVER returned in plaintext\n— the response shape carries the masked constant. event_filter\nis an optional allowlist; empty subscribes to every currently\nsupported producer-backed event. delivery_format defaults to\n`json`; selecting `cloudevents` emits CloudEvents 1.0 structured\nmode (`application/cloudevents+json`) while retaining the existing\nsigned webhook headers.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAppWebhookRequest"
              },
              "example": {
                "target_url": "https://example.com/hook",
                "webhook_secret": "shh",
                "event_filter": [
                  "app.parked",
                  "app.woken"
                ],
                "retry_policy": "default",
                "delivery_format": "json",
                "enabled": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Webhook created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppWebhookResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/AppWebhookInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanWebhooksNotAllowed"
          },
          "403": {
            "$ref": "#/components/responses/PlanWebhookQuota"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AppWebhookInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/webhooks/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "webhooks"
        ],
        "operationId": "getAppWebhook",
        "summary": "Fetch one webhook subscription by id.",
        "responses": {
          "200": {
            "description": "The webhook.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppWebhookResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanWebhooksNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "tags": [
          "webhooks"
        ],
        "operationId": "updateAppWebhook",
        "summary": "Partial-update a webhook subscription.",
        "description": "Every field is optional. To rotate the secret in place, send\n`webhook_secret` (the handler seals it; the response carries\nthe masked constant). To rotate via the dedicated endpoint,\nuse POST /webhooks/{id}/rotate-secret.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAppWebhookRequest"
              },
              "example": {
                "target_url": "https://example.com/hook2",
                "enabled": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated webhook.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppWebhookResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/AppWebhookInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanWebhooksNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "webhooks"
        ],
        "operationId": "deleteAppWebhook",
        "summary": "Delete a webhook subscription.",
        "description": "Cascades into app_webhook_deliveries via FK CASCADE — the\ncustomer can no longer read the delivery history once the\nsubscription is gone. Mirrors the alert-rule DELETE shape.\n",
        "responses": {
          "204": {
            "description": "No body. The webhook was removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanWebhooksNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/webhooks/{id}/rotate-secret": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "post": {
        "tags": [
          "webhooks"
        ],
        "operationId": "rotateAppWebhookSecret",
        "summary": "Replace a webhook HMAC secret.",
        "description": "Seals the caller-supplied replacement and overwrites the row's\nciphertext in place. Supply the same value to the receiver. The\nplaintext is never returned; the response carries the masked\nconstant and rotated_at only.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RotateAppWebhookSecretRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook secret rotation succeeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RotateAppWebhookSecretResponse"
                },
                "example": {
                  "rotated_at": "2026-08-06T12:00:00Z",
                  "webhook_secret_sealed_masked": "***"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanWebhooksNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/webhooks/{id}/deliveries": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        },
        {
          "in": "query",
          "name": "page_size",
          "description": "Page size (1..100; default 50).",
          "schema": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 50
          }
        },
        {
          "in": "query",
          "name": "page_token",
          "description": "Opaque cursor from the previous page's next_token.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "webhooks"
        ],
        "operationId": "listAppWebhookDeliveries",
        "summary": "List recent deliveries for this webhook.",
        "description": "Cursor-paginated; most-recent-first. The delivery status\nfollows the closed vocabulary `pending | in_flight |\nsucceeded | failed | dead`. Dead rows can be re-armed with\nPOST /webhooks/{id}/deliveries/{did}/retry.\n",
        "responses": {
          "200": {
            "description": "The deliveries page.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppWebhookDeliveryListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanWebhooksNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/webhooks/{id}/deliveries/{did}/retry": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        },
        {
          "in": "path",
          "name": "did",
          "required": true,
          "description": "Delivery id (32-hex-char UUID).",
          "schema": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          }
        }
      ],
      "post": {
        "tags": [
          "webhooks"
        ],
        "operationId": "retryAppWebhookDelivery",
        "summary": "Re-arm a dead delivery.",
        "description": "Resets the row to `pending` with attempt=0 +\nnext_attempt_at=now() so the dispatcher picks it up at the\nnext tick. Only valid on rows with status='dead'; returns\n400 app_webhook_invalid otherwise.\n",
        "responses": {
          "200": {
            "description": "The re-armed delivery.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppWebhookRetryDeliveryResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/AppWebhookInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanWebhooksNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/webhooks/{id}/deliveries/{did}/attempts": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        },
        {
          "in": "path",
          "name": "did",
          "required": true,
          "description": "Delivery whose completed dispatch attempts are requested.",
          "schema": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          }
        },
        {
          "in": "query",
          "name": "page_size",
          "description": "Maximum attempt records per page (1..100; default 50).",
          "schema": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 50
          }
        },
        {
          "in": "query",
          "name": "page_token",
          "description": "Cursor returned by the previous attempt history page.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "webhooks"
        ],
        "operationId": "listAppWebhookDeliveryAttempts",
        "summary": "List completed delivery attempts, newest first.",
        "description": "Manual retry creates a new replay generation and preserves older outcomes. No request or response body is retained in this history.",
        "responses": {
          "200": {
            "description": "The attempt history page.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppWebhookDeliveryAttemptListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanWebhooksNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/webhooks/{id}/health": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "webhooks"
        ],
        "operationId": "getAppWebhookDeliveryHealth",
        "summary": "Read current delivery queue health for one webhook.",
        "responses": {
          "200": {
            "description": "Current webhook delivery health.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppWebhookDeliveryHealthResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanWebhooksNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/release-webhooks": {
      "get": {
        "tags": [
          "webhooks"
        ],
        "operationId": "listAccountReleaseWebhooks",
        "summary": "List release receivers owned by the active account.",
        "responses": {
          "200": {
            "description": "Account-owned release receivers.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AccountReleaseWebhookResponse"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanWebhooksNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "webhooks"
        ],
        "operationId": "createAccountReleaseWebhook",
        "summary": "Subscribe one receiver to release events from all current and future account apps.",
        "description": "The target is SSRF-guarded and the signing secret is sealed at rest; the response never exposes plaintext.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAccountReleaseWebhookRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Release receiver created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountReleaseWebhookResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/AppWebhookInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanWebhooksNotAllowed"
          },
          "403": {
            "$ref": "#/components/responses/PlanWebhookQuota"
          },
          "409": {
            "$ref": "#/components/responses/AppWebhookInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/release-webhooks/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "webhooks"
        ],
        "operationId": "getAccountReleaseWebhook",
        "summary": "Fetch one account release receiver.",
        "responses": {
          "200": {
            "description": "The receiver.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountReleaseWebhookResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanWebhooksNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "tags": [
          "webhooks"
        ],
        "operationId": "updateAccountReleaseWebhook",
        "summary": "Update an account release receiver.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAccountReleaseWebhookRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated receiver.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountReleaseWebhookResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/AppWebhookInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanWebhooksNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "webhooks"
        ],
        "operationId": "deleteAccountReleaseWebhook",
        "summary": "Delete an account release receiver and its delivery history.",
        "responses": {
          "204": {
            "description": "Receiver removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanWebhooksNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/release-webhooks/{id}/rotate-secret": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "post": {
        "tags": [
          "webhooks"
        ],
        "operationId": "rotateAccountReleaseWebhookSecret",
        "summary": "Replace a release receiver's HMAC signing secret.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RotateAppWebhookSecretRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Secret rotated; plaintext is never returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RotateAppWebhookSecretResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanWebhooksNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/release-webhooks/{id}/deliveries": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        },
        {
          "in": "query",
          "name": "page_size",
          "description": "Maximum number of deliveries returned in this page.",
          "schema": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 50
          }
        },
        {
          "in": "query",
          "name": "page_token",
          "description": "Opaque cursor from the preceding response.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "webhooks"
        ],
        "operationId": "listAccountReleaseWebhookDeliveries",
        "summary": "List release deliveries across all source apps, newest first.",
        "responses": {
          "200": {
            "description": "Delivery page; each row includes its source app_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppWebhookDeliveryListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanWebhooksNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/release-webhooks/{id}/deliveries/{did}/retry": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        },
        {
          "in": "path",
          "name": "did",
          "required": true,
          "description": "Delivery identifier to re-arm.",
          "schema": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          }
        }
      ],
      "post": {
        "tags": [
          "webhooks"
        ],
        "operationId": "retryAccountReleaseWebhookDelivery",
        "summary": "Re-arm one dead account release delivery.",
        "responses": {
          "200": {
            "description": "The re-armed account release delivery.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppWebhookRetryDeliveryResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/AppWebhookInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanWebhooksNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/release-webhooks/{id}/deliveries/{did}/attempts": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        },
        {
          "in": "path",
          "name": "did",
          "required": true,
          "description": "Release delivery whose completed attempts are requested.",
          "schema": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          }
        },
        {
          "in": "query",
          "name": "page_size",
          "description": "Maximum release attempt records per page.",
          "schema": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 50
          }
        },
        {
          "in": "query",
          "name": "page_token",
          "description": "Cursor returned by the previous release attempt page.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "webhooks"
        ],
        "operationId": "listAccountReleaseWebhookDeliveryAttempts",
        "summary": "List completed attempts for one account release delivery.",
        "responses": {
          "200": {
            "description": "Release delivery attempt history, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppWebhookDeliveryAttemptListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanWebhooksNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/release-webhooks/{id}/health": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "webhooks"
        ],
        "operationId": "getAccountReleaseWebhookDeliveryHealth",
        "summary": "Read current delivery queue health for one account release webhook.",
        "responses": {
          "200": {
            "description": "Current account release webhook delivery health.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppWebhookDeliveryHealthResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanWebhooksNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/inbound-webhooks": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "inbound_webhooks"
        ],
        "operationId": "listInboundWebhookEndpoints",
        "summary": "List durable inbound webhook endpoints for this app.",
        "responses": {
          "200": {
            "description": "The configured endpoints. Public route tokens are never returned.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/InboundWebhookEndpointResponse"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "inbound_webhooks"
        ],
        "operationId": "createInboundWebhookEndpoint",
        "summary": "Create a provider-verified durable webhook endpoint.",
        "description": "Returns the public endpoint_url once. Gregale stores only a SHA-256\ndigest of its opaque token and an age/X25519-sealed provider signing\nsecret. Providers are Stripe and generic timestamped HMAC-SHA256 senders.\nGeneric secrets must contain at least 32 bytes of random material.\nHobby, Pro, and Scale plans are supported.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateInboundWebhookEndpointRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Endpoint created; copy endpoint_url into the provider now.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboundWebhookEndpointResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InboundWebhookInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanInboundWebhooksNotAllowed"
          },
          "403": {
            "$ref": "#/components/responses/PlanInboundWebhookQuota"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/InboundWebhookInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/inbound-webhooks/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Inbound webhook endpoint ID."
        }
      ],
      "get": {
        "tags": [
          "inbound_webhooks"
        ],
        "operationId": "getInboundWebhookEndpoint",
        "summary": "Fetch one durable inbound webhook endpoint.",
        "responses": {
          "200": {
            "description": "Endpoint metadata. The route token and signing secret are not returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboundWebhookEndpointResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "tags": [
          "inbound_webhooks"
        ],
        "operationId": "updateInboundWebhookEndpoint",
        "summary": "Change delivery, enabled state, or rotate the provider secret.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateInboundWebhookEndpointRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated endpoint metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboundWebhookEndpointResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InboundWebhookInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "inbound_webhooks"
        ],
        "operationId": "deleteInboundWebhookEndpoint",
        "summary": "Stop future ingress for this endpoint.",
        "description": "Already accepted invocation rows remain queued and deliverable.",
        "responses": {
          "204": {
            "description": "Endpoint deleted."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/inbound-webhooks/{id}/workflow-binding": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Endpoint whose future verified events use this stored workflow binding."
        }
      ],
      "put": {
        "tags": [
          "inbound_webhooks"
        ],
        "operationId": "putWebhookWorkflowBinding",
        "summary": "Route a verified Stripe endpoint to a published stored workflow.",
        "description": "One binding per endpoint, owned by the same app. expected_version is zero\nfor creation and the returned version for updates. take_over_delivery\nmust be true: bound endpoints start stored workflows instead of app delivery.\nCallback and managed-operation bindings must be removed first.\nEvent types accept edge wildcards; filters use the existing event language.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "description": "Explicit delivery takeover and published stored workflow selection.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutWebhookWorkflowBindingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved binding with its new revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookWorkflowBindingResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Plan does not allow workflows.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Binding revision or routing mode conflict (webhook_workflow_conflict).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "Request body exceeds 64 KiB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "get": {
        "tags": [
          "inbound_webhooks"
        ],
        "operationId": "getWebhookWorkflowBinding",
        "summary": "Inspect an endpoint stored workflow binding.",
        "description": "Returns the current event selection and revision for this endpoint.",
        "responses": {
          "200": {
            "description": "Current binding.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookWorkflowBindingResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "inbound_webhooks"
        ],
        "operationId": "deleteWebhookWorkflowBinding",
        "summary": "Restore ordinary delivery for future webhook events.",
        "description": "Already accepted receipts retain their captured routing decision.",
        "parameters": [
          {
            "name": "expected_version",
            "description": "Current binding revision returned by a previous read or update.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Binding removed."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Binding revision conflict (webhook_workflow_conflict).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/inbound-webhooks/{id}/operation-binding": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Endpoint whose future verified events start or signal customer operations."
        }
      ],
      "put": {
        "tags": [
          "inbound_webhooks"
        ],
        "operationId": "putOperationWebhookBinding",
        "summary": "Route a verified endpoint to a customer operation.",
        "description": "One binding per endpoint, owned by the same app. The platform tenant is\nthe operation owner; it must be active and linked to the app through an\nactive tenant surface, and it is never derived from provider payload.\nThe named operation must exist on the environment's live deployment;\nevery event resolves it again and admission pins it. expected_version is\nzero for creation and the returned version for updates.\ntake_over_delivery must be true. Stored workflow and managed exclusive\noperation bindings must be removed first. An empty event_types list\nadmits every verified event; other types are acknowledged as ignored.\n\nmode signal starts nothing. Each event whose type a signals\nentry maps is delivered as that operation event to the platform\ntenant's active operations of the named definition whose subject\nmatches subject.id_from in the provider payload, at most 16 per event.\nThe subject type must equal the definition's subject type, the\ndefinition must be a workflow, and its live workflow must wait for\nevery mapped event. event_types must be empty in this mode.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "description": "Explicit delivery takeover, operation, owner, mode and event selection.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutOperationWebhookBindingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved operation binding with its new revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWebhookBindingResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The platform tenant is suspended.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Binding revision (operation_webhook_binding_conflict) or routing mode conflict (inbound_webhook_routing_conflict).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "Request body exceeds 16 KiB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "get": {
        "tags": [
          "inbound_webhooks"
        ],
        "operationId": "getOperationWebhookBinding",
        "summary": "Inspect an endpoint's customer operation binding.",
        "description": "Returns the bound operation, owner, mode, event selection and revision.",
        "responses": {
          "200": {
            "description": "Current operation binding for this endpoint.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWebhookBindingResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "inbound_webhooks"
        ],
        "operationId": "deleteOperationWebhookBinding",
        "summary": "Stop starting customer operations from future webhook events.",
        "description": "Operations already admitted through the endpoint, and their event receipts, are retained.",
        "parameters": [
          {
            "name": "expected_version",
            "description": "Current operation binding revision returned by a previous read or update.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Operation binding removed; future events use ordinary delivery."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Binding revision conflict (operation_webhook_binding_conflict).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/inbound-webhooks/{id}/workflow-receipts/{event_id}": {
      "get": {
        "tags": [
          "inbound_webhooks"
        ],
        "operationId": "getWebhookWorkflowReceipt",
        "summary": "Inspect a verified provider event and its stored workflow admission.",
        "description": "Returns the captured decision and scheduler progress for a retained provider event.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "id",
            "description": "Endpoint that accepted the provider event being inspected.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "event_id",
            "description": "Stripe event ID returned in the verified provider receipt.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Receipt, routing status and admitted run ID when retained.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookWorkflowReceiptResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/hooks/{token}": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Opaque one-time-disclosed endpoint routing capability.",
          "schema": {
            "type": "string",
            "pattern": "^gwh_[A-Za-z0-9_-]+$",
            "maxLength": 128
          }
        }
      ],
      "post": {
        "tags": [
          "inbound_webhooks"
        ],
        "operationId": "receiveInboundWebhook",
        "summary": "Verify and durably accept a Stripe or generic signed webhook.",
        "description": "This route does not use a Gregale bearer key. The opaque URL and the\nprovider signature are the trust boundary. For Stripe, the exact raw\nbody is verified against Stripe-Signature. Generic endpoints require\nX-Gregale-Event-ID, X-Gregale-Event-Type, X-Gregale-Timestamp and\nX-Gregale-Signature. The HMAC-SHA256 covers the timestamp, event ID,\nevent type and exact raw body; timestamps must be within five minutes.\nAn exact Stripe workflow callback binding completes its callback\ndurably instead of enqueuing an app invocation. Unmatched events keep\nthe ordinary invocation path.\nTerminal callbacks are acknowledged as ignored after verification.\nA stored-workflow-bound endpoint captures its published definition in durable\nfanout work. Paused, unpublished or type-unmatched events are durably ignored;\ncontent filters are evaluated by the scheduler. Provider retries return the\noriginal receipt; changed content for the same event ID returns 409.\nAn operation-bound endpoint admits one customer operation per\nprovider event, owned by the binding's platform tenant, with input\n{webhook: {endpoint, provider, event_id, event_type}, payload}. Closed\npreview admission or an unavailable operation returns 503 with\nRetry-After so the provider retries.\n",
        "security": [],
        "parameters": [
          {
            "name": "Stripe-Signature",
            "in": "header",
            "required": false,
            "description": "Required for Stripe endpoints; Stripe v1 timestamped HMAC signature over the exact request body.",
            "schema": {
              "type": "string",
              "maxLength": 4096
            }
          },
          {
            "name": "X-Gregale-Event-ID",
            "in": "header",
            "required": false,
            "description": "Required for generic endpoints; stable event ID of 1 to 256 visible ASCII bytes, with no spaces.",
            "schema": {
              "type": "string",
              "pattern": "^[!-~]{1,256}$",
              "maxLength": 256
            }
          },
          {
            "name": "X-Gregale-Event-Type",
            "in": "header",
            "required": false,
            "description": "Required for generic endpoints; exact event type matching ^[a-z][a-z0-9_.]{0,255}$.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_.]{0,255}$",
              "maxLength": 256
            }
          },
          {
            "name": "X-Gregale-Timestamp",
            "in": "header",
            "required": false,
            "description": "Required for generic endpoints; Unix timestamp in seconds.",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{1,12}$"
            }
          },
          {
            "name": "X-Gregale-Signature",
            "in": "header",
            "required": false,
            "description": "Required for generic endpoints; sha256= followed by the lowercase hex HMAC-SHA256 digest.",
            "schema": {
              "type": "string",
              "pattern": "^sha256=[0-9a-f]{64}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Verified and durably accepted, duplicated, or ignored after callback closure.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/WebhookWorkflowReceiptResponse"
                    },
                    {
                      "$ref": "#/components/schemas/WorkflowCallbackWebhookReceiptResponse"
                    },
                    {
                      "$ref": "#/components/schemas/InboundWebhookReceiptResponse"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InboundWebhookInvalid"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Changed content for a retained provider event ID (webhook_workflow_conflict).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "$ref": "#/components/responses/InboundWebhookTooLarge"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "listManagedRealtimeEndpoints",
        "summary": "List managed realtime endpoints for this app.",
        "responses": {
          "200": {
            "description": "The configured managed realtime endpoints.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ManagedRealtimeEndpointResponse"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanRealtimeNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "createManagedRealtimeEndpoint",
        "summary": "Create a managed realtime endpoint.",
        "description": "Registers the callback contract used by the realtime service for connect,\nmessage, and disconnect events. Callback and optional client\ncredentials are sealed at rest and never returned in plaintext.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateManagedRealtimeEndpointRequest"
              },
              "example": {
                "callback_url": "https://api.example.com",
                "connect_path": "/realtime/connect",
                "message_path": "/realtime/message",
                "disconnect_path": "/realtime/disconnect",
                "callback_auth_token": "callback-secret",
                "auth_token": "client-secret",
                "enabled": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Managed realtime endpoint created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeEndpointResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/RealtimeInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanRealtimeNotAllowed"
          },
          "403": {
            "$ref": "#/components/responses/PlanRealtimeQuota"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "getManagedRealtimeEndpoint",
        "summary": "Fetch one managed realtime endpoint.",
        "responses": {
          "200": {
            "description": "The managed realtime endpoint.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeEndpointResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanRealtimeNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "tags": [
          "realtime"
        ],
        "operationId": "updateManagedRealtimeEndpoint",
        "summary": "Partially update a managed realtime endpoint.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateManagedRealtimeEndpointRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated managed realtime endpoint.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeEndpointResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/RealtimeInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanRealtimeNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "realtime"
        ],
        "operationId": "deleteManagedRealtimeEndpoint",
        "summary": "Delete a managed realtime endpoint.",
        "responses": {
          "204": {
            "description": "No body. The endpoint was removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanRealtimeNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/connections": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        },
        {
          "name": "limit",
          "in": "query",
          "required": false,
          "schema": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000,
            "default": 100
          },
          "description": "Maximum number of live connections to return."
        },
        {
          "name": "channel",
          "in": "query",
          "required": false,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "^[^/?#\\\\r\\\\n ]+$"
          },
          "description": "Return only connections subscribed to this channel."
        },
        {
          "name": "principal",
          "in": "query",
          "required": false,
          "schema": {
            "type": "string",
            "maxLength": 256
          },
          "description": "Return only connections authenticated as this principal."
        },
        {
          "name": "cursor",
          "in": "query",
          "required": false,
          "schema": {
            "type": "string",
            "maxLength": 2048
          },
          "description": "Opaque next_cursor returned by a previous inventory response."
        }
      ],
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "listManagedRealtimeConnections",
        "summary": "List live connections for a managed realtime endpoint.",
        "description": "Returns a bounded point-in-time inventory, optionally filtered by\nchannel or authenticated principal. Results are ordered by connection\nID; use the opaque `next_cursor` value to continue a truncated page.\n`partial` is true when one or more active realtime nodes could not be\nqueried; healthy node results remain in the response.\n",
        "responses": {
          "200": {
            "description": "The live connection inventory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeConnectionListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/RealtimeInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanRealtimeNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/occupancy": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        },
        {
          "name": "channel",
          "in": "query",
          "required": true,
          "style": "form",
          "explode": true,
          "schema": {
            "type": "array",
            "minItems": 1,
            "maxItems": 20,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256,
              "pattern": "^[^/?#\\\\r\\\\n ]+$"
            }
          },
          "description": "Channel to count; repeat the parameter for up to 20 channels."
        }
      ],
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "getManagedRealtimeOccupancy",
        "summary": "Count a managed realtime channel's subscribers and presence members.",
        "description": "Returns fleet-wide counts for each requested channel.\n`subscribers` counts every open subscription: WebSocket, read-only\nticket and SSE. `presence_members` counts distinct presence members;\na principal-scoped member with several connections counts once.\nCounts are a point-in-time snapshot. `partial` is true when one or\nmore active realtime nodes could not be asked; the counts then cover\nthe nodes that answered.\n",
        "responses": {
          "200": {
            "description": "Channel occupancy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeOccupancyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/RealtimeInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanRealtimeNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/connections/drain": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "drainManagedRealtimeConnections",
        "summary": "Close a bounded or explicitly all-matching set of live managed realtime connections.",
        "description": "Selects connections from a point-in-time fleet inventory by channel,\nprincipal, or explicit connection IDs. `dry_run` returns the selected\nconnections without closing them. A non-dry-run request fails with\n`409 conflict` when the inventory is partial unless `allow_partial`\nis true; this prevents an unavailable node from making a drain look\ncomplete. Set `all` to select every matching connection, up to the\nserver safety cap of 10,000; `all` cannot be combined with\n`connection_ids`; any supplied `limit` is ignored in all mode, and\nthe request returns `409 conflict` when the cap would be exceeded.\n",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Replays the accepted operation for 24 hours when the request is retried.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimeDrainRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The durable drain operation was accepted for background execution.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeDrainResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/RealtimeInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanRealtimeNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/connections/drain/{drain_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        },
        {
          "name": "drain_id",
          "in": "path",
          "required": true,
          "description": "Durable identifier returned by the drain request.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "getManagedRealtimeDrainOperation",
        "summary": "Get the durable result of a realtime connection drain.",
        "description": "Returns a previously recorded drain result scoped to the application and endpoint.",
        "responses": {
          "200": {
            "description": "The persisted drain result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeDrainResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanRealtimeNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/auth/rotate": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "rotateManagedRealtimeAuth",
        "summary": "Rotate a static bearer credential with a bounded overlap window.",
        "description": "Promotes the supplied credential to current and accepts the previous\ncredential until previous_token_expires_at. Credentials are sealed at\nrest and never returned in plaintext.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RotateManagedRealtimeAuthRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Static bearer credential rotation started.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RotateManagedRealtimeAuthResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/RealtimeInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanRealtimeNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/tickets": {
      "post": {
        "operationId": "issueRealtimeSubscriptionTicket",
        "tags": [
          "realtime"
        ],
        "summary": "Issue a short-lived channel subscription ticket",
        "description": "Operator preview. Backend-only app-scoped write with MFA. The backend authorizes the principal and explicit channels before issuing. Tickets allow retained subscriptions only and are returned once with no-store.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug for issue a short-lived channel subscription ticket."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint or webhook ID for issue a short-lived channel subscription ticket."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeTicketRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Issued bearer ticket; do not log or cache.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeTicketResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "revokeRealtimeSubscriptionTickets",
        "tags": [
          "realtime"
        ],
        "summary": "Revoke every live subscription ticket of one principal",
        "description": "Operator preview. Backend-only app-scoped write with MFA, for example at logout. Connections using a revoked ticket close within about a second, when they next re-read their ticket. Expired tickets are not counted.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug owning the endpoint whose principal tickets are revoked."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint whose principal tickets are revoked."
          },
          {
            "name": "principal",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "description": "Principal whose tickets are revoked."
          }
        ],
        "responses": {
          "200": {
            "description": "Number of live tickets revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeTicketsRevokeResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/RealtimeInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanRealtimeNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/tickets/{ticket}": {
      "delete": {
        "operationId": "revokeRealtimeSubscriptionTicket",
        "tags": [
          "realtime"
        ],
        "summary": "Revoke one subscription ticket",
        "description": "Operator preview. Backend-only app-scoped write with MFA. Uses the ticket_id returned when the ticket was issued, so the backend never needs to keep the bearer token. Connections using the ticket close within about a second.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Application slug owning the endpoint of the revoked ticket."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Realtime endpoint that issued the revoked ticket."
          },
          {
            "name": "ticket",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "ticket_id returned when the ticket was issued."
          }
        ],
        "responses": {
          "204": {
            "description": "Ticket revoked."
          },
          "400": {
            "$ref": "#/components/responses/RealtimeInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanRealtimeNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/principals/{principal}/access": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        },
        {
          "name": "principal",
          "in": "path",
          "required": true,
          "description": "Verified OIDC principal whose durable access controls are managed.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        }
      ],
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "getManagedRealtimeAccess",
        "summary": "Read durable channel denies and session cutoff for one principal.",
        "description": "Requires MFA and read scope. Operator preview requires FAAS_REALTIME_ACCESS_PREVIEW_ENABLED=1 on the API and every realtime node. OIDC endpoints only. Revision zero means no stored controls. Responses contain no token or connection identifiers.",
        "responses": {
          "200": {
            "description": "Durable controls; not proof that every live node has applied them.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeAccessResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/RealtimeInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanRealtimeNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "changeManagedRealtimeAccess",
        "summary": "Revoke channel access or older sessions, or remove a channel deny.",
        "description": "Requires MFA and write scope. OIDC operator preview must be enabled on the API and every realtime node. Channel revocation also denies its private activity scopes. Revoke_sessions records a monotonic server-time cutoff; tokens require an integer iat strictly after it. Nodes refresh access state every second and fail closed on refresh failure. Restoration does not grant app membership or automatically resubscribe. Success confirms persistence, not instantaneous fleet convergence.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimeAccessRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Committed access controls.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeAccessResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/RealtimeInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanRealtimeNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/auth/rotate/finalize": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "finalizeManagedRealtimeAuth",
        "summary": "Revoke the predecessor static bearer credential immediately.",
        "responses": {
          "200": {
            "description": "Static bearer credential rotation finalized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinalizeManagedRealtimeAuthResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/RealtimeInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanRealtimeNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/connections/{connection_id}/send": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        },
        {
          "name": "connection_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Live connection identifier returned by the callback event."
        }
      ],
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "sendManagedRealtimeConnection",
        "summary": "Send a message to one live managed realtime connection.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimeMessageRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Message accepted by the connection owner."
          },
          "400": {
            "$ref": "#/components/responses/RealtimeInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanRealtimeNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/connections/{connection_id}/close": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        },
        {
          "name": "connection_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Live socket identifier to close on its owning realtime node."
        }
      ],
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "closeManagedRealtimeConnection",
        "summary": "Close one live managed realtime connection.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimeCloseRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "The connection was closed."
          },
          "400": {
            "$ref": "#/components/responses/RealtimeInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanRealtimeNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/connections/{connection_id}/subscriptions/{channel}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        },
        {
          "name": "connection_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Live connection identifier returned in realtime callback events."
        },
        {
          "name": "channel",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "^[^/?#\\\\r\\\\n ]+$"
          },
          "description": "Channel to add or remove for the live connection."
        }
      ],
      "put": {
        "tags": [
          "realtime"
        ],
        "operationId": "subscribeManagedRealtimeConnection",
        "summary": "Subscribe one live connection to a channel.",
        "responses": {
          "204": {
            "description": "Subscription applied."
          },
          "400": {
            "$ref": "#/components/responses/RealtimeInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanRealtimeNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "realtime"
        ],
        "operationId": "unsubscribeManagedRealtimeConnection",
        "summary": "Remove one live connection from a channel.",
        "responses": {
          "204": {
            "description": "Subscription removed."
          },
          "400": {
            "$ref": "#/components/responses/RealtimeInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanRealtimeNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/publish": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        },
        {
          "name": "channel",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "^[^/?#\\\\r\\\\n ]+$"
          },
          "description": "Channel that receives the published message."
        }
      ],
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "publishManagedRealtimeChannel",
        "summary": "Publish a message to live or resumable channel subscribers.",
        "description": "delivery=live (the default) fans out to live raw-frame subscribers. delivery=retained is preview-only and requires FAAS_REALTIME_RETAINED_PREVIEW_ENABLED=1 on the API; it accepts at most 4096 decoded bytes and requires an Idempotency-Key. Retained delivery commits the message to the ordered channel log before fan-out and returns its sequence. V2 subscribers read the committed log in sequence; a best-effort wake reduces latency while bounded polling recovers missed wakes. The retained log remains authoritative if live fan-out is incomplete. The resume protocol separately requires FAAS_REALTIME_RESUME_PREVIEW_ENABLED=1 on the realtime service.\nA supplied Idempotency-Key binds the publish to delivery mode, decoded payload and binary flag for 24 hours. Replays return the original response and do not retry recipients that missed a partial publish. Reusing a key with a different mode or payload returns 409. An in-flight or uncertain reservation also returns 409 and is not run again while the key is active. Queue admission does not confirm client receipt.",
        "parameters": [
          {
            "name": "delivery",
            "in": "query",
            "required": false,
            "description": "Use retained to commit a sequenced message before live fan-out; this is preview-only and requires an Idempotency-Key.",
            "schema": {
              "type": "string",
              "enum": [
                "live",
                "retained"
              ],
              "default": "live"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Stable printable-ASCII key for retrying this publish; reuse it only with the same delivery mode, payload, and binary flag.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[!-~]{1,128}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimeMessageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Per-recipient queue outcomes; retained publishes also include the committed channel sequence.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimePublishResponse"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "description": "Present with value true when this response replays a prior result for the supplied key.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/RealtimeInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanRealtimeNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/retained-messages": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        },
        {
          "name": "channel",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "description": "Endpoint-scoped channel."
        }
      ],
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "appendManagedRealtimeRetainedMessage",
        "summary": "Append one ordered message to retained channel history.",
        "description": "Disabled by default; an operator must set FAAS_REALTIME_RETAINED_PREVIEW_ENABLED=1 on the API. Retained writes reach only opt-in v2 WebSocket subscribers when the separate realtime service resume preview is enabled. The sequence is committed before the response; idempotency applies while the message remains retained. At most 32 channels and 1024 messages per channel are retained per endpoint, for up to 24 hours.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimeRetainedMessageRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Message committed to the channel log.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeRetainedMessageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/RealtimeInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanRealtimeNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "readManagedRealtimeRetainedMessages",
        "summary": "Read a page of retained channel history after a sequence.",
        "description": "Disabled by default; an operator must set FAAS_REALTIME_RETAINED_PREVIEW_ENABLED=1 on the API. A cursor older than retained history returns 410 with code history_unavailable. This management API is not a WebSocket resume protocol.",
        "parameters": [
          {
            "name": "after",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            },
            "description": "Last processed sequence; zero starts at the first retained message."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            },
            "description": "Maximum number of retained messages to return."
          }
        ],
        "responses": {
          "200": {
            "description": "A consistent page of retained messages.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeRetainedHistoryResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/RealtimeInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanRealtimeNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/principals:send": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "sendManagedRealtimePrincipal",
        "summary": "Send to a verified principal, optionally retaining a notification with push fallback.",
        "description": "Retained sends require the retained-history preview gate and a stable message ID. Notification category is part of deduplication and defaults to notifications. Push preferences are evaluated before provider delivery; ACKs cancel queued fallback. Live sends can request receipts instead of retention.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimePrincipalMessageRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted; durable reports storage acceptance and queued reports live connection queueing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimePrincipalSendResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/activity-scopes/{activity_scope}/signals": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedRealtimeSlugPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeIdPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeChannelPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeActivityScopePath"
        }
      ],
      "post": {
        "operationId": "publishManagedRealtimeScopedSignal",
        "summary": "Send a backend signal to a private activity scope",
        "description": "Publishes to the canonical isolated activity channel for this parent and scope. Scope labels are at most 64 UTF-8 bytes and the encoded channel must fit 256 bytes. Subscribers require a separate read_activity authorization callback grant. Best-effort live delivery with no retained history, sequence, replay, or idempotency receipt. Sender member_id is backend. JSON data is limited to 2048 encoded bytes and the endpoint payload limit; request body is limited to 4096 bytes. Rate limit is 20 requests per second per endpoint/channel per API process, in addition to normal auth limits. Named signals default to a 5000 ms expiry; ttl_ms 0 clears a named signal. Deploy-write scopes and MFA apply. Acceptance is not subscriber acknowledgement; failures may follow partial delivery.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimeSignalRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Best-effort fanout accepted, including when no subscribers exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeSignalResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/signals": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedRealtimeSlugPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeIdPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeChannelPath"
        }
      ],
      "post": {
        "operationId": "publishManagedRealtimeSignal",
        "summary": "Send an ephemeral backend signal to connected v2 channel subscribers",
        "description": "Best-effort live delivery with no retained history, sequence, replay, or idempotency receipt. Sender member_id is backend. JSON data is limited to 2048 encoded bytes and the endpoint payload limit; request body is limited to 4096 bytes. Rate limit is 20 requests per second per endpoint/channel per API process, in addition to normal auth limits. Named signals default to a 5000 ms expiry; ttl_ms 0 clears a named signal. Deploy-write scopes and MFA apply. Acceptance is not subscriber acknowledgement; failures may follow partial delivery.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimeSignalRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Channel signal fanout accepted even when no subscribers exist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeSignalResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/schedules": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedRealtimeSlugPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeIdPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeChannelPath"
        }
      ],
      "get": {
        "operationId": "listManagedRealtimeSchedules",
        "summary": "List pending and recent terminal retained-event schedules",
        "parameters": [
          {
            "$ref": "#/components/parameters/ManagedRealtimeGroupQuery"
          },
          {
            "$ref": "#/components/parameters/ManagedRealtimeStatusQuery"
          }
        ],
        "responses": {
          "200": {
            "description": "Schedules ordered by delivery time and ID",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeSchedulesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/schedules/groups/{group}/{group_action}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedRealtimeSlugPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeIdPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeChannelPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeGroupPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeGroupActionPath"
        }
      ],
      "post": {
        "operationId": "applyManagedRealtimeScheduleGroup",
        "summary": "Atomically pause, resume, or cancel a channel schedule group",
        "description": "Requires exactly every pending/paused member's version. Membership/version changes or incompatible transitions reject the entire action. Terminal members are excluded. Already-target-state members remain unchanged. Supports one-time and recurring schedules; deploy-write scopes, MFA and preview gating apply.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimeScheduleGroupRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Pending/paused members included in the action, with updated states and totals",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "schedules",
                    "totals"
                  ],
                  "properties": {
                    "schedules": {
                      "type": "array",
                      "maxItems": 256,
                      "items": {
                        "$ref": "#/components/schemas/ManagedRealtimeScheduleResponse"
                      }
                    },
                    "totals": {
                      "$ref": "#/components/schemas/ManagedRealtimeScheduleTotals"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/schedules/{schedule_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedRealtimeSlugPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeIdPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeChannelPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeScheduleIdPathBounded"
        }
      ],
      "put": {
        "operationId": "putManagedRealtimeSchedule",
        "summary": "Schedule a retained channel event using an idempotent schedule ID",
        "description": "Future delivery within 30 days; timestamps normalize to microseconds.\nUp to 256 pending and recent terminal schedules per endpoint. Terminal\nreceipts remain available for 24 hours. Identical ID/content retries\nreturn the existing record; different content conflicts. Schema and reducer\nvalidation run at delivery time. Preview gate and deploy-write scopes apply.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimeScheduleRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Pending schedule or identical existing record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeScheduleResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "description": "Endpoint schedule capacity reached"
          }
        }
      },
      "patch": {
        "operationId": "rescheduleManagedRealtimeSchedule",
        "summary": "Change a pending schedule deadline with a version check",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimeScheduleUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated pending schedule",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeScheduleResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      },
      "delete": {
        "operationId": "cancelManagedRealtimeSchedule",
        "summary": "Cancel a pending schedule with a version check",
        "parameters": [
          {
            "$ref": "#/components/parameters/ManagedRealtimeExpectedVersionQuery"
          }
        ],
        "responses": {
          "200": {
            "description": "Canceled schedule; cancellation retries are idempotent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeScheduleResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/schedules/{schedule_id}/pause": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedRealtimeSlugPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeIdPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeChannelPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeScheduleIdPath"
        }
      ],
      "post": {
        "operationId": "pauseManagedRealtimeSchedule",
        "summary": "Pause a recurring retained-event schedule",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimeSchedulePauseRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Schedule updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeScheduleResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/schedules/{schedule_id}/resume": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedRealtimeSlugPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeIdPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeChannelPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeScheduleIdPath"
        }
      ],
      "post": {
        "operationId": "resumeManagedRealtimeSchedule",
        "summary": "Resume a recurring retained-event schedule",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimeSchedulePauseRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Schedule resumed with its updated version.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeScheduleResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/schedules/{schedule_id}/history": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedRealtimeSlugPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeIdPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeChannelPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeScheduleIdPathBounded"
        }
      ],
      "get": {
        "operationId": "getManagedRealtimeScheduleHistory",
        "summary": "Inspect schedule changes and recorded delivery attempts",
        "description": "Events commit with schedule changes. Up to 128 entries are retained per\nschedule, ordered by version. history_truncated marks missing earlier\nhistory, including migrated baseline records. Terminal history expires\nwith its schedule receipt. Preview, ownership, MFA, and read scopes apply.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/ManagedRealtimeAfterVersionQuery"
          },
          {
            "$ref": "#/components/parameters/ManagedRealtimeLimitQuery"
          }
        ],
        "responses": {
          "200": {
            "description": "Consistent schedule timeline snapshot",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeScheduleHistoryResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/schedules/{schedule_id}/retry": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedRealtimeSlugPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeIdPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeChannelPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeScheduleIdPathBounded"
        }
      ],
      "post": {
        "operationId": "retryManagedRealtimeSchedule",
        "summary": "Retry a failed schedule using its existing ID and payload",
        "description": "Requires the current version. Resets the cycle attempt budget, preserves lifetime attempts, and advances the version. Published or canceled schedules cannot retry.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimeScheduleRetryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Retry pending",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeScheduleResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/reducer": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedRealtimeSlugPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeIdPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeChannelPath"
        }
      ],
      "put": {
        "operationId": "putManagedRealtimeReducer",
        "summary": "Enable a channel reducer from a state baseline matching the current sequence",
        "description": "Retained JSON events support set, merge, delete, increment, append, and remove operations.\nIncrement payloads use op=increment, key, field, and a required integer delta;\noptional min/max bounds reject results outside the allowed range.\nValues, deltas, bounds, and results must be safe integers in\n[-9007199254740991, 9007199254740991]. Missing entities or fields start at zero.\nIncrement supports expected_version and preserves expires_at unless replaced\nor cleared with null. Array operations use key, field, and items (1..32 JSON values).\nAppend accepts unique=true for structural JSON deduplication; remove deletes\nall matching items. Optional max_length (0..256) rejects longer results.\nMissing fields start as empty arrays; existing targets must be arrays of at\nmost 256 items. Array operations support expected_version and the same\nexpires_at behavior as increment. Every operation accepts optional conditions\n(1..16 predicates), each with a literal field and exactly one of equals (any\nJSON value) or absent:true. All predicates must hold before the update.\nEquality is structural and compares numbers exactly. Failed conditions return\n409 realtime_condition_conflict with entity_key, condition_field,\ncondition_index, message_index, current_version, entity_exists, and field_exists.\nInvalid operations roll back the whole batch.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimeReducerRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Enabled reducer or identical current state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeReducerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid state or size"
          },
          "409": {
            "description": "Stale baseline or attempt to reseed an active reducer"
          }
        }
      },
      "get": {
        "operationId": "getManagedRealtimeReducer",
        "summary": "Read channel entities and their exact sequence",
        "responses": {
          "200": {
            "description": "Current reduced state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeReducerResponse"
                }
              }
            }
          },
          "404": {
            "description": "Reducer not enabled"
          }
        }
      },
      "delete": {
        "operationId": "deleteManagedRealtimeReducer",
        "summary": "Disable the reducer and remove its state and generated snapshot",
        "responses": {
          "200": {
            "description": "Reducer disabled; retained history remains"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/schemas/{event_type}/{version}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedRealtimeSlugPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeIdPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeChannelPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeEventTypePath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeVersionPath"
        }
      ],
      "put": {
        "operationId": "putManagedRealtimeEventSchema",
        "summary": "Register an immutable event schema version and enable channel enforcement",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimeEventSchemaRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Registered version or identical existing version",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeEventSchemaResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid schema or identity"
          },
          "409": {
            "description": "Existing version has a different schema"
          },
          "429": {
            "description": "Endpoint has 64 registered versions"
          }
        }
      },
      "get": {
        "operationId": "getManagedRealtimeEventSchema",
        "summary": "Get a registered event schema version",
        "responses": {
          "200": {
            "description": "Immutable schema",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeEventSchemaResponse"
                }
              }
            }
          },
          "404": {
            "description": "Version not registered"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/publish-batch": {
      "post": {
        "operationId": "publishManagedRealtimeChannelBatch",
        "summary": "Atomically retain a bounded batch, then attempt live delivery",
        "parameters": [
          {
            "$ref": "#/components/parameters/ManagedRealtimeSlugPath"
          },
          {
            "$ref": "#/components/parameters/ManagedRealtimeIdPath"
          },
          {
            "$ref": "#/components/parameters/ManagedRealtimeChannelPath"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimeChannelBatchRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Durable batch, including per-message best-effort fanout outcomes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeChannelBatchResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid batch count, size or ID"
          },
          "409": {
            "description": "Sequence conflict includes current_sequence and expected_sequence; also batch ID conflict or channel capacity reached."
          },
          "429": {
            "description": "Endpoint has 256 retained batch IDs"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/snapshot": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedRealtimeSlugPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeIdPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeChannelPath"
        }
      ],
      "get": {
        "operationId": "getManagedRealtimeChannelSnapshot",
        "summary": "Get channel state and its replay baseline",
        "responses": {
          "200": {
            "description": "Snapshot with a replayable tail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeChannelSnapshotResponse"
                }
              }
            }
          },
          "404": {
            "description": "Snapshot or channel not found"
          },
          "410": {
            "description": "Snapshot expired or tail no longer replayable"
          }
        }
      },
      "put": {
        "operationId": "putManagedRealtimeChannelSnapshot",
        "summary": "Save state representing an explicit committed channel sequence",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimeChannelSnapshotRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved snapshot, expires after 24 hours",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeChannelSnapshotResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid sequence, size, or older snapshot overwrite"
          },
          "404": {
            "description": "Channel has no retained history"
          },
          "410": {
            "description": "Sequence no longer replayable"
          }
        }
      },
      "delete": {
        "operationId": "deleteManagedRealtimeChannelSnapshot",
        "summary": "Remove a snapshot without deleting channel history",
        "responses": {
          "200": {
            "description": "Snapshot removed"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/push/notifications/{message_id}/timeline": {
      "get": {
        "operationId": "listManagedRealtimeNotificationTimeline",
        "summary": "List notification state changes across devices, newest first",
        "parameters": [
          {
            "$ref": "#/components/parameters/ManagedRealtimeSlugPath"
          },
          {
            "$ref": "#/components/parameters/ManagedRealtimeIdPath"
          },
          {
            "$ref": "#/components/parameters/ManagedRealtimeMessageIdPath"
          },
          {
            "$ref": "#/components/parameters/ManagedRealtimePrincipalQuery"
          },
          {
            "name": "before",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            },
            "description": "Exclusive event ID cursor. Omit or zero for the newest page."
          }
        ],
        "responses": {
          "200": {
            "description": "Up to 100 retained events, newest first; empty when none remain.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ManagedRealtimeNotificationTimelineEvent"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid principal, message ID or cursor"
          },
          "404": {
            "description": "Endpoint or preview unavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/push/notifications/{message_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedRealtimeSlugPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeIdPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeMessageIdPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimePrincipalQuery"
        }
      ],
      "delete": {
        "operationId": "cancelManagedRealtimeNotification",
        "summary": "Cancel pending notification fallback and device deliveries without deleting inbox messages",
        "responses": {
          "200": {
            "description": "Counts of affected pending fallback timers and device deliveries; zero counts are an idempotent no-op.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeNotificationControlResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid principal or message ID"
          },
          "404": {
            "description": "Notification cancellation endpoint or preview unavailable."
          }
        }
      },
      "put": {
        "operationId": "rescheduleManagedRealtimeNotification",
        "summary": "Reschedule active notifications across devices without reviving completed deliveries",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimeNotificationRescheduleRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Counts of affected active timers and device deliveries.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeNotificationControlResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid schedule or schedule beyond expiration"
          },
          "404": {
            "description": "Notification rescheduling endpoint or preview unavailable."
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/push/preferences": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimePrincipalQueryBounded"
        }
      ],
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "getManagedRealtimeNotificationPreferences",
        "summary": "Read a user notification preference document.",
        "description": "Requires the retained-history preview gate. Defaults enable all categories and devices. Preferences apply to built-in push; inbox retention and ACKs remain independent. Quiet-hour deferrals do not consume attempts. At most 256 preference documents per endpoint.",
        "responses": {
          "200": {
            "description": "Current preference document.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeNotificationPreferences"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "realtime"
        ],
        "operationId": "putManagedRealtimeNotificationPreferences",
        "summary": "Replace notification preferences across user devices.",
        "description": "Replaces the principal preference document under the retained-history preview gate. Built-in push uses these preferences independently of inbox retention and ACKs. Quiet-hour deferrals consume no attempts. Each endpoint retains at most 256 documents.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeNotificationPreferences"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved notification preference document.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeNotificationPreferences"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/push/providers": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "listManagedRealtimePushProviders",
        "summary": "List realtime push providers.",
        "description": "Requires the retained-history preview gate. Credentials and tokens are never returned. Delivery history includes the latest 100 records for the principal; sent means provider acceptance, not user delivery.",
        "responses": {
          "200": {
            "description": "Push metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ManagedRealtimePushProvider"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/push/devices": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimePrincipalQueryBounded"
        }
      ],
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "listManagedRealtimePushDevices",
        "summary": "List realtime push devices.",
        "description": "Lists registered devices under the retained-history preview gate. Device tokens and provider credentials are omitted.",
        "responses": {
          "200": {
            "description": "Registered push device metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ManagedRealtimePushDevice"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/push/deliveries": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimePrincipalQueryBounded"
        }
      ],
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "listManagedRealtimePushDeliveries",
        "summary": "List realtime push deliveries.",
        "description": "Lists the latest 100 push delivery records for the principal under the retained-history preview gate. Provider acceptance does not confirm delivery to the user. Tokens and credentials are omitted.",
        "responses": {
          "200": {
            "description": "Recent push delivery attempt metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ManagedRealtimePushDelivery"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/push/providers/{provider}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeProviderPath"
        }
      ],
      "put": {
        "tags": [
          "realtime"
        ],
        "operationId": "configureManagedRealtimePushProvider",
        "summary": "Configure or disable a push provider.",
        "description": "Provider credentials are sealed at rest. Disabling cancels queued deliveries; re-enabling does not replay them. The retained-history preview gate is required.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimePushProviderRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Provider configured; credentials are omitted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "provider",
                    "enabled"
                  ],
                  "properties": {
                    "provider": {
                      "type": "string",
                      "enum": [
                        "fcm",
                        "apns",
                        "webpush"
                      ]
                    },
                    "enabled": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/push/devices/{device}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimePrincipalQueryBounded"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeDevicePath"
        }
      ],
      "put": {
        "tags": [
          "realtime"
        ],
        "operationId": "registerManagedRealtimePushDevice",
        "summary": "Register or rotate a device push token.",
        "description": "Requires the retained-history preview gate. Registration is limited to 16 devices per principal and 1024 per endpoint. A provider must be enabled before registration. Identical registrations preserve pending deliveries; changed tokens cancel old work.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimePushRegistration"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Registration updated; token is omitted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "realtime"
        ],
        "operationId": "unregisterManagedRealtimePushDevice",
        "summary": "Remove a push registration and cancel its queued work.",
        "description": "Removes a device registration under the retained-history preview gate and cancels its queued push deliveries.",
        "responses": {
          "200": {
            "description": "Device registration removed and pending work canceled.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/log-drains": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "observability"
        ],
        "operationId": "listAppLogDrains",
        "summary": "List runtime log destinations for this app.",
        "responses": {
          "200": {
            "description": "The configured log destinations. Authentication headers are always masked.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AppLogDrainResponse"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanLogDrainsNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "observability"
        ],
        "operationId": "createAppLogDrain",
        "summary": "Export runtime logs to an external HTTP or OTLP endpoint.",
        "description": "The platform tails the existing per-instance runtime log ring and\nforwards each line through a bounded queue. `http_json` sends a\nprovider-neutral JSON record; `otlp` sends an OTLP/HTTP JSON logs\nenvelope suitable for a collector or vendor OTLP endpoint. The URL\nis SSRF-checked, and auth_header is sealed at rest and never echoed.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAppLogDrainRequest"
              },
              "example": {
                "kind": "otlp",
                "target_url": "https://otel-collector.example.com/v1/logs",
                "auth_header": "Authorization: Bearer <token>",
                "enabled": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Log drain created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppLogDrainResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/AppLogDrainInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanLogDrainsNotAllowed"
          },
          "403": {
            "$ref": "#/components/responses/PlanLogDrainQuota"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AppLogDrainInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/log-drains/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "observability"
        ],
        "operationId": "getAppLogDrain",
        "summary": "Fetch one runtime log destination.",
        "responses": {
          "200": {
            "description": "The log destination. Authentication headers are masked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppLogDrainResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanLogDrainsNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "tags": [
          "observability"
        ],
        "operationId": "updateAppLogDrain",
        "summary": "Update a runtime log destination.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAppLogDrainRequest"
              },
              "example": {
                "enabled": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated log destination.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppLogDrainResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/AppLogDrainInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanLogDrainsNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AppLogDrainInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "observability"
        ],
        "operationId": "deleteAppLogDrain",
        "summary": "Delete a runtime log destination.",
        "responses": {
          "204": {
            "description": "No body. The log drain was removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanLogDrainsNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/log-drains/{id}/health": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "observability"
        ],
        "operationId": "getAppLogDrainHealth",
        "summary": "Fetch durable delivery health for a runtime log destination.",
        "description": "Returns a customer-safe delivery snapshot. Authentication headers and\nraw transport errors are never returned. Empty timestamps mean that\nthe corresponding event has not happened yet.\n",
        "responses": {
          "200": {
            "description": "Durable log-drain delivery health.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppLogDrainHealthResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanLogDrainsNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/log-drains/{id}/analytics": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "observability"
        ],
        "operationId": "getAppLogDrainAnalytics",
        "summary": "Fetch hourly delivery analytics for a runtime log destination.",
        "description": "Returns bounded, customer-safe hourly delivery history. The default\nwindow is 24 hours; supported windows are 1h, 24h, 7d, and 30d.\nSuccess rate is delivered records divided by delivered, failed, and\ndropped terminal outcomes. Average latency includes queue wait and\nendpoint time. The platform retains at least 30 days of samples.\n",
        "parameters": [
          {
            "in": "query",
            "name": "window",
            "description": "History window. Defaults to 24h.",
            "schema": {
              "type": "string",
              "enum": [
                "1h",
                "24h",
                "7d",
                "30d"
              ],
              "default": "24h"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Hourly customer-safe log-drain delivery analytics.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppLogDrainAnalyticsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/AppLogDrainInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanLogDrainsNotAllowed"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/invoke": {
      "post": {
        "tags": [
          "invocations"
        ],
        "operationId": "invokeApp",
        "summary": "Sync-invoke an app; long-poll for the result.",
        "description": "Enqueues an invocation row and waits for the drain to drive it\nto a terminal state. Server-side cap is 30s on paid plans, 5s\non Free. Returns 503 (long_poll_timeout) when the cap elapses;\nthe customer can immediately re-call /v1/invocations/{id}\nto pick up the eventual result.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/GregaleRevision"
          },
          {
            "$ref": "#/components/parameters/GregaleRelease"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InvokeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The completed invocation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvokeResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "413": {
            "$ref": "#/components/responses/PlanSourceBytes"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/LongPollTimeout"
          },
          "504": {
            "$ref": "#/components/responses/LongPollTimeout"
          }
        }
      }
    },
    "/v1/deployments/response-check/capabilities": {
      "get": {
        "tags": [
          "deployments"
        ],
        "operationId": "getDeploymentResponseCheckCapabilities",
        "summary": "Read deployment response-check compatibility before deploying.",
        "description": "Requires deployment-write access. This read-only preflight does not require\nMFA, resolve an app, allocate capacity, create work, or contact a guest.\nQueries the configured gateway control listener with a three-second bound\nand returns protocol support and forwarding configuration. An unavailable\ngateway is reported in a 200 response with available=false and a stable\nunavailable_reason: gateway_unsupported, gateway_unconfigured, or\ngateway_unavailable. Account credentials and internal addresses are not\nforwarded or returned. A successful preflight is not a capacity or future\navailability guarantee. Responses use Cache-Control: no-store.\n",
        "responses": {
          "200": {
            "description": "Current API/gateway compatibility; never cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentResponseCheckCapabilities"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/deployments/{deployment}/response-check": {
      "post": {
        "tags": [
          "deployments"
        ],
        "operationId": "checkDeploymentResponse",
        "summary": "Check one GET against an owned deployment.",
        "description": "Requires deployment-write access and MFA. Pins a live deployment, app UUID\nand runtime scope; named scopes also require project and environment UUIDs.\nGatewayd may wake that exact deployment through existing scheduler admission.\nSends one GET without forwarding API credentials, cookies, arbitrary headers\nor a request body. Does not follow redirects or use public response caches.\nReturns the actual application HTTP status, selected identities and a bounded\nUTF-8 response preview. A 200 API envelope includes application failures; only\nthe inner HTTP status describes the workload response. This is owner access,\nnot proof of public routing or customer authentication. Application-owned\nauthentication is preserved. Rechecks target identity after forwarding.\nTimeout is 20 seconds, path limit 2048 bytes, preview limit 4096 bytes.\nResponse content and path queries are ephemeral. Responses are not cached.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "deployment",
            "in": "path",
            "required": true,
            "description": "Exact accepted deployment UUID; revisions and aliases are not accepted.",
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9-]{32,36}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeploymentResponseCheckRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Ephemeral HTTP response evidence; Cache-Control no-store.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeploymentResponseCheckResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The deployment or catalog lifetime no longer matches the requested target.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "The control request exceeds the 64 KiB envelope limit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "The selected deployment could not be reached or evidence was unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/quotas": {
      "get": {
        "tags": [
          "invocations"
        ],
        "operationId": "inspectDurableEntityTenantQuotas",
        "summary": "Inspect Durable Entity Tenant Quotas.",
        "description": "Inspect durable entity tenant quotas: Opt-in durable-object preview. Requires the configured application allowlist and applicable feature gates; production enablement awaits native GCS/KVM acceptance. Account-owner HTTP operations require MFA and app read access for inspection or deploy write access for mutation. Reader grace, claims and unknown acknowledgements must be respected. Responses are not cacheable. See the durable entity operator guides for the bounded recovery contract.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "namespace",
            "in": "query",
            "required": true,
            "description": "Inspect durable entity tenant quotas — parameters / namespace: Exact entity namespace selecting the scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": true,
            "description": "Inspect durable entity tenant quotas — parameters / key: Exact entity key selecting the scope; scope management affects the entire account/app/environment/tenant registry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "description": "Inspect durable entity tenant quotas — parameters / environment: Registered environment, defaulting to production.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform_tenant_id",
            "in": "query",
            "required": false,
            "description": "Inspect durable entity tenant quotas — parameters / platform tenant id: Optional same-account platform tenant; customer self-service tokens cannot manage scope state.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Inspect durable entity tenant quotas — responses / 200: Bounded preview result. Metadata revisions remain opaque or exact integers as documented in the operator guide.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Inspect durable entity tenant quotas — responses / 200 / content / application/json / schema: Operator preview metadata, including nullable checkpoints and advisory observations. No business state is returned.",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Inspect durable entity tenant quotas — responses / 409: Observed revision, ownership, migration or request identity conflicts. Inspect before replaying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "Inspect durable entity tenant quotas — responses / 410: Entity identity is permanently retired. Use a new identity for new work.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/readiness": {
      "get": {
        "tags": [
          "invocations"
        ],
        "operationId": "getDurableEntityReadiness",
        "summary": "Get Durable Entity Readiness.",
        "description": "Get durable entity readiness: Opt-in durable-object preview. Requires the configured application allowlist and applicable feature gates; production enablement awaits native GCS/KVM acceptance. Account-owner HTTP operations require MFA and app read access for inspection or deploy write access for mutation. Reader grace, claims and unknown acknowledgements must be respected. Responses are not cacheable. See the durable entity operator guides for the bounded recovery contract.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          }
        ],
        "responses": {
          "200": {
            "description": "Get durable entity readiness — responses / 200: Bounded preview result. Metadata revisions remain opaque or exact integers as documented in the operator guide.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Get durable entity readiness — responses / 200 / content / application/json / schema: Operator preview metadata, including nullable checkpoints and advisory observations. No business state is returned.",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Get durable entity readiness — responses / 409: Observed revision, ownership, migration or request identity conflicts. Inspect before replaying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "Get durable entity readiness — responses / 410: Entity identity is permanently retired. Use a new identity for new work.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/quota-migration/plan": {
      "get": {
        "tags": [
          "invocations"
        ],
        "operationId": "planDurableEntityQuotaMigration",
        "summary": "Plan Durable Entity Quota Migration.",
        "description": "Plan durable entity quota migration: Opt-in durable-object preview. Requires the configured application allowlist and applicable feature gates; production enablement awaits native GCS/KVM acceptance. Account-owner HTTP operations require MFA and app read access for inspection or deploy write access for mutation. Reader grace, claims and unknown acknowledgements must be respected. Responses are not cacheable. See the durable entity operator guides for the bounded recovery contract.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "namespace",
            "in": "query",
            "required": true,
            "description": "Plan durable entity quota migration — parameters / namespace: Exact entity namespace selecting the scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": true,
            "description": "Plan durable entity quota migration — parameters / key: Exact entity key selecting the scope; scope management affects the entire account/app/environment/tenant registry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "description": "Plan durable entity quota migration — parameters / environment: Registered environment, defaulting to production.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform_tenant_id",
            "in": "query",
            "required": false,
            "description": "Plan durable entity quota migration — parameters / platform tenant id: Optional same-account platform tenant; customer self-service tokens cannot manage scope state.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Plan durable entity quota migration — parameters / cursor: Opaque continuation from the preceding page; restart listing after revision or cursor conflicts.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Plan durable entity quota migration — responses / 200: Bounded preview result. Metadata revisions remain opaque or exact integers as documented in the operator guide.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Plan durable entity quota migration — responses / 200 / content / application/json / schema: Operator preview metadata, including nullable checkpoints and advisory observations. No business state is returned.",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Plan durable entity quota migration — responses / 409: Observed revision, ownership, migration or request identity conflicts. Inspect before replaying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "Plan durable entity quota migration — responses / 410: Entity identity is permanently retired. Use a new identity for new work.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/quota-migration": {
      "get": {
        "tags": [
          "invocations"
        ],
        "operationId": "inspectDurableEntityQuotaMigration",
        "summary": "Inspect Durable Entity Quota Migration.",
        "description": "Inspect durable entity quota migration: Opt-in durable-object preview. Requires the configured application allowlist and applicable feature gates; production enablement awaits native GCS/KVM acceptance. Account-owner HTTP operations require MFA and app read access for inspection or deploy write access for mutation. Reader grace, claims and unknown acknowledgements must be respected. Responses are not cacheable. See the durable entity operator guides for the bounded recovery contract.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "namespace",
            "in": "query",
            "required": true,
            "description": "Inspect durable entity quota migration — parameters / namespace: Exact entity namespace selecting the scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": true,
            "description": "Inspect durable entity quota migration — parameters / key: Exact entity key selecting the scope; scope management affects the entire account/app/environment/tenant registry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "description": "Inspect durable entity quota migration — parameters / environment: Registered environment, defaulting to production.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform_tenant_id",
            "in": "query",
            "required": false,
            "description": "Inspect durable entity quota migration — parameters / platform tenant id: Optional same-account platform tenant; customer self-service tokens cannot manage scope state.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Inspect durable entity quota migration — responses / 200: Bounded preview result. Metadata revisions remain opaque or exact integers as documented in the operator guide.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Inspect durable entity quota migration — responses / 200 / content / application/json / schema: Operator preview metadata, including nullable checkpoints and advisory observations. No business state is returned.",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Inspect durable entity quota migration — responses / 409: Observed revision, ownership, migration or request identity conflicts. Inspect before replaying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "Inspect durable entity quota migration — responses / 410: Entity identity is permanently retired. Use a new identity for new work.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/quota-migration/start": {
      "post": {
        "tags": [
          "invocations"
        ],
        "operationId": "startDurableEntityQuotaMigration",
        "summary": "Start Durable Entity Quota Migration.",
        "description": "Start durable entity quota migration: Opt-in durable-object preview. Requires the configured application allowlist and applicable feature gates; production enablement awaits native GCS/KVM acceptance. Account-owner HTTP operations require MFA and app read access for inspection or deploy write access for mutation. Reader grace, claims and unknown acknowledgements must be respected. Responses are not cacheable. See the durable entity operator guides for the bounded recovery contract.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "namespace",
            "in": "query",
            "required": true,
            "description": "Start durable entity quota migration — parameters / namespace: Exact entity namespace selecting the scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": true,
            "description": "Start durable entity quota migration — parameters / key: Exact entity key selecting the scope; scope management affects the entire account/app/environment/tenant registry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "description": "Start durable entity quota migration — parameters / environment: Registered environment, defaulting to production.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform_tenant_id",
            "in": "query",
            "required": false,
            "description": "Start durable entity quota migration — parameters / platform tenant id: Optional same-account platform tenant; customer self-service tokens cannot manage scope state.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Start durable entity quota migration — responses / 200: Bounded preview result. Metadata revisions remain opaque or exact integers as documented in the operator guide.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Start durable entity quota migration — responses / 200 / content / application/json / schema: Operator preview metadata, including nullable checkpoints and advisory observations. No business state is returned.",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Start durable entity quota migration — responses / 409: Observed revision, ownership, migration or request identity conflicts. Inspect before replaying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "Start durable entity quota migration — responses / 410: Entity identity is permanently retired. Use a new identity for new work.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "description": "Start durable entity quota migration — requestBody: Exact operation input. Retain operation identity and payload when replaying an uncertain mutation.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "Start durable entity quota migration — requestBody / content / application/json / schema: Preview mutation input with server-side size, scope and revision validation.",
                "properties": {
                  "migration_id": {
                    "type": "string",
                    "description": "Start durable entity quota migration — requestBody / content / application/json / schema / properties / migration id: Fresh operation identity; replay must retain this identity and the exact request.",
                    "format": "uuid"
                  },
                  "expected_migration_id": {
                    "type": "string",
                    "description": "Start durable entity quota migration — requestBody / content / application/json / schema / properties / expected migration id: Prior migration identity, or empty for an initial migration."
                  },
                  "expected_revision": {
                    "type": "integer",
                    "description": "Start durable entity quota migration — requestBody / content / application/json / schema / properties / expected revision: Exact observed numeric checkpoint revision; inspect after uncertain outcomes.",
                    "minimum": 0
                  }
                },
                "required": [
                  "migration_id",
                  "expected_revision"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/quota-migration/step": {
      "post": {
        "tags": [
          "invocations"
        ],
        "operationId": "stepDurableEntityQuotaMigration",
        "summary": "Step Durable Entity Quota Migration.",
        "description": "Step durable entity quota migration: Opt-in durable-object preview. Requires the configured application allowlist and applicable feature gates; production enablement awaits native GCS/KVM acceptance. Account-owner HTTP operations require MFA and app read access for inspection or deploy write access for mutation. Reader grace, claims and unknown acknowledgements must be respected. Responses are not cacheable. See the durable entity operator guides for the bounded recovery contract.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "namespace",
            "in": "query",
            "required": true,
            "description": "Step durable entity quota migration — parameters / namespace: Exact entity namespace selecting the scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": true,
            "description": "Step durable entity quota migration — parameters / key: Exact entity key selecting the scope; scope management affects the entire account/app/environment/tenant registry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "description": "Step durable entity quota migration — parameters / environment: Registered environment, defaulting to production.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform_tenant_id",
            "in": "query",
            "required": false,
            "description": "Step durable entity quota migration — parameters / platform tenant id: Optional same-account platform tenant; customer self-service tokens cannot manage scope state.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Step durable entity quota migration — responses / 200: Bounded preview result. Metadata revisions remain opaque or exact integers as documented in the operator guide.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Step durable entity quota migration — responses / 200 / content / application/json / schema: Operator preview metadata, including nullable checkpoints and advisory observations. No business state is returned.",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Step durable entity quota migration — responses / 409: Observed revision, ownership, migration or request identity conflicts. Inspect before replaying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "Step durable entity quota migration — responses / 410: Entity identity is permanently retired. Use a new identity for new work.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "description": "Step durable entity quota migration — requestBody: Exact operation input. Retain operation identity and payload when replaying an uncertain mutation.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "Step durable entity quota migration — requestBody / content / application/json / schema: Preview mutation input with server-side size, scope and revision validation.",
                "properties": {
                  "migration_id": {
                    "type": "string",
                    "description": "Step durable entity quota migration — requestBody / content / application/json / schema / properties / migration id: Fresh operation identity; replay must retain this identity and the exact request.",
                    "format": "uuid"
                  },
                  "expected_revision": {
                    "type": "integer",
                    "description": "Step durable entity quota migration — requestBody / content / application/json / schema / properties / expected revision: Exact observed numeric checkpoint revision; inspect after uncertain outcomes.",
                    "minimum": 0
                  }
                },
                "required": [
                  "migration_id",
                  "expected_revision"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/quota-policy": {
      "get": {
        "tags": [
          "invocations"
        ],
        "operationId": "inspectDurableEntityQuotaPolicy",
        "summary": "Inspect Durable Entity Quota Policy.",
        "description": "Inspect durable entity quota policy: Opt-in durable-object preview. Requires the configured application allowlist and applicable feature gates; production enablement awaits native GCS/KVM acceptance. Account-owner HTTP operations require MFA and app read access for inspection or deploy write access for mutation. Reader grace, claims and unknown acknowledgements must be respected. Responses are not cacheable. See the durable entity operator guides for the bounded recovery contract.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "namespace",
            "in": "query",
            "required": true,
            "description": "Inspect durable entity quota policy — parameters / namespace: Exact entity namespace selecting the scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": true,
            "description": "Inspect durable entity quota policy — parameters / key: Exact entity key selecting the scope; scope management affects the entire account/app/environment/tenant registry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "description": "Inspect durable entity quota policy — parameters / environment: Registered environment, defaulting to production.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform_tenant_id",
            "in": "query",
            "required": false,
            "description": "Inspect durable entity quota policy — parameters / platform tenant id: Optional same-account platform tenant; customer self-service tokens cannot manage scope state.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Inspect durable entity quota policy — responses / 200: Bounded preview result. Metadata revisions remain opaque or exact integers as documented in the operator guide.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Inspect durable entity quota policy — responses / 200 / content / application/json / schema: Operator preview metadata, including nullable checkpoints and advisory observations. No business state is returned.",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Inspect durable entity quota policy — responses / 409: Observed revision, ownership, migration or request identity conflicts. Inspect before replaying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "Inspect durable entity quota policy — responses / 410: Entity identity is permanently retired. Use a new identity for new work.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/quota-policy/preview": {
      "post": {
        "tags": [
          "invocations"
        ],
        "operationId": "previewDurableEntityQuotaPolicy",
        "summary": "Preview Durable Entity Quota Policy.",
        "description": "Preview durable entity quota policy: Opt-in durable-object preview. Requires the configured application allowlist and applicable feature gates; production enablement awaits native GCS/KVM acceptance. Account-owner HTTP operations require MFA and app read access for inspection or deploy write access for mutation. Reader grace, claims and unknown acknowledgements must be respected. Responses are not cacheable. See the durable entity operator guides for the bounded recovery contract.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "namespace",
            "in": "query",
            "required": true,
            "description": "Preview durable entity quota policy — parameters / namespace: Exact entity namespace selecting the scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": true,
            "description": "Preview durable entity quota policy — parameters / key: Exact entity key selecting the scope; scope management affects the entire account/app/environment/tenant registry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "description": "Preview durable entity quota policy — parameters / environment: Registered environment, defaulting to production.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform_tenant_id",
            "in": "query",
            "required": false,
            "description": "Preview durable entity quota policy — parameters / platform tenant id: Optional same-account platform tenant; customer self-service tokens cannot manage scope state.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Preview durable entity quota policy — responses / 200: Bounded preview result. Metadata revisions remain opaque or exact integers as documented in the operator guide.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Preview durable entity quota policy — responses / 200 / content / application/json / schema: Operator preview metadata, including nullable checkpoints and advisory observations. No business state is returned.",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Preview durable entity quota policy — responses / 409: Observed revision, ownership, migration or request identity conflicts. Inspect before replaying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "Preview durable entity quota policy — responses / 410: Entity identity is permanently retired. Use a new identity for new work.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "description": "Preview durable entity quota policy — requestBody: Exact operation input. Retain operation identity and payload when replaying an uncertain mutation.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "Preview durable entity quota policy — requestBody / content / application/json / schema: Preview mutation input with server-side size, scope and revision validation.",
                "properties": {
                  "operation_id": {
                    "type": "string",
                    "description": "Preview durable entity quota policy — requestBody / content / application/json / schema / properties / operation id: Fresh operation identity; replay must retain this identity and the exact request.",
                    "format": "uuid"
                  },
                  "expected_revision": {
                    "type": "integer",
                    "description": "Preview durable entity quota policy — requestBody / content / application/json / schema / properties / expected revision: Exact observed numeric checkpoint revision; inspect after uncertain outcomes.",
                    "minimum": 0
                  },
                  "expected_migration_id": {
                    "type": "string",
                    "description": "Preview durable entity quota policy — requestBody / content / application/json / schema / properties / expected migration id: Observed completed migration identity."
                  },
                  "expected_migration_revision": {
                    "type": "integer",
                    "description": "Preview durable entity quota policy — requestBody / content / application/json / schema / properties / expected migration revision: Exact observed numeric checkpoint revision; inspect after uncertain outcomes.",
                    "minimum": 0
                  },
                  "migration_id": {
                    "type": "string",
                    "description": "Preview durable entity quota policy — requestBody / content / application/json / schema / properties / migration id: Fresh operation identity; replay must retain this identity and the exact request.",
                    "format": "uuid"
                  },
                  "limits": {
                    "type": "object",
                    "description": "Preview durable entity quota policy — requestBody / content / application/json / schema / properties / limits: Proposed tenant admission caps; all fields are required.",
                    "properties": {
                      "connections": {
                        "type": "integer",
                        "description": "Preview durable entity quota policy — requestBody / content / application/json / schema / properties / limits / properties / connections: Approved connections cap; server validates bounds and monotonic increases.",
                        "minimum": 1
                      },
                      "grants_per_minute": {
                        "type": "integer",
                        "description": "Preview durable entity quota policy — requestBody / content / application/json / schema / properties / limits / properties / grants per minute: Approved grants per minute cap; server validates bounds and monotonic increases.",
                        "minimum": 1
                      },
                      "invocations_per_minute": {
                        "type": "integer",
                        "description": "Preview durable entity quota policy — requestBody / content / application/json / schema / properties / limits / properties / invocations per minute: Approved invocations per minute cap; server validates bounds and monotonic increases.",
                        "minimum": 1
                      },
                      "retained_bytes": {
                        "type": "integer",
                        "description": "Preview durable entity quota policy — requestBody / content / application/json / schema / properties / limits / properties / retained bytes: Approved retained bytes cap; server validates bounds and monotonic increases.",
                        "minimum": 1
                      },
                      "entity_bytes": {
                        "type": "integer",
                        "description": "Preview durable entity quota policy — requestBody / content / application/json / schema / properties / limits / properties / entity bytes: Approved entity bytes cap; server validates bounds and monotonic increases.",
                        "minimum": 1
                      }
                    },
                    "required": [
                      "connections",
                      "grants_per_minute",
                      "invocations_per_minute",
                      "retained_bytes",
                      "entity_bytes"
                    ]
                  }
                },
                "required": [
                  "operation_id",
                  "expected_revision",
                  "expected_migration_revision",
                  "migration_id",
                  "limits"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/quota-policy/apply": {
      "post": {
        "tags": [
          "invocations"
        ],
        "operationId": "applyDurableEntityQuotaPolicy",
        "summary": "Apply Durable Entity Quota Policy.",
        "description": "Apply durable entity quota policy: Opt-in durable-object preview. Requires the configured application allowlist and applicable feature gates; production enablement awaits native GCS/KVM acceptance. Account-owner HTTP operations require MFA and app read access for inspection or deploy write access for mutation. Reader grace, claims and unknown acknowledgements must be respected. Responses are not cacheable. See the durable entity operator guides for the bounded recovery contract.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "namespace",
            "in": "query",
            "required": true,
            "description": "Apply durable entity quota policy — parameters / namespace: Exact entity namespace selecting the scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": true,
            "description": "Apply durable entity quota policy — parameters / key: Exact entity key selecting the scope; scope management affects the entire account/app/environment/tenant registry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "description": "Apply durable entity quota policy — parameters / environment: Registered environment, defaulting to production.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform_tenant_id",
            "in": "query",
            "required": false,
            "description": "Apply durable entity quota policy — parameters / platform tenant id: Optional same-account platform tenant; customer self-service tokens cannot manage scope state.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Apply durable entity quota policy — responses / 200: Bounded preview result. Metadata revisions remain opaque or exact integers as documented in the operator guide.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Apply durable entity quota policy — responses / 200 / content / application/json / schema: Operator preview metadata, including nullable checkpoints and advisory observations. No business state is returned.",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Apply durable entity quota policy — responses / 409: Observed revision, ownership, migration or request identity conflicts. Inspect before replaying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "Apply durable entity quota policy — responses / 410: Entity identity is permanently retired. Use a new identity for new work.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "description": "Apply durable entity quota policy — requestBody: Exact operation input. Retain operation identity and payload when replaying an uncertain mutation.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "Apply durable entity quota policy — requestBody / content / application/json / schema: Preview mutation input with server-side size, scope and revision validation.",
                "properties": {
                  "operation_id": {
                    "type": "string",
                    "description": "Apply durable entity quota policy — requestBody / content / application/json / schema / properties / operation id: Fresh operation identity; replay must retain this identity and the exact request.",
                    "format": "uuid"
                  },
                  "expected_revision": {
                    "type": "integer",
                    "description": "Apply durable entity quota policy — requestBody / content / application/json / schema / properties / expected revision: Exact observed numeric checkpoint revision; inspect after uncertain outcomes.",
                    "minimum": 0
                  },
                  "expected_migration_id": {
                    "type": "string",
                    "description": "Apply durable entity quota policy — requestBody / content / application/json / schema / properties / expected migration id: Observed completed migration identity."
                  },
                  "expected_migration_revision": {
                    "type": "integer",
                    "description": "Apply durable entity quota policy — requestBody / content / application/json / schema / properties / expected migration revision: Exact observed numeric checkpoint revision; inspect after uncertain outcomes.",
                    "minimum": 0
                  },
                  "migration_id": {
                    "type": "string",
                    "description": "Apply durable entity quota policy — requestBody / content / application/json / schema / properties / migration id: Fresh operation identity; replay must retain this identity and the exact request.",
                    "format": "uuid"
                  },
                  "limits": {
                    "type": "object",
                    "description": "Apply durable entity quota policy — requestBody / content / application/json / schema / properties / limits: Proposed tenant admission caps; all fields are required.",
                    "properties": {
                      "connections": {
                        "type": "integer",
                        "description": "Apply durable entity quota policy — requestBody / content / application/json / schema / properties / limits / properties / connections: Approved connections cap; server validates bounds and monotonic increases.",
                        "minimum": 1
                      },
                      "grants_per_minute": {
                        "type": "integer",
                        "description": "Apply durable entity quota policy — requestBody / content / application/json / schema / properties / limits / properties / grants per minute: Approved grants per minute cap; server validates bounds and monotonic increases.",
                        "minimum": 1
                      },
                      "invocations_per_minute": {
                        "type": "integer",
                        "description": "Apply durable entity quota policy — requestBody / content / application/json / schema / properties / limits / properties / invocations per minute: Approved invocations per minute cap; server validates bounds and monotonic increases.",
                        "minimum": 1
                      },
                      "retained_bytes": {
                        "type": "integer",
                        "description": "Apply durable entity quota policy — requestBody / content / application/json / schema / properties / limits / properties / retained bytes: Approved retained bytes cap; server validates bounds and monotonic increases.",
                        "minimum": 1
                      },
                      "entity_bytes": {
                        "type": "integer",
                        "description": "Apply durable entity quota policy — requestBody / content / application/json / schema / properties / limits / properties / entity bytes: Approved entity bytes cap; server validates bounds and monotonic increases.",
                        "minimum": 1
                      }
                    },
                    "required": [
                      "connections",
                      "grants_per_minute",
                      "invocations_per_minute",
                      "retained_bytes",
                      "entity_bytes"
                    ]
                  }
                },
                "required": [
                  "operation_id",
                  "expected_revision",
                  "expected_migration_revision",
                  "migration_id",
                  "limits"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/registry": {
      "get": {
        "tags": [
          "invocations"
        ],
        "operationId": "listDurableEntityRegistry",
        "summary": "List Durable Entity Registry.",
        "description": "List durable entity registry: Opt-in durable-object preview. Requires the configured application allowlist and applicable feature gates; production enablement awaits native GCS/KVM acceptance. Account-owner HTTP operations require MFA and app read access for inspection or deploy write access for mutation. Reader grace, claims and unknown acknowledgements must be respected. Responses are not cacheable. See the durable entity operator guides for the bounded recovery contract.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "namespace",
            "in": "query",
            "required": true,
            "description": "List durable entity registry — parameters / namespace: Exact entity namespace selecting the scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": true,
            "description": "List durable entity registry — parameters / key: Exact entity key selecting the scope; scope management affects the entire account/app/environment/tenant registry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "description": "List durable entity registry — parameters / environment: Registered environment, defaulting to production.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform_tenant_id",
            "in": "query",
            "required": false,
            "description": "List durable entity registry — parameters / platform tenant id: Optional same-account platform tenant; customer self-service tokens cannot manage scope state.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "List durable entity registry — parameters / cursor: Opaque continuation from the preceding page; restart listing after revision or cursor conflicts.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List durable entity registry — responses / 200: Bounded preview result. Metadata revisions remain opaque or exact integers as documented in the operator guide.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "List durable entity registry — responses / 200 / content / application/json / schema: Operator preview metadata, including nullable checkpoints and advisory observations. No business state is returned.",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "List durable entity registry — responses / 409: Observed revision, ownership, migration or request identity conflicts. Inspect before replaying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "List durable entity registry — responses / 410: Entity identity is permanently retired. Use a new identity for new work.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/registry/enable": {
      "post": {
        "tags": [
          "invocations"
        ],
        "operationId": "enableDurableEntityRegistry",
        "summary": "Enable Durable Entity Registry.",
        "description": "Enable durable entity registry: Opt-in durable-object preview. Requires the configured application allowlist and applicable feature gates; production enablement awaits native GCS/KVM acceptance. Account-owner HTTP operations require MFA and app read access for inspection or deploy write access for mutation. Reader grace, claims and unknown acknowledgements must be respected. Responses are not cacheable. See the durable entity operator guides for the bounded recovery contract.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "namespace",
            "in": "query",
            "required": true,
            "description": "Enable durable entity registry — parameters / namespace: Exact entity namespace selecting the scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": true,
            "description": "Enable durable entity registry — parameters / key: Exact entity key selecting the scope; scope management affects the entire account/app/environment/tenant registry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "description": "Enable durable entity registry — parameters / environment: Registered environment, defaulting to production.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform_tenant_id",
            "in": "query",
            "required": false,
            "description": "Enable durable entity registry — parameters / platform tenant id: Optional same-account platform tenant; customer self-service tokens cannot manage scope state.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Enable durable entity registry — responses / 200: Bounded preview result. Metadata revisions remain opaque or exact integers as documented in the operator guide.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Enable durable entity registry — responses / 200 / content / application/json / schema: Operator preview metadata, including nullable checkpoints and advisory observations. No business state is returned.",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Enable durable entity registry — responses / 409: Observed revision, ownership, migration or request identity conflicts. Inspect before replaying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "Enable durable entity registry — responses / 410: Entity identity is permanently retired. Use a new identity for new work.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "description": "Enable durable entity registry — requestBody: Exact operation input. Retain operation identity and payload when replaying an uncertain mutation.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "Enable durable entity registry — requestBody / content / application/json / schema: Preview mutation input with server-side size, scope and revision validation.",
                "properties": {
                  "operation_id": {
                    "type": "string",
                    "description": "Enable durable entity registry — requestBody / content / application/json / schema / properties / operation id: Fresh operation identity; replay must retain this identity and the exact request.",
                    "format": "uuid"
                  },
                  "expected_revision": {
                    "type": "string",
                    "description": "Enable durable entity registry — requestBody / content / application/json / schema / properties / expected revision: Exact opaque revision returned by inspection; never convert it to a number.",
                    "minLength": 1
                  }
                },
                "required": [
                  "operation_id",
                  "expected_revision"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/registry/cleanup": {
      "get": {
        "tags": [
          "invocations"
        ],
        "operationId": "inspectDurableEntityRegistryCleanup",
        "summary": "Inspect Durable Entity Registry Cleanup.",
        "description": "Inspect durable entity registry cleanup: Opt-in durable-object preview. Requires the configured application allowlist and applicable feature gates; production enablement awaits native GCS/KVM acceptance. Account-owner HTTP operations require MFA and app read access for inspection or deploy write access for mutation. Reader grace, claims and unknown acknowledgements must be respected. Responses are not cacheable. See the durable entity operator guides for the bounded recovery contract.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "namespace",
            "in": "query",
            "required": true,
            "description": "Inspect durable entity registry cleanup — parameters / namespace: Exact entity namespace selecting the scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": true,
            "description": "Inspect durable entity registry cleanup — parameters / key: Exact entity key selecting the scope; scope management affects the entire account/app/environment/tenant registry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "description": "Inspect durable entity registry cleanup — parameters / environment: Registered environment, defaulting to production.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform_tenant_id",
            "in": "query",
            "required": false,
            "description": "Inspect durable entity registry cleanup — parameters / platform tenant id: Optional same-account platform tenant; customer self-service tokens cannot manage scope state.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Inspect durable entity registry cleanup — responses / 200: Bounded preview result. Metadata revisions remain opaque or exact integers as documented in the operator guide.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Inspect durable entity registry cleanup — responses / 200 / content / application/json / schema: Operator preview metadata, including nullable checkpoints and advisory observations. No business state is returned.",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Inspect durable entity registry cleanup — responses / 409: Observed revision, ownership, migration or request identity conflicts. Inspect before replaying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "Inspect durable entity registry cleanup — responses / 410: Entity identity is permanently retired. Use a new identity for new work.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/registry/cleanup/start": {
      "post": {
        "tags": [
          "invocations"
        ],
        "operationId": "startDurableEntityRegistryCleanup",
        "summary": "Start Durable Entity Registry Cleanup.",
        "description": "Start durable entity registry cleanup: Opt-in durable-object preview. Requires the configured application allowlist and applicable feature gates; production enablement awaits native GCS/KVM acceptance. Account-owner HTTP operations require MFA and app read access for inspection or deploy write access for mutation. Reader grace, claims and unknown acknowledgements must be respected. Responses are not cacheable. See the durable entity operator guides for the bounded recovery contract.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "namespace",
            "in": "query",
            "required": true,
            "description": "Start durable entity registry cleanup — parameters / namespace: Exact entity namespace selecting the scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": true,
            "description": "Start durable entity registry cleanup — parameters / key: Exact entity key selecting the scope; scope management affects the entire account/app/environment/tenant registry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "description": "Start durable entity registry cleanup — parameters / environment: Registered environment, defaulting to production.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform_tenant_id",
            "in": "query",
            "required": false,
            "description": "Start durable entity registry cleanup — parameters / platform tenant id: Optional same-account platform tenant; customer self-service tokens cannot manage scope state.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Start durable entity registry cleanup — responses / 200: Bounded preview result. Metadata revisions remain opaque or exact integers as documented in the operator guide.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Start durable entity registry cleanup — responses / 200 / content / application/json / schema: Operator preview metadata, including nullable checkpoints and advisory observations. No business state is returned.",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Start durable entity registry cleanup — responses / 409: Observed revision, ownership, migration or request identity conflicts. Inspect before replaying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "Start durable entity registry cleanup — responses / 410: Entity identity is permanently retired. Use a new identity for new work.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "description": "Start durable entity registry cleanup — requestBody: Exact operation input. Retain operation identity and payload when replaying an uncertain mutation.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "Start durable entity registry cleanup — requestBody / content / application/json / schema: Preview mutation input with server-side size, scope and revision validation.",
                "properties": {
                  "operation_id": {
                    "type": "string",
                    "description": "Start durable entity registry cleanup — requestBody / content / application/json / schema / properties / operation id: Fresh operation identity; replay must retain this identity and the exact request.",
                    "format": "uuid"
                  },
                  "expected_revision": {
                    "type": "string",
                    "description": "Start durable entity registry cleanup — requestBody / content / application/json / schema / properties / expected revision: Exact opaque revision returned by inspection; never convert it to a number.",
                    "minLength": 1
                  }
                },
                "required": [
                  "operation_id",
                  "expected_revision"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/registry/cleanup/step": {
      "post": {
        "tags": [
          "invocations"
        ],
        "operationId": "stepDurableEntityRegistryCleanup",
        "summary": "Step Durable Entity Registry Cleanup.",
        "description": "Step durable entity registry cleanup: Opt-in durable-object preview. Requires the configured application allowlist and applicable feature gates; production enablement awaits native GCS/KVM acceptance. Account-owner HTTP operations require MFA and app read access for inspection or deploy write access for mutation. Reader grace, claims and unknown acknowledgements must be respected. Responses are not cacheable. See the durable entity operator guides for the bounded recovery contract.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "namespace",
            "in": "query",
            "required": true,
            "description": "Step durable entity registry cleanup — parameters / namespace: Exact entity namespace selecting the scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": true,
            "description": "Step durable entity registry cleanup — parameters / key: Exact entity key selecting the scope; scope management affects the entire account/app/environment/tenant registry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "description": "Step durable entity registry cleanup — parameters / environment: Registered environment, defaulting to production.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform_tenant_id",
            "in": "query",
            "required": false,
            "description": "Step durable entity registry cleanup — parameters / platform tenant id: Optional same-account platform tenant; customer self-service tokens cannot manage scope state.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Step durable entity registry cleanup — responses / 200: Bounded preview result. Metadata revisions remain opaque or exact integers as documented in the operator guide.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Step durable entity registry cleanup — responses / 200 / content / application/json / schema: Operator preview metadata, including nullable checkpoints and advisory observations. No business state is returned.",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Step durable entity registry cleanup — responses / 409: Observed revision, ownership, migration or request identity conflicts. Inspect before replaying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "Step durable entity registry cleanup — responses / 410: Entity identity is permanently retired. Use a new identity for new work.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "description": "Step durable entity registry cleanup — requestBody: Exact operation input. Retain operation identity and payload when replaying an uncertain mutation.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "Step durable entity registry cleanup — requestBody / content / application/json / schema: Preview mutation input with server-side size, scope and revision validation.",
                "properties": {
                  "operation_id": {
                    "type": "string",
                    "description": "Step durable entity registry cleanup — requestBody / content / application/json / schema / properties / operation id: Fresh operation identity; replay must retain this identity and the exact request.",
                    "format": "uuid"
                  },
                  "expected_revision": {
                    "type": "integer",
                    "description": "Step durable entity registry cleanup — requestBody / content / application/json / schema / properties / expected revision: Exact observed numeric checkpoint revision; inspect after uncertain outcomes.",
                    "minimum": 0
                  },
                  "restart_cleanup": {
                    "type": "boolean",
                    "description": "Step durable entity registry cleanup — requestBody / content / application/json / schema / properties / restart cleanup: Restart bounded listing passes while preserving the existing epoch fence.",
                    "default": false
                  }
                },
                "required": [
                  "operation_id",
                  "expected_revision"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/retirement": {
      "get": {
        "tags": [
          "invocations"
        ],
        "operationId": "previewDurableEntityRetirement",
        "summary": "Preview Durable Entity Retirement.",
        "description": "Preview durable entity retirement: Opt-in durable-object preview. Requires the configured application allowlist and applicable feature gates; production enablement awaits native GCS/KVM acceptance. Account-owner HTTP operations require MFA and app read access for inspection or deploy write access for mutation. Reader grace, claims and unknown acknowledgements must be respected. Responses are not cacheable. See the durable entity operator guides for the bounded recovery contract.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "namespace",
            "in": "query",
            "required": true,
            "description": "Preview durable entity retirement — parameters / namespace: Exact entity namespace selecting the scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": true,
            "description": "Preview durable entity retirement — parameters / key: Exact entity key selecting the scope; scope management affects the entire account/app/environment/tenant registry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "description": "Preview durable entity retirement — parameters / environment: Registered environment, defaulting to production.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform_tenant_id",
            "in": "query",
            "required": false,
            "description": "Preview durable entity retirement — parameters / platform tenant id: Optional same-account platform tenant; customer self-service tokens cannot manage scope state.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Preview durable entity retirement — responses / 200: Bounded preview result. Metadata revisions remain opaque or exact integers as documented in the operator guide.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Preview durable entity retirement — responses / 200 / content / application/json / schema: Operator preview metadata, including nullable checkpoints and advisory observations. No business state is returned.",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Preview durable entity retirement — responses / 409: Observed revision, ownership, migration or request identity conflicts. Inspect before replaying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "Preview durable entity retirement — responses / 410: Entity identity is permanently retired. Use a new identity for new work.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/retirement/start": {
      "post": {
        "tags": [
          "invocations"
        ],
        "operationId": "startDurableEntityRetirement",
        "summary": "Start Durable Entity Retirement.",
        "description": "Start durable entity retirement: Opt-in durable-object preview. Requires the configured application allowlist and applicable feature gates; production enablement awaits native GCS/KVM acceptance. Account-owner HTTP operations require MFA and app read access for inspection or deploy write access for mutation. Reader grace, claims and unknown acknowledgements must be respected. Responses are not cacheable. See the durable entity operator guides for the bounded recovery contract.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "namespace",
            "in": "query",
            "required": true,
            "description": "Start durable entity retirement — parameters / namespace: Exact entity namespace selecting the scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": true,
            "description": "Start durable entity retirement — parameters / key: Exact entity key selecting the scope; scope management affects the entire account/app/environment/tenant registry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "description": "Start durable entity retirement — parameters / environment: Registered environment, defaulting to production.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform_tenant_id",
            "in": "query",
            "required": false,
            "description": "Start durable entity retirement — parameters / platform tenant id: Optional same-account platform tenant; customer self-service tokens cannot manage scope state.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Start durable entity retirement — responses / 200: Bounded preview result. Metadata revisions remain opaque or exact integers as documented in the operator guide.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Start durable entity retirement — responses / 200 / content / application/json / schema: Operator preview metadata, including nullable checkpoints and advisory observations. No business state is returned.",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Start durable entity retirement — responses / 409: Observed revision, ownership, migration or request identity conflicts. Inspect before replaying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "Start durable entity retirement — responses / 410: Entity identity is permanently retired. Use a new identity for new work.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "description": "Start durable entity retirement — requestBody: Exact operation input. Retain operation identity and payload when replaying an uncertain mutation.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "Start durable entity retirement — requestBody / content / application/json / schema: Preview mutation input with server-side size, scope and revision validation.",
                "properties": {
                  "operation_id": {
                    "type": "string",
                    "description": "Start durable entity retirement — requestBody / content / application/json / schema / properties / operation id: Fresh operation identity; replay must retain this identity and the exact request.",
                    "format": "uuid"
                  },
                  "expected_version": {
                    "type": "integer",
                    "description": "Start durable entity retirement — requestBody / content / application/json / schema / properties / expected version: Exact entity version observed in the retirement preview.",
                    "minimum": 0
                  },
                  "expected_recovery_revision": {
                    "type": "string",
                    "description": "Start durable entity retirement — requestBody / content / application/json / schema / properties / expected recovery revision: Exact opaque revision returned by inspection; never convert it to a number.",
                    "minLength": 1
                  }
                },
                "required": [
                  "operation_id",
                  "expected_version",
                  "expected_recovery_revision"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/retirement/step": {
      "post": {
        "tags": [
          "invocations"
        ],
        "operationId": "stepDurableEntityRetirement",
        "summary": "Step Durable Entity Retirement.",
        "description": "Step durable entity retirement: Opt-in durable-object preview. Requires the configured application allowlist and applicable feature gates; production enablement awaits native GCS/KVM acceptance. Account-owner HTTP operations require MFA and app read access for inspection or deploy write access for mutation. Reader grace, claims and unknown acknowledgements must be respected. Responses are not cacheable. See the durable entity operator guides for the bounded recovery contract.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "namespace",
            "in": "query",
            "required": true,
            "description": "Step durable entity retirement — parameters / namespace: Exact entity namespace selecting the scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": true,
            "description": "Step durable entity retirement — parameters / key: Exact entity key selecting the scope; scope management affects the entire account/app/environment/tenant registry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "description": "Step durable entity retirement — parameters / environment: Registered environment, defaulting to production.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform_tenant_id",
            "in": "query",
            "required": false,
            "description": "Step durable entity retirement — parameters / platform tenant id: Optional same-account platform tenant; customer self-service tokens cannot manage scope state.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Step durable entity retirement — responses / 200: Bounded preview result. Metadata revisions remain opaque or exact integers as documented in the operator guide.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Step durable entity retirement — responses / 200 / content / application/json / schema: Operator preview metadata, including nullable checkpoints and advisory observations. No business state is returned.",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Step durable entity retirement — responses / 409: Observed revision, ownership, migration or request identity conflicts. Inspect before replaying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "Step durable entity retirement — responses / 410: Entity identity is permanently retired. Use a new identity for new work.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "description": "Step durable entity retirement — requestBody: Exact operation input. Retain operation identity and payload when replaying an uncertain mutation.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "Step durable entity retirement — requestBody / content / application/json / schema: Preview mutation input with server-side size, scope and revision validation.",
                "properties": {
                  "operation_id": {
                    "type": "string",
                    "description": "Step durable entity retirement — requestBody / content / application/json / schema / properties / operation id: Fresh operation identity; replay must retain this identity and the exact request.",
                    "format": "uuid"
                  },
                  "expected_revision": {
                    "type": "integer",
                    "description": "Step durable entity retirement — requestBody / content / application/json / schema / properties / expected revision: Exact observed numeric checkpoint revision; inspect after uncertain outcomes.",
                    "minimum": 0
                  },
                  "restart_cleanup": {
                    "type": "boolean",
                    "description": "Step durable entity retirement — requestBody / content / application/json / schema / properties / restart cleanup: Restart verified retirement cleanup after an uncertain outcome.",
                    "default": false
                  }
                },
                "required": [
                  "operation_id",
                  "expected_revision"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/session-grants": {
      "post": {
        "tags": [
          "invocations"
        ],
        "operationId": "mintDurableEntitySessionGrant",
        "summary": "Mint Durable Entity Session Grant.",
        "description": "Mint durable entity session grant: Opt-in durable-object preview. Requires the configured application allowlist and applicable feature gates; production enablement awaits native GCS/KVM acceptance. Account-owner HTTP operations require MFA and app read access for inspection or deploy write access for mutation. Reader grace, claims and unknown acknowledgements must be respected. Responses are not cacheable. See the durable entity operator guides for the bounded recovery contract.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          }
        ],
        "responses": {
          "201": {
            "description": "Mint durable entity session grant — responses / 201: Bounded preview result. Metadata revisions remain opaque or exact integers as documented in the operator guide.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Mint durable entity session grant — responses / 201 / content / application/json / schema: Operator preview metadata, including nullable checkpoints and advisory observations. No business state is returned.",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Mint durable entity session grant — responses / 409: Observed revision, ownership, migration or request identity conflicts. Inspect before replaying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "Mint durable entity session grant — responses / 410: Entity identity is permanently retired. Use a new identity for new work.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "description": "Mint durable entity session grant — requestBody: Exact operation input. Retain operation identity and payload when replaying an uncertain mutation.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "Mint durable entity session grant — requestBody / content / application/json / schema: Preview mutation input with server-side size, scope and revision validation.",
                "properties": {
                  "namespace": {
                    "type": "string",
                    "description": "Mint durable entity session grant — requestBody / content / application/json / schema / properties / namespace: Exact entity namespace.",
                    "minLength": 1,
                    "maxLength": 256
                  },
                  "key": {
                    "type": "string",
                    "description": "Mint durable entity session grant — requestBody / content / application/json / schema / properties / key: Exact logical entity key.",
                    "minLength": 1,
                    "maxLength": 256
                  },
                  "env": {
                    "type": "string",
                    "description": "Mint durable entity session grant — requestBody / content / application/json / schema / properties / env: Registered environment; defaults to production."
                  },
                  "platform_tenant_id": {
                    "type": "string",
                    "description": "Mint durable entity session grant — requestBody / content / application/json / schema / properties / platform tenant id: Optional same-account platform tenant."
                  },
                  "session_id": {
                    "type": "string",
                    "description": "Mint durable entity session grant — requestBody / content / application/json / schema / properties / session id: Existing logical session identity."
                  },
                  "generation": {
                    "type": "integer",
                    "description": "Mint durable entity session grant — requestBody / content / application/json / schema / properties / generation: Current session generation.",
                    "minimum": 1
                  },
                  "origin": {
                    "type": "string",
                    "description": "Mint durable entity session grant — requestBody / content / application/json / schema / properties / origin: Exact browser origin without a path, query or fragment.",
                    "format": "uri"
                  },
                  "commands": {
                    "type": "array",
                    "description": "Mint durable entity session grant — requestBody / content / application/json / schema / properties / commands: Allowed command names; delegation does not grant other commands.",
                    "items": {
                      "type": "string"
                    }
                  },
                  "ttl_seconds": {
                    "type": "integer",
                    "description": "Mint durable entity session grant — requestBody / content / application/json / schema / properties / ttl seconds: Credential lifetime in seconds.",
                    "minimum": 1,
                    "maximum": 300
                  }
                },
                "required": [
                  "namespace",
                  "key",
                  "session_id",
                  "generation",
                  "origin",
                  "commands",
                  "ttl_seconds"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/session-grants/{grant}": {
      "delete": {
        "tags": [
          "invocations"
        ],
        "operationId": "revokeDurableEntitySessionGrant",
        "summary": "Revoke Durable Entity Session Grant.",
        "description": "Revoke durable entity session grant: Opt-in durable-object preview. Requires the configured application allowlist and applicable feature gates; production enablement awaits native GCS/KVM acceptance. Account-owner HTTP operations require MFA and app read access for inspection or deploy write access for mutation. Reader grace, claims and unknown acknowledgements must be respected. Responses are not cacheable. See the durable entity operator guides for the bounded recovery contract.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "grant",
            "in": "path",
            "required": true,
            "description": "Revoke durable entity session grant — parameters / grant: Grant identity returned when minting the credential.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Revoke durable entity session grant — responses / 204: Credential revoked."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Revoke durable entity session grant — responses / 409: Observed revision, ownership, migration or request identity conflicts. Inspect before replaying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "Revoke durable entity session grant — responses / 410: Entity identity is permanently retired. Use a new identity for new work.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/connect": {
      "get": {
        "tags": [
          "invocations"
        ],
        "operationId": "connectDurableEntity",
        "summary": "Upgrade a scoped durable entity session to WebSocket.",
        "description": "Upgrade a scoped durable entity session to websocket: Service transport requires Bearer authentication, MFA, deploy write access and exact entity selectors. Origin headers are rejected. Every frame re-enters authentication and immutable-scope admission. Feature gates and the application allowlist must be enabled; native acceptance remains pending. The Node durable-session helper handles framing, replay and generation fences.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "namespace",
            "in": "query",
            "required": true,
            "description": "Upgrade a scoped durable entity session to websocket — parameters / namespace: Exact entity namespace selecting the scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": true,
            "description": "Upgrade a scoped durable entity session to websocket — parameters / key: Exact entity key selecting the scope; scope management affects the entire account/app/environment/tenant registry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "description": "Upgrade a scoped durable entity session to websocket — parameters / environment: Registered environment, defaulting to production.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform_tenant_id",
            "in": "query",
            "required": false,
            "description": "Upgrade a scoped durable entity session to websocket — parameters / platform tenant id: Optional same-account platform tenant; customer self-service tokens cannot manage scope state.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "101": {
            "description": "Upgrade a scoped durable entity session to websocket — responses / 101: WebSocket upgrade; subsequent frames follow the documented durable-session protocol."
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/session-connect": {
      "get": {
        "tags": [
          "invocations"
        ],
        "operationId": "connectDurableEntityBrowserSession",
        "summary": "Upgrade a scoped browser session to WebSocket.",
        "description": "Upgrade a scoped browser session to websocket: Browser transport authenticates the short-lived grant through Sec-WebSocket-Protocol and requires the exact Origin bound at issuance. Authorization headers and query parameters are rejected. Issuer revocation, scope and generation are rechecked for commands. Feature gates and the application allowlist must be enabled; native acceptance remains pending. The Node durable-session helper handles framing, replay and generation fences.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          }
        ],
        "responses": {
          "101": {
            "description": "Upgrade a scoped browser session to websocket — responses / 101: WebSocket upgrade; subsequent frames follow the documented durable-session protocol."
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "security": []
      }
    },
    "/v1/apps/{slug}/entities/inspect": {
      "get": {
        "tags": [
          "invocations"
        ],
        "operationId": "inspectDurableEntity",
        "summary": "Inspect one durable entity's state and recovery metadata.",
        "description": "Account-owner read preview, requiring apps:read or admin, MFA where\napplicable, and the explicit durable entity app allowlist. Resolves the\ncurrent immutable environment and same-account optional customer. Owner\ninspection permits suspended customers and plan downgrades for diagnosis;\nit does not authorize execution. Customer self-service tokens are excluded.\nReturns state version, alarm and pending-outbox recovery metadata only.\nNo business data, receipts, payloads, credentials, claim tokens or bucket\npaths are exposed. Inspection acquires no ownership, writes no objects,\nrepairs no indexes and runs no guest code. A missing entity returns 404\nwithout creating it; corrupt committed state fails closed with 503.\nHead delivery status is a separate, later observation of retained transport\nhistory. Unknown includes absent/pruned history or read failures and never\nproves a message was not accepted. An empty pending queue does not prove\nreceiver completion. These observations are not atomic across stores.\nInspection does not retry work. Use its recovery_revision for the separate\nowner-only retry endpoint. Responses are not cacheable.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "namespace",
            "in": "query",
            "required": true,
            "description": "Entity namespace, bounded to 256 UTF-8 bytes.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          {
            "name": "key",
            "in": "query",
            "required": true,
            "description": "Logical entity key, bounded to 256 UTF-8 bytes.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          {
            "name": "environment",
            "in": "query",
            "description": "Current registered project environment; defaults to production.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "platform_tenant_id",
            "in": "query",
            "description": "Optional customer owned by the authenticated account, including suspended customers.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Metadata-only entity and head delivery observations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DurableEntityInspectResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Preview disabled, bucket unavailable, corrupt committed state or retryable reclamation race.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Inspection deadline elapsed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/backups": {
      "get": {
        "tags": [
          "invocations"
        ],
        "operationId": "listDurableEntityBackups",
        "summary": "List retained backup metadata.",
        "description": "This backup listing operation provides an owner diagnostic preview requiring apps:read or admin and MFA where\napplicable. Requires durable entity app enablement. Private, no-store.\nNo ownership acquisition, guest execution or writes. Backup listing is\nbounded and metadata-only; backup reads contain sensitive application data.\nRestore preview reports observed versions, recognized schema envelopes and\npreserved pending work. Compatibility is always unverified; schema equality\ndoes not validate application data. Preview grants no restore authority.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "namespace",
            "description": "Entity namespace for backup listing.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "description": "Logical entity key for backup listing.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "environment",
            "description": "Registered environment for backup listing; defaults to production.",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform_tenant_id",
            "description": "Optional account-owned customer scope for backup listing.",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "description": "Opaque continuation cursor from the previous backup page.",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Backup listing observation. Observational result; subsequent restore still requires a fenced commit.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "Private backup listing response; caches must not retain application state."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DurableEntityBackupPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Backup listing observation. Observation raced with publication/deletion, preview is unavailable or storage is corrupt. Retry the read.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Backup listing observation. Observation deadline elapsed. Retry the read.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/backups/get": {
      "get": {
        "tags": [
          "invocations"
        ],
        "operationId": "getDurableEntityBackup",
        "summary": "Read one private application-state backup.",
        "description": "This backup retrieval operation provides an owner diagnostic preview requiring apps:read or admin and MFA where\napplicable. Requires durable entity app enablement. Private, no-store.\nNo ownership acquisition, guest execution or writes. Backup listing is\nbounded and metadata-only; backup reads contain sensitive application data.\nRestore preview reports observed versions, recognized schema envelopes and\npreserved pending work. Compatibility is always unverified; schema equality\ndoes not validate application data. Preview grants no restore authority.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "namespace",
            "description": "Entity namespace for backup retrieval.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "description": "Logical entity key for backup retrieval.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "environment",
            "description": "Registered environment for backup retrieval; defaults to production.",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform_tenant_id",
            "description": "Optional account-owned customer scope for backup retrieval.",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "backup_id",
            "description": "Identifier of the retained backup to retrieve.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Backup retrieval observation. Observational result; subsequent restore still requires a fenced commit.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "Private backup retrieval response; caches must not retain application state."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DurableEntityBackup"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Backup retrieval observation. Observation raced with publication/deletion, preview is unavailable or storage is corrupt. Retry the read.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Backup retrieval observation. Observation deadline elapsed. Retry the read.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/restore/preview": {
      "post": {
        "tags": [
          "invocations"
        ],
        "operationId": "previewDurableEntityRestore",
        "summary": "Preview a restore without writes or execution.",
        "description": "This restore preview operation provides an owner diagnostic preview requiring apps:read or admin and MFA where\napplicable. Requires durable entity app enablement. Private, no-store.\nNo ownership acquisition, guest execution or writes. Backup listing is\nbounded and metadata-only; backup reads contain sensitive application data.\nRestore preview reports observed versions, recognized schema envelopes and\npreserved pending work. Compatibility is always unverified; schema equality\ndoes not validate application data. Preview grants no restore authority.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DurableEntityRestoreRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Restore preview observation. Observational result; subsequent restore still requires a fenced commit.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "Private restore preview response; caches must not retain application state."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DurableEntityRestorePreview"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "description": "Preview body exceeds the central invocation byte limit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Restore preview observation. Observation raced with publication/deletion, preview is unavailable or storage is corrupt. Retry the read.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Restore preview observation. Observation deadline elapsed. Retry the read.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/export": {
      "get": {
        "tags": [
          "invocations"
        ],
        "operationId": "exportDurableEntity",
        "summary": "Export committed application state from one durable entity.",
        "description": "Owner-only preview requiring apps:read or admin and MFA where applicable.\nResolves immutable account, app, environment and tenant identity. Requires\napp enablement. Diagnostic reads permit held/suspended scopes and plan\ndowngrades. Performs no writes or guest invocation. Contains sensitive\napplication JSON; responses are private, no-store. Excludes alarms,\nreceipts, outbox and ownership. Checksum detects corruption, not authority.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "namespace",
            "description": "Entity namespace for state export.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "description": "Logical entity key for state export.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "environment",
            "description": "Registered environment for state export; defaults to production.",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform_tenant_id",
            "description": "Optional account-owned customer scope for state export.",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One committed state export. No version-zero entity is exported.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "Private state export response; caches must not retain application state."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DurableEntityStateExport"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "State export preview is unavailable, ownership is busy or storage failed. Retry the export read.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "State export deadline elapsed. Retry the export read.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/restore/validate": {
      "post": {
        "tags": [
          "invocations"
        ],
        "operationId": "validateDurableEntityRestore",
        "summary": "Ask the live application deployment to validate exported state.",
        "description": "Operator-gated preview requiring deploy:write or admin, MFA where applicable,\napp enablement, execution plan and active-tenant/account rules. Enqueues\na pinned invocation to the distinct private validation path. The synchronous\napplication validator must be pure and returns only a versioned boolean\nverdict. Gregale commits no state, alarm, outbox or request receipt here;\ninvocation rows and normal execution resource use still occur. External\napplication I/O is not independently disabled by the current runtime.\nValidate needs an existing committed entity and matching expected_version.\nReturned deployment_id identifies the checked deployment, not a permission\ntoken. Restore revalidates under its claim and rejects deployment drift;\npreview/validation does not reserve a version. Keep candidate data private.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DurableEntityRestoreRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Application verdict without entity publication; false rejects the candidate.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "Private restore validation response; caches must not retain application state."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DurableEntityRestoreValidationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "validateDurableEntityRestore requires an eligible plan and an account without a billing or abuse hold.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Current state or selected deployment changed. Resolve the observation before starting a new operation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "Validation request exceeds the central invocation byte limit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "502": {
            "description": "Application validation failed or returned a malformed verdict.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Application validation preview is disabled or storage/execution is unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Validation deadline elapsed. No entity commit occurs for validation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/restore": {
      "post": {
        "tags": [
          "invocations"
        ],
        "operationId": "restoreDurableEntity",
        "summary": "Restore exported application data with a fenced expected-version check.",
        "description": "Owner-only mutation preview requiring deploy:write or admin and MFA where\napplicable. Applies app enablement, execution plan, account hold and active\ntenant rules. Export identity must exactly match resolved target scope.\nRequires an existing committed entity, positive expected_version and stable\nrequest_id. Commits only application data, preserving current receipts,\nalarms, outbox and delivery attempts. Advances business version once; invokes\nno guest unless application restore validation is enabled. With\nFAAS_DURABLE_ENTITY_RESTORE_VALIDATION_ENABLED=1, every new restore requires\nvalidation_deployment_id and a fresh pure validator verdict under the claim.\nThe chosen deployment is resolved before and after validation; publication\nstill uses the entity ownership/version CAS. Deployment routing and bucket\npublication are not one atomic transaction. Receipt replay skips validation.\nReceipt replay precedes expected-version comparison. Retry uncertain\noutcomes with the identical request body and ID. Check application schema\ncompatibility before restoring. Audit is best effort after acknowledged\nsuccess, not atomic with the object-store commit. Responses are private,\nno-store; request/response state must not be logged.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DurableEntityRestoreRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Restore committed or an existing receipt was replayed.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "Private state restore response; caches must not retain application state."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DurableEntityRestoreResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "restoreDurableEntity requires an eligible plan and an account without a billing or abuse hold.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Expected version is stale, request identity conflicts or storage budget is exceeded.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "Restore request exceeds the central invocation byte limit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Preview unavailable, busy ownership, storage failure or uncertain outcome. Retry restore with identical request ID and body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Deadline elapsed. Retry restore with identical request ID and body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/retry": {
      "post": {
        "tags": [
          "invocations"
        ],
        "operationId": "retryDurableEntity",
        "summary": "Re-arm exactly one exhausted alarm or outgoing message.",
        "description": "Account-owner mutation preview requiring deploy:write or admin, MFA where\napplicable, durable entity app enablement and the existing execution plan\nand active-customer rules. Account holds block recovery. Requires a fresh\ninspection's version and opaque recovery_revision plus alarm_at or head_id.\nThe revision changes on every manifest write, including ownership and\nretry metadata changes. Only exhausted work on an unowned entity can be\nre-armed. A stale observation or non-exhausted target returns 409; an\nactive owner returns 503. No missing entity is created.\nRecovery changes retry metadata only, preserving state, receipts, deadlines,\nmessage identities, payloads and durable transport acceptance. It does not\ninvoke the guest, send a webhook or retry a terminal receiver delivery.\nExisting workers must be enabled separately. Responses are not cacheable.\nA repeated request after success returns 409. After an uncertain response,\ninspect again before deciding whether another recovery is needed.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DurableEntityRetryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Retry metadata was re-armed; execution or delivery is not confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DurableEntityRetryResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "retryDurableEntity requires an eligible plan and an account without a billing or abuse hold.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Observation changed, target changed or work is not exhausted. Inspect again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "Recovery request exceeds the central durable entity metadata size limit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Preview unavailable, active owner, corrupt state or uncertain recovery outcome. Inspect before retrying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Recovery deadline elapsed. Inspect before retrying.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/entities/invoke": {
      "post": {
        "tags": [
          "invocations"
        ],
        "operationId": "invokeDurableEntity",
        "summary": "Invoke an object-storage-backed entity in the operator preview.",
        "description": "Disabled unless the operator configures a private bucket and explicitly\nenables this app. Account authentication, deploy-write scopes and MFA\napply. A selected customer must belong to the account and be active;\ncustomer self-service tokens are not accepted on this surface.\nEntity identity includes the app, immutable environment identity,\noptional verified customer, namespace and key. The deployed handler\nreceives state at POST /__gregale/entities and returns data, result and\nan optional alarm_at. Handlers must compute transitions without external\nside effects. Alarm delivery requires a separate operator opt-in and\nprivate delimiter listing. Due alarms use the same scheduler path with\nevent=alarm. Clearing or replacing the deadline invalidates stale work;\na failed handler leaves the alarm due. Attempts may repeat, while state,\nthe alarm receipt and its next deadline publish atomically. Alarm timing\ndepends on bounded entity sweeps and has no production latency guarantee.\nState and replay receipts commit in object storage; the existing SQL\ninvocation ledger is used only to schedule and observe guest execution.\nKeep request_id and exact payload bytes for retries, including after an\nuncertain response. HTTP Idempotency-Key does not identify entity work.\nRequest IDs starting with __gregale_alarm/ are reserved for delivery.\nReplays return the original result and version without executing code.\nCalls have a 25 second budget. Owners expire after at most five minutes.\nAn immutable receipt index preserves original results without a receipt\ncount ceiling. Encoded snapshots and individual receipts remain bounded\nto 1 MiB. Operator cleanup can reclaim superseded snapshots and index\nnodes after a fenced generation barrier; it never expires replay receipts.\nAn explicit operator per-entity byte cap can limit the current snapshot\nand its reachable immutable receipts/index/archive. It excludes metadata,\nabandoned uploads and provider history; it is not a plan billing quota.\nOver-cap new work returns 409 durable_entity_storage_limit with limit and\nobserved projected bytes. Existing receipts replay at capacity. Legacy\nentities under a cap return 503 durable_entity_inventory_pending for new\nwork until bounded verified accounting completes. Handler computation\ncan run before quota rejection. Entity deletion is not available yet.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DurableEntityInvokeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Committed or replayed entity result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DurableEntityInvokeResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "invokeDurableEntity requires an eligible plan and an account without a billing or abuse hold.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Request identity conflict, object budget or committed storage cap exceeded, or deployment unavailable. Storage limits include limit and observed projected bytes.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "$ref": "#/components/responses/PlanSourceBytes"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "502": {
            "description": "Handler failed without publishing entity state.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Preview disabled, owner busy, legacy accounting pending, storage unavailable or commit outcome uncertain; retry the same request identity.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Request budget elapsed; retry the same request identity and payload.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/invoke/async": {
      "post": {
        "tags": [
          "invocations"
        ],
        "operationId": "invokeAppAsync",
        "summary": "Async-invoke an app; returns id + status URL.",
        "description": "Enqueues an invocation row and returns immediately with the\nid. The customer polls /v1/invocations/{id} (or uses the\ndashboard SSE) for the eventual row state.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/GregaleRevision"
          },
          {
            "$ref": "#/components/parameters/GregaleRelease"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InvokeRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The enqueued invocation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AsyncInvokeResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "413": {
            "$ref": "#/components/responses/PlanSourceBytes"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/work-policies": {
      "get": {
        "tags": [
          "invocations"
        ],
        "operationId": "listAppWorkPolicies",
        "summary": "List named work policies for an app.",
        "description": "Stage reads return the complete desired policy collection from immutable workload settings. An uninitialized stage collection returns 409 and never inherits production policies. Stage policy execution remains unavailable until work lanes and producers are isolated.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "description": "Registered project environment. Omit for legacy production policies. An explicit production selection uses the legacy collection.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "App work policies.",
            "headers": {
              "X-Gregale-Workload-Revision": {
                "description": "Desired workload configuration revision for a stage.",
                "schema": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 1
                }
              },
              "X-Gregale-Workload-Config-Hash": {
                "description": "SHA-256 of the stage's immutable desired configuration.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkPolicyListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/apps/{slug}/work-policies/{name}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "environment",
          "in": "query",
          "required": false,
          "description": "Edit the complete desired collection in a registered stage. Omit for legacy production policies. Protected environments reject direct edits.",
          "schema": {
            "type": "string"
          }
        },
        {
          "in": "path",
          "name": "name",
          "required": true,
          "description": "Named app work policy.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          }
        }
      ],
      "put": {
        "tags": [
          "invocations"
        ],
        "operationId": "upsertAppWorkPolicy",
        "summary": "Create or update a named app work policy.",
        "description": "Legacy production changes affect new work only. Stage edits create immutable desired workload configuration and subsequent deployments pin it; existing deployments keep their policies. Stage policy execution and qualification remain unavailable until work lanes and producers are isolated.",
        "parameters": [
          {
            "name": "If-Workload-Revision",
            "in": "header",
            "required": false,
            "description": "Expected complete desired workload revision for a stage edit. Zero means no revision exists; concurrent edits return 409.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertWorkPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved policy.",
            "headers": {
              "X-Gregale-Workload-Revision": {
                "description": "Desired complete workload configuration revision for a stage.",
                "schema": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 1
                }
              },
              "X-Gregale-Workload-Config-Hash": {
                "description": "Configuration hash containing the saved stage policy definition.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkPolicyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      },
      "delete": {
        "tags": [
          "invocations"
        ],
        "operationId": "deleteAppWorkPolicy",
        "summary": "Delete a policy after removing event subscription bindings.",
        "description": "A stage deletion preserves an explicit empty collection and its collection revision clock after the last policy is removed. Production producer bindings retain their existing deletion checks.",
        "parameters": [
          {
            "name": "If-Workload-Revision",
            "in": "header",
            "required": false,
            "description": "Expected complete desired workload revision for a stage edit.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Policy deleted.",
            "headers": {
              "X-Gregale-Workload-Revision": {
                "description": "Desired workload revision after removing the stage policy.",
                "schema": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 1
                }
              },
              "X-Gregale-Workload-Config-Hash": {
                "description": "Configuration hash containing the remaining stage policy collection.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/apps/{slug}/work-policies/{name}/cancel-pending": {
      "post": {
        "tags": [
          "invocations"
        ],
        "operationId": "cancelPendingAppWork",
        "summary": "Cancel pending work for one policy and application key.",
        "description": "Running work continues. A repeated Idempotency-Key returns the original receipt and does not cancel newer work. A stage selection cancels only its isolated environment lane, including work admitted under a policy that has since been deleted from desired settings. Cancellation receipts are independent per environment. Omitting environment preserves the production API.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "name": "environment",
            "in": "query",
            "required": false,
            "description": "Registered project environment whose pending work should be cancelled. Stage lanes and receipts are isolated by the environment's immutable identity.",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "name",
            "required": true,
            "description": "Policy whose pending lane is being cancelled.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,62}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelPendingWorkRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Durable cancellation receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelPendingWorkResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/apps/{slug}/queues/send": {
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "queueSend",
        "summary": "Enqueue a row on the per-app FIFO queue.",
        "description": "Cap-checked against the plan's MaxQueueDepth (Hobby 5, Pro 25,\nScale 100). The drain re-checks at dispatch tick. API keys require\n`queues:send`, `deploy:write`, or `admin`.\n",
        "x-faas-queue-leases": false,
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/GregaleRevision"
          },
          {
            "$ref": "#/components/parameters/GregaleRelease"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueueSendRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The enqueued row.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueSendResponse"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/PlanQueueDepth"
          },
          "413": {
            "$ref": "#/components/responses/PlanSourceBytes"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/queues/send-batch": {
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "queueSendBatch",
        "summary": "Send up to 100 messages to one queue as one request.",
        "description": "Sends the messages in order with the same admission as a single send:\nqueue depth, backlog bytes and message size are checked for each one.\nThe first refused message ends the batch; the messages after it are\nnot attempted. Resend from the first message that was not accepted.\nThe batch counts as one request against the account's API budget.\nAPI keys require `queues:send`, `deploy:write`, or `admin`.\n",
        "x-faas-queue-leases": false,
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueueSendBatchRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The outcome of every message, in input order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueSendBatchResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "403": {
            "$ref": "#/components/responses/PlanQueueDepth"
          },
          "413": {
            "$ref": "#/components/responses/PlanSourceBytes"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/commit-sources": {
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "createCommitSource",
        "summary": "Bind an internal PostgreSQL outbox source to Operations or event publication.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCommitSourceRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Commit source created with its immutable application, destination and contract binding.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommitSourceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/commit-sources/{source}": {
      "get": {
        "tags": [
          "queues"
        ],
        "operationId": "getCommitSource",
        "summary": "Inspect source health and its last observed pending/blocked backlog.",
        "parameters": [
          {
            "name": "source",
            "description": "Commit source to inspect within the authenticated account.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Source and last relay observation; no credential material.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommitSourceResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "patch": {
        "tags": [
          "queues"
        ],
        "operationId": "setCommitSourceEnabled",
        "summary": "Pause or resume new source acceptance; existing receipts remain recoverable.",
        "parameters": [
          {
            "name": "source",
            "description": "Commit source whose acceptance state is being changed.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "enabled"
                ],
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Source acceptance state updated; previously accepted receipts remain readable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommitSourceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/commit-sources/{source}/connection": {
      "put": {
        "tags": [
          "queues"
        ],
        "operationId": "putCommitSourceConnection",
        "summary": "Seal a verified-TLS database connection; credentials are never returned.",
        "parameters": [
          {
            "name": "source",
            "description": "Commit source receiving the sealed database connection.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "connection_url"
                ],
                "properties": {
                  "connection_url": {
                    "type": "string",
                    "maxLength": 8192,
                    "writeOnly": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Verified database connection sealed without returning credential material."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/commit-sources/{source}/events": {
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "acceptCommitEvent",
        "summary": "Durably accept committed work; source/event identity has no expiry.",
        "parameters": [
          {
            "name": "source",
            "description": "Commit source defining the immutable event delivery destination.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommitEventRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Event durably accepted with its original or newly created work receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommitReceiptResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/commit-sources/{source}/publications": {
      "get": {
        "tags": [
          "queues"
        ],
        "operationId": "listCommitPublications",
        "summary": "List retained publication acceptance receipts for an event source.",
        "description": "Newest-first metadata only. Acceptance does not imply subscriber completion. Pages are live reads; concurrent admissions may require restarting from the first page. Delivery evidence may expire independently.",
        "parameters": [
          {
            "name": "source",
            "description": "Event-destination Commit source owned by the authenticated account.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "before",
            "description": "Opaque source-scoped next_before cursor from the previous page.",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "description": "Maximum number of retained receipts per page.",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Accepted publications and an optional continuation cursor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommitPublicationHistoryResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/commit-sources/{source}/blocked-events": {
      "get": {
        "tags": [
          "queues"
        ],
        "operationId": "listCommitBlockedEvents",
        "summary": "Read the latest bounded blocked-event snapshot without payloads.",
        "parameters": [
          {
            "name": "source",
            "description": "Commit source whose blocked-event observation is being read.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Up to 32 observed blocked events; source info reports the full count.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommitBlockedEventsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/commit-sources/{source}/events/{event}/replay": {
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "replayCommitBlockedEvent",
        "summary": "Request durable replay after correcting an unaccepted source event.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "name": "source",
            "description": "Commit source containing the corrected blocked event.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "event",
            "description": "Customer outbox event UUID to request for replay.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Replay request persisted; this is not downstream acceptance or completion."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/commit-sources/{source}/events/{event}": {
      "get": {
        "tags": [
          "queues"
        ],
        "operationId": "getCommitReceipt",
        "summary": "Recover acceptance independently of execution completion.",
        "parameters": [
          {
            "name": "source",
            "description": "Commit source that owns the retained acceptance receipt.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "event",
            "description": "Customer outbox event UUID whose receipt is being recovered.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retained acceptance receipt for the requested source and event.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommitReceiptResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/inbox": {
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "sendAppMessage",
        "summary": "Reliably send work to another Gregale application.",
        "description": "Wraps `data` in a CloudEvents 1.0 envelope and durably enqueues it on\nthe target application's existing invocation queue. Delivery is\nat-least-once and uses the queue's normal retry, tracing, dead-letter,\nreplay, wake, and capacity behavior. This is a straightforward\napplication inbox, not a general-purpose streaming log. API keys\nrequire `events:publish`, `deploy:write`, or `admin`.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/GregaleRevision"
          },
          {
            "$ref": "#/components/parameters/GregaleRelease"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendAppMessageRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The message was durably queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendAppMessageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/PlanQueueDepth"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/PlanSourceBytes"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/queue-workload": {
      "description": "Production queue workload profile. Stage environment or scope queries are rejected before changing production resources; stage definitions use the project environment workload queue-bindings endpoint.",
      "put": {
        "tags": [
          "queues"
        ],
        "operationId": "configureQueueWorkload",
        "summary": "Configure the simple queue workload profile.",
        "description": "Idempotently creates or updates the app's default push queue\nbinding, consumer projection, and queue-depth scaling policy.\nZero-valued request fields use platform defaults; advanced\nresources remain available through the individual APIs.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueueWorkloadProfileRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Existing profile converged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueWorkloadProfileResponse"
                }
              }
            }
          },
          "201": {
            "description": "New profile created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueWorkloadProfileResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/queue-bindings": {
      "description": "Production queue bindings. Stage environment or scope queries are rejected before production access or idempotent replay. Stage definitions use the project environment workload queue-bindings endpoint.",
      "get": {
        "tags": [
          "queues"
        ],
        "operationId": "listQueueBindings",
        "summary": "List first-class queue bindings for an app.",
        "description": "Returns the durable mappings between logical queues and worker/job\nworkloads. Bindings are the configuration source for push consumers\nand queue-depth autoscaling; queue messages remain under /queues/*.\nActive bindings are returned by default. Set include_retired=true to\nretrieve retained identities and retirement timestamps for reviewed recovery.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "include_retired",
            "in": "query",
            "required": false,
            "description": "Include retained retired bindings belonging to this app.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Queue bindings.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/QueueBindingResponse"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "createQueueBinding",
        "summary": "Create a first-class queue binding.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateQueueBindingRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created queue binding.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueBindingResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/queue-bindings/{id}": {
      "description": "Production queue binding identity. Stage environment or scope queries are rejected; stage definitions use logical names in the project environment workload queue-bindings endpoint.",
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "queues"
        ],
        "operationId": "getQueueBinding",
        "summary": "Get one queue binding.",
        "responses": {
          "200": {
            "description": "Queue binding.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueBindingResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "tags": [
          "queues"
        ],
        "operationId": "updateQueueBinding",
        "summary": "Update one queue binding.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateQueueBindingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated queue binding.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueBindingResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "queues"
        ],
        "operationId": "deleteQueueBinding",
        "summary": "Delete one queue binding.",
        "responses": {
          "204": {
            "description": "Queue binding deleted."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/queue-bindings/{id}/status": {
      "description": "Production consumer status. Stage environment or scope queries are rejected before reading production counters.",
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "queues"
        ],
        "operationId": "getQueueBindingStatus",
        "summary": "Read queue binding consumer state and queue counters.",
        "description": "Returns the durable push-consumer projection and binding-scoped\nqueue counters. `consumer_state` is control-plane state\n(`active`, `paused`, `not_configured`, or `external`), while\n`consumer_liveness` and the poll timestamps expose the scheduler's\nlast-known health. A push snapshot is stale after 30 seconds without\na completed poll; pull bindings report `external` liveness.\n",
        "responses": {
          "200": {
            "description": "Queue binding status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueBindingStatusResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/queues/receive": {
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "queueReceive",
        "summary": "Long-poll for the next dispatched row.",
        "description": "Returns 200 with the dequeued row, or 204 (no body) if the\nserver-side 30s budget elapses with no event. The customer\nretries on 204.\n",
        "x-faas-queue-leases": true,
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          }
        ],
        "responses": {
          "200": {
            "description": "A dispatched row.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueReceiveResponse"
                }
              }
            }
          },
          "204": {
            "description": "No row dispatched within the budget."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/queues/{id}/ack": {
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "queueAck",
        "summary": "Ack a queue row (idempotent).",
        "x-faas-queue-leases": false,
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/Id32"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "204": {
            "description": "No body. The ack (or a re-ack) was accepted."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/queues/{queue}/leases": {
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "leaseQueueMessages",
        "summary": "Lease ready messages from a pull-bound queue.",
        "description": "Leases up to `max_messages` ready messages from a queue with an\nenabled pull binding on this app. Each message stays hidden for the\nvisibility timeout and is redelivered with a new attempt if it is not\nacked, nacked or extended in time. Unexpired leases never exceed the\nbinding's `max_concurrency`. An empty list means nothing is ready;\npoll again with back-off. Authenticate with an API key carrying\n`queues:consume`, `deploy:write` or `admin`, or with a workload\nidentity token for audience `gregale:queues` from a live instance of\nthis app.\n",
        "x-faas-queue-leases": true,
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/QueueLeaseQueue"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueueLeaseRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Leased messages, possibly none.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueLeaseResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/queues/{queue}/leases:ack": {
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "ackQueueLeases",
        "summary": "Complete leased messages.",
        "x-faas-queue-leases": true,
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/QueueLeaseQueue"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueueLeaseReceiptsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Receipts that completed their messages, and receipts that no longer own one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueLeaseReceiptsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/queues/{queue}/leases:nack": {
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "nackQueueLeases",
        "summary": "Return leased messages for a retry.",
        "description": "Applies the message's retry policy and the plan's attempt budget:\nthe message returns to the queue after the back-off (or after\n`delay_seconds` if later), or moves to the dead-letter queue once the\nbudget is spent. `error` is recorded as the attempt's last error.\n",
        "x-faas-queue-leases": true,
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/QueueLeaseQueue"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueueLeaseReceiptsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Receipts whose messages went back for a retry or to the dead-letter queue, and receipts that no longer own one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueLeaseReceiptsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/queues/{queue}/leases:extend": {
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "extendQueueLeases",
        "summary": "Extend the visibility timeout of leased messages.",
        "x-faas-queue-leases": true,
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/QueueLeaseQueue"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueueLeaseReceiptsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Receipts whose visibility deadline moved, and receipts that no longer own their message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueLeaseReceiptsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/queues/state": {
      "get": {
        "tags": [
          "queues"
        ],
        "operationId": "queueState",
        "summary": "Read queue depth, in-flight count, and oldest pending age.",
        "description": "Read-only depth / in-flight / oldest-pending stats. NO lease is\nacquired and no row is mutated — the response can be polled at\nany cadence without affecting drain behaviour. Free plans can\ncall this for diagnostics even though they cannot send.\n",
        "x-faas-queue-leases": false,
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          }
        ],
        "responses": {
          "200": {
            "description": "Queue stats for the app.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueStateResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/queues/peek": {
      "get": {
        "tags": [
          "queues"
        ],
        "operationId": "queuePeek",
        "summary": "List pending queue rows without acquiring a lease.",
        "description": "Read-only peek at pending rows, oldest first. Repeated calls\nreturn the same rows in the same order — the underlying SQL has\nno FOR UPDATE / FOR SHARE / advisory lock, so attempts is\nnever incremented and no row state changes. Cursor pagination\nmatches the existing `?before=<id>` convention. NOT equivalent\nto `queues/receive` — peek never leases.\n",
        "x-faas-queue-leases": false,
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/QueueCursorLimit"
          },
          {
            "$ref": "#/components/parameters/QueueCursorBefore"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of pending rows.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueuePeekResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/queues/dead_letter": {
      "get": {
        "tags": [
          "queues"
        ],
        "operationId": "queueDeadLetter",
        "summary": "List queue rows that exhausted the plan's retry budget.",
        "description": "Read-only list of rows in `state='dead_letter'`, newest first.\nThe drain transitions a row here once it has failed\n`MaxQueueAttempts` times for the app's plan (Hobby 3, Pro 10,\nScale 25). NO lease is acquired and no row is mutated. Replaying\na dead-letter row is out of scope for this endpoint — see\n`POST /v1/apps/{slug}/queues/dead_letter/{id}/replay`.\n",
        "x-faas-queue-leases": false,
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/QueueCursorLimit"
          },
          {
            "$ref": "#/components/parameters/QueueCursorBefore"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of dead-letter rows.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueDeadLetterResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/queues/dead_letter/{id}/replay": {
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "queueDeadLetterReplay",
        "summary": "Reset a dead-letter queue row back to pending.",
        "description": "Resets the row's `state` to `pending` with\n`attempts=0`, `last_error=null`, `due_at=now`,\n`last_replayed_at=now`. Distinct from\n`POST /v1/invocations/{id}/replay`, which enqueues a NEW row\ntagged Source=InvocationReplay. This endpoint mutates the\nexisting row in place so the dashboard's replay history view\ntracks the chain on a single row id.\n\nIdempotent: a second POST after the first has succeeded\nfinds the row in 'pending' and returns 404. The\nIdempotency-Key middleware (issued automatically by the SDK)\ncovers double-POST across network retries.\n",
        "x-faas-queue-leases": false,
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{32}$"
            },
            "description": "The invocation id of the dead-letter row to replay."
          }
        ],
        "responses": {
          "202": {
            "description": "Replay accepted; row is back to pending.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AsyncInvokeResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/dlq": {
      "get": {
        "tags": [
          "queues"
        ],
        "operationId": "listDeadLetterEvents",
        "summary": "List dead-letter events for an app.",
        "description": "Returns queue invocation, broker trigger, and outbound webhook\ndelivery failures in one durable, newest-first ledger. The source row\nis not leased or mutated.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/QueueCursorLimit"
          },
          {
            "$ref": "#/components/parameters/QueueCursorBefore"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of unified dead-letter events.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeadLetterEventsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "queues"
        ],
        "operationId": "purgeDeadLetterEvents",
        "summary": "Purge dead-letter events from the app ledger.",
        "description": "Removes up to `limit` ledger projections; source records remain dead-lettered.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/QueueCursorLimit"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Number of ledger events purged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeadLetterPurgeResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "listEventSubscriptions",
        "summary": "List event subscriptions reconciled for an app.",
        "description": "Returns the event subscriptions currently installed from the app's\ndeployment manifest. The response is read-only and account-scoped;\nuse it to verify the router will receive matching published events.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          }
        ],
        "responses": {
          "200": {
            "description": "Reconciled event subscriptions, in creation order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventSubscriptionListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/replay-preview": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "previewEventReplay",
        "summary": "Preview historical retained events for one subscription.",
        "description": "Read-only, account-scoped preview using the current enabled ordinary\napplication subscription and the routing matcher. Work-bound subscriptions\nare unsupported. Select a half-open platform acceptance-time range; producer\nevent time is not the range key. A fixed cutoff excludes later acceptances.\nEach page examines at most limit envelopes, so a page can contain no matches\nand still have next_after. Counts describe this page only. Pass the cursor\nunchanged with the same target and range; a changed declaration returns 409.\nMatches contain metadata and original captured-membership status, never\npayloads. Captured membership does not imply successful delivery or define\nreplay eligibility. No deliveries, replay jobs or retention pins are created.\nRetention can remove rows between pages. This is a live retained view, not a\nfrozen export or a complete archive; late commits can change visible rows.\nSettled receipts are kept for the plan's settled-receipt window from routing\nsettlement (Free 1 day, Hobby 3, Pro 7, Scale 14); pending receipts may\nsurvive longer. Earliest retained acceptance is account-wide and does not\nestablish coverage of a requested range. Responses use Cache-Control: no-store\nand require the existing read scopes and MFA rules.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Current subscription owned by this app and account."
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Inclusive acceptance-time lower bound, preceding the cutoff."
          },
          {
            "name": "until",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Exclusive acceptance-time upper bound; future values are capped at the first page observation."
          },
          {
            "name": "after",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 4096
            },
            "description": "Opaque next_after continuation bound to account, target, revision, range and fixed cutoff."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Maximum envelopes examined per page, including nonmatches."
          }
        ],
        "responses": {
          "200": {
            "description": "Matching retained-event metadata and page-local counts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventReplayPreviewResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Subscription changed, disabled or work-bound (event_replay_preview_changed, event_replay_preview_disabled, event_replay_preview_unsupported).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Retained-event read failed or exceeded the five-second deadline (event_replay_preview_read_timeout).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/workflow-event-replay-preview": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "previewWorkflowEventReplay",
        "summary": "Preview retained events for one captured workflow recipient.",
        "description": "Read-only, bounded inspection of retained envelopes and their immutable\nworkflow recipient snapshots. The preview evaluates the captured\nworkflow trigger filter, reports its routing checkpoint and durable\nworkflow admission receipt, and never creates a workflow run. It does\nnot inspect events where the workflow was not captured, current workflow\ndefinitions, or current workflow quota/target eligibility. Potential\nadmissions are estimates for a future replay policy, not a guarantee.\nEvent payloads and captured definitions are never returned.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "workflow_name",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "description": "Workflow name in the immutable recipient snapshot."
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Inclusive platform acceptance-time lower bound, preceding the cutoff."
          },
          {
            "name": "until",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Exclusive acceptance-time upper bound; future values are capped at first-page observation."
          },
          {
            "name": "after",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 4096
            },
            "description": "Opaque next_after cursor bound to account, app, workflow name, range and fixed cutoff."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Maximum retained envelopes examined per page, including events without this captured workflow."
          }
        ],
        "responses": {
          "200": {
            "description": "Matching retained workflow-recipient metadata and page-local counts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowEventReplayPreviewResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Retained-event read failed or exceeded the five-second deadline (workflow_event_replay_preview_read_timeout).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/replays": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "createEventReplayBackfill",
        "summary": "Create a resumable historical event backfill.",
        "description": "Creates a durable job for one current enabled ordinary subscription.\nThe target declaration is snapshotted at creation, the half-open range\nuses platform acceptance time, and a fixed cutoff excludes later\nevents. Only surviving retained envelopes are considered; this does\nnot create a complete archive. The required duplicate policy is\nskip_existing: events originally captured for the target, legacy events\nwith unknown membership, prior target rows, and unsettled receipts are\nskipped. Only settled receipts with captured snapshots and definitively\nabsent target membership can create deliveries. The scheduler scans at\nmost 100 envelopes per page and holds at most 100 target deliveries\npending or processing per job. At most three jobs may run per account,\nwith one active job per subscription. Active jobs protect their\nrequested range from normal settled-receipt pruning. Routing uses the\nexisting recipient lease, capacity, retry, and handler lifecycle.\nWork-bound subscriptions are unsupported. `enqueued` means the handler\ninvocation was admitted, not completed. Responses use no-store.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Current ordinary subscription owned by this app and account."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventReplayBackfillRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Durable replay job accepted.",
            "headers": {
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "URL of the replay job progress resource."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventReplayBackfillJobResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Target subscription is disabled or work-bound (event_replay_backfill_disabled, event_replay_backfill_unsupported).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Durable job creation timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/workflow-event-replays": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "createWorkflowEventReplayBackfill",
        "summary": "Create a durable historical workflow-start backfill.",
        "description": "Creates a durable job for one currently eligible event-triggered workflow\nin the app's preferred live default deployment. The selected workflow\ndefinition and trigger are snapshotted at creation. The half-open range\nuses platform acceptance time with a fixed exclusive cutoff and spans\nat most the plan's settled-receipt window. Only retained events with a known immutable\nrecipient snapshot, a settled delivered receipt, and no captured\nmembership for this app workflow are considered. Legacy events with an\nunknown snapshot, events that already captured this workflow, unsettled\nreceipts, filtered events, and any event with a durable workflow\nadmission receipt are skipped. A durable `(outbox_id, workflow\nrecipient_id)` receipt deduplicates run admission across backfill jobs,\nincluding after the linked run is pruned. Admission uses the definition\npinned to the job and current account/app eligibility and run quotas.\nQuota and temporary target failures can be retried with the standard\nbackfill retry operation. The scan handles at most 100 envelopes per\npage; at most three jobs may run per account, with one active job per\nworkflow. Active jobs protect their range from normal settled-receipt\npruning. `enqueued` means a workflow run was admitted; run completion is\nseparate. Retained event history is not a complete archive.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkflowEventReplayBackfillRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Durable workflow replay job accepted.",
            "headers": {
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Relative link to this workflow job's status and outcomes."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventReplayBackfillJobResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Job target conflict, unsupported workflow, or workflow is not currently eligible (event_replay_backfill_conflict, event_replay_backfill_unsupported).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Workflow replay request exceeded its processing deadline.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/delivery-health": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventConsumerDeliveryHealth",
        "summary": "Inspect subscription delivery health across routing and retained execution evidence.",
        "description": "Requires `apps:read` or `admin`. Combines independent reads under one bounded deadline, not a single database snapshot. Routing counts cover the live backlog. Current execution counts include bounded retained handler replays. Attempt rates and completion latency use durable per-subscription window evidence, with explicit completeness and retention boundaries. Pending sample blocker counts cover at most 50 oldest pending application recipients and are sampled when truncated. Capacity-wait and waiting-reason counts cover all retained pending application recipients independently of that sample. Component observed_at timestamps describe each read; top-level observed_at marks assembly completion. Configured rate and pause/circuit state are controls, not proof that every recipient is blocked. Latest successful completion is the latest in bounded retained execution coverage, not an all-time watermark.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug for this operation: inspect combined routing, execution and pending delivery health.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "description": "Application event subscription identifier for this operation: inspect combined routing, execution and pending delivery health.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "window",
            "description": "Retained observation window for this operation: inspect combined routing, execution and pending delivery health.",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "5m",
                "15m",
                "1h",
                "6h",
                "24h"
              ],
              "default": "5m"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Independent routing, execution, and oldest pending sample reads.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventConsumerDeliveryHealth"
                }
              }
            }
          },
          "400": {
            "description": "Invalid subscription identifier or combined delivery observation window.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "The combined delivery health request exceeded its bounded deadline. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "The combined delivery health request exceeded its bounded deadline.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/execution-reconciliation/case-backfill/{requestID}/pause": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "pauseEventExecutionLineageCaseBackfill",
        "summary": "Pause a retained lineage diagnostic scan.",
        "description": "Requires deploy/write scope and MFA. Scan UUID and original created_at fence the incarnation. Pauses a pending or waiting scan. Repeating pause on a paused scan leaves its metadata unchanged. Completed, cancelled and expired scans return 409. Controls serialize under the same coverage lock as scheduler batches; an already-held batch may commit before the control. Range, counters, existing diagnostics, normal repair progress and original 30-day deadline stay unchanged. Paused scans expire on their original deadline and cannot be replaced until cancelled or expired. These are desired-state controls, not an immutable command ledger; conflicting controls follow server lock order. Read status before retrying after an intervening opposite control.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Application whose retained diagnostic scan is being paused.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "Event subscription identifier.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "requestID",
            "in": "path",
            "required": true,
            "description": "Reviewed original nonzero diagnostic scan UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ControlEventExecutionLineageCaseBackfillRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Current guarded scan state and preserved progress.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventExecutionLineageCaseBackfill"
                }
              }
            }
          },
          "400": {
            "description": "Invalid identifier or missing original creation timestamp.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Scan UUID or creation guard changed, or pause/resume requested for a terminal scan; stable code event_lineage_case_backfill_changed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "Request exceeds the 65536-byte body limit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Control timed out; read current status, then repeat the desired control with the original UUID and creation guard. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Control timed out; read current status, then repeat the desired control with the original UUID and creation guard.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/execution-reconciliation/case-backfill/{requestID}/resume": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "resumeEventExecutionLineageCaseBackfill",
        "summary": "Resume a retained lineage diagnostic scan.",
        "description": "Requires deploy/write scope and MFA. Scan UUID and original created_at fence the incarnation. Resumes a paused scan from its saved cursor and fixed retained range. Repeating resume on a pending or waiting scan leaves metadata unchanged. Completed, cancelled and expired scans return 409. Active bulk retry jobs still govern whether the scheduler can scan. Controls serialize under the same coverage lock as scheduler batches; an already-held batch may commit before the control. Range, counters, existing diagnostics, normal repair progress and original 30-day deadline stay unchanged. Paused scans expire on their original deadline and cannot be replaced until cancelled or expired. These are desired-state controls, not an immutable command ledger; conflicting controls follow server lock order. Read status before retrying after an intervening opposite control.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Application slug. Context: Resume a retained lineage diagnostic scan.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "Event subscription identifier. Context: Resume a retained lineage diagnostic scan.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "requestID",
            "in": "path",
            "required": true,
            "description": "Reviewed original nonzero diagnostic scan UUID. Context: Resume a retained lineage diagnostic scan.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ControlEventExecutionLineageCaseBackfillRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Current guarded scan state and preserved progress. Context: Resume a retained lineage diagnostic scan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventExecutionLineageCaseBackfill"
                }
              }
            }
          },
          "400": {
            "description": "Invalid identifier or missing original creation timestamp. Context: Resume a retained lineage diagnostic scan.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Scan UUID or creation guard changed, or pause/resume requested for a terminal scan; stable code event_lineage_case_backfill_changed. Context: Resume a retained lineage diagnostic scan.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "Request exceeds the 65536-byte body limit. Context: Resume a retained lineage diagnostic scan.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Control timed out; read current status, then repeat the desired control with the original UUID and creation guard. Context: Resume a retained lineage diagnostic scan. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Control timed out; read current status, then repeat the desired control with the original UUID and creation guard. Context: Resume a retained lineage diagnostic scan.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/execution-reconciliation/case-backfill/{requestID}/cancel": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "cancelEventExecutionLineageCaseBackfill",
        "summary": "Cancel a retained lineage diagnostic scan.",
        "description": "Requires deploy/write scope and MFA. Scan UUID and original created_at fence the incarnation. Cancels unprocessed diagnostic work while keeping existing case records, cursor and counters. Repeating cancel on a cancelled, completed or expired scan returns its current terminal state unchanged. A cancelled scan cannot be resumed. Controls serialize under the same coverage lock as scheduler batches; an already-held batch may commit before the control. Range, counters, existing diagnostics, normal repair progress and original 30-day deadline stay unchanged. Paused scans expire on their original deadline and cannot be replaced until cancelled or expired. These are desired-state controls, not an immutable command ledger; conflicting controls follow server lock order. Read status before retrying after an intervening opposite control.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Application slug. Context: Cancel a retained lineage diagnostic scan.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "Event subscription identifier. Context: Cancel a retained lineage diagnostic scan.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "requestID",
            "in": "path",
            "required": true,
            "description": "Reviewed original nonzero diagnostic scan UUID. Context: Cancel a retained lineage diagnostic scan.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ControlEventExecutionLineageCaseBackfillRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Current guarded scan state and preserved progress. Context: Cancel a retained lineage diagnostic scan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventExecutionLineageCaseBackfill"
                }
              }
            }
          },
          "400": {
            "description": "Invalid identifier or missing original creation timestamp. Context: Cancel a retained lineage diagnostic scan.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Scan UUID or creation guard changed, or pause/resume requested for a terminal scan; stable code event_lineage_case_backfill_changed. Context: Cancel a retained lineage diagnostic scan.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "Request exceeds the 65536-byte body limit. Context: Cancel a retained lineage diagnostic scan.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Control timed out; read current status, then repeat the desired control with the original UUID and creation guard. Context: Cancel a retained lineage diagnostic scan. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Control timed out; read current status, then repeat the desired control with the original UUID and creation guard. Context: Cancel a retained lineage diagnostic scan.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/execution-reconciliation/case-backfill": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventExecutionLineageCaseBackfill",
        "summary": "Inspect the latest bounded lineage diagnostic scan.",
        "description": "Requires read scope. Reports the latest scan only, or not_requested. Counters describe examined retained receipts, not live blockers or complete history. Existing case revisions and forward repair progress are preserved. Expiry is visible immediately after the 30-day work deadline.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Application slug. Context: Inspect the latest bounded lineage diagnostic scan.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "Event subscription identifier. Context: Inspect the latest bounded lineage diagnostic scan.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Latest scan status and counters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventExecutionLineageCaseBackfill"
                }
              }
            }
          },
          "400": {
            "description": "Invalid identifier or scan guard.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Latest scan changed or is active; stable code event_lineage_case_backfill_changed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Request timed out; repeat the same request UUID and previous-request guard. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Request timed out; repeat the same request UUID and previous-request guard.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "requestEventExecutionLineageCaseBackfill",
        "summary": "Backfill missing lineage cases from retained admission evidence.",
        "description": "Requires deploy/write scope and an existing execution coverage row. The request UUID and expected previous scan UUID fence retries and replacement of a completed, cancelled or expired scan. Only the latest scan is retained in coverage metadata; superseded requests fail their stale guards. Captures an upper receipt ID and resumes a separate bounded cursor. Waits for active bulk lineage retries on this subscription. Inserts missing unresolved/conflicting diagnostics with unique diagnostic IDs, without overwriting existing cases, associating roots, executing handlers or reconstructing outcomes. Retained receipt membership remains live during the scan. Missing or pruned evidence cannot be recovered. Work expires 30 days after request; a deliberate replacement needs a new UUID and the latest request UUID as its guard.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Application slug. Context: Backfill missing lineage cases from retained admission evidence.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "Event subscription identifier. Context: Backfill missing lineage cases from retained admission evidence.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RequestEventExecutionLineageCaseBackfillRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Current paused, cancelled, completed or expired scan, or an empty retained range.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventExecutionLineageCaseBackfill"
                }
              }
            }
          },
          "202": {
            "description": "Durably accepted active diagnostic scan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventExecutionLineageCaseBackfill"
                }
              }
            }
          },
          "400": {
            "description": "Invalid identifier or scan guard. Context: Backfill missing lineage cases from retained admission evidence.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Latest scan changed or is active; stable code event_lineage_case_backfill_changed. Context: Backfill missing lineage cases from retained admission evidence.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Request timed out; repeat the same request UUID and previous-request guard. Context: Backfill missing lineage cases from retained admission evidence. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Request timed out; repeat the same request UUID and previous-request guard. Context: Backfill missing lineage cases from retained admission evidence.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/execution-reconciliation/retry-preview": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "previewEventExecutionLineageRetries",
        "summary": "Preview unresolved or conflicting retained lineage cases.",
        "description": "Requires read scope. Optional exact reason filter; live pagination, not a reserved selection. Review case acceptance timestamps and revisions before submitting a fixed job selection.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Application slug. Context: Preview unresolved or conflicting retained lineage cases.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "Event subscription identifier. Context: Preview unresolved or conflicting retained lineage cases.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "reason",
            "in": "query",
            "description": "Exact reason code; empty matches all reasons.",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "name": "after",
            "in": "query",
            "description": "Exclusive outbox cursor.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0,
              "default": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Page size; zero selects the default.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retained eligible cases.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventExecutionLineageCases"
                }
              }
            }
          },
          "400": {
            "description": "Invalid identifier, selection or pagination.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Case guard changed or retained request identity reused with another selection.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Operation timed out; repeat submission with the same request identity and selection. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Operation timed out; repeat submission with the same request identity and selection.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/execution-reconciliation/retry-jobs": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "listEventExecutionLineageRetryJobs",
        "summary": "List retained bulk lineage retry job summaries.",
        "description": "Requires read scope and MFA. Returns live retained jobs newest first by original creation time, with request UUID as a descending tie-breaker. Expired jobs are excluded before physical cleanup. Status and progress are current observations; pagination is not a frozen snapshot. Optional attention=any|stalled|retention_risk restricts the list to matching retained pending/paused jobs, before pagination. Any matches either warning. Stalled uses 15 minutes of inactivity; retention risk uses a 24-hour deadline. Attention responses include observation time, page coverage and has_more plus per-job progress/retention diagnostics and the original creation guard. This list is not capped by the health sample or 500-job health scan. Continue with next_after and the same status and attention filters. Jobs created or changing into a filtered status or warning above the cursor can require restarting from the first page. No frozen snapshot or complete backlog count is claimed. Status completed/cancelled with attention is invalid. Summaries omit case selections and results; GET an individual job for details or its original creation guard before cancellation.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug selecting the owner of this lineage operation. List retained bulk lineage retry job summaries.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "description": "Subscription UUID whose retained lineage records are inspected. List retained bulk lineage retry job summaries.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Omit for all retained states.",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "paused",
                "completed",
                "cancelled"
              ]
            }
          },
          {
            "name": "after",
            "in": "query",
            "description": "Continuation cursor returned by next_after; pass unchanged with the same status filter.",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "name": "limit",
            "description": "Maximum number of retained records in this response; zero selects the default. List retained bulk lineage retry job summaries.",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 200,
              "default": 50,
              "description": "Zero selects the default page size."
            }
          },
          {
            "name": "attention",
            "in": "query",
            "description": "Optional warning filter; applies only to active pending/paused jobs. Empty means ordinary retained listing.",
            "schema": {
              "type": "string",
              "enum": [
                "",
                "any",
                "stalled",
                "retention_risk"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retained job summaries; an existing subscription with no jobs returns an empty array.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventExecutionLineageRetryJobs"
                }
              }
            }
          },
          "400": {
            "description": "Invalid identifier, status filter or pagination.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Listing timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Listing timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "createEventExecutionLineageRetryJob",
        "summary": "Submit a fixed reviewed lineage retry selection.",
        "description": "Requires deploy/write scope. At most 200 unique cases with expected revisions, original acceptance timestamps and diagnostic IDs when present. Creation validates every guard atomically. Repeating the same retained UUID and normalized selection returns current job progress; another selection returns 409. Scheduler evaluations and checkpoints commit together. Changed or unavailable cases are reported individually. Repairs lineage only, without handler execution or historical outcome reconstruction. Jobs expire 30 days after submission; use a new UUID after expiry and refresh case guards.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Application slug. Context: Submit a fixed reviewed lineage retry selection.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "Event subscription identifier. Context: Submit a fixed reviewed lineage retry selection.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateEventExecutionLineageRetryJobRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Previously paused, completed or cancelled job.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventExecutionLineageRetryJob"
                }
              }
            }
          },
          "202": {
            "description": "Durably accepted pending job.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventExecutionLineageRetryJob"
                }
              }
            }
          },
          "400": {
            "description": "Invalid identifier, selection or pagination. Context: Submit a fixed reviewed lineage retry selection.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Case guard changed or retained request identity reused with another selection. Context: Submit a fixed reviewed lineage retry selection.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Operation timed out; repeat submission with the same request identity and selection. Context: Submit a fixed reviewed lineage retry selection. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Operation timed out; repeat submission with the same request identity and selection. Context: Submit a fixed reviewed lineage retry selection.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/execution-reconciliation/retry-jobs/{requestID}/controls": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "listEventExecutionLineageRetryJobControls",
        "summary": "List retained immutable bulk retry control receipts.",
        "description": "Requires read scope and MFA. Fences the original job incarnation with expected_created_at. Successful UUID-keyed pause/resume/cancel commands, including new-command no-ops, are ordered by their increasing per-job sequence. Duplicate commands create no new receipt. Legacy controls without a UUID and failed requests are absent. New receipts include server-derived actor_kind, actor_id and credential_type; older receipts omit attribution. Repeats preserve the original actor even under another authorized credential. Receipts are immutable metadata observations, expire with the original job and cascade on job deletion. Optional action, actor_id and credential_type filters combine with AND before pagination. Sequence cursors retain their original per-job meaning and may have gaps; keep filters unchanged across pages or restart at after=0. Legacy unattributed receipts remain in unfiltered history and match action filters but not nonempty attribution filters. Pagination is a live append-only listing, not a reservation; timestamps are informational and sequence defines order. An existing retained job with no receipts returns an empty controls array. Expired/missing jobs return 404 and stale creation guards return 409.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug selecting the owner of this lineage operation. List retained immutable bulk retry control receipts.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "description": "Subscription UUID whose retained lineage records are inspected. List retained immutable bulk retry control receipts.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "requestID",
            "description": "Original bulk retry submission UUID whose command receipts are listed. List retained immutable bulk retry control receipts.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "expected_created_at",
            "in": "query",
            "required": true,
            "description": "Original nonzero creation timestamp from the reviewed job.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "after",
            "description": "Opaque continuation boundary returned by the preceding control-history page. List retained immutable bulk retry control receipts.",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0,
              "maximum": 128,
              "default": 0
            }
          },
          {
            "name": "limit",
            "description": "Maximum number of retained records in this response; zero selects the default. List retained immutable bulk retry control receipts.",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 200,
              "default": 50,
              "description": "Zero selects the default page size. Context: List retained immutable bulk retry control receipts."
            }
          },
          {
            "name": "action",
            "in": "query",
            "description": "Exact action filter; empty means all actions.",
            "schema": {
              "type": "string",
              "enum": [
                "",
                "pause",
                "resume",
                "cancel"
              ]
            }
          },
          {
            "name": "actor_id",
            "in": "query",
            "description": "Exact original actor UUID or store for internal calls. UUIDs must use hyphenated form; casing is normalized. Empty means all actors. Attribution-free legacy receipts do not match a nonempty actor filter.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "credential_type",
            "in": "query",
            "description": "Exact original credential type; empty means all types. Attribution-free legacy receipts do not match a nonempty filter.",
            "schema": {
              "type": "string",
              "enum": [
                "",
                "session",
                "api_key",
                "deploy_token",
                "platform_tenant_token",
                "internal"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Immutable command receipts, oldest sequence first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventExecutionLineageRetryJobControls"
                }
              }
            }
          },
          "400": {
            "description": "Invalid identifier, creation guard, pagination or history filter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Job creation guard changed; event_lineage_retry_job_changed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "History read timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "History read timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/execution-reconciliation/retry-jobs/{requestID}/pause": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "pauseEventExecutionLineageRetryJob",
        "summary": "Pause unprocessed cases in a retained bulk lineage retry job.",
        "description": "Requires deploy/write scope and MFA. The original creation timestamp fences the job. Optional command_id enables an immutable successful-control receipt scoped to this job incarnation. The job lock commits state and receipt together. Repeating the same command UUID and original inputs returns current job state with its original control_receipt and never reapplies the action, including after another action or terminal completion. Reusing a command UUID with another action returns 409. At most 128 retained receipts per job; new UUIDs beyond that limit return 429 without changing the job. New UUIDs for completed/cancelled jobs return 409; repeated successful commands still work while the job is retained. Receipt result_status and progress describe its recorded outcome; outer job fields describe current state. Without command_id, legacy desired-state behavior remains. Pause preserves selection, results, cursor and expiry; resume continues at the next unprocessed item. An evaluation already holding the lock may commit before pause. Paused jobs still block diagnostic case scans until finished, cancelled or expired.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Application slug. Context: Pause unprocessed cases in a retained bulk lineage retry job.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "Event subscription identifier. Context: Pause unprocessed cases in a retained bulk lineage retry job.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "requestID",
            "in": "path",
            "required": true,
            "description": "Original nonzero submission UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ControlEventExecutionLineageRetryJobRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Current job; control_receipt contains the immutable original outcome when command_id was supplied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventExecutionLineageRetryJob"
                }
              }
            }
          },
          "400": {
            "description": "Invalid identifier or missing original creation timestamp. Context: Pause unprocessed cases in a retained bulk lineage retry job.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Creation guard changed or a new control targets a terminal job (event_lineage_retry_job_changed), or command UUID reused with different inputs (event_lineage_retry_control_command_changed).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "Request exceeds the 65536-byte body limit. Context: Pause unprocessed cases in a retained bulk lineage retry job.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Job already has 128 retained command receipts; event_lineage_retry_control_limit. Existing command repeats remain available.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Control timed out; repeat the same command UUID and inputs when supplied, otherwise read current state before repeating the desired action. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Control timed out; repeat the same command UUID and inputs when supplied, otherwise read current state before repeating the desired action.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/execution-reconciliation/retry-jobs/{requestID}/resume": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "resumeEventExecutionLineageRetryJob",
        "summary": "Resume unprocessed cases in a paused bulk lineage retry job.",
        "description": "Requires deploy/write scope and MFA. The original creation timestamp fences the job. Optional command_id enables an immutable successful-control receipt scoped to this job incarnation. The job lock commits state and receipt together. Repeating the same command UUID and original inputs returns current job state with its original control_receipt and never reapplies the action, including after another action or terminal completion. Reusing a command UUID with another action returns 409. At most 128 retained receipts per job; new UUIDs beyond that limit return 429 without changing the job. New UUIDs for completed/cancelled jobs return 409; repeated successful commands still work while the job is retained. Receipt result_status and progress describe its recorded outcome; outer job fields describe current state. Without command_id, legacy desired-state behavior remains. Pause preserves selection, results, cursor and expiry; resume continues at the next unprocessed item. An evaluation already holding the lock may commit before pause. Paused jobs still block diagnostic case scans until finished, cancelled or expired. Context: Resume unprocessed cases in a paused bulk lineage retry job.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Application slug. Context: Resume unprocessed cases in a paused bulk lineage retry job.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "Event subscription identifier. Context: Resume unprocessed cases in a paused bulk lineage retry job.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "requestID",
            "in": "path",
            "required": true,
            "description": "Original nonzero submission UUID. Context: Resume unprocessed cases in a paused bulk lineage retry job.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ControlEventExecutionLineageRetryJobRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Current job; control_receipt contains the immutable original outcome when command_id was supplied. Context: Resume unprocessed cases in a paused bulk lineage retry job.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventExecutionLineageRetryJob"
                }
              }
            }
          },
          "400": {
            "description": "Invalid identifier or missing original creation timestamp. Context: Resume unprocessed cases in a paused bulk lineage retry job.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Creation guard changed or a new control targets a terminal job (event_lineage_retry_job_changed), or command UUID reused with different inputs (event_lineage_retry_control_command_changed). Context: Resume unprocessed cases in a paused bulk lineage retry job.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "Request exceeds the 65536-byte body limit. Context: Resume unprocessed cases in a paused bulk lineage retry job.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Job already has 128 retained command receipts; event_lineage_retry_control_limit. Existing command repeats remain available. Context: Resume unprocessed cases in a paused bulk lineage retry job.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Control timed out; repeat the same command UUID and inputs when supplied, otherwise read current state before repeating the desired action. Context: Resume unprocessed cases in a paused bulk lineage retry job. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Control timed out; repeat the same command UUID and inputs when supplied, otherwise read current state before repeating the desired action. Context: Resume unprocessed cases in a paused bulk lineage retry job.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/execution-reconciliation/retry-jobs/{requestID}/cancel": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "cancelEventExecutionLineageRetryJob",
        "summary": "Cancel unprocessed cases in a retained bulk lineage retry job.",
        "description": "Requires deploy/write scope and MFA. The original creation timestamp fences the job incarnation. Cancellation accepts pending or paused jobs and waits for the scheduler job lock, preserves committed evaluations and marks remaining items cancelled. Processed counts evaluated items only. Repeating cancellation with the same original timestamp returns the unchanged terminal job; a completed job stays completed. No evaluation can start for this job after cancellation commits. Existing repairs remain applied. Cancellation does not extend retention, change case revisions or reset coverage. Reusing the original submission UUID and selection returns the cancelled job without restarting it. Optional nonzero command_id atomically records an immutable cancellation acknowledgment with the state change. Repeating the same UUID/action/creation guard returns current job state with the original control_receipt. A completed or already cancelled job remains unchanged and a new UUID records that terminal acknowledgment. Reusing a pause/resume command UUID returns 409 event_lineage_retry_control_command_changed. The shared cap is 128 receipts per job; a new UUID beyond the cap returns 429 without cancelling, while known command repeats and cancellation without command_id remain available. Receipts expire with the original job.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Application slug. Context: Cancel unprocessed cases in a retained bulk lineage retry job.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "Event subscription identifier. Context: Cancel unprocessed cases in a retained bulk lineage retry job.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "requestID",
            "in": "path",
            "required": true,
            "description": "Original nonzero submission UUID. Context: Cancel unprocessed cases in a retained bulk lineage retry job.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelEventExecutionLineageRetryJobRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Cancelled or previously terminal job, preserving evaluated results; optional control_receipt records the original command outcome.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventExecutionLineageRetryJob"
                }
              }
            }
          },
          "400": {
            "description": "Invalid identifier, command UUID or missing original creation timestamp.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Original creation timestamp does not match (event_lineage_retry_job_changed) or command UUID reused for another action (event_lineage_retry_control_command_changed).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "Request exceeds the 65536-byte body limit. Context: Cancel unprocessed cases in a retained bulk lineage retry job.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "New command UUID exceeds the shared 128-receipt cap; stable code event_lineage_retry_control_limit.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Cancellation timed out; repeat the same job UUID, original creation timestamp and command UUID if supplied. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Cancellation timed out; repeat the same job UUID, original creation timestamp and command UUID if supplied.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/execution-reconciliation/retry-jobs/{requestID}": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventExecutionLineageRetryJob",
        "summary": "Inspect retained bulk lineage retry progress and per-case results.",
        "description": "Requires read scope. Completed means all selected cases were evaluated or skipped; individual cases may remain unresolved, conflicted, changed or unavailable. Paused jobs preserve results and leave unprocessed items pending until resumed, cancelled or expired. Cancelled jobs preserve evaluated results and mark unprocessed items cancelled. Results describe recorded evaluations, not live lineage status.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Application slug. Context: Inspect retained bulk lineage retry progress and per-case results.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "Event subscription identifier. Context: Inspect retained bulk lineage retry progress and per-case results.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "requestID",
            "in": "path",
            "required": true,
            "description": "Original nonzero submission UUID. Context: Inspect retained bulk lineage retry progress and per-case results.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retained job and case results.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventExecutionLineageRetryJob"
                }
              }
            }
          },
          "400": {
            "description": "Invalid identifier, selection or pagination. Context: Inspect retained bulk lineage retry progress and per-case results.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Case guard changed or retained request identity reused with another selection. Context: Inspect retained bulk lineage retry progress and per-case results.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Operation timed out; repeat submission with the same request identity and selection. Context: Inspect retained bulk lineage retry progress and per-case results. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Operation timed out; repeat submission with the same request identity and selection. Context: Inspect retained bulk lineage retry progress and per-case results.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/execution-reconciliation/cases": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "listEventExecutionLineageCases",
        "summary": "List retained lineage repair cases.",
        "description": "Requires read scope. Cases cover recorded retained scans, not all historical gaps. No event payloads or handler errors are returned.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Application slug. Context: List retained lineage repair cases.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "Application event subscription identifier.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "after",
            "in": "query",
            "description": "Exclusive outbox ID cursor.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0,
              "default": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Page size; zero selects the server default.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retained cases or the saved guarded retry result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventExecutionLineageCases"
                }
              }
            }
          },
          "400": {
            "description": "Invalid identifier, pagination or retry guard.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Case revision or request identity changed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Lineage operation timed out; repeat the same guarded request. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Lineage operation timed out; repeat the same guarded request.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/execution-reconciliation/cases/{outboxID}/retry": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "retryEventExecutionLineageCase",
        "summary": "Recheck one reviewed lineage case with an idempotent guard.",
        "description": "Requires deploy/write scope. Request UUID, expected revision and any diagnostic identity fence each evaluation; duplicate requests return the original result for 30 days. Reuses authoritative evidence checks and does not reset scan progress or established coverage. Known receipt acceptance and root incarnation remain guarded. No event payloads or handler errors are returned.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Application slug. Context: Recheck one reviewed lineage case with an idempotent guard.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "Application event subscription identifier. Context: Recheck one reviewed lineage case with an idempotent guard.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "outboxID",
            "in": "path",
            "required": true,
            "description": "Retained case outbox identifier.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RetryEventExecutionLineageCaseRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Retained cases or the saved guarded retry result. Context: Recheck one reviewed lineage case with an idempotent guard.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventExecutionLineageCase"
                }
              }
            }
          },
          "400": {
            "description": "Invalid identifier, pagination or retry guard. Context: Recheck one reviewed lineage case with an idempotent guard.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Case revision or request identity changed. Context: Recheck one reviewed lineage case with an idempotent guard.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Lineage operation timed out; repeat the same guarded request. Context: Recheck one reviewed lineage case with an idempotent guard. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Lineage operation timed out; repeat the same guarded request. Context: Recheck one reviewed lineage case with an idempotent guard.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/execution-reconciliation": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventExecutionReconciliation",
        "summary": "Inspect durable execution coverage reconciliation.",
        "description": "Requires `apps:read` or `admin`. Bounded durable scans repair unambiguous lineage from retained captured recipients, deterministic delivery identity and matching root content. Historical unknown outcomes are not reconstructed. Retained app executions without authoritative ledger lineage block completion, including unrelated app invocations. The scheduler establishes a new collection boundary after blockers clear. Recorded losses and unknown outcomes remain applicable.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Application slug. Context: Inspect durable execution coverage reconciliation.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "Application event subscription identifier. Context: Inspect durable execution coverage reconciliation.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current reconciliation status, including completed or already qualified requests.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventExecutionReconciliation"
                }
              }
            }
          },
          "400": {
            "description": "Invalid subscription identifier.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Subscription reconciliation request timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Subscription reconciliation request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "requestEventExecutionReconciliation",
        "summary": "Request a forward-only execution coverage boundary.",
        "description": "Requires `apps:deploy` or `admin`; requests are idempotent per subscription. Bounded durable scans repair unambiguous lineage from retained captured recipients, deterministic delivery identity and matching root content. Historical unknown outcomes are not reconstructed. Retained app executions without authoritative ledger lineage block completion, including unrelated app invocations. The scheduler establishes a new collection boundary after blockers clear. Recorded losses and unknown outcomes remain applicable.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Application slug. Context: Request a forward-only execution coverage boundary.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "Application event subscription identifier. Context: Request a forward-only execution coverage boundary.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current reconciliation status, including completed or already qualified requests. Context: Request a forward-only execution coverage boundary.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventExecutionReconciliation"
                }
              }
            }
          },
          "202": {
            "description": "Durable request accepted; awaiting scheduler reconciliation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventExecutionReconciliation"
                }
              }
            }
          },
          "400": {
            "description": "Invalid subscription identifier. Context: Request a forward-only execution coverage boundary.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Subscription reconciliation request timed out. Context: Request a forward-only execution coverage boundary. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Subscription reconciliation request timed out. Context: Request a forward-only execution coverage boundary.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/execution-health": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventConsumerExecutionHealth",
        "summary": "Inspect consumer execution health over a retained history window.",
        "description": "Requires `apps:read` or `admin`. Reports current retained execution states and windowed attempt outcomes for admitted deliveries and handler replays. Current state coverage is bounded by retained roots. Windowed outcomes use an immutable per-subscription ledger with 30-day retention and independent completeness diagnostics; source cleanup does not erase retained ledger outcomes. Legacy ledger baselines remain unknown until requested forward-only reconciliation establishes a new boundary. Counts are not unique event totals. Completion latency starts at original event acceptance.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug for this operation: inspect consumer execution health over a retained history window.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "description": "Application event subscription identifier for this operation: inspect consumer execution health over a retained history window.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "window",
            "description": "Retained observation window for this operation: inspect consumer execution health over a retained history window.",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "5m",
                "15m",
                "1h",
                "6h",
                "24h"
              ],
              "default": "5m"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retained execution states and windowed handler outcomes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventConsumerExecutionHealth"
                }
              }
            }
          },
          "400": {
            "description": "Invalid subscription identifier or observation window.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Subscription control request timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Subscription control request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/health": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventConsumerHealth",
        "summary": "Inspect consumer routing health over a retained history window.",
        "description": "Requires `apps:read` or `admin`. Current backlog is live. Rates and routing latency use bounded recorded outcomes; history_compacted marks incomplete windows. Routing success measures admission before invocation execution.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug for this operation: inspect consumer routing health over a retained history window.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "description": "Application event subscription identifier for this operation: inspect consumer routing health over a retained history window.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "window",
            "description": "Retained observation window for this operation: inspect consumer routing health over a retained history window.",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "5m",
                "15m",
                "1h",
                "6h",
                "24h"
              ],
              "default": "5m"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Consumer backlog and windowed recorded routing outcomes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventConsumerHealth"
                }
              }
            }
          },
          "400": {
            "description": "Inspect consumer routing health over a retained history window: invalid subscription identifier or observation window.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Inspect consumer routing health over a retained history window: subscription control request timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Inspect consumer routing health over a retained history window: subscription control request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/circuit-breaker": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventCircuitBreaker",
        "summary": "Inspect consumer circuit breaker state.",
        "description": "Requires `apps:read` or `admin`. Runtime controls apply to retained pending routing for one application consumer. Manual pauses remain independent. Invocation execution failures do not count. PUT uses defaults for omitted fields and resets the observation window. Reset preserves policy and manual pause. Disable removes automatic gating. Status reports the last durable transition; cooldown progresses when work is available.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug for this operation: inspect consumer circuit breaker state.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "description": "Application event subscription identifier for this operation: inspect consumer circuit breaker state.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Durable breaker configuration and state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventCircuitBreakerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid subscription identifier or circuit breaker policy.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Inspect consumer circuit breaker state: subscription control request timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Inspect consumer circuit breaker state: subscription control request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "events"
        ],
        "operationId": "setEventCircuitBreaker",
        "summary": "Enable or replace a consumer circuit breaker policy.",
        "description": "Requires `deploy:write` or `admin`. Runtime controls apply to retained pending routing for one application consumer. Manual pauses remain independent. Invocation execution failures do not count. PUT uses defaults for omitted fields and resets the observation window. Reset preserves policy and manual pause. Disable removes automatic gating. Status reports the last durable transition; cooldown progresses when work is available.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug for this operation: enable or replace a consumer circuit breaker policy.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "description": "Application event subscription identifier for this operation: enable or replace a consumer circuit breaker policy.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventCircuitBreakerPolicy"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Enable or replace a consumer circuit breaker policy: durable breaker configuration and state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventCircuitBreakerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Enable or replace a consumer circuit breaker policy: invalid subscription identifier or circuit breaker policy.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Enable or replace a consumer circuit breaker policy: subscription control request timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Enable or replace a consumer circuit breaker policy: subscription control request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "events"
        ],
        "operationId": "disableEventCircuitBreaker",
        "summary": "Disable a consumer circuit breaker.",
        "description": "Disable a consumer circuit breaker. Requires `deploy:write` or `admin`. Runtime controls apply to retained pending routing for one application consumer. Manual pauses remain independent. Invocation execution failures do not count. PUT uses defaults for omitted fields and resets the observation window. Reset preserves policy and manual pause. Disable removes automatic gating. Status reports the last durable transition; cooldown progresses when work is available.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug for this operation: disable a consumer circuit breaker.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "description": "Application event subscription identifier for this operation: disable a consumer circuit breaker.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Disable a consumer circuit breaker: durable breaker configuration and state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventCircuitBreakerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Disable a consumer circuit breaker: invalid subscription identifier or circuit breaker policy.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Disable a consumer circuit breaker: subscription control request timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Disable a consumer circuit breaker: subscription control request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/circuit-breaker/reset": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "resetEventCircuitBreaker",
        "summary": "Close an enabled circuit breaker and start a fresh observation window.",
        "description": "Close an enabled circuit breaker and start a fresh observation window. Requires `deploy:write` or `admin`. Runtime controls apply to retained pending routing for one application consumer. Manual pauses remain independent. Invocation execution failures do not count. PUT uses defaults for omitted fields and resets the observation window. Reset preserves policy and manual pause. Disable removes automatic gating. Status reports the last durable transition; cooldown progresses when work is available.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug for this operation: close an enabled circuit breaker and start a fresh observation window.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "description": "Application event subscription identifier for this operation: close an enabled circuit breaker and start a fresh observation window.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Close an enabled circuit breaker and start a fresh observation window: durable breaker configuration and state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventCircuitBreakerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Close an enabled circuit breaker and start a fresh observation window: invalid subscription identifier or circuit breaker policy.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Close an enabled circuit breaker and start a fresh observation window: subscription control request timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Close an enabled circuit breaker and start a fresh observation window: subscription control request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/schema-versions": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventSubscriptionSchemaVersions",
        "summary": "Inspect schema version selection for future events.",
        "description": "Requires `apps:read` or `admin`. Captured events retain their acceptance-time selection. An empty selection accepts all versions, including unversioned envelopes. Only current app subscriptions can be configured.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug for this operation: inspect schema version selection for future events.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "description": "Application event subscription identifier for this operation: inspect schema version selection for future events.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Selected schema versions; an empty array accepts all versions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventSubscriptionSchemaVersionsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid subscription identifier or schema version selection.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Inspect schema version selection for future events: subscription control request timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Inspect schema version selection for future events: subscription control request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "events"
        ],
        "operationId": "setEventSubscriptionSchemaVersions",
        "summary": "Replace schema version selection for future events.",
        "description": "Requires `deploy:write` or `admin`. Captured events retain their acceptance-time selection. An empty selection accepts all versions, including unversioned envelopes. Only current app subscriptions can be configured.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug for this operation: replace schema version selection for future events.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "description": "Application event subscription identifier for this operation: replace schema version selection for future events.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventSubscriptionSchemaVersionsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Replace schema version selection for future events: selected schema versions; an empty array accepts all versions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventSubscriptionSchemaVersionsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Replace schema version selection for future events: invalid subscription identifier or schema version selection.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Replace schema version selection for future events: subscription control request timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Replace schema version selection for future events: subscription control request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "events"
        ],
        "operationId": "resetEventSubscriptionSchemaVersions",
        "summary": "Accept all schema versions for future events.",
        "description": "Accept all schema versions for future events. Requires `deploy:write` or `admin`. Captured events retain their acceptance-time selection. An empty selection accepts all versions, including unversioned envelopes. Only current app subscriptions can be configured.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug for this operation: accept all schema versions for future events.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "description": "Application event subscription identifier for this operation: accept all schema versions for future events.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Accept all schema versions for future events: selected schema versions; an empty array accepts all versions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventSubscriptionSchemaVersionsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Accept all schema versions for future events: invalid subscription identifier or schema version selection.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Accept all schema versions for future events: subscription control request timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Accept all schema versions for future events: subscription control request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/retry-policy": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventSubscriptionRetryPolicy",
        "summary": "Inspect routing retry policy for future events.",
        "description": "Requires `apps:read` or `admin`. Captured events retain their acceptance-time policy. Omitted policy uses legacy defaults. Only current app subscriptions can be configured.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug for this operation: inspect routing retry policy for future events.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "description": "Application event subscription identifier for this operation: inspect routing retry policy for future events.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Effective policy and whether explicitly configured.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventRoutingRetryPolicyResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid subscription identifier or retry policy.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Inspect routing retry policy for future events: subscription control request timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Inspect routing retry policy for future events: subscription control request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "events"
        ],
        "operationId": "setEventSubscriptionRetryPolicy",
        "summary": "Replace routing retry policy for future events.",
        "description": "Requires `deploy:write` or `admin`. Captured events retain their acceptance-time policy. Omitted policy uses legacy defaults. Only current app subscriptions can be configured.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug for this operation: replace routing retry policy for future events.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "description": "Application event subscription identifier for this operation: replace routing retry policy for future events.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventRoutingRetryPolicy"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Replace routing retry policy for future events: effective policy and whether explicitly configured.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventRoutingRetryPolicyResponse"
                }
              }
            }
          },
          "400": {
            "description": "Replace routing retry policy for future events: invalid subscription identifier or retry policy.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Replace routing retry policy for future events: subscription control request timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Replace routing retry policy for future events: subscription control request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "events"
        ],
        "operationId": "resetEventSubscriptionRetryPolicy",
        "summary": "Restore legacy routing retry defaults for future events.",
        "description": "Restore legacy routing retry defaults for future events. Requires `deploy:write` or `admin`. Captured events retain their acceptance-time policy. Omitted policy uses legacy defaults. Only current app subscriptions can be configured.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug for this operation: restore legacy routing retry defaults for future events.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "description": "Application event subscription identifier for this operation: restore legacy routing retry defaults for future events.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Restore legacy routing retry defaults for future events: effective policy and whether explicitly configured.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventRoutingRetryPolicyResponse"
                }
              }
            }
          },
          "400": {
            "description": "Restore legacy routing retry defaults for future events: invalid subscription identifier or retry policy.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Restore legacy routing retry defaults for future events: subscription control request timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Restore legacy routing retry defaults for future events: subscription control request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/delivery-control": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventSubscriptionDeliveryControl",
        "summary": "Inspect one consumer pause, pacing and backlog.",
        "description": "Requires `apps:read` or `admin`. Controls survive deployment and subscription removal. Already admitted invocations continue. Resume defaults to ten admissions per second and zero removes pacing.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug for this operation: inspect one consumer pause, pacing and backlog.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "description": "Application event subscription identifier for this operation: inspect one consumer pause, pacing and backlog.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current control configuration and waiting recipient counts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventSubscriptionDeliveryControl"
                }
              }
            }
          },
          "400": {
            "description": "Invalid subscription identifier or drain rate.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Inspect one consumer pause, pacing and backlog: subscription control request timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Inspect one consumer pause, pacing and backlog: subscription control request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/delivery-control/pause": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "pauseEventSubscription",
        "summary": "Pause new routing admissions for one event consumer.",
        "description": "Requires `deploy:write` or `admin`. Controls survive deployment and subscription removal. Already admitted invocations continue. Resume defaults to ten admissions per second and zero removes pacing.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug for this operation: pause new routing admissions for one event consumer.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "description": "Application event subscription identifier for this operation: pause new routing admissions for one event consumer.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Pause new routing admissions for one event consumer: current control configuration and waiting recipient counts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventSubscriptionDeliveryControl"
                }
              }
            }
          },
          "400": {
            "description": "Pause new routing admissions for one event consumer: invalid subscription identifier or drain rate.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Pause new routing admissions for one event consumer: subscription control request timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Pause new routing admissions for one event consumer: subscription control request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/delivery-control/resume": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "resumeEventSubscription",
        "summary": "Resume one event consumer with controlled draining.",
        "description": "Resume one event consumer with controlled draining. Requires `deploy:write` or `admin`. Controls survive deployment and subscription removal. Already admitted invocations continue. Resume defaults to ten admissions per second and zero removes pacing.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug for this operation: resume one event consumer with controlled draining.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "description": "Application event subscription identifier for this operation: resume one event consumer with controlled draining.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventSubscriptionResumeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Resume one event consumer with controlled draining: current control configuration and waiting recipient counts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventSubscriptionDeliveryControl"
                }
              }
            }
          },
          "400": {
            "description": "Resume one event consumer with controlled draining: invalid subscription identifier or drain rate.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Resume one event consumer with controlled draining: subscription control request timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Resume one event consumer with controlled draining: subscription control request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/delivery-control/deadlines": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "listEventSubscriptionDeadlines",
        "summary": "List pending deliveries by effective deadline.",
        "description": "Read-only deadline triage for retained captured pending application recipients of one owned subscription, without payloads. Orders by effective deadline, acceptance time and internal receipt ID ascending; this does not guarantee delivery order. Optional deadline_from is inclusive and deadline_before exclusive. Expired/upcoming filters compare to the first page window_at, which also bounds acceptance time. Each page has a fresh observation and live routing state, so expired flags and waiting reasons use observed_at. Cursor is scoped to account, application, subscription, normalized filters and page size, expires after 15 minutes, and is navigational metadata rather than authorization. Membership and deadlines can change between pages; newly captured or replayed work can appear, disappear, move or be skipped. This is not a frozen snapshot, reservation or deadline-safety certificate. No effective deadline means exclusion. Reads have fixed time budgets; timeout returns no partial page.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Application slug for a deadline-ordered pending-delivery listing.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "Owned application subscription UUID whose pending deadlines are being investigated.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "deadline_from",
            "in": "query",
            "description": "Inclusive effective-deadline bound, normalized to UTC microseconds.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "deadline_before",
            "in": "query",
            "description": "Exclusive effective-deadline bound, later than deadline_from after normalization.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Expiry classification at the first page window_at; keep unchanged across pages.",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "expired",
                "upcoming"
              ],
              "default": "all"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Opaque continuation; preserve scope, filters and page size. Expires 15 minutes after the first page.",
            "schema": {
              "type": "string",
              "maxLength": 4096
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum returned recipients; keep unchanged across pages.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "within_millis",
            "in": "query",
            "description": "Optional upcoming window strictly after the first page window_at and before window_at plus this horizon. Normalizes all/omitted status to upcoming; expired status is rejected. Keep unchanged across pages.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 100,
              "maximum": 86400000
            }
          },
          {
            "name": "waiting_reason",
            "in": "query",
            "description": "Optional known observed backlog waiting reason, applied before pagination at each page observation. Keep unchanged across pages; reasons remain live.",
            "schema": {
              "type": "string",
              "enum": [
                "circuit_open",
                "circuit_probe_wait",
                "circuit_recovery_rate_limited",
                "subscription_paused",
                "subscription_rate_limited",
                "ordering_blocked",
                "capacity_consumer",
                "capacity_app",
                "capacity_account",
                "routing_in_progress",
                "receipt_processing",
                "retry_backoff",
                "workflow_routing",
                "ready"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A bounded live page of pending deliveries with effective deadlines.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventSubscriptionDeadlinePage"
                }
              }
            }
          },
          "400": {
            "description": "Subscription UUID, deadline filters, page size or cursor are invalid or expired.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Deadline listing exceeded its read budget; no partial page was returned. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Deadline listing exceeded its read budget; no partial page was returned.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/delivery-control/deadline-window": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventSubscriptionDeadlineWindow",
        "summary": "Count upcoming delivery deadlines and observed waiting reasons.",
        "description": "Read-only, payload-free full pending summary and deadline cohorts from one Repeatable Read snapshot. Upcoming deadlines are strictly after summary.observed_at and strictly before window_end_at. Already-expired recipients are separate in summary.already_expired_count. Each cohort has an exact partition of observed backlog waiting reasons, including zero keys. Counts have no sample cap and include only retained captured pending application recipients with effective deadlines; processing, future arrivals and recipients without deadlines are excluded from cohorts. Waiting reasons are observations, not unique causes or execution guarantees. Fixed request and statement budgets apply; timeout returns no partial counts. Require summary.complete before interpreting coverage or recovery. This does not predict admissions, change state, reserve capacity or extend deadlines.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Application slug for full deadline-window monitoring.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "Owned application subscription UUID whose retained pending deadlines are being counted.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "within_millis",
            "in": "query",
            "required": true,
            "description": "Positive whole-millisecond horizon from this snapshot observation; upper deadline boundary is exclusive.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 100,
              "maximum": 86400000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Full pending summary, separate upcoming and expired counts, and exact waiting-reason partitions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventSubscriptionDeadlineWindow"
                }
              }
            }
          },
          "400": {
            "description": "Subscription UUID or within_millis is invalid, missing, repeated or unsupported.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Deadline-window read exceeded its budget; no partial counts were returned. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Deadline-window read exceeded its budget; no partial counts were returned.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/delivery-control/pending-summary": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventSubscriptionPendingSummary",
        "summary": "Read complete consumer pending counts and effective deadlines.",
        "description": "Read-only, payload-free counts and earliest effective deadline across all retained captured pending application recipients for this subscription. One Repeatable Read snapshot includes current controls. Processing work, future arrivals and publications awaiting recipient capture are excluded. No sample cap; request and statement budgets bound scan time. Timeout returns 503 (504 from older edges) without partial counts. Incomplete or absent evidence is unknown, never zero or a successful recovery. Counts do not model future admission or guarantee deadline safety.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Application slug for a full pending summary.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "Owned application subscription UUID whose retained pending recipients are being counted.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Complete pending counts, effective deadlines and current controls; inspect complete before monitoring.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventSubscriptionPendingSummary"
                }
              }
            }
          },
          "400": {
            "description": "Subscription UUID is invalid.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Full pending-summary read exceeded its budget; coverage is unknown. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Full pending-summary read exceeded its budget; coverage is unknown.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/delivery-control/rate-limit/preview": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "previewEventSubscriptionRateLimit",
        "summary": "Preview consumer pacing and delivery deadline risk.",
        "description": "Read-only advisory preview of proposed interval/burst settings from one owned subscription snapshot. Requires read scope. Returns the reviewed bucket revision for a subsequent guarded command, without allocating a command ID or receipt, consuming tokens, claiming work or reserving capacity. Models the oldest 1000 captured pending recipients in acceptance order, with current scheduled times and the legacy per-second cap. This models admission rather than completion and does not promise scheduler ordering. Pause, circuit, lease and capacity constraints can delay actual admission without bound; inspect constraints and completeness. Deadline-risk identities are limited to 100.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Application slug for a read-only consumer pacing preview.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "Owned application subscription UUID whose pacing is being reviewed.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventSubscriptionRatePreviewRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Advisory rate-only admission model and bounded deadline evidence; completeness does not certify deadline safety.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventSubscriptionRatePreview"
                }
              }
            }
          },
          "400": {
            "description": "Proposed preview settings or subscription UUID are invalid.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Read-only pacing preview exceeded its request deadline; retry with a fresh observation. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Read-only pacing preview exceeded its request deadline; retry with a fresh observation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/delivery-control/rate-limit": {
      "put": {
        "tags": [
          "events"
        ],
        "operationId": "setEventSubscriptionRateLimit",
        "summary": "Configure rate bucket.",
        "description": "Configure rate bucket: Durable per-subscription pacing shared by admission workers. Mutations require deploy:write or admin and return an applied or rejected receipt; revision mismatch is a recorded rejection with no configuration change. Repeating an unexpired command UUID with identical inputs returns its original receipt. Reads require read scope. Existing pause, circuit, per-second drain caps, attempts and delivery deadlines remain in force. Capacity observations reserve nothing.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Configure rate bucket: Application slug owning this subscription rate policy.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "Configure rate bucket: Application subscription UUID for rate controls.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventSubscriptionRateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Configure rate bucket: Retained rate command evidence; inspect outcome for applied or rejected.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventSubscriptionRateCommandReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Configure rate bucket: Invalid rate control input.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Configure rate bucket: Command UUID inputs changed or database clock moved behind the refill anchor.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Configure rate bucket: 128 unexpired receipts retained; known repeats remain available.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Configure rate bucket: Request deadline elapsed; after an uncertain mutation look up or replay the same command UUID. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Configure rate bucket: Request deadline elapsed; after an uncertain mutation look up or replay the same command UUID.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/delivery-control/rate-limit/commands": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "listEventSubscriptionRateCommands",
        "summary": "List rate history.",
        "description": "List rate history: Durable per-subscription pacing shared by admission workers. Mutations require deploy:write or admin and return an applied or rejected receipt; revision mismatch is a recorded rejection with no configuration change. Repeating an unexpired command UUID with identical inputs returns its original receipt. Reads require read scope. Existing pause, circuit, per-second drain caps, attempts and delivery deadlines remain in force. Capacity observations reserve nothing.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "List rate history: Application slug owning this subscription rate policy.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "List rate history: Application subscription UUID for rate controls.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "after",
            "in": "query",
            "description": "List rate history: Exclusive increasing history sequence; pages contain at most 50 retained receipts and do not freeze history.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List rate history: Retained rate command evidence; inspect outcome for applied or rejected.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventSubscriptionRateCommands"
                }
              }
            }
          },
          "400": {
            "description": "List rate history: Invalid rate control input.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "List rate history: Request deadline elapsed; after an uncertain mutation look up or replay the same command UUID. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "List rate history: Request deadline elapsed; after an uncertain mutation look up or replay the same command UUID.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/delivery-control/rate-limit/commands/{commandID}": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventSubscriptionRateCommand",
        "summary": "Look up rate command.",
        "description": "Look up rate command: Durable per-subscription pacing shared by admission workers. Mutations require deploy:write or admin and return an applied or rejected receipt; revision mismatch is a recorded rejection with no configuration change. Repeating an unexpired command UUID with identical inputs returns its original receipt. Reads require read scope. Existing pause, circuit, per-second drain caps, attempts and delivery deadlines remain in force. Capacity observations reserve nothing.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Look up rate command: Application slug owning this subscription rate policy.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "Look up rate command: Application subscription UUID for rate controls.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "commandID",
            "in": "path",
            "required": true,
            "description": "Look up rate command: Nonzero UUID of a retained rate command.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Look up rate command: Retained rate command evidence; inspect outcome for applied or rejected.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventSubscriptionRateCommandReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Look up rate command: Invalid rate control input.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Look up rate command: Request deadline elapsed; after an uncertain mutation look up or replay the same command UUID. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Look up rate command: Request deadline elapsed; after an uncertain mutation look up or replay the same command UUID.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/delivery-control/capacity": {
      "put": {
        "tags": [
          "events"
        ],
        "operationId": "setEventSubscriptionCapacity",
        "summary": "Set a lower live-delivery ceiling for one event consumer.",
        "description": "Set a lower live-delivery ceiling for one event consumer. Requires `deploy:write` or `admin`. Controls survive deployment and subscription removal. Already admitted invocations continue. The explicit integer counts pending plus dispatching invocations. Zero restores the current plan limit; positive values cannot exceed it. Lowering does not evict existing work. Pause, rate and circuit state are preserved; plan downgrades clamp the effective ceiling. Routing and replay share this limit.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug for this operation: set the live-delivery ceiling for one event consumer.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "description": "Application event subscription identifier for this operation: set the live-delivery ceiling for one event consumer.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventSubscriptionCapacityRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Set consumer delivery capacity: current control configuration and waiting recipient counts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventSubscriptionDeliveryControl"
                }
              }
            }
          },
          "400": {
            "description": "Set consumer delivery capacity: invalid subscription identifier, missing capacity or capacity outside the current plan ceiling.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Saved capacity or plan ceiling changed from expected values, or a retained command UUID was reused with different normalized input; no change is applied. Refresh preview before retrying. Value guards do not detect changes that return to the same values and do not reserve live capacity.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "New command exceeds 128 retained receipts for this subscription. Known repeats remain available; expiry frees receipt slots. Controls without a command UUID remain available without idempotent evidence.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Set consumer delivery capacity: subscription control request timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Set consumer delivery capacity: subscription control request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/delivery-control/capacity/commands": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "listEventSubscriptionCapacityCommands",
        "summary": "List retained original capacity-command receipts.",
        "description": "Requires apps:read or admin and MFA. Read-only newest-first pagination by recorded_at and command UUID descending. Outcome and expiry filters apply before the page limit. Each page has a fresh ownership and receipt snapshot; cursors are bound to account, app, subscription and normalized outcome filter, but do not freeze history. New commands and expiry can affect later pages. Listing never applies commands, prunes evidence or extends retention. Empty history does not prove commands never ran. Recording order does not establish delivery or execution order. Responses use Cache-Control no-store.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Owned application slug.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "Owned active subscription or retained delivery control identifier.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "outcome",
            "in": "query",
            "description": "Original successful command outcome to include. Omission is equivalent to any.",
            "schema": {
              "type": "string",
              "enum": [
                "any",
                "applied",
                "unchanged"
              ],
              "default": "any"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum receipts in this page. Omission uses 25. Explicit zero is invalid.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "after",
            "in": "query",
            "description": "Opaque next_after from the preceding page with the same owned scope and outcome filter. Page size may change. This cursor is a boundary rather than an authorization credential.",
            "schema": {
              "type": "string",
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Scoped page of original receipts and a continuation cursor when more matching retained receipts exist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventSubscriptionCapacityCommands"
                }
              }
            }
          },
          "400": {
            "description": "Invalid UUID, outcome filter, page limit or scoped cursor.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Read-only command history timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Read-only command history timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/delivery-control/capacity/commands/{commandID}": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventSubscriptionCapacityCommand",
        "summary": "Read retained original capacity-command evidence.",
        "description": "Requires apps:read or admin and MFA. Returns the original successful command request values and outcome without applying a change, consuming receipt capacity, pruning records or extending retention. The fixed retention deadline is thirty days after success. A missing or expired receipt is unavailable evidence and does not prove the command never ran. The receipt does not describe current configuration and does not establish an ordering or execution guarantee.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Owned application slug. Context: Read retained original capacity-command evidence.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "Owned active subscription or retained delivery control identifier. Context: Read retained original capacity-command evidence.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "commandID",
            "in": "path",
            "required": true,
            "description": "Original nonzero hyphenated command UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Immutable original successful capacity-command receipt. Cache-Control is no-store.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventSubscriptionCapacityCommandReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid subscription or command UUID.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "No owned target or unexpired command receipt is available. Receipt absence does not prove the command never ran.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Read-only capacity-command lookup timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Read-only capacity-command lookup timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-recoveries/notification-retry-backlog": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "listEventRecoveryNotificationRetryBacklog",
        "summary": "Inspect app-wide recovery notification retry backlog.",
        "description": "Requires apps:read or admin and MFA. Reads original-generation retry outcomes across a bounded page of owned retained recovery jobs containing saved retry requests. Defaults to failed, pending, and inconclusive requests. Totals cover every request in scanned jobs before status filtering and are explicitly job-page scoped. Empty filtered pages may still have a next cursor. Each page is a fresh read-only snapshot; refresh from the beginning to see newer jobs or updated previously scanned jobs.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Owned app slug whose retained recovery retry requests are inspected.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Distinct comma-separated request statuses selected as a union. Omission selects failed, pending, and inconclusive. Include succeeded explicitly to inspect successful requests.",
            "schema": {
              "type": "string",
              "default": "failed,pending,inconclusive",
              "pattern": "^(succeeded|failed|pending|inconclusive)(,(succeeded|failed|pending|inconclusive))*$"
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "description": "Number of retained recovery jobs with saved retry requests inspected per page; this limits jobs rather than request rows.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10,
              "default": 5
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque continuation bound to account, app, and canonical status selection. Continue even when a filtered page has no request rows.",
            "schema": {
              "type": "string",
              "maxLength": 4096
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Original-generation retry requests and explicitly page-scoped counts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventRecoveryNotificationRetryBacklog"
                }
              }
            }
          },
          "400": {
            "description": "Invalid retry backlog query or cursor.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required for the app retry backlog.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Read scope or MFA required for the app retry backlog.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "App retry backlog not found or not owned.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "App retry backlog request rate exceeded.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "App retry backlog could not be read.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "App retry backlog evidence deadline expired. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "App retry backlog evidence deadline expired.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-recoveries/health": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventRecoveryHealth",
        "summary": "Inspect recovery admission and unresolved execution health.",
        "description": "Requires apps:read or admin and MFA. Current app-scoped admission observations and bounded unresolved execution health. Execution inspects the oldest 50 retained terminal-admission jobs missing exact saved replay results, samples up to three, and marks partial counts as lower bounds. Prolonged execution waits measure 15 minutes since admission completion; retention risk starts 24 hours before the nominal 30-day job retention boundary. Reads do not capture results or notifications. Stalled requires five minutes without admission progress and five minutes overdue for eligibility. Capacity/legacy claim retries and pacing defer eligibility. Paused jobs are reported separately and excluded from running-job alert counts. Expiry warnings cover pending items within one hour of expiry, including overdue expiry cleanup. No query parameters are accepted.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug for this operation: inspect active recovery progress and expiry risk.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Admission health and bounded unresolved execution observations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventRecoveryHealth"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query parameters.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Recovery health request timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Recovery health request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-recoveries/preview": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "previewEventRecovery",
        "summary": "Preview failed application event recipients without requeueing.",
        "description": "Requires `apps:read` or `admin`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug for this operation: preview failed application event recipients without requeueing.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventRecoveryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Recovery result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventRecoveryPreview"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or selection larger than 10000 recipients.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Recovery request timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Recovery request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-recoveries": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "listEventRecoveries",
        "summary": "Discover retained recovery jobs for an owned application.",
        "description": "Requires apps:read or admin and MFA. Newest creation time and ID first. Lists admission metadata only; execution outcomes are available through recovery status. Pages reflect live state and retention, not a frozen snapshot. Reuse the same app and filters with next_cursor.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug for this operation: discover retained recovery jobs for an owned application.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "description": "Current admission state.",
            "schema": {
              "type": "string",
              "enum": [
                "running",
                "paused",
                "completed",
                "cancelled"
              ]
            }
          },
          {
            "name": "mode",
            "in": "query",
            "description": "Recovery mode; legacy omitted modes are routing.",
            "schema": {
              "type": "string",
              "enum": [
                "routing",
                "execution",
                "workflow"
              ]
            }
          },
          {
            "name": "subscription_id",
            "in": "query",
            "description": "Matches the frozen selection filter or any captured item subscription.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "created_after",
            "in": "query",
            "description": "Exclusive creation lower bound.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "created_before",
            "in": "query",
            "description": "Exclusive creation upper bound.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Opaque next_cursor from the previous page; bound to account, app, and filters.",
            "schema": {
              "type": "string",
              "maxLength": 4096
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum jobs per page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retained recovery job metadata; execution summaries are omitted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventRecoveryJobs"
                }
              }
            }
          },
          "400": {
            "description": "Invalid filters or cursor.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Recovery listing timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Recovery listing timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "createEventRecovery",
        "summary": "Create a durable recovery job for a frozen selection of routing failures.",
        "description": "Requires `deploy:write` or `admin`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug for this operation: create a durable recovery job for a frozen selection of routing failures.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventRecoveryRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Create a durable recovery job for a frozen selection of routing failures: recovery result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventRecoveryJob"
                }
              }
            }
          },
          "400": {
            "description": "Create a durable recovery job for a frozen selection of routing failures: invalid request or selection larger than 10000 recipients.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Account already has three active recovery jobs.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Create a durable recovery job for a frozen selection of routing failures: recovery request timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Create a durable recovery job for a frozen selection of routing failures: recovery request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/event-recoveries/{jobID}": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventRecovery",
        "summary": "Read bulk recovery progress.",
        "description": "Read bulk recovery progress. Requires `apps:read` or `admin`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobID",
            "description": "Durable recovery job identifier for this operation: read bulk recovery progress.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Read bulk recovery progress: recovery result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventRecoveryJob"
                }
              }
            }
          },
          "400": {
            "description": "Read bulk recovery progress: invalid request or selection larger than 10000 recipients.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Read bulk recovery progress: recovery request timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Read bulk recovery progress: recovery request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/event-recoveries/{jobID}/cancel": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "cancelEventRecovery",
        "summary": "Cancel retries that have not yet been queued.",
        "description": "Cancel retries that have not yet been queued. Requires `deploy:write` or `admin`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobID",
            "description": "Durable recovery job identifier for this operation: cancel retries that have not yet been queued.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "description": "Optional operator reason; an empty body preserves existing clients.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventRecoveryControlRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Cancel retries that have not yet been queued: recovery result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventRecoveryJob"
                }
              }
            }
          },
          "400": {
            "description": "Cancel retries that have not yet been queued: invalid request or selection larger than 10000 recipients.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Cancel retries that have not yet been queued: recovery request timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Cancel retries that have not yet been queued: recovery request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/event-recoveries/{jobID}/pause": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "pauseEventRecovery",
        "summary": "Pause further recovery admissions.",
        "description": "Requires `deploy:write` or `admin` and MFA. Controls preserve the frozen selection, spent window budget, existing waits, quota, and original expiry. Already queued deliveries continue. Completed, cancelled, or expired jobs return 409. Repeated desired-state controls on active jobs are idempotent.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobID",
            "description": "Durable recovery job identifier for this operation: pause further recovery admissions.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "description": "Request to pause further recovery admissions: optional operator reason; an empty body preserves existing clients.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventRecoveryControlRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Pause further recovery admissions: recovery result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventRecoveryJob"
                }
              }
            }
          },
          "400": {
            "description": "Pause further recovery admissions: invalid request or selection larger than 10000 recipients.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Recovery job is completed, cancelled, or expired.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Pause further recovery admissions: recovery request timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Pause further recovery admissions: recovery request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/event-recoveries/{jobID}/resume": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "resumeEventRecovery",
        "summary": "Resume the frozen recovery selection.",
        "description": "Resume the frozen recovery selection. Requires `deploy:write` or `admin` and MFA. Controls preserve the frozen selection, spent window budget, existing waits, quota, and original expiry. Already queued deliveries continue. Completed, cancelled, or expired jobs return 409. Repeated desired-state controls on active jobs are idempotent.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobID",
            "description": "Durable recovery job identifier for this operation: resume the frozen recovery selection.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "description": "Request to resume the frozen recovery selection: optional operator reason; an empty body preserves existing clients.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventRecoveryControlRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Resume the frozen recovery selection: recovery result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventRecoveryJob"
                }
              }
            }
          },
          "400": {
            "description": "Resume the frozen recovery selection: invalid request or selection larger than 10000 recipients.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Resume the frozen recovery selection: recovery job is completed, cancelled, or expired.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Resume the frozen recovery selection: recovery request timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Resume the frozen recovery selection: recovery request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/event-recoveries/{jobID}/rate": {
      "put": {
        "tags": [
          "events"
        ],
        "operationId": "setEventRecoveryRate",
        "summary": "Change the current recovery admission rate.",
        "description": "Change the current recovery admission rate. Requires `deploy:write` or `admin` and MFA. Controls preserve the frozen selection, spent window budget, existing waits, quota, and original expiry. Already queued deliveries continue. Completed, cancelled, or expired jobs return 409. Repeated desired-state controls on active jobs are idempotent.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobID",
            "description": "Durable recovery job identifier for this operation: change the current recovery admission rate.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventRecoveryRateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Change the current recovery admission rate: recovery result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventRecoveryJob"
                }
              }
            }
          },
          "400": {
            "description": "Change the current recovery admission rate: invalid request or selection larger than 10000 recipients.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Change the current recovery admission rate: recovery job is completed, cancelled, or expired.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Change the current recovery admission rate: recovery request timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Change the current recovery admission rate: recovery request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/recovery-policy": {
      "get": {
        "operationId": "getWorkflowRecoveryPolicy",
        "summary": "Inspect the recovery policy",
        "description": "Returns the current app policy and scheduler evaluation status. An unconfigured app has a disabled version-zero policy.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "App slug for getWorkflowRecoveryPolicy.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Result of getWorkflowRecoveryPolicy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRecoveryPolicyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "setWorkflowRecoveryPolicy",
        "summary": "Configure a recovery policy",
        "description": "Updates an app policy with optimistic version checks. Preview prepares plans from retained native evidence. Opt-in automatic_retry authorizes bounded retries of saved failures; automatic_initial authorizes bounded generation-zero recovery with explicit workflow and failure-status filters. Enabling automatic_initial requires the workflow runtime. Requires deploy write permission and MFA; cancellation remains manual.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "App slug for setWorkflowRecoveryPolicy.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Recovery policy settings and explicit automatic retry limits with the last observed version.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetWorkflowRecoveryPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result of setWorkflowRecoveryPolicy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRecoveryPolicyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      }
    },
    "/v1/apps/{slug}/recovery-policy/evaluate": {
      "post": {
        "operationId": "evaluateWorkflowRecoveryPolicy",
        "summary": "Evaluate proposed recovery settings against retained historical candidates",
        "description": "Read-only consistent snapshot comparing current and proposed settings against up to 100 oldest retained reviews and 500 decisions in a maximum 30-day window. Requires the observed current policy version. Individual historical failure status is not captured; historical policy filters establish a possible status set and ambiguous narrower filters remain unknown. Preparation budgets, cooldown and deduplication are replayed conditionally from empty window-start state; unknown candidates are not charged. Actual recorded applications establish lower-bound execution pressure, never admission availability or counterfactual retry results. Application warmup uses the longer policy cooldown or one hour, with up to 10000 records and explicit truncation. Never reads current run state as historical proof or writes policy, reviews, jobs, audit events or notifications.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "App whose retained review evidence is used for policy comparison.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkflowRecoveryPolicyEvaluationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Evidence-limited conditional comparison with explicit coverage notes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRecoveryPolicyEvaluation"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Current recovery policy version differs from expected_version.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/recovery-policy/change-preview": {
      "post": {
        "operationId": "previewWorkflowRecoveryPolicyChange",
        "summary": "Preview a recovery policy replacement",
        "description": "Read-only impact of replacing the observed policy version. Every replacement suppresses old pending automatic intents and preserves unresolved applied children and spent charges. Inspects up to five newest matching recovery jobs and returns up to 25 candidate decisions. Retained preparation targets continue to prevent duplicate plans. Requires read access and MFA. No plans, controls, retries or notifications are written. Advisory evidence can change before a separately authorized version-fenced update.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "App slug for previewWorkflowRecoveryPolicyChange.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Proposed policy using the last observed configuration version; version zero means no existing policy.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetWorkflowRecoveryPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Read-only proposed-policy snapshot with parent-job and bounded initial-failure candidates. No reviews, jobs or notifications are created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRecoveryPolicyChangePreview"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "description": "Policy change preview inspection timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Policy change preview inspection timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/recovery-policy/control": {
      "post": {
        "operationId": "controlWorkflowRecoveryPolicy",
        "summary": "Pause or resume automatic recovery",
        "description": "Controls enabled automatic recovery without replacing its policy or discarding prepared retries. Requires deploy write and MFA. The observed version, update timestamp and pause timestamp fence concurrent controls and failure pauses. Resume clears the consecutive failure streak; committed children continue while paused.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "App slug for controlWorkflowRecoveryPolicy.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Observed recovery control state, operation and operator reason.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ControlWorkflowRecoveryPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result of controlWorkflowRecoveryPolicy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRecoveryPolicyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflow-failures/{failureID}/recovery-reviews": {
      "post": {
        "operationId": "prepareWorkflowInitialRecoveryReview",
        "summary": "Prepare a durable first-recovery review",
        "description": "Policy-version-fenced initial recovery. Preparation captures retained generation-zero evidence and a live safety preview. Submit repeats evidence, safety, cooldown and budget checks and atomically creates a native recovery job. Ready notifications use the existing delivery ledger. Reads never prepare or submit. Expiry and changed policy authority block submission and pending admission. Submission is explicit; no automatic first recovery is enabled.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "failureID",
            "description": "Captured initial workflow failure identifier.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkflowInitialRecoveryReviewRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Initial recovery review",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowInitialRecoveryReview"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/apps/{slug}/recovery-policy/reviews/{reviewID}/actions/{actionID}/evidence/parent": {
      "get": {
        "operationId": "diagnoseWorkflowRetryParentEvidence",
        "summary": "Diagnose pending retry parent evidence",
        "description": "Read-only diagnosis of the exact parent generation and item required by the frozen pending retry plan. Missing admission history and superseded runs cannot be repaired. Requires read scope and MFA.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug used to diagnose pending retry parent evidence.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reviewID",
            "description": "Durable recovery review identifier.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "actionID",
            "description": "Frozen retry action identifier.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Consistent retained evidence diagnosis.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRetryEvidenceDiagnosis"
                }
              }
            }
          },
          "default": {
            "description": "Error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/recovery-policy/reviews/{reviewID}/actions/{actionID}/evidence/parent/repair": {
      "post": {
        "operationId": "repairWorkflowRetryParentEvidence",
        "summary": "Save verified pending retry parent terminal evidence",
        "description": "Requires deploy write and MFA. Re-inspects the exact parent generation, item and admission lineage under lock. Repair applies only to pending actions and does not authorize child submission. Parent and child repair receipts are separate. Saves a missing result once and records the operator reason. Never overwrites retained evidence or resumes a paused policy. Replaying the same request ID and reason returns its receipt; changes conflict. The worker observes repaired proof on its next eligible poll.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug used to save verified pending retry parent terminal evidence.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reviewID",
            "description": "Durable recovery review identifier used to save verified pending retry parent terminal evidence.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "actionID",
            "description": "Frozen retry action identifier used to save verified pending retry parent terminal evidence.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkflowInitialEvidenceRepairRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Retained repair receipt and evidence diagnosis.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRetryEvidenceDiagnosis"
                }
              }
            }
          },
          "default": {
            "description": "Save verified pending retry parent terminal evidence failed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/recovery-policy/reviews/{reviewID}/actions/{actionID}/evidence": {
      "get": {
        "operationId": "diagnoseWorkflowRetryEvidence",
        "summary": "Diagnose retained automatic retry evidence",
        "description": "Read-only exact retry-generation diagnosis with frozen parent and child lineage checks. Missing admission history and superseded runs cannot be repaired. Requires read scope and MFA.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug used to diagnose retained automatic retry evidence.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reviewID",
            "description": "Durable recovery review identifier used to diagnose retained automatic retry evidence.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "actionID",
            "description": "Frozen retry action identifier used to diagnose retained automatic retry evidence.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Diagnose retained automatic retry evidence. Consistent retained evidence diagnosis.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRetryEvidenceDiagnosis"
                }
              }
            }
          },
          "default": {
            "description": "Diagnose retained automatic retry evidence failed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/recovery-policy/reviews/{reviewID}/actions/{actionID}/evidence/repair": {
      "post": {
        "operationId": "repairWorkflowRetryEvidence",
        "summary": "Save verified automatic retry terminal evidence",
        "description": "Requires deploy write and MFA. Re-inspects the exact generation and admission lineage under lock. Saves a missing result once and records the operator reason. Never overwrites retained evidence or resumes a paused policy. Replaying the same request ID and reason returns its receipt; changes conflict. The worker observes repaired proof on its next eligible poll.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug used to save verified automatic retry terminal evidence.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reviewID",
            "description": "Durable recovery review identifier used to save verified automatic retry terminal evidence.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "actionID",
            "description": "Frozen retry action identifier used to save verified automatic retry terminal evidence.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkflowInitialEvidenceRepairRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Save verified automatic retry terminal evidence. Retained repair receipt and evidence diagnosis.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRetryEvidenceDiagnosis"
                }
              }
            }
          },
          "default": {
            "description": "Save verified automatic retry terminal evidence failed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/initial-recovery-reviews/{reviewID}/evidence": {
      "get": {
        "operationId": "diagnoseWorkflowInitialEvidence",
        "summary": "Diagnose retained initial recovery evidence",
        "description": "Read-only exact-generation diagnosis. Missing admission history and superseded runs cannot be repaired. Requires read scope and MFA.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug used to diagnose retained initial recovery evidence.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reviewID",
            "description": "Durable recovery review identifier used to diagnose retained initial recovery evidence.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Diagnose retained initial recovery evidence. Consistent retained evidence diagnosis.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowInitialEvidenceDiagnosis"
                }
              }
            }
          },
          "default": {
            "description": "Diagnose retained initial recovery evidence failed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/initial-recovery-reviews/{reviewID}/evidence/repair": {
      "post": {
        "operationId": "repairWorkflowInitialEvidence",
        "summary": "Save verified initial recovery terminal evidence",
        "description": "Save verified initial recovery terminal evidence. Requires deploy write and MFA. Re-inspects the exact generation and admission lineage under lock. Saves a missing result once and records the operator reason. Never overwrites retained evidence or resumes a paused policy. Replaying the same request ID and reason returns its receipt; changes conflict. The worker observes repaired proof on its next eligible poll.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug used to save verified initial recovery terminal evidence.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reviewID",
            "description": "Durable recovery review identifier used to save verified initial recovery terminal evidence.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkflowInitialEvidenceRepairRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Save verified initial recovery terminal evidence. Retained repair receipt and evidence diagnosis.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowInitialEvidenceDiagnosis"
                }
              }
            }
          },
          "default": {
            "description": "Save verified initial recovery terminal evidence failed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/initial-recovery-reviews/{reviewID}": {
      "get": {
        "operationId": "getWorkflowInitialRecoveryReview",
        "summary": "Inspect a durable first-recovery review",
        "description": "Inspect a durable first-recovery review. Policy-version-fenced initial recovery. Preparation captures retained generation-zero evidence and a live safety preview. Submit repeats evidence, safety, cooldown and budget checks and atomically creates a native recovery job. Ready notifications use the existing delivery ledger. Reads never prepare or submit. Expiry and changed policy authority block submission and pending admission. Submission is explicit; no automatic first recovery is enabled.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug for inspect a durable first-recovery review.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reviewID",
            "description": "Durable recovery review identifier for inspect a durable first-recovery review.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Inspect a durable first-recovery review result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowInitialRecoveryReview"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/apps/{slug}/initial-recovery-reviews/{reviewID}/decision": {
      "post": {
        "operationId": "decideWorkflowInitialRecoveryReview",
        "summary": "Submit or cancel a durable first-recovery review",
        "description": "Submit or cancel a durable first-recovery review. Policy-version-fenced initial recovery. Preparation captures retained generation-zero evidence and a live safety preview. Submit repeats evidence, safety, cooldown and budget checks and atomically creates a native recovery job. Ready notifications use the existing delivery ledger. Reads never prepare or submit. Expiry and changed policy authority block submission and pending admission. Submission is explicit; no automatic first recovery is enabled.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug used to submit or cancel a durable first-recovery review.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reviewID",
            "description": "Durable recovery review identifier used to submit or cancel a durable first-recovery review.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkflowInitialRecoveryReviewDecisionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Submit or cancel a durable first-recovery review result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowInitialRecoveryReview"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "501": {
            "$ref": "#/components/responses/NotImplemented"
          }
        }
      }
    },
    "/v1/apps/{slug}/initial-recovery-reviews": {
      "get": {
        "operationId": "listWorkflowInitialRecoveryReviews",
        "summary": "List retained first-recovery reviews",
        "description": "List retained first-recovery reviews. Policy-version-fenced initial recovery. Preparation captures retained generation-zero evidence and a live safety preview. Submit repeats evidence, safety, cooldown and budget checks and atomically creates a native recovery job. Ready notifications use the existing delivery ledger. Reads never prepare or submit. Expiry and changed policy authority block submission and pending admission. Submission is explicit; no automatic first recovery is enabled.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug used to list retained first-recovery reviews.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "after",
            "description": "Opaque cursor from the previous page.",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "description": "Maximum number of results to return.",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List retained first-recovery reviews result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowInitialRecoveryReviews"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflow-failures": {
      "get": {
        "operationId": "listWorkflowInitialFailures",
        "summary": "List captured initial workflow failures",
        "description": "Read-only, policy-independent generation-zero failure inbox. Capture is prospective and partial, retained for 30 days with at most 10000 entries per app. Newest-first cursors bind the account, app, workflow filter and observation ceiling. Retention may remove entries between pages. Evidence alone does not prove that a run can safely resume. No run inputs, outputs or error text are returned.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug used to list captured initial workflow failures.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "workflow",
            "description": "Workflow name to filter captured failures.",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "after",
            "description": "Opaque cursor from the previous page used to list captured initial workflow failures.",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "name": "limit",
            "description": "Maximum number of results to return used to list captured initial workflow failures.",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 100,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retained initial failures.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowInitialFailures"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflow-failures/{failureID}/recovery-preview": {
      "get": {
        "operationId": "previewWorkflowInitialRecovery",
        "summary": "Review first recovery eligibility for a captured failure",
        "description": "Read-only consistent live inspection of retained generation-zero evidence, current generation, safe resume diagnostics and operation ownership. Returns a generation-fenced target only when eligible. Cached later eligibility and policy existence do not authorize recovery. This does not prepare a policy review or admit a run. Operators may submit the exact reviewed target through event recovery creation with a stable request_id; creation and worker admission recheck evidence retention and generation, and resume rechecks safety and capacity. No automatic first recovery is enabled.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "description": "Application slug for review first recovery eligibility for a captured failure.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "failureID",
            "description": "Captured initial workflow failure identifier for review first recovery eligibility for a captured failure.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Live first recovery diagnostic.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowInitialRecoveryPreview"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/recovery-policy/history": {
      "get": {
        "operationId": "getWorkflowRecoveryHistory",
        "summary": "Inspect retained recovery automation history",
        "description": "Read-only timeline of retained review decisions, controls, retry events, durable policy changes, worker reason transitions and health incident events, alongside latest observations. Durable events are captured prospectively with their state mutations, retained for 30 days and capped at 10000 per app. Results are ordered newest first with stable identifier tie breaks. Cursors fix the time window and durable event sequence ceiling; later appends are excluded. Retention can remove events, and latest observations can change across pages. Workflow, run and policy filters omit records without those associations. No execution inputs or outputs are returned.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "App slug.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "workflow",
            "in": "query",
            "description": "Workflow name filter.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "run_id",
            "in": "query",
            "description": "Workflow run filter.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "policy_version",
            "in": "query",
            "description": "Policy version filter; zero includes all versions.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "created_after",
            "in": "query",
            "description": "Inclusive start; defaults to seven days before the end.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "created_before",
            "in": "query",
            "description": "Inclusive end; defaults to the first page observation time. Maximum window is 30 days.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "after",
            "in": "query",
            "description": "Opaque next_after cursor; preserve the original filters.",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Page size; zero uses the default.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 100,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retained history page.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRecoveryHistory"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/recovery-policy/report": {
      "get": {
        "operationId": "getWorkflowRecoveryReport",
        "summary": "Report observed recovery automation effectiveness",
        "description": "Read-only consistent snapshot summarizing at most 10000 newest retained history entries. Deduplicates durable and retained retry records by action. Attempts and results are selected independently by event time; missing results do not prove children are running. Durations measure application to result recording including worker polling delay. Groups use workflow and policy version. Blockers count distinct actions per observed reason. Recording is prospective, without backfill, and durable history retains 30 days / 10000 events per app. Coverage notes and truncation always accompany counts; no success percentage or causal effectiveness claim is inferred.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "App whose observed recovery behavior is summarized.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "workflow",
            "in": "query",
            "description": "Restrict report evidence to this workflow name.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "policy_version",
            "in": "query",
            "description": "Restrict report evidence to this policy version; zero includes every version.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "created_after",
            "in": "query",
            "description": "Inclusive report start; omitted values use seven days before the report end.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "created_before",
            "in": "query",
            "description": "Inclusive end; defaults to the snapshot observation time. Maximum window is 30 days.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Observed effectiveness report.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRecoveryReport"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/recovery-policy/health": {
      "get": {
        "operationId": "getWorkflowRecoveryPolicyHealth",
        "summary": "Inspect recovery automation health",
        "description": "Read-only app-scoped recovery policy health from a consistent bounded queue snapshot. Expected cooldown and exhausted budgets are blocked rather than stalled. Stalled means worker evaluation is overdue, not that a running child exceeded its execution deadline. This is advisory and never releases slots or authorizes execution.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "App slug for recovery policy health.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "stall_after_seconds",
            "in": "query",
            "description": "Worker evaluation age threshold; request-local and not persisted.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 86400,
              "default": 300
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Observed recovery automation health.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRecoveryPolicyHealth"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/recovery-policy/queue": {
      "get": {
        "operationId": "getWorkflowRecoveryAutomaticQueue",
        "summary": "Inspect queued automatic retries",
        "description": "Returns a consistent app-scoped snapshot of current pending intents, unresolved applied children across policy versions, and execution charges across all versions. Includes at most 100 entries in review order. Reasons reflect the last worker evaluation and are informational; unknown evidence never grants execution authority.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "App slug for getWorkflowRecoveryAutomaticQueue.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Result of getWorkflowRecoveryAutomaticQueue.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRecoveryAutomaticQueue"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/recovery-policy/reviews": {
      "get": {
        "operationId": "listWorkflowRecoveryPolicyReviews",
        "summary": "List retained recovery policy decisions",
        "description": "Lists immutable evaluations and prepared response plans in identifier order. Evidence is retained with the parent recovery job.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "App slug for listWorkflowRecoveryPolicyReviews.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "after",
            "in": "query",
            "description": "Exclusive review identifier cursor from the previous policy review page.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum retained policy reviews returned in this page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Result of listWorkflowRecoveryPolicyReviews.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRecoveryPolicyReviews"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/recovery-policy/reviews/{reviewID}": {
      "get": {
        "operationId": "getWorkflowRecoveryPolicyReview",
        "summary": "Inspect one retained policy review",
        "description": "Reads a frozen policy version and its target decisions. A prepared plan can be exported and explicitly applied using generation-fenced controls.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "App slug for getWorkflowRecoveryPolicyReview.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reviewID",
            "in": "path",
            "required": true,
            "description": "Retained recovery policy review to inspect.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Result of getWorkflowRecoveryPolicyReview.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRecoveryPolicyReview"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/recovery-policy/reviews/{reviewID}/decision": {
      "post": {
        "operationId": "decideWorkflowRecoveryPolicyReview",
        "summary": "Approve or dismiss a policy plan",
        "description": "Records one immutable actor-attributed decision. An identical retry returns the original decision; a different decision or reason conflicts. Approval never applies actions and can be recorded for stale plans. Only reviews with prepared plans can be decided.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "App owning the policy review.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reviewID",
            "in": "path",
            "required": true,
            "description": "Retained policy review identifier.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkflowRecoveryReviewDecisionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Review operation result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRecoveryPolicyReview"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/apps/{slug}/recovery-policy/reviews/{reviewID}/actions/{actionID}/suppress": {
      "post": {
        "operationId": "suppressWorkflowRecoveryAutomaticAction",
        "summary": "Suppress one pending automatic retry",
        "description": "Suppresses a retained pending intent under its observed policy version. Records a trusted operator and reason. Requires deploy write and MFA. Applied children cannot be suppressed; no child is cancelled and no charge is refunded. Identical reason retries return the retained audit receipt while the policy version remains current. Manual recovery remains available.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "App slug for suppressWorkflowRecoveryAutomaticAction.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reviewID",
            "in": "path",
            "required": true,
            "description": "Retained review containing the automatic retry to suppress.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "actionID",
            "in": "path",
            "required": true,
            "description": "Stable pending automatic action identifier for suppression.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Observed automatic policy version and operator suppression reason.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SuppressWorkflowRecoveryAutomaticActionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Retained result of suppressWorkflowRecoveryAutomaticAction.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRecoveryAutomaticAction"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/apps/{slug}/recovery-policy/reviews/{reviewID}/status": {
      "get": {
        "operationId": "getWorkflowRecoveryReviewStatus",
        "summary": "Inspect live policy plan freshness",
        "description": "Checks retained action receipts before live generation eligibility. Reports ready, stale, unknown, applied, partially_applied or no_plan. Applied means a cancellation succeeded or a retry child was created; execution outcomes require the response-status command. Advisory checks never mutate or refresh plans.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "App whose prepared response plan freshness is inspected.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reviewID",
            "in": "path",
            "required": true,
            "description": "Policy review containing the saved targets to inspect.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current advisory freshness and durable application evidence.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRecoveryReviewStatus"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/event-recoveries/{jobID}/workflow-action-receipts/{requestID}": {
      "get": {
        "operationId": "getWorkflowRecoveryActionReceipt",
        "summary": "Read a retained workflow recovery action receipt",
        "description": "Reads an immutable cancellation decision in the authenticated account. Missing or expired action receipts return 404. This operation never submits cancellation.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobID",
            "in": "path",
            "required": true,
            "description": "Owned recovery job whose cancellation receipt is being reconciled.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "requestID",
            "in": "path",
            "required": true,
            "description": "Stable cancellation action identifier from the saved response plan.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retained cancellation action and its original outcome.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRecoveryActionReceipt"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/apps/{slug}/event-recoveries/by-request/{requestID}": {
      "get": {
        "operationId": "getEventRecoveryByRequest",
        "summary": "Find a retained recovery job by its stable request identifier",
        "description": "Looks up the original recovery job in this app and account after an interrupted creation request. Missing or expired jobs return 404. This operation never creates work.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "App containing the original recovery creation request.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "requestID",
            "in": "path",
            "required": true,
            "description": "Original recovery creation request identifier to locate in this app.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Original retained recovery job and its current progress.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventRecoveryJob"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/event-recoveries/{jobID}/workflow-cancellation-preview": {
      "post": {
        "operationId": "previewWorkflowRecoveryCancellation",
        "summary": "Preview cancellation of an admitted workflow generation",
        "description": "Cancellation preview for native workflow recovery only. Rechecks the frozen item and generation under the run lock. Changed or unproven generations are refused. Cancellation is cooperative and cannot undo external side effects. Successful cancellation and its actor and reason are recorded atomically in recovery history.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobID",
            "in": "path",
            "required": true,
            "description": "Owned retained recovery job ID for workflow-cancellation-preview.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Reviewed item and generation with the operator reason for workflow-cancellation-preview.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkflowRecoveryCancellationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Cancellation preview outcome. Noneligible outcomes do not change execution or history.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRecoveryCancellationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/event-recoveries/{jobID}/workflow-cancel": {
      "post": {
        "operationId": "cancelWorkflowRecoveryExecution",
        "summary": "Cancel one reviewed admitted workflow generation",
        "description": "Cancellation commit for native workflow recovery only. Rechecks the frozen item and generation under the run lock. Changed or unproven generations are refused. Cancellation is cooperative and cannot undo external side effects. Successful cancellation and its actor and reason are recorded atomically in recovery history.",
        "tags": [
          "events"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobID",
            "in": "path",
            "required": true,
            "description": "Owned retained recovery job ID for workflow-cancel.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Reviewed item and generation with the operator reason for workflow-cancel.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkflowRecoveryCancellationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Cancellation commit outcome. Noneligible outcomes do not change execution or history.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRecoveryCancellationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/event-recoveries/{jobID}/preflight": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventRecoveryPreflight",
        "summary": "Assess a frozen recovery selection without admitting work.",
        "description": "Requires apps:read or admin and MFA. Read-only observations of all pending items, with up to 100 sample positions. Current per-item eligibility and capacity are not reservations. Conditions can change before admission. The optimistic rate-window estimate includes all pending admissions/skips and spent permits, assumes immediate resume, and excludes future contention, worker delays and handler execution. With retry=true, review every saved item of a terminal native workflow recovery using one consistent snapshot. Only saved failures matching the retained run generation can be retried. Capacity is temporary; changed, missing, unsafe, and resume-limit targets cannot be selected. This view never creates a job or resumes a run. Timing fields describe the parent job, not a prospective child.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobID",
            "description": "Durable recovery job identifier for this operation: assess a frozen recovery selection without admitting work.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "retry",
            "in": "query",
            "description": "Review saved native workflow outcomes for an explicit child retry instead of pending parent admissions. Only true is accepted; omit for ordinary preflight.",
            "required": false,
            "schema": {
              "type": "boolean",
              "enum": [
                true
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current eligibility observations and optimistic timing estimate.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventRecoveryPreflight"
                }
              }
            }
          },
          "400": {
            "description": "Invalid job ID or query parameters.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Retry view requires a terminal native workflow recovery parent.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Recovery preflight timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Recovery preflight timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/event-recoveries/{jobID}/notifications": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventRecoveryNotifications",
        "summary": "Inspect recovery notification capture and receiver acknowledgements.",
        "description": "Requires apps:read or admin and MFA. Read-only account-scoped report for a retained recovery job. Admission and execution notifications are separate. Preserved receiver snapshots and retained outbox rows can establish complete selection; retained deliveries alone cannot. Reports up to 100 receivers per notification and marks incomplete counts. Missing/pruned evidence is unknown, never proof of acknowledgement. Existing retry paths require their normal write scope and MFA. No query parameters are accepted.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobID",
            "in": "path",
            "required": true,
            "description": "Retained recovery job ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current metadata-only notification and delivery report.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventRecoveryNotifications"
                }
              }
            }
          },
          "400": {
            "description": "Invalid recovery notification job ID or unsupported query parameters.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is required to inspect recovery notification delivery.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Read scope or MFA required.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Recovery job not found or not owned.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Request rate limited.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Internal notification reporting failure or invalid capture metadata.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/event-recoveries/{jobID}/notifications/retry-preview": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "previewEventRecoveryNotificationRetry",
        "summary": "Preview selective recovery notification retries.",
        "description": "Requires apps:read or admin and MFA. Read-only preview of admission and execution receivers. Only retained dead deliveries with an enabled owned receiver and an eligible current plan are eligible. Incomplete evidence remains explicit; preview reserves nothing and accepts no query parameters.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobID",
            "in": "path",
            "required": true,
            "description": "Retained recovery job identifier for retry-preview.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Notification retry-preview decision for the selected job.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventRecoveryNotificationRetryPreview"
                }
              }
            }
          },
          "400": {
            "description": "Invalid notification retry-preview input or query parameters.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required for notification retry-preview.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Required scope or MFA missing for notification retry-preview.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Retained job unavailable for notification retry-preview.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Notification retry-preview request rate limited.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Notification retry-preview storage failure.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Notification retry-preview request exceeded its time budget. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Notification retry-preview request exceeded its time budget.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/event-recoveries/{jobID}/notifications/retry": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "retryEventRecoveryNotifications",
        "summary": "Retry selected recovery notification deliveries.",
        "description": "Requires deploy:write or admin and MFA. Explicit targets require notification kind, webhook and delivery identity, and expected replay generation. Revalidates each receiver and records queued or skipped decisions atomically with resets. A stable request_id returns the saved decision regardless of later delivery state; reuse with different targets conflicts. At most 100 targets and 100 saved decisions per retained job. Decisions expire with job pruning. Delivery IDs and source event IDs remain stable; queued means pending delivery, not acknowledgement. No query parameters are accepted.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobID",
            "in": "path",
            "required": true,
            "description": "Retained recovery job identifier for retry.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventRecoveryNotificationRetryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Notification retry decision for the selected job.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventRecoveryNotificationRetryResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid notification retry input or query parameters.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required for notification retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Required scope or MFA missing for notification retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Retained job unavailable for notification retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Notification retry request ID conflicts or saved decision limit reached.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Notification retry request rate limited.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Notification retry storage failure.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Notification retry request exceeded its time budget. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Notification retry request exceeded its time budget.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/event-recoveries/{jobID}/notification-retry-decisions": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "listEventRecoveryNotificationRetryHistory",
        "summary": "List saved recovery notification retry decisions.",
        "description": "Requires apps:read or admin and MFA. Lists at most 100 immutable request summaries in decision time order for the retained owned recovery job. The optional status filter selects a comma-separated union of original-generation request statuses. Totals cover all retained requests before filtering; matched_count counts returned rows. Other query parameters, repeated status parameters, duplicate statuses, empty selections, and unknown statuses are rejected. Decisions expire when the job is pruned.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobID",
            "in": "path",
            "required": true,
            "description": "Retained recovery job identifier whose retry decisions are listed.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Comma-separated distinct request statuses selected as a union; omitting returns all retained requests. Aggregate totals remain unfiltered.",
            "schema": {
              "type": "string",
              "pattern": "^(succeeded|failed|pending|inconclusive)(,(succeeded|failed|pending|inconclusive))*$"
            },
            "example": "failed,inconclusive"
          }
        ],
        "responses": {
          "200": {
            "description": "Saved retry request summaries and counts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventRecoveryNotificationRetryHistory"
                }
              }
            }
          },
          "400": {
            "description": "Invalid job identifier or unsupported query parameters for retry history.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required to list retry decisions.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Read scope or MFA required to list retry decisions.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Recovery job not found or not owned for retry history.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Retry history request rate limited.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Saved retry history could not be read.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/event-recoveries/{jobID}/notification-retry-decisions/{requestID}": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventRecoveryNotificationRetryDecision",
        "summary": "Inspect a saved recovery notification retry decision.",
        "description": "Requires apps:read or admin and MFA. Returns the original queued or skipped decision for each target and current retained delivery status observed now. Missing or pruned deliveries are unavailable; original decisions remain unchanged. Query parameters are not accepted.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobID",
            "in": "path",
            "required": true,
            "description": "Retained recovery job that owns the saved retry decision.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "requestID",
            "in": "path",
            "required": true,
            "description": "Canonical request identifier returned by retry history.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Frozen decision and latest retained delivery status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventRecoveryNotificationRetryDecisionDetail"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or recovery identifier or unsupported query parameters.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Authentication required to inspect a saved retry decision.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Read scope or MFA required to inspect a saved retry decision.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Recovery job or saved request not found or not owned.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Retry decision detail request rate limited.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Saved retry decision could not be read.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/event-recoveries/{jobID}/history": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "listEventRecoveryHistory",
        "summary": "Inspect retained recovery control audit history.",
        "description": "Requires apps:read or admin and MFA. Entries are ordered by ID ascending. Actor identity is server-resolved. Failed requests and no-op controls add no entry. Expiry discovered by controls commits a system entry even when the request returns 409. History is retained and deleted with its job. Existing jobs have no fabricated historical entries.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobID",
            "description": "Durable recovery job identifier for this operation: inspect retained recovery control audit history.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "after",
            "in": "query",
            "description": "Exclusive last history entry ID; IDs need not be contiguous.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0,
              "default": 0
            }
          },
          {
            "name": "limit",
            "description": "Maximum page size for this operation: inspect retained recovery control audit history.",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retained audit history page.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventRecoveryHistory"
                }
              }
            }
          },
          "400": {
            "description": "Invalid pagination.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Recovery history request timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Recovery history request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/event-recoveries/{jobID}/items": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "listEventRecoveryItems",
        "summary": "Read a stable page of selected recipients and recovery outcomes.",
        "description": "Read a stable page of selected recipients and recovery outcomes. Requires `apps:read` or `admin`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobID",
            "description": "Durable recovery job identifier for this operation: read a stable page of selected recipients and recovery outcomes.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "after",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0,
              "default": 0
            },
            "description": "Last item position returned on the preceding page of this job."
          },
          {
            "name": "limit",
            "description": "Maximum page size for this operation: read a stable page of selected recipients and recovery outcomes.",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Read a stable page of selected recipients and recovery outcomes: recovery result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventRecoveryItems"
                }
              }
            }
          },
          "400": {
            "description": "Read a stable page of selected recipients and recovery outcomes: invalid request or selection larger than 10000 recipients.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Read a stable page of selected recipients and recovery outcomes: recovery request timed out. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Read a stable page of selected recipients and recovery outcomes: recovery request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/event-replays/{jobID}": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventReplayBackfill",
        "summary": "Read durable event backfill progress.",
        "description": "Returns account-scoped scan and per-envelope routing counts without exposing payloads.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobID",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Durable backfill job identifier returned at creation."
          }
        ],
        "responses": {
          "200": {
            "description": "Current replay job progress.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventReplayBackfillJobResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Job status read timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/event-replays/{jobID}/items": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "listEventReplayBackfillItems",
        "summary": "List per-envelope outcomes for a durable backfill.",
        "description": "Returns stable, acceptance-ordered metadata pages. Event identity and routing outcomes remain readable after the source envelope is pruned; event payloads are never returned.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobID",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Durable backfill job identifier."
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "processing",
                "enqueued",
                "filtered",
                "failed",
                "skipped_captured",
                "skipped_unknown",
                "skipped_existing",
                "skipped_unsettled",
                "cancelled"
              ]
            },
            "description": "Filter items to one durable routing outcome."
          },
          {
            "name": "after",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Opaque continuation cursor. Keep the job and state filter unchanged."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Maximum items returned in this page."
          }
        ],
        "responses": {
          "200": {
            "description": "One metadata-only page of backfill outcomes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventReplayBackfillItemsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Item read timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/event-replays/{jobID}/retry-failed": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "retryFailedEventReplayBackfill",
        "summary": "Retry a bounded batch of failed backfill deliveries.",
        "description": "Resets up to 100 failed routing recipients in this job with a fresh routing generation; handler retries and dead letters remain independent.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobID",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Backfill job whose eligible failed routing deliveries are being retried."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventReplayBackfillRetryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Failed routing deliveries requeued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventReplayBackfillRetryResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Job has not completed with failures (event_replay_backfill_state).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Retry request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/event-replays/{jobID}/cancel": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "cancelEventReplayBackfill",
        "summary": "Cancel a running backfill.",
        "description": "Ends a running backfill as cancelled. Deliveries already admitted finish; undelivered ones are dropped and their receipts released. Cancelling an ended job returns it unchanged.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobID",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Backfill job to cancel."
          }
        ],
        "responses": {
          "200": {
            "description": "The job after cancellation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventReplayBackfillJobResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Cancel request timed out.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-deliveries": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "listEventDeliveries",
        "summary": "Inspect event delivery lifecycle for an app.",
        "description": "Returns original event-triggered invocation metadata, operator replay\ninvocations carrying event identity headers, and terminal fanout\nrecipient failures, each newest first. The projections include the\npublished event identity, subscription, lifecycle state, attempts,\nand last error without returning payloads. The two histories have\nindependent pagination cursors. event_id alone searches across event\nsources; provide event_source with event_id to select one event identity.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "event_source",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Optional exact published event source; requires event_id."
          },
          {
            "name": "event_id",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Published event ID; without event_source, matching IDs from all sources are included."
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "dispatching",
                "completed",
                "failed",
                "dead_letter"
              ]
            },
            "description": "Exact delivery state to include; failed also includes pre-invocation recipient routing failures."
          },
          {
            "name": "before",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Opaque cursor from next_before, bound to this app and the event identity and state filters."
          },
          {
            "$ref": "#/components/parameters/QueueCursorLimit"
          },
          {
            "name": "fanout_before",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Opaque cursor from next_fanout_before for this app and event source and ID filters."
          }
        ],
        "responses": {
          "200": {
            "description": "App-scoped event deliveries and terminal fanout failures, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventDeliveryListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/event-deliveries/attempts": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "listEventFanoutAttemptHistory",
        "summary": "Inspect one event recipient's fanout attempt history.",
        "description": "Returns the routing outcomes and explicit operator replay requests\nretained for one app-scoped event identity. This immutable history is\nseparate from the current recipient checkpoint and survives replay.\nEvent source and ID are required so reused IDs cannot mix histories.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "event_source",
            "in": "query",
            "required": true,
            "description": "Exact published event source.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "event_id",
            "in": "query",
            "required": true,
            "description": "Exact published event ID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscription_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Optional filter for one captured recipient."
          },
          {
            "name": "before",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Opaque cursor from next_before, bound to this app, event identity, and recipient filter."
          },
          {
            "$ref": "#/components/parameters/QueueCursorLimit"
          }
        ],
        "responses": {
          "200": {
            "description": "Recipient routing attempt history, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventFanoutAttemptHistoryResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/event-deliveries:replay-fanout-failure": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "replayEventFanoutFailure",
        "summary": "Retry one terminal event recipient routing failure.",
        "description": "Requeues only the named failed recipient captured at acceptance or\nadded by a retained historical backfill. Backfill failures must be\nretryable and have a running or completed-with-failures job; reopening\na completed job observes active-job limits. Other recipients and\ntheir outcomes are left untouched. With independent recipient routing,\na terminal recipient can be replayed while siblings are active and gets\na fresh routing retry budget. Legacy receipts must settle first.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReplayEventFanoutFailureRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "One recipient accepted for replay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReplayEventFanoutFailureResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/event-deliveries:replay-retryable-fanout-failures": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "replayRetryableEventFanoutFailures",
        "summary": "Replay a bounded batch of retryable event recipient failures.",
        "description": "Requeues up to 100 terminal recipients for the app whose stable failure\nclassification marks them retryable. Optional event_source and event_id\nnarrow the action to one published event and must be supplied together.\nNon-retryable recipients are left alone. Independent recipient routing\npermits replay while siblings are active and renews each selected\nrecipient's routing retry budget. Legacy receipts with active whole-event\nclaims are skipped; repeat after they settle if has_more remains true.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReplayRetryableEventFanoutFailuresRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Bounded replay accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReplayRetryableEventFanoutFailuresResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/dlq:replay_all": {
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "replayAllDeadLetterEvents",
        "summary": "Replay pending dead-letter events for an app.",
        "description": "Atomically resets up to `limit` pending queue invocation, broker\ntrigger, and outbound webhook delivery records to pending and stamps\neach ledger row with replayed_at. Concurrent operators claim disjoint\nrows.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/QueueCursorLimit"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "202": {
            "description": "Number of events accepted for replay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeadLetterReplayAllResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/dlq/{id}": {
      "get": {
        "tags": [
          "queues"
        ],
        "operationId": "getDeadLetterEvent",
        "summary": "Get one dead-letter event for an app.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/Id32"
          }
        ],
        "responses": {
          "200": {
            "description": "The dead-letter event.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeadLetterEvent"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "queues"
        ],
        "operationId": "deleteDeadLetterEvent",
        "summary": "Purge one dead-letter event from the app ledger.",
        "description": "Removes only the ledger projection; the source remains dead-lettered.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/Id32"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "204": {
            "description": "Dead-letter event purged."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/dlq/{id}/replay": {
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "replayDeadLetterEvent",
        "summary": "Replay one dead-letter event atomically.",
        "description": "Resets the source invocation, trigger record, or outbound webhook\ndelivery to pending, clears its retry error, and records replayed_at\non the unified ledger. An event_route entry (a routing failure whose\nreceipt was pruned) has nothing to redrive and answers 409\ndead_letter_not_replayable.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/Id32"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "202": {
            "description": "Replay accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeadLetterEvent"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/delayed-tasks": {
      "get": {
        "tags": [
          "delayed_tasks"
        ],
        "operationId": "listDelayedTasks",
        "summary": "List delayed tasks for an app.",
        "description": "Newest-first, cursor-paginated delayed-task history.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Invocation id returned as next_before by a prior page."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 20
            },
            "description": "Page size from 1 to 200; defaults to 20."
          }
        ],
        "responses": {
          "200": {
            "description": "One page of delayed tasks.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListDelayedTasksResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "delayed_tasks"
        ],
        "operationId": "delayedTaskCreate",
        "summary": "Schedule a delayed task to fire at a future time.",
        "description": "Supply exactly one of `scheduled_at` or `delay_seconds`. Scheduling is\nbounded to one year. Cap-checked against the plan's\nMaxDelayedTasksPerApp (Hobby 5, Pro 50, Scale 1_000_000). Accepted\ntasks are grandfathered across later plan changes. Delivery is at\nleast once; handlers should use the invocation id to make side effects\nidempotent.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/GregaleRevision"
          },
          {
            "$ref": "#/components/parameters/GregaleRelease"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DelayedTaskRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The newly-scheduled task.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DelayedTaskResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidScheduledAt"
          },
          "403": {
            "$ref": "#/components/responses/PlanDelayedTasksCap"
          },
          "413": {
            "$ref": "#/components/responses/PlanSourceBytes"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/invocations": {
      "get": {
        "tags": [
          "invocations"
        ],
        "operationId": "listInvocations",
        "summary": "List recent invocations on the account.",
        "description": "Paginated by `?before=<id>` (the LAST id of the returned slice).\nDefaults to 20 per page; capped at 200.\n",
        "parameters": [
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Cursor — return rows whose id is strictly less than this. Omit for the most recent page."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 20
            },
            "description": "Page size; 1-200, default 20."
          }
        ],
        "responses": {
          "200": {
            "description": "The page.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListInvocationsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/instances": {
      "get": {
        "tags": [
          "instances"
        ],
        "operationId": "listInstancesForAccount",
        "summary": "List every live instance across the caller's account.",
        "description": "Replaces the per-app fan-out from `/v1/apps/{slug}/instances`\nwith one account-scoped read. Each instance carries\nits `app_id`; cross-account isolation is enforced by the SQL\n`apps.account_id = $1` join (test: see\n`TestListInstancesForAccount_CrossAccountIsolation`).\n\nCursor: `?before=<id>` (the instances.id UUIDv7). Defaults to 25\nper page; capped at 100; invalid `limit` returns 400\n`code_validation` with `limit=100` and the observed value\n(RFC 7807 strict mode, matching `/v1/invoices`).\n\nRate-limit tiering: one call now replaces N per-app calls,\nso per-page-load token spend drops from N to 1. The\nper-account bucket still applies at the gateway\nedge; this route charges 1 token via the API authLimited\nmiddleware, same as every other `/v1/*` route.\n",
        "parameters": [
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Cursor (instances.id UUIDv7). Omit for the most recent page."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            },
            "description": "Page size; server clamps to 1..100, returns 400 with `limit=100` and the observed value on bad input."
          }
        ],
        "responses": {
          "200": {
            "description": "One page of instances, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListInstancesResponse"
                },
                "example": {
                  "instances": [
                    {
                      "id": "0123456789abcdef0123456789abcdef",
                      "app_id": "0123456789abcdef0123456789abcdef",
                      "deployment_id": "0123456789abcdef0123456789abcdef",
                      "state": "running",
                      "ram_mb": 256,
                      "started_at": "2026-07-23T11:25:00Z"
                    }
                  ],
                  "next_before": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/secrets": {
      "get": {
        "tags": [
          "secrets"
        ],
        "operationId": "listSecretsForAccount",
        "summary": "List every sealed secret across the caller's account.",
        "description": "Replaces the per-app fan-out from `/v1/apps/{slug}/secrets`\nwith one account-scoped read. Each row carries\nthe owning app's `app_id` and `app_slug` so the dashboard\ncan render \"foo-app / DATABASE_URL\" without a parallel\n`/v1/apps` round-trip.\n\n**Plaintext never appears here** — only the age-sealed\nenvelope (base64). The plaintext value lives transiently in\nthe PUT handler and never crosses the API wire.\n\nCursor: `?before=<slug>|<key>` — the (app_slug, key) pair,\npipe-separated. The SQL splits it back via `split_part`.\nSort order is (app_slug ASC, key ASC). Default limit 25,\nmax 100 (strict 400 on bad input, matching `/v1/invoices`).\n",
        "parameters": [
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Cursor in the form `<slug>|<key>`. Omit for the first page."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            },
            "description": "Page size; server clamps to 1..100, returns 400 on bad input."
          }
        ],
        "responses": {
          "200": {
            "description": "One page of sealed-secret envelopes, ordered by (app_slug ASC, key ASC).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListSecretsForAccountResponse"
                },
                "example": {
                  "secrets": [
                    {
                      "app_id": "0123456789abcdef0123456789abcdef",
                      "app_slug": "foo-app",
                      "key": "DATABASE_URL",
                      "ciphertext": "YWdlLWVuY3J5cHRpb24...",
                      "created_at": "2026-07-23T11:25:00Z",
                      "updated_at": "2026-07-23T11:25:00Z"
                    }
                  ],
                  "next_before": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/metrics": {
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppsMetrics",
        "summary": "Account-wide per-app metrics rollup.",
        "description": "One call replaces N per-app `/v1/apps/{slug}/metrics` calls. Returns the same `AppMetricsResponse` shape\nper app, keyed by `app_slug`, so the dashboard can render\nall apps on a single page without a per-app fan-out.\n\nRange is the closed vocabulary from the per-app endpoint:\n`5m` (default) | `15m` | `1h` | `6h` | `24h` | `7d` | `15d`.\nPrometheus failure short-circuits the entire response\n(never partial-populated) and emits `source:\n\"degraded: <reason>\"` with zeroed `apps`, matching the\nper-app contract exactly.\n\nPromQL cost: 6 round-trips regardless of N apps (vs. 7N\nfor the naive per-app loop)\nand `Client.QueryBuckets`. This rollup exposes the same\nHobby+ signals as the per-app endpoint, so Free accounts\nreceive 402.\n",
        "parameters": [
          {
            "name": "range",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "5m",
                "15m",
                "1h",
                "6h",
                "24h",
                "7d",
                "15d"
              ],
              "default": "5m"
            },
            "description": "Time window applied to every per-app rollup row. Default `5m`."
          }
        ],
        "responses": {
          "200": {
            "description": "The rollup.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppsMetricsResponse"
                },
                "example": {
                  "range": "5m",
                  "source": "prometheus",
                  "as_of": "2026-07-28T13:00:00Z",
                  "apps": {
                    "foo-app": {
                      "app_id": "0123456789abcdef0123456789abcdef",
                      "range": "5m",
                      "source": "prometheus",
                      "as_of": "2026-07-28T13:00:00Z",
                      "request_count": 142,
                      "latency_p50_ms": 12.4,
                      "latency_p95_ms": 87.3,
                      "latency_p99_ms": 412.5,
                      "error_rate_pct": 0.7,
                      "cold_start_pct": 8.5,
                      "wake_p95_ms": 380.2
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanPerAppMetricsNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/service-map": {
      "get": {
        "tags": [
          "observability"
        ],
        "operationId": "getServiceMap",
        "summary": "Account service map of caller → target app edges.",
        "description": "Internal preview, enabled by `FAAS_SERVICE_MAP_ENABLED=1`;\notherwise 403 `service_map_unavailable`.\n\nBuilt from the unsampled service-proxy edge series. Both the\ncaller and the target are constrained to the account's apps.\nEdges are ranked by call volume and capped at 500\n(`truncated: true`). Latency percentiles cover successful calls\nonly. Prometheus failure returns 200 with null `nodes`/`edges`\nand `source: \"degraded: <reason>\"`, as `/v1/apps/metrics` does.\n",
        "parameters": [
          {
            "name": "range",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "5m",
                "15m",
                "1h",
                "6h",
                "24h",
                "7d",
                "15d"
              ],
              "default": "1h"
            },
            "description": "Observation window. Default `1h`."
          }
        ],
        "responses": {
          "200": {
            "description": "The service map.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceMapResponse"
                },
                "example": {
                  "range": "1h",
                  "source": "prometheus",
                  "as_of": "2026-10-08T13:00:00Z",
                  "truncated": false,
                  "nodes": [
                    {
                      "app_id": "0f8fad5b-d9cb-469f-a165-70867728950e",
                      "app_slug": "billing",
                      "wake_ahead_enabled": false
                    },
                    {
                      "app_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
                      "app_slug": "public-api",
                      "wake_ahead_enabled": false
                    }
                  ],
                  "edges": [
                    {
                      "caller_app_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
                      "caller_app_slug": "public-api",
                      "target_app_id": "0f8fad5b-d9cb-469f-a165-70867728950e",
                      "target_app_slug": "billing",
                      "calls": 12040,
                      "errors": 48,
                      "error_rate_pct": 0.4,
                      "latency_p50_ms": 11.2,
                      "latency_p95_ms": 38,
                      "cold_calls": 9030,
                      "cold_call_pct": 75,
                      "suggest_wake_ahead": true,
                      "wake_ahead_started": 0,
                      "wake_ahead_used": 0,
                      "tcp_sessions": 0,
                      "tcp_errors": 0,
                      "tcp_cold_sessions": 0
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanPerAppMetricsNotAllowed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/previews": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "listPreviews",
        "summary": "List the platform previews you can join.",
        "description": "Self-serve platform previews: the previews an\noperator opened to self-serve, plus any you joined that have since\nclosed, so you can still leave them. `eligible` says whether your plan\nmay join; `enabled` whether the preview is on for you now, for any\nreason.\n",
        "responses": {
          "200": {
            "description": "The previews.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreviewList"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/previews/{key}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/PreviewKey"
        }
      ],
      "put": {
        "tags": [
          "account"
        ],
        "operationId": "joinPreview",
        "summary": "Join a platform preview.",
        "description": "Opts your account in. Joining twice changes nothing. A preview never\ngrants a plan entitlement, and an operator can still exclude an\naccount.\n",
        "responses": {
          "200": {
            "description": "The preview after joining.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Preview"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`preview_plan_not_eligible`: your plan cannot join this preview.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "`preview_not_offered`: not a preview open to self-serve.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "`preview_full` (with limit and observed) or a concurrent change.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "account"
        ],
        "operationId": "leavePreview",
        "summary": "Leave a platform preview.",
        "description": "Removes your account's opt-in. Leaving is always allowed, even after the preview closed; leaving one you never joined changes nothing.",
        "responses": {
          "200": {
            "description": "The preview after leaving.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Preview"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "`preview_not_offered`: not a platform preview.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/invocations/{id}": {
      "get": {
        "tags": [
          "invocations"
        ],
        "operationId": "getInvocation",
        "summary": "Read a single invocation by id (account-scoped).",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id32"
          }
        ],
        "responses": {
          "200": {
            "description": "The row.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Invocation"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/invocations/{id}/replay": {
      "post": {
        "tags": [
          "invocations"
        ],
        "operationId": "replayInvocation",
        "summary": "Re-issue a failed or dead_letter invocation.",
        "description": "Accepts no request body. Requires deployment write scope and configured\nMFA. Only failed or dead-lettered unbound unkeyed work is eligible.\nThe parent and its current app must belong to the caller. The child\npreserves the original request, deployment scope, customer identity\nand trusted replay lineage. Trace/version headers and execution/result\nlifetimes are refreshed; retry policy uses the current app and plan.\n\nEach parent creates at most one durable recovery child. Concurrent and\nrepeated requests return that child regardless of Idempotency-Key,\nincluding after completion. A subsequent recovery targets the failed\nchild. If its child has been pruned, the retained parent returns 409\n`invocation_replay_unavailable` instead of creating another execution.\nExisting acceptance is returned before checking expired deployment pins.\nApplication delivery and external side effects remain at least once.\n\nOther parent states return `invocation_not_replayable`. Keyed work\nreturns `keyed_replay_requires_policy`; use `/replay-keyed` for failed\nkeyed work. Queue-bound or named-queue work returns\n`queue_replay_requires_binding` and requires its app queue dead-letter\nreplay endpoint.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id32"
          }
        ],
        "responses": {
          "202": {
            "description": "The recovery child was enqueued or already exists.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AsyncInvokeResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The parent is not replayable, requires its policy/binding recovery\npath, or its durable child is no longer retained\n(`invocation_replay_unavailable`).\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/invocations/{id}/replay-keyed": {
      "post": {
        "tags": [
          "invocations"
        ],
        "operationId": "replayKeyedInvocation",
        "summary": "Recover failed keyed work in its captured policy lane",
        "description": "Accepts no request body. Requires deploy write scope and configured MFA.\nOnly failed keyed work without a queue binding is eligible. The child\nretains the captured policy revision, key, fairness limits, deployment\nscope, customer identity, payload, retry policy and trusted replay root.\nIt receives the next sequence in the same lane, after previously admitted\nwork. Replay does not supersede pending rows or restart debounce.\n\nThe original pending expiry and start deadline remain effective. A new\nreplay after either elapsed deadline returns `keyed_replay_expired`.\nEach parent creates at most one child. Repeating a request returns that\nchild, including after completion; a subsequent recovery must target\nthe failed child. If the child has been pruned while its parent remains,\nthe parent returns `keyed_replay_unavailable` instead of executing again.\nThe original failure remains visible in event receipts and retained\nreplay history. Delivery and application side effects remain at least once.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id32"
          }
        ],
        "responses": {
          "202": {
            "description": "The lane-preserving recovery child was admitted or is already retained.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AsyncInvokeResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Recovery is ineligible, its pending deadline expired, or its child is no longer retained.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/delayed-tasks/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "delayed_tasks"
        ],
        "operationId": "delayedTaskGet",
        "summary": "Read a single delayed task by id.",
        "responses": {
          "200": {
            "description": "The task.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DelayedTaskResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "delayed_tasks"
        ],
        "operationId": "delayedTaskCancel",
        "summary": "Cancel a pending delayed task.",
        "description": "Atomically cancels a pending row. A re-cancel is idempotent.\nDispatching or terminal rows are left unchanged and their actual\nstate is returned, so clients never claim completed work was stopped.\n",
        "responses": {
          "200": {
            "description": "The task with its authoritative resulting state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DelayedTaskResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/keys": {
      "get": {
        "tags": [
          "keys"
        ],
        "operationId": "listKeys",
        "summary": "List API keys (no plaintext).",
        "responses": {
          "200": {
            "description": "API key metadata on the account. Plaintext is never returned.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/APIKeyResponse"
                  }
                },
                "example": [
                  {
                    "id": "0123456789abcdef0123456789abcdef",
                    "org_id": "8b1f5e5d-273e-5a18-ae00-58fceba4fe6c",
                    "prefix": "fp_live_ab",
                    "label": "ci-deploy",
                    "scopes": [
                      "apps:read",
                      "deploy:write"
                    ],
                    "created_at": "2026-07-23T11:25:00Z",
                    "last_used_at": "2026-07-23T11:25:00Z"
                  }
                ]
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "keys"
        ],
        "operationId": "createKey",
        "summary": "Mint a new API key.",
        "description": "Returns the plaintext key **once**. The plaintext is never stored\nand cannot be retrieved; subsequent GETs return only the prefix.\n",
        "requestBody": {
          "required": true,
          "description": "Create a new API key for the authenticated account. Plaintext is returned exactly once in the 201 response and cannot be recovered later — store it immediately. rev2 for the scope vocabulary.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateKeyRequest",
                "example": {
                  "label": "ci-deploy"
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new API key. **The plaintext is returned exactly once** — every subsequent GET returns only the prefix.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIKeyResponse",
                  "example": {
                    "id": "0123456789abcdef0123456789abcdef",
                    "org_id": "8b1f5e5d-273e-5a18-ae00-58fceba4fe6c",
                    "prefix": "fp_live_ab",
                    "label": "ci-deploy",
                    "scopes": [
                      "apps:read",
                      "deploy:write"
                    ],
                    "created_at": "2026-07-23T11:25:00Z",
                    "last_used_at": "2026-07-23T11:25:00Z"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/keys/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "delete": {
        "tags": [
          "keys"
        ],
        "operationId": "deleteKey",
        "summary": "Revoke an API key.",
        "responses": {
          "204": {
            "description": "No body. The key was revoked."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/agent-connections": {
      "get": {
        "tags": [
          "keys"
        ],
        "operationId": "listAgentConnections",
        "summary": "List the agents connected to the account.",
        "description": "The account's connected agents, newest first:\nhosted MCP sign-ins, whose `mcp-login` keys the hosted MCP server\nholds, and API keys with the `agent` scope. Only keys that still work\nare listed. A hosted sign-in shows the client name its consent page\nshowed and the site the client was verified at, when known.\n",
        "responses": {
          "200": {
            "description": "The connected agents.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentConnectionsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/agent-approvals": {
      "get": {
        "tags": [
          "keys"
        ],
        "operationId": "listAgentApprovals",
        "summary": "List agent approval requests.",
        "description": "With an agent connection's key: that agent's requests that needed a\nperson's approval, newest first. With any other credential: the\npending requests the caller may decide, those of agents they\nconnected and of agents acting in organizations they own or\nadminister. A person decides only on the review page.\n",
        "responses": {
          "200": {
            "description": "The approval requests.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentApprovalsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/agent-approvals/channels": {
      "get": {
        "tags": [
          "keys"
        ],
        "operationId": "getAgentApprovalChannels",
        "summary": "Show where the account's agents' approval requests also go.",
        "description": "The notification channels that get a message for each new approval\nrequest of the account's agents, besides the email to the person\nwho connected the agent.\n",
        "responses": {
          "200": {
            "description": "The account's approval channels.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentApprovalChannelsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "put": {
        "tags": [
          "keys"
        ],
        "operationId": "setAgentApprovalChannels",
        "summary": "Choose where the account's agents' approval requests also go.",
        "description": "Replaces the notification channels that get the account's agents'\napproval requests. Name your own channels; an empty list leaves\nemail only. Needs an admin credential, so an agent cannot change\nwhere its own requests go.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentApprovalChannelsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The channels now bound.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentApprovalChannelsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/agent-approvals/{id}": {
      "get": {
        "tags": [
          "keys"
        ],
        "operationId": "getAgentApproval",
        "summary": "Get an agent approval request.",
        "description": "An agent reads its own request to learn whether a person approved\nit; a person reads one they may decide. Any other request answers\n404.\n",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The approval request's id.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The approval request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentApprovalResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/agent-connections/revoke_all": {
      "post": {
        "tags": [
          "keys"
        ],
        "operationId": "revokeAllAgentConnections",
        "summary": "Revoke every agent connected to the account.",
        "description": "Revokes the API key of every connected agent; each must sign in\nagain. Needs an admin credential. Audits `key.revoked` with reason\n`agent_disconnected` for each key and `agent_connections.revoke_all`\nwith the count.\n",
        "responses": {
          "200": {
            "description": "How many connections were revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentConnectionsRevokeAllResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/agent-connections/self": {
      "put": {
        "tags": [
          "keys"
        ],
        "operationId": "nameAgentClient",
        "summary": "Name the client of the calling hosted MCP key.",
        "description": "Called by the hosted MCP server after a browser sign-in, with the\nconnection's own `mcp-login` key. Any other credential is refused.\nThe first name wins.\n",
        "x-internal": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentClientRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "No body. The client is named."
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "keys"
        ],
        "operationId": "disconnectAgent",
        "summary": "Revoke the calling hosted MCP key.",
        "description": "Called by the hosted MCP server when a connection ends (consent\ndenied, or the connection revoked or expired), with that connection's\nown `mcp-login` key. Any other credential is refused.\n",
        "x-internal": true,
        "responses": {
          "204": {
            "description": "No body. The key is revoked."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/agent-connections/self/activity": {
      "get": {
        "tags": [
          "keys"
        ],
        "operationId": "agentConnectionSelfActivity",
        "summary": "Read the calling agent's own activity.",
        "description": "The write requests (POST, PUT, PATCH, DELETE) the calling agent key\nmade in the last 7 days, newest first. Only an agent key can call it;\na person reads an agent's log by its connection id.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/AgentActivityBefore"
          },
          {
            "$ref": "#/components/parameters/AgentActivityLimit"
          }
        ],
        "responses": {
          "200": {
            "description": "One page of the calling agent's write requests, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentActivityResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/agent-connections/self/budget": {
      "get": {
        "tags": [
          "keys"
        ],
        "operationId": "agentConnectionSelfBudget",
        "summary": "Read the calling agent's own budget.",
        "description": "The monthly budget for always-on capacity that applies to the\ncalling agent key and what it committed this month. Only an agent key\ncan call it.\n",
        "responses": {
          "200": {
            "description": "The calling agent's budget and spend.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentBudgetResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/agent-connections/{id}/budget": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "API key id of the connected agent whose budget to read or set.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "keys"
        ],
        "operationId": "agentConnectionBudget",
        "summary": "Read a connected agent's budget.",
        "description": "The monthly budget for always-on capacity (warm instances, schedule\nfloors, prewarms) that applies to one of the account's agents, where\nit comes from, and what the agent committed this month. Past the\nbudget, each change needs a person's approval. An agent key may read\nonly its own.\n",
        "responses": {
          "200": {
            "description": "The agent's budget and spend.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentBudgetResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "put": {
        "tags": [
          "keys"
        ],
        "operationId": "setAgentConnectionBudget",
        "summary": "Set a connected agent's budget.",
        "description": "Sets the agent's monthly budget, makes it unlimited (an organization's\nceiling still applies) or returns it to the plan's default: half the\nplan's default spend cap. Needs an admin credential; an agent cannot\nchange its own budget.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentBudgetRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The agent's budget after the change.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentBudgetResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/agent-connections/self/undo/plan": {
      "post": {
        "tags": [
          "keys"
        ],
        "operationId": "planSelfAgentUndo",
        "summary": "Plan undoing the calling agent's own changes.",
        "description": "An agent key plans an undo of its own changes, like a person's plan.\nApplying it needs a person's approval.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentUndoRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The undo plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentUndoPlan"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/agent-connections/self/undo": {
      "post": {
        "tags": [
          "keys"
        ],
        "operationId": "applySelfAgentUndo",
        "summary": "Undo the calling agent's own changes, once a person approves.",
        "description": "An agent key applies a reviewed undo of its own changes. It always\nwaits for a person's approval: the first call answers 428\napproval_required with the request to wait on (category undo, bound\nto this body and so to the plan digest); after the approval, the same\ncall applies it once.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentUndoRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "What the undo did to each change.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentUndoResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/agent-connections/{id}/undo/plan": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "API key id of the connected agent whose changes to undo.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "tags": [
          "keys"
        ],
        "operationId": "planAgentUndo",
        "summary": "Plan undoing a connected agent's changes.",
        "description": "Lists the agent's changes the request selects, newest first (by\ndefault those of the last 24 hours; changes are kept 7 days), with\nwhat undoing each will do: undo it, leave it because it cannot be\nundone or because someone changed it again since, or nothing because\nit was already undone. Apply the plan with its plan_digest. An agent\nkey cannot plan or apply an undo.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentUndoRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The undo plan for the connected agent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentUndoPlan"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/agent-connections/{id}/undo": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "API key id of the connected agent whose changes are undone.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "tags": [
          "keys"
        ],
        "operationId": "applyAgentUndo",
        "summary": "Undo a connected agent's changes.",
        "description": "Applies a reviewed plan: the same request with the plan's\nplan_digest. Changes are undone newest first through the same API\nthe agent used, as the caller; a change that cannot be undone leaves\nthe older changes of its resource as they are. 409 when the changes\nor their state differ from the plan. Needs an admin credential.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentUndoRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "What the undo did to each of the connected agent's changes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentUndoResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/agent-connections/{id}/activity": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "API key id of the connected agent whose activity to read.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "keys"
        ],
        "operationId": "agentConnectionActivity",
        "summary": "Read a connected agent's activity.",
        "description": "The write requests one of the account's agents made in the last 7\ndays, newest first: when, method, path, response status and the\napproval request it went through on. Reads and requests the approval\ngate answered are not listed. An agent key may read only its own.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/AgentActivityBefore"
          },
          {
            "$ref": "#/components/parameters/AgentActivityLimit"
          }
        ],
        "responses": {
          "200": {
            "description": "One page of the connected agent's write requests, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentActivityResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/agent-connections/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "The connected agent's API key id.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "delete": {
        "tags": [
          "keys"
        ],
        "operationId": "revokeAgentConnection",
        "summary": "Revoke one connected agent.",
        "description": "Revokes the agent's API key; the agent must sign in again. Needs an\nadmin credential. Revoking it again succeeds; an id that is not one of\nthe account's connected agents is 404.\n",
        "responses": {
          "204": {
            "description": "No body. The agent's key is revoked."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/keys/{id}/rotate": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "post": {
        "tags": [
          "keys"
        ],
        "operationId": "rotateKey",
        "summary": "Rotate an API key.",
        "description": "Mints a new key (status='active') and demotes the old key in\na single transaction. The new key\ninherits the predecessor's label + scopes so the customer's\nCI config does not need to chase a label change.\n\nThe old key's `expires_at` is OVERWRITTEN to the grace\ndeadline (now + grace_window_days, where grace_window_days\nresolves from the per-account override or the 7-day plan\ndefault). Status flips to 'grace' for the window, then to\n'revoked' at the deadline. Setting\n`accounts.key_grace_window_days = 0` makes rotation atomic\n(old key revoked immediately).\n\nReturns the new plaintext exactly once — the old plaintext\nis not re-issued (we only store the SHA-256 hash). The\ncustomer's CI script captures the new plaintext at the\nmoment of rotation and uses the new key thereafter; the old\nkey remains valid only for the grace window.\n\nQuota: rotation is quota-neutral (-1 +1 = 0 net). A\ncustomer AT the per-account cap can still rotate.\n",
        "responses": {
          "200": {
            "description": "New key minted, old key now in 'grace' (or 'revoked' if grace_window_days=0).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RotateKeyResponse"
                },
                "example": {
                  "key": {
                    "id": "0123456789abcdef0123456789abcdef",
                    "org_id": "8b1f5e5d-273e-5a18-ae00-58fceba4fe6c",
                    "prefix": "fp_live_ab",
                    "label": "ci-deploy",
                    "scopes": [
                      "apps:read",
                      "deploy:write"
                    ],
                    "created_at": "2026-08-02T11:25:00Z",
                    "status": "active",
                    "rotated_from_id": "fedcba9876543210fedcba9876543210"
                  },
                  "key_plaintext": "fp_live_NEW_PLAINTEXT_HERE",
                  "old_key_id": "fedcba9876543210fedcba9876543210",
                  "old_key_expires_at": "2026-08-09T11:25:00Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "No such key, or the key is already revoked.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/agent-connections": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "orgs",
          "keys"
        ],
        "operationId": "listOrgAgentConnections",
        "summary": "List the agents acting in an organization.",
        "description": "Hosted MCP connections bound to the organization and its API keys\nwith the `agent` scope that still work, newest first, with the\nmember who connected each. Owners and admins only.\n",
        "responses": {
          "200": {
            "description": "The organization's connected agents.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentConnectionsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/agent-connections/revoke_all": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "orgs",
          "keys"
        ],
        "operationId": "revokeAllOrgAgentConnections",
        "summary": "Revoke every agent acting in an organization.",
        "description": "Revokes the API key of every agent acting in the organization; each\nmust sign in again. Owners and admins only. Each revocation is\nrecorded in the organization's activity.\n",
        "responses": {
          "200": {
            "description": "How many of the organization's connections were revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentConnectionsRevokeAllResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/agent-connections/{id}/undo/plan": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "API key id of the organization agent whose changes to undo.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "tags": [
          "orgs",
          "keys"
        ],
        "operationId": "planOrgAgentUndo",
        "summary": "Plan undoing the changes of an agent acting in an organization.",
        "description": "The organization's variant of planning an undo, for its owners and\nadmins.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentUndoRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The undo plan for the organization agent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentUndoPlan"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/agent-connections/{id}/undo": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "API key id of the organization agent whose changes are undone.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "tags": [
          "orgs",
          "keys"
        ],
        "operationId": "applyOrgAgentUndo",
        "summary": "Undo the changes of an agent acting in an organization.",
        "description": "The organization's variant of applying a reviewed undo plan, for its\nowners and admins.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentUndoRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "What the undo did to each of the organization agent's changes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentUndoResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/agent-connections/{id}/activity": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "API key id of the organization agent whose activity to read.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "orgs",
          "keys"
        ],
        "operationId": "orgAgentConnectionActivity",
        "summary": "Read the activity of an agent acting in an organization.",
        "description": "The write requests an agent acting in the organization made in the\nlast 7 days, newest first. Owners and admins only; an id that is not\none of the organization's agents is 404.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/AgentActivityBefore"
          },
          {
            "$ref": "#/components/parameters/AgentActivityLimit"
          }
        ],
        "responses": {
          "200": {
            "description": "One page of the organization agent's write requests, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentActivityResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/agent-connections/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "The API key id of an agent acting in the organization.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "delete": {
        "tags": [
          "orgs",
          "keys"
        ],
        "operationId": "revokeOrgAgentConnection",
        "summary": "Revoke one agent acting in an organization.",
        "description": "Revokes the agent's API key; the agent must sign in again. Owners and\nadmins only. An id that is not one of the organization's agents is\n404.\n",
        "responses": {
          "204": {
            "description": "No body. The agent's organization key is revoked."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/agent-policy": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "getOrgAgentPolicy",
        "summary": "Show whether agents may act in an organization.",
        "description": "An organization that never set a policy allows agents with every\ncapability. Every member may read it.\n",
        "responses": {
          "200": {
            "description": "The organization's agent policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgAgentPolicyResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "put": {
        "tags": [
          "orgs"
        ],
        "operationId": "setOrgAgentPolicy",
        "summary": "Set whether agents may act in an organization.",
        "description": "Owners and admins only. Agents connecting to the organization get\nonly the capabilities the policy allows. Connections the new policy\nno longer allows are revoked in the same request, and `revoked`\ncounts them.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrgAgentPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The policy as saved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgAgentPolicyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/keys": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "orgs",
          "keys"
        ],
        "operationId": "listOrgAPIKeys",
        "summary": "List API keys minted against the active org.",
        "description": "Returns every key the org owns (active + grace + revoked).\nMirrors `GET /v1/keys`; the canonical path. The `org_id`\non every row will match `{slug}` because the store filters\nserver-side on the loaded membership.\n",
        "responses": {
          "200": {
            "description": "Org-scoped API key list.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListOrgAPIKeysResponse"
                },
                "example": {
                  "keys": [
                    {
                      "id": "0123456789abcdef0123456789abcdef",
                      "org_id": "8b1f5e5d-273e-5a18-ae00-58fceba4fe6c",
                      "prefix": "fp_live_ab",
                      "label": "ci-deploy",
                      "scopes": [
                        "apps:read",
                        "deploy:write"
                      ],
                      "created_at": "2026-08-02T11:25:00Z",
                      "status": "active"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Org slug not found, or caller has no membership.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "orgs",
          "keys"
        ],
        "operationId": "createOrgAPIKey",
        "summary": "Mint a new API key for the active org.",
        "description": "Returns the plaintext exactly once (same as `POST /v1/keys`).\nThe new row's `org_id` is the loaded membership's org; personal\norgs are mintable (the `org_personal_immutable` 409 applies to\nmutations on the org row, not key mints against it).\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOrgAPIKeyRequest"
              },
              "example": {
                "label": "ci-deploy",
                "scopes": [
                  "apps:read",
                  "deploy:write"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "New API key minted against the org.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIKeyResponse"
                },
                "example": {
                  "id": "0123456789abcdef0123456789abcdef",
                  "org_id": "8b1f5e5d-273e-5a18-ae00-58fceba4fe6c",
                  "prefix": "fp_live_ab",
                  "label": "ci-deploy",
                  "scopes": [
                    "apps:read",
                    "deploy:write"
                  ],
                  "created_at": "2026-08-02T11:25:00Z",
                  "status": "active",
                  "plaintext": "fp_live_NEW_PLAINTEXT_HERE"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body (unknown scope, label too long).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Active-org header missing or unknown; caller has no membership on the resolved slug.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Per-account key quota (`api.Plan.KeysMax`) reached.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{slug}/keys/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "orgs",
          "keys"
        ],
        "operationId": "getOrgAPIKey",
        "summary": "Fetch a single API key by id (org-scoped).",
        "description": "Lookup mirror of `GET /v1/keys/{id}`; this path is the canonical\nsingle-key read. The response is the standard `APIKeyResponse` (no\nplaintext). Cross-org probes collapse to 404.\n",
        "responses": {
          "200": {
            "description": "Single API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APIKeyResponse"
                },
                "example": {
                  "id": "0123456789abcdef0123456789abcdef",
                  "org_id": "8b1f5e5d-273e-5a18-ae00-58fceba4fe6c",
                  "prefix": "fp_live_ab",
                  "label": "ci-deploy",
                  "scopes": [
                    "apps:read",
                    "deploy:write"
                  ],
                  "created_at": "2026-08-02T11:25:00Z",
                  "status": "active"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Key id not in org, or org slug not found.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "orgs",
          "keys"
        ],
        "operationId": "revokeOrgAPIKey",
        "summary": "Revoke an API key (org-scoped).",
        "description": "Soft-delete mirror of `DELETE /v1/keys/{id}`. Status flips to\n'revoked'; subsequent bearer-auth attempts hit `ErrAPIKeyRevoked`\n(401 unauthenticated). The audit row carries `org_id`.\n",
        "responses": {
          "204": {
            "description": "No body. Status flipped to revoked; the row stays for audit lineage."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Key id not in this org, or active-org slug not found.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/keys/{id}/rotate": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "post": {
        "tags": [
          "orgs",
          "keys"
        ],
        "operationId": "rotateOrgAPIKey",
        "summary": "Rotate an API key (org-scoped).",
        "description": "Org-scoped counterpart of `POST /v1/keys/{id}/rotate`. Mints a\nnew key (status='active') and demotes the predecessor into the\ngrace window in one transaction. The new key inherits the\npredecessor's `org_id` — rotation never silently rebinds across\norgs. Quota is neutral (-1 +1 = 0).\n",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RotateOrgAPIKeyRequest"
              },
              "example": {
                "label": "ci-deploy-rotated",
                "grace_window_days": 7
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "New key minted, predecessor in 'grace' (or 'revoked' if grace_window_days=0).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RotateOrgAPIKeyResponse"
                },
                "example": {
                  "key": {
                    "id": "0123456789abcdef0123456789abcdef",
                    "org_id": "8b1f5e5d-273e-5a18-ae00-58fceba4fe6c",
                    "prefix": "fp_live_ab",
                    "label": "ci-deploy-rotated",
                    "scopes": [
                      "apps:read",
                      "deploy:write"
                    ],
                    "created_at": "2026-08-02T11:25:00Z",
                    "status": "active",
                    "rotated_from_id": "fedcba9876543210fedcba9876543210"
                  },
                  "key_plaintext": "fp_live_NEW_PLAINTEXT_HERE",
                  "old_key_id": "fedcba9876543210fedcba9876543210",
                  "old_key_expires_at": "2026-08-09T11:25:00Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Key id not in org, or org slug not found, or predecessor already revoked.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/keys/grace_window_days": {
      "get": {
        "tags": [
          "keys"
        ],
        "operationId": "getGraceWindow",
        "summary": "Read the per-account rotation grace-window override.",
        "description": "Returns the customer's current override (the value stored in\n`accounts.key_grace_window_days`) and the plan default\nalongside. `days=null` means \"no override\" — the rotation\nhandler uses the plan default (api.DefaultAPIKeyGraceWindowDays = 7).\n",
        "responses": {
          "200": {
            "description": "Current override + plan default.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GraceWindowResponse"
                },
                "example": {
                  "days": 7,
                  "plan_default": 7
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "tags": [
          "keys"
        ],
        "operationId": "setGraceWindow",
        "summary": "Set the per-account rotation grace-window override.",
        "description": "Writes the override and invalidates the in-process cache so\nthe next rotation observes the new value. `days=0` is atomic\nrotation (no grace); `days=null` (or omission) clears the\noverride and falls back to the plan default.\nA failed save returns retryable 503 without invalidating the cache\nor emitting a successful change audit event.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetGraceWindowRequest"
              },
              "example": {
                "days": 14
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Override applied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GraceWindowResponse"
                },
                "example": {
                  "days": 14,
                  "plan_default": 7
                }
              }
            }
          },
          "400": {
            "description": "Invalid body (negative days, or more than 30).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/account/egress_allowlist_extra": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "getAccountEgressAllowlistExtra",
        "summary": "Read the per-account egress allowlist extra budget.",
        "description": "Returns the per-account additive budget on top of the\nplan's `apps.egress_allowlist` cap. The plan cap (Pro 16 / Scale 64) is\nauthoritative for the default case; the additive budget\nlets admins raise one account's effective cap without\nchanging the plan default for everyone. `extra=0`\nmeans \"no override\" — the plan cap is authoritative.\n\nAdmin scope is required.\n",
        "responses": {
          "200": {
            "description": "Current extra + plan cap + global max extra.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountEgressAllowlistExtraResponse"
                },
                "example": {
                  "extra": 0,
                  "plan_cap": 16,
                  "max_extra": 1024
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "tags": [
          "account"
        ],
        "operationId": "setAccountEgressAllowlistExtra",
        "summary": "Set the per-account egress allowlist extra budget.",
        "description": "Writes the per-account additive budget. `extra=0` clears\nthe override (the plan cap is authoritative again);\nnegative values or values above `max_extra` (1024) are\nrejected with `account_egress_allowlist_extra_out_of_range`.\nThe PATCH emits an `account.egress_allowlist_extra_set`\naudit row carrying `old_extra`, `new_extra`, `plan_cap`,\nand `max_extra` so the dashboard can render the toggle\nhistory.\n\nAdmin scope + MFA are required.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetAccountEgressAllowlistExtraRequest"
              },
              "example": {
                "extra": 8
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Override applied; the body echoes the new value.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountEgressAllowlistExtraResponse"
                },
                "example": {
                  "extra": 8,
                  "plan_cap": 16,
                  "max_extra": 1024
                }
              }
            }
          },
          "400": {
            "description": "Invalid body (e.g. extra < 0 or extra > max_extra).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                },
                "example": {
                  "type": "about:blank",
                  "title": "egress_allowlist_extra out of range",
                  "code": "account_egress_allowlist_extra_out_of_range",
                  "status": 400,
                  "detail": "extra=1025 is outside [0, 1024]; clear with extra=0 to fall back to the plan cap.",
                  "limit": 1024,
                  "observed": 1025
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/audit-events": {
      "get": {
        "tags": [
          "audit"
        ],
        "operationId": "listAuditEvents",
        "summary": "List the caller's auth audit events.",
        "description": "Newest-first. Returns the customer's own security event timeline:\nlogins, logouts, key mints/deletes, secret sets/deletes, plan\nchanges, and account deletion scheduling/restore.\n\nThe events table is append-only. The response\nis bounded by `limit` (default 50, max 100). For a full-history\npull, use `GET /v1/account/export`, which unions these events\nwith the customer's GDPR-action rows.\n",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Only return rows with `at >= since` (RFC 3339). Omit to read from the newest row."
          },
          {
            "name": "kind_prefix",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Only return rows whose `kind` starts with this prefix (e.g. `key.` returns `key.created` and `key.deleted`)."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Max rows to return. Silently capped at 100."
          },
          {
            "name": "include_anonymous",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "Also surface rows with `subject =\nNULL`. The defensive case where the customer's app row\nwas deleted between wake and the stateless-advisory\naudit emit. Default `false` (the customer never sees\nsubject=NULL rows); operators can flip to `true` via\n`?include_anonymous=true` for post-mortems.\n"
          },
          {
            "name": "app_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Filter the overscan window to\nevents whose `data.app_id` matches the given uuid. The\ndashboard's `app_detail.html` \"Stateless advisories\"\nlink uses this combo with `kind_prefix=stateless.advisory`\nto drill into a single app's advisories. Resolved\npost-SQL on the bounded overscan window; the events\ntable is not indexed on `data`.\n"
          }
        ],
        "responses": {
          "200": {
            "description": "Newest-first audit events for the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListAuditEventsResponse"
                },
                "example": {
                  "limit": 50,
                  "events": [
                    {
                      "id": "42",
                      "at": "2026-07-25T13:25:00Z",
                      "actor": "apid",
                      "kind": "auth.login",
                      "subject": "0190f8e1-2a3b-7c4d-9e5f-6a7b8c9d0e1f",
                      "data": {
                        "method": "password"
                      }
                    },
                    {
                      "id": "41",
                      "at": "2026-07-25T11:00:00Z",
                      "actor": "apid",
                      "kind": "key.created",
                      "subject": "0190f8e1-2a3b-7c4d-9e5f-6a7b8c9d0e1f",
                      "data": {
                        "key_id": "0123456789abcdef0123456789abcdef",
                        "scopes": [
                          "admin"
                        ]
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request — malformed `since` or `limit`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/audit-events/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "description": "Event row id (bigint as string)."
        }
      ],
      "get": {
        "tags": [
          "audit"
        ],
        "operationId": "getAuditEvent",
        "summary": "Fetch one auth audit event by id.",
        "description": "Returns the single event with that id if and only if it\nbelongs to the caller's account. Cross-account access is\nindistinguishable from \"not found\" — a customer cannot\nenumerate other accounts' row counts by ID-probing.\n",
        "responses": {
          "200": {
            "description": "The event.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditEventResponse"
                },
                "example": {
                  "id": "42",
                  "at": "2026-07-25T13:25:00Z",
                  "actor": "apid",
                  "kind": "auth.login",
                  "subject": "0190f8e1-2a3b-7c4d-9e5f-6a7b8c9d0e1f",
                  "data": {
                    "method": "password"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request — id is not a positive integer.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/audit-log": {
      "get": {
        "tags": [
          "audit"
        ],
        "operationId": "listAuditLog",
        "summary": "List the caller's audit-log entries (post-deletion evidence).",
        "description": "Newest-first. Reads the FK-free `audit_log` table, distinct from\n`/v1/audit-events` which reads the live `events` table. The\n`audit_log` table is append-only by spec (ISO 27001 SoA\nA.5.33 — retention forever) and a regulator / DPO can replay\npost-deletion state from the row alone.\n\nScope: session cookie (implicitly admin) or any API key\ncarrying `{admin, apps:read}` (`api.ScopesReadSurface`).\nMFA-gated. Cross-account invisibility is enforced by pinning\n`account_id` to the calling account's id inside the handler;\nthe SQL filter rejects `account_id IS NULL` rows by default\n(a customer never sees anonymous rows).\n",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Audit-log rows with `received_at >= since` (RFC 3339) are returned. Omit to read from the newest row."
          },
          {
            "name": "before",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Opaque cursor returned as `next_before`; fetches the next older page. Pass verbatim without decoding or re-encoding."
          },
          {
            "name": "kind_prefix",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Only return rows whose `kind` starts with this prefix (e.g. `account.` returns `account.deleted`)."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Audit-log page size. Silently capped at 100."
          }
        ],
        "responses": {
          "200": {
            "description": "Newest-first audit-log entries for the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListAuditLogResponse"
                },
                "example": {
                  "limit": 50,
                  "entries": [
                    {
                      "id": "0190f8e1-2a3b-7c4d-9e5f-6a7b8c9d0e1f",
                      "kind": "account.deleted",
                      "account_id": "0190f8e1-2a3b-7c4d-9e5f-6a7b8c9d0e1f",
                      "account_email": "alice@example.com",
                      "actor": "grace-sweep",
                      "received_at": "2026-08-08T12:00:00Z",
                      "data": {
                        "source": "grace-sweep",
                        "email": "alice@example.com",
                        "actor": "grace-sweep"
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request — malformed `since`, `limit`, or `kind_prefix` (each must be RFC 3339 / a positive integer / a non-empty string when present).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/audit-log/all": {
      "get": {
        "tags": [
          "audit"
        ],
        "operationId": "listAuditLogAll",
        "summary": "Operator view of every audit-log entry (cross-account).",
        "description": "Admin-only read of the FK-free `audit_log` table. Reads\nacross accounts by default; pass `?account_id=<uuid>` to\nrestrict to one account. `?include_anonymous=true` surfaces\nthe `account_id IS NULL` rows emitted by background /\nanonymous activity (the customer-scoped `/v1/audit-log`\nendpoint never returns those rows).\n\nScope: session cookie (implicitly admin) or an admin API\nkey (`api.ScopesAdminOnly` — `{admin}`). Not MFA-gated at\nthe handler level because admin sessions / admin keys are\nalready MFA-gated upstream at session / key issue time.\n",
        "parameters": [
          {
            "name": "account_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Restrict the result to rows with this `account_id`. Omit to read across all accounts."
          },
          {
            "name": "since",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Operator-side audit-log rows with `received_at >= since` (RFC 3339) are returned. Omit to read from the newest row."
          },
          {
            "name": "before",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Operator-only opaque cursor returned as `next_before`; fetches the next older page. Pass verbatim without decoding or re-encoding."
          },
          {
            "name": "kind_prefix",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Only return rows whose `kind` starts with this prefix."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Operator-side audit-log page size. Silently capped at 100."
          },
          {
            "name": "include_anonymous",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "When `true`, also surface rows with `account_id IS NULL` (anonymous / background activity). Default `false`."
          }
        ],
        "responses": {
          "200": {
            "description": "Newest-first audit-log entries across accounts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListAuditLogResponse"
                },
                "example": {
                  "limit": 50,
                  "entries": [
                    {
                      "id": "0190f8e1-2a3b-7c4d-9e5f-6a7b8c9d0e1f",
                      "kind": "account.deleted",
                      "account_id": "0190f8e1-2a3b-7c4d-9e5f-6a7b8c9d0e1f",
                      "account_email": "alice@example.com",
                      "actor": "grace-sweep",
                      "received_at": "2026-08-08T12:00:00Z",
                      "data": {
                        "source": "grace-sweep",
                        "email": "alice@example.com",
                        "actor": "grace-sweep"
                      }
                    },
                    {
                      "id": "0190f8e1-2a3b-7c4d-9e5f-6a7b8c9d0e20",
                      "kind": "system.health",
                      "received_at": "2026-08-08T11:55:00Z",
                      "data": {
                        "source": "healthcheck",
                        "status": "ok"
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request — malformed `since`, `limit`, or `account_id`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/wakes/{wake_id}/timeline": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "App slug (lowercase, kebab-case; per-account unique)."
        },
        {
          "name": "wake_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "The per-wake correlation handle minted by the scheduler\nengine (UUID v4 in production). The endpoint returns\nevery `wake.*` events row whose `data.wake_id`\nmatches — the partial index `events_wake_id_idx` serves the read in O(frames)\nregardless of the events table size.\n"
        }
      ],
      "get": {
        "tags": [
          "apps",
          "observability"
        ],
        "operationId": "listWakeTimeline",
        "summary": "List the canonical wake-timeline frames for one wake.",
        "description": "Oldest-first (forward narrative). Returns every typed\n`wake.*` events row for the given wake_id: queue_accepted\n→ admitted → boot_started → boot_completed →\nreadiness_200 → proxy_first_byte. Build and deploy\nfailures (`wake.build_failed`, `wake.deploy_failed`,\n`wake.boot_failed`) are joined in alongside the success\npath so a single GET shows the whole lifecycle.\n\nWhen an attempted restore falls back to a successful cold boot\nbecause the application's `after_restore` callback failed, the\n`wake.boot_completed` payload includes\n`data.restore_fallback_reason: after_restore_failed`. The field is\nabsent on other wakes. This reason never contains callback URLs,\nresponse bodies, or raw error text.\n\nFor `wake.proxy_first_byte`, `data.latency_ms` is measured from\nrequest/queue acceptance through the first upstream byte. New rows\nalso include `data.proxy_latency_ms` for the final bridge hop. Rows\nwritten before this contract correction contain the former\nproxy-only value in `latency_ms` and omit `proxy_latency_ms`.\nGateway rows may also include `data.gateway_phases_ms`, a per-wake\nmap of integer-millisecond durations for `pre_admission`,\n`scheduler_wake`, `target_publication`, `post_publication`, and\n`internal_proxy`. This keeps phase attribution joinable to one\n`wake_id` without adding wake IDs as metric labels.\n\nThe endpoint is a sub-resource of `/v1/apps/{slug}`;\nauth and rate-limit share the per-app budget with\nlogs/metrics/wake. Cross-account access 404s the\nsame way unknown slugs do (forge-proof: every row's\n`data.app_id` is verified to match the resolved app).\nWake narratives are a Hobby+ observability surface; Free\naccounts receive 402 before slug or wake lookup.\n",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Exclusive at > since lower bound (RFC3339). Omission reads from retained history. keyset_v1 normalizes to UTC/PostgreSQL microseconds."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 200
            },
            "description": "Max frames to return. Values outside 1..1000 are rejected."
          },
          {
            "name": "pagination",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "keyset_v1"
              ]
            },
            "description": "Opt in to app-scoped timestamp/event-ID keyset pagination. Omit for the unchanged legacy timestamp-hint contract."
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 2048
            },
            "description": "Opaque page.next_cursor from keyset_v1. Requires pagination=keyset_v1 and the same account, immutable app, wake, normalized since and limit. Selection data, not authorization; pages are live retained reads, not a snapshot."
          }
        ],
        "responses": {
          "200": {
            "description": "Wake-timeline frames.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WakeTimelineResponse"
                },
                "example": {
                  "wake_id": "abcdef01-2345-6789-abcd-ef0123456789",
                  "app_id": "0123456789abcdef0123456789abcdef",
                  "limit": 200,
                  "next_cursor": "",
                  "events": [
                    {
                      "at": "2026-07-25T13:25:00.123Z",
                      "kind": "wake.queue_accepted",
                      "actor": "schedd",
                      "data": {
                        "wake_id": "abcdef01-2345-6789-abcd-ef0123456789",
                        "app_id": "0123456789abcdef0123456789abcdef",
                        "request_id": "r-1",
                        "queue_wait_ms": 12
                      }
                    },
                    {
                      "at": "2026-07-25T13:25:00.135Z",
                      "kind": "wake.admitted",
                      "actor": "schedd",
                      "data": {
                        "wake_id": "abcdef01-2345-6789-abcd-ef0123456789",
                        "app_id": "0123456789abcdef0123456789abcdef",
                        "request_id": "r-1",
                        "account_id": "fdecba98-7654-3210-fedc-ba9876543210",
                        "plan": "pro"
                      }
                    },
                    {
                      "at": "2026-07-25T13:25:00.420Z",
                      "kind": "wake.boot_started",
                      "actor": "schedd",
                      "data": {
                        "wake_id": "abcdef01-2345-6789-abcd-ef0123456789",
                        "app_id": "0123456789abcdef0123456789abcdef",
                        "instance_id": "inst-1",
                        "node_id": "node-1",
                        "method": "restore"
                      }
                    },
                    {
                      "at": "2026-07-25T13:25:01.180Z",
                      "kind": "wake.readiness_200",
                      "actor": "vmmd",
                      "data": {
                        "wake_id": "abcdef01-2345-6789-abcd-ef0123456789",
                        "app_id": "0123456789abcdef0123456789abcdef",
                        "instance_id": "inst-1",
                        "node_id": "node-1",
                        "healthcheck_path": "/healthz",
                        "probe_count": 1,
                        "elapsed_ms": 760
                      }
                    },
                    {
                      "at": "2026-07-25T13:25:01.220Z",
                      "kind": "wake.proxy_first_byte",
                      "actor": "egress",
                      "data": {
                        "wake_id": "abcdef01-2345-6789-abcd-ef0123456789",
                        "app_id": "0123456789abcdef0123456789abcdef",
                        "request_id": "r-1",
                        "instance_id": "inst-1",
                        "node_id": "node-1",
                        "latency_ms": 1097,
                        "proxy_latency_ms": 40,
                        "gateway_phases_ms": {
                          "pre_admission": 3,
                          "scheduler_wake": 14,
                          "target_publication": 2,
                          "post_publication": 1,
                          "internal_proxy": 40
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed query parameter on the wake-timeline read — `since` not RFC 3339 or `limit` out of range.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanPerAppMetricsNotAllowed"
          },
          "404": {
            "description": "No such app (slug) or wake_id is unknown.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/sidecars/{sidecar_name}/timeline": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "App slug that owns this sidecar timeline (lowercase, kebab-case; per-account unique)."
        },
        {
          "name": "sidecar_name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "The sidecar name from the app deployment's sidecar set."
        }
      ],
      "get": {
        "tags": [
          "apps",
          "observability"
        ],
        "operationId": "listSidecarTimeline",
        "summary": "List the lifecycle timeline for one sidecar.",
        "description": "Oldest-first (forward narrative). Returns the sidecar's init-exit,\nrestart, and health-transition frames. The `latest` field is the\nmost recent `wake.sidecar_health` status (`starting`, `healthy`,\n`unhealthy`, `restarting`, `failed`, `ready`, or `unready`) when one is available.\n\nThe endpoint is a sub-resource of `/v1/apps/{slug}` and uses the\nsame MFA, scope, per-app rate-limit, and Hobby+ observability gates\nas the wake timeline. Cross-account rows are dropped by verifying\nevery event's `data.app_id` against the slug's resolved app.\n",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Only return rows with `at > since` (RFC 3339)."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 200
            },
            "description": "Max frames to return. Values above 1000 are rejected."
          }
        ],
        "responses": {
          "200": {
            "description": "Sidecar lifecycle frames and the latest health snapshot.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SidecarTimelineResponse"
                },
                "example": {
                  "sidecar_name": "metrics",
                  "app_id": "0123456789abcdef0123456789abcdef",
                  "limit": 200,
                  "next_cursor": "",
                  "latest": {
                    "at": "2026-07-25T13:25:02.100Z",
                    "status": "healthy"
                  },
                  "events": [
                    {
                      "at": "2026-07-25T13:25:00.420Z",
                      "kind": "wake.sidecar_health",
                      "actor": "vmmd",
                      "data": {
                        "app_id": "0123456789abcdef0123456789abcdef",
                        "sidecar_name": "metrics",
                        "status": "starting",
                        "reason": "init"
                      }
                    },
                    {
                      "at": "2026-07-25T13:25:02.100Z",
                      "kind": "wake.sidecar_health",
                      "actor": "vmmd",
                      "data": {
                        "app_id": "0123456789abcdef0123456789abcdef",
                        "sidecar_name": "metrics",
                        "status": "healthy",
                        "reason": "healthcheck_ok"
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed query parameter — `since` is not RFC 3339 or `limit` is out of range.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanPerAppMetricsNotAllowed"
          },
          "404": {
            "description": "No such app (slug) or sidecar timeline is unknown.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/templates": {
      "get": {
        "tags": [
          "templates"
        ],
        "operationId": "listTemplates",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "summary": "Catalog of starter templates the dashboard wizard renders.",
        "description": "Cookie-session-authenticated (NOT API-key). The dashboard and\nthe CLI read the same template list.\nAdding a template means a new entry\n+ the same category + description wiring here.\n\nUsed by the dashboard's /dashboard/apps/new wizard to populate\nthe \"Starting template\" dropdown. The CLI's `gregale deploy\n--template NAME` and `gregale init --template NAME` validators\nreference the same source on the CLI side.\n",
        "responses": {
          "200": {
            "description": "Every available template with category + description.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TemplateView"
                  }
                },
                "example": [
                  {
                    "name": "hello-node",
                    "category": "hello",
                    "description": "minimal Node.js HTTP server — first-touch smoke test"
                  },
                  {
                    "name": "cron-worker",
                    "category": "stateless-contract",
                    "description": "scheduled job worker with retries — bring your own schedule"
                  }
                ]
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/usage": {
      "get": {
        "tags": [
          "usage"
        ],
        "operationId": "getUsage",
        "summary": "Per-app monthly usage.",
        "parameters": [
          {
            "name": "month",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}$",
              "example": "2026-07"
            },
            "description": "Billing month in `YYYY-MM` form (UTC). Defaults to the current month."
          }
        ],
        "responses": {
          "200": {
            "description": "Per-app usage rows for the month.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/UsageResponse"
                  }
                },
                "example": [
                  {
                    "month": "2026-07",
                    "app_id": "0123456789abcdef0123456789abcdef",
                    "mb_seconds": 1234,
                    "requests": 42,
                    "included_gb_hours": 50,
                    "used_gb_hours": 1.234,
                    "next_before": null
                  }
                ]
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/usage/summary": {
      "get": {
        "tags": [
          "usage"
        ],
        "operationId": "usageSummary",
        "summary": "Monthly roll-up with overage math.",
        "parameters": [
          {
            "name": "month",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}$"
            },
            "description": "Billing month in `YYYY-MM` form (UTC). Defaults to the current month for the roll-up."
          }
        ],
        "responses": {
          "200": {
            "description": "The monthly roll-up with overage math.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageSummaryResponse",
                  "example": {
                    "month": "2026-07",
                    "plan": "hobby",
                    "included_gb_hours": 50,
                    "used_gb_hours": 1.234,
                    "overage_gb_hours": 0,
                    "overage_cents": 0
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/usage/daily": {
      "get": {
        "tags": [
          "usage"
        ],
        "operationId": "usageDaily",
        "summary": "Per-app daily rollup (informational).",
        "parameters": [
          {
            "name": "day",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
              "example": "2026-07-29"
            },
            "description": "Calendar day in `YYYY-MM-DD` form (UTC). Required."
          }
        ],
        "responses": {
          "200": {
            "description": "Per-app daily rollup rows for the requested day.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DailyUsageListResponse"
                },
                "example": {
                  "items": [
                    {
                      "app_id": "0123456789abcdef0123456789abcdef",
                      "day": "2026-07-29",
                      "mb_seconds": 1234,
                      "requests": 42,
                      "cpu_usec": 5678,
                      "tx_bytes": 12345,
                      "net_tx_bytes": 23456,
                      "net_rx_bytes": 34567,
                      "cold_boots": 1,
                      "builder_seconds": 12
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed `day` query parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/usage/storage": {
      "get": {
        "tags": [
          "usage"
        ],
        "operationId": "usageStorage",
        "summary": "Per-app daily storage rollup (informational).",
        "parameters": [
          {
            "name": "day",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
              "example": "2026-07-29"
            },
            "description": "Calendar day in `YYYY-MM-DD` form (UTC). Required for the storage rollup."
          }
        ],
        "responses": {
          "200": {
            "description": "Per-app storage rollup rows for the requested day.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StorageUsageListResponse"
                },
                "example": {
                  "items": [
                    {
                      "app_id": "0123456789abcdef0123456789abcdef",
                      "day": "2026-07-29",
                      "snapshot_bytes": 130000000,
                      "layer_bytes": 256000000
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed `day` query parameter on the storage rollup surface.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/usage/realtime": {
      "get": {
        "tags": [
          "usage"
        ],
        "operationId": "getRealtimeUsage",
        "summary": "Realtime connections against the plan's fair-use limit, and recorded usage per hour.",
        "description": "Realtime is free. open_connections counts connections on realtime nodes that reported in the last 30 seconds. Hourly usage appears only when the operator records realtime usage; the peak is the most connections open at once in any minute of the hour.",
        "parameters": [
          {
            "name": "hours",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 744,
              "default": 24
            },
            "description": "How many most recent UTC hours of usage to return, including the current one."
          }
        ],
        "responses": {
          "200": {
            "description": "Open connections, the plan limit, and hourly usage for the account and each endpoint.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeUsageResponse"
                }
              }
            }
          },
          "400": {
            "description": "The hours query parameter is not a whole number from 1 to 744.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/invoices": {
      "get": {
        "tags": [
          "usage"
        ],
        "operationId": "listInvoices",
        "summary": "List the authenticated account's billing invoices.",
        "parameters": [
          {
            "name": "month",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}$"
            },
            "description": "Optional `YYYY-MM` filter (UTC half-open range on period_end)."
          },
          {
            "name": "before",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Cursor (RFC3339Nano) for the next older page. Omit for the first page."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            },
            "description": "Page size; server clamps to 1..100."
          }
        ],
        "responses": {
          "200": {
            "description": "One page of invoices, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceListResponse"
                },
                "example": {
                  "items": [
                    {
                      "id": "9f1d8e7c-6b5a-4d3c-2b1a-0fedcba98765",
                      "provider": "stripe",
                      "provider_invoice_id": "in_1NxAbC2eZvKYlo2C0D4E5F6G",
                      "number": "FaaS-2026-007",
                      "status": "paid",
                      "period_start": "2026-07-01T00:00:00Z",
                      "period_end": "2026-07-31T23:59:59Z",
                      "subtotal_cents": 900,
                      "tax_cents": 0,
                      "total_cents": 900,
                      "amount_paid_cents": 900,
                      "currency": "eur",
                      "pdf_available": true,
                      "created_at": "2026-08-01T01:23:45Z"
                    }
                  ],
                  "next_before": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/invoices/{id}/refresh": {
      "post": {
        "tags": [
          "billing"
        ],
        "operationId": "refreshInvoiceFacts",
        "summary": "Refresh provider facts for an existing account invoice.",
        "description": "Requires usage:read and the invoice-history session MFA gate. Fetches\nthe configured provider's invoice, transaction, or order using the\naccount's provider-qualified customer identity. Accepts no body or query\nparameters. Only invoice details and their lifecycle history change;\nmonetary values, payment state, refunds, credits, and plan are preserved.\nProvider identity, currency, total, and tax must match the captured local\ninvoice. A concurrent invoice update returns 409, allowing a fresh retry.\nStripe paginates all lines and resolves opaque price/plan IDs. Unknown\nfacts and classifications remain source gaps. The operation is bounded\nto 32 provider reads, 1,000 items, 4 MiB per response, and two minutes.\nIt enriches known invoices; it does not discover missing provider history.\n",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Local invoice UUID from GET /v1/invoices."
          }
        ],
        "responses": {
          "200": {
            "description": "Refreshed source coverage; invoice financial fields are unchanged.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceRefreshResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "description": "Configured provider does not implement invoice refresh.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/invoices/backfill": {
      "post": {
        "tags": [
          "billing"
        ],
        "operationId": "backfillInvoiceHistory",
        "summary": "Import one bounded page of missing provider invoices.",
        "description": "Requires usage:read and invoice-history session MFA. Scans at most 25\ninvoices for the authenticated account's provider-qualified customer.\nThe opaque next_cursor resumes the next page for the same provider\ncustomer. Existing natural-key matches are skipped without modifying\nwebhook data. Imported documents preserve provider financial facts and\ncarry an unknown historical Gregale plan, so credit proration fails\nclosed until that plan is independently established. Unsupported\ncurrencies, statuses, incomplete totals, and absent billing periods are\ncounted as skipped. has_more reports provider pagination at request time;\nit is not a stable snapshot guarantee. Each page commits atomically.\n",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 2048
            },
            "description": "Provider and customer bound token emitted by the preceding response."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 25,
              "default": 25
            },
            "description": "Maximum provider records to scan in this page."
          }
        ],
        "responses": {
          "200": {
            "description": "One imported provider-history page.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceHistoryBackfillResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "description": "Configured provider does not implement invoice history discovery.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/resource-inventory": {
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppResourceInventory",
        "summary": "Read a bounded page of app resource metadata.",
        "description": "Requires apps:read and current application access. App-bound readers may\ninspect only their immutable app. This is metadata access: object data,\ndatabase connections, credentials and lifecycle operations retain their\nown permissions. Counts and offsets are filtered by app, kind and exact\nscope in the native catalog before pagination. Resource capability flags\nstill apply. Domains and crons are app-wide; omit environment for them.\nPages are individual read snapshots; concurrent changes may move offsets.\nMetadata state does not establish runtime readiness or connectivity.\nNo provider calls, probes, reservations or writes are performed.\n",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Application whose resource references are requested.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": true,
            "description": "One metadata collection within the selected application.",
            "schema": {
              "type": "string",
              "enum": [
                "domains",
                "crons",
                "buckets",
                "storage_bindings",
                "databases"
              ]
            }
          },
          {
            "name": "environment",
            "in": "query",
            "description": "Exact named environment in the app project; omit for default-scope inventory.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum metadata entries in this backend page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Offset within the selected app, resource kind and scope only.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000000,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Filtered resource metadata and explicit continuation evidence.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppResourceInventoryResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/operation-preview": {
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getAppOperationPreview",
        "summary": "Preview authorization for an application operation without writing intent.",
        "description": "Requires application read or deployment scope and current application access.\nEvaluates the target operation's native scope, organization role and release\npolicy. Authorization is a snapshot; admission remains unknown when exact\nrequest validation, quotas, approval or runtime capacity need apply-time checks.\nThis endpoint creates no plan, approval, reservation or customer intent.\n",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Application slug to inspect.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "operation",
            "in": "query",
            "required": true,
            "description": "Native application operation whose current authorization is inspected.",
            "schema": {
              "type": "string",
              "enum": [
                "deploy",
                "restart",
                "scale",
                "env_change"
              ]
            }
          },
          {
            "name": "environment",
            "in": "query",
            "description": "Named environment in the application's project; omit for default scope.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Native authorization snapshot and explicit admission limitations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppOperationPreview"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/costs": {
      "get": {
        "tags": [
          "billing"
        ],
        "operationId": "getAppCosts",
        "summary": "Read retained usage costs attributed to one application.",
        "description": "Requires usage:read and current application access. App-agent credentials may\nopt into usage:read for their bound app; account billing remains inaccessible.\nUses the native billing subject and the canonical allocation of included\nusage. Excludes other applications, account totals, invoices, forecasts,\nand account-wide unpriced or nonbillable quantities. Sampling windows remain\nexplicit; per-app quantity coverage and a complete bill estimate are unknown.\nAll monetary amounts use integer millicents. This endpoint has no writes.\n",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Application slug whose retained allocations are requested.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "month",
            "in": "query",
            "description": "UTC month for this application's retained cost allocations; omit for the current month.",
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Application allocations and source-window coverage, without account financial details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppCostsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/billing/costs": {
      "get": {
        "tags": [
          "billing"
        ],
        "operationId": "getFinancialCosts",
        "summary": "Read attributable usage costs and historical price contracts.",
        "description": "Requires usage:read and session MFA. Uses retained account-owned evidence\nand immutable price versions. Applies a single shared monthly allowance;\nwhen the plan changes, the largest recorded grant is retained and shared\nproportionally across versions. Known usage amounts use integer millicents.\nMissing samples and historical prices are explicit coverage gaps.\nThe reported compute/interface-egress scope excludes other bill components.\nStored provider invoices are separate facts and are not automatically\nreconciled to this usage ledger. The UTC usage month and provider invoice\nperiods can differ. At most 10000 allocations are returned; larger reports\nfail without returning truncated totals. This endpoint has no writes.\n",
        "parameters": [
          {
            "name": "month",
            "in": "query",
            "description": "Current or historical UTC usage month; defaults to the current month.",
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Account-owned cost breakdown, coverage, forecasts, and separate invoice facts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinancialCostsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/billing/forecast": {
      "get": {
        "tags": [
          "billing"
        ],
        "operationId": "getFinancialForecast",
        "summary": "Read usage cost forecasts with coverage and method.",
        "description": "Requires usage:read and session MFA. Elapsed-time quantity forecasts apply\nthe recorded price after the shared allowance. At least one complete day,\nfresh evidence, and unchanged pricing are required. Unavailable forecasts\ncontain a reason and omit projected amounts. The overall invoice forecast\nremains unavailable until all bill components have authoritative coverage.\nThis endpoint is read-only and never changes workload admission.\n",
        "parameters": [
          {
            "name": "month",
            "in": "query",
            "description": "UTC usage month for the projection; defaults to the current month.",
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Meter forecasts and explicit missing bill components.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinancialForecastResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/billing/budgets": {
      "get": {
        "tags": [
          "billing"
        ],
        "operationId": "listFinancialBudgets",
        "summary": "List account budget policies and their enforcement readiness.",
        "description": "Requires usage:read and session MFA. Deleted policies are omitted. Drafts do not enforce limits.",
        "responses": {
          "200": {
            "description": "Account-owned policies, bounded to 128.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinancialBudgetListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "post": {
        "tags": [
          "billing"
        ],
        "operationId": "createFinancialBudget",
        "summary": "Save a budget policy with atomic revision audit and supported activation checks.",
        "description": "Requires admin scope and session MFA. Idempotency-Key is required (1..255 bytes).\nIt fixes creation identity beyond replay-cache retention. Reusing an operation\nidentity cannot overwrite a changed or deleted policy. Disabled policies are drafts.\nActivation supports monitored notify, monitored compute-only stop_previews, and strict app/job gross compute or account net compute (optionally combined with egress) suspend_workloads with zero drain and no alert thresholds. Other enabled responses return 422 financial_budget_activation_unavailable. Strict activation requires quiet covered workloads, complete accounting and capable native owners; unavailable authority returns 422 financial_compute_not_ready.\nDisabled drafts create no notifications or workload changes. Active notification policies never stop workloads.\n",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Stable creation operation identity, required for retries across replay-cache retention.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateFinancialBudgetRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Saved draft with revision 1; retries retain its identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinancialBudgetResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "description": "Invalid policy count or financial_budget_activation_unavailable; no policy mutation occurred.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/billing/budgets/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Stable identity of an account-owned budget policy.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "billing"
        ],
        "operationId": "getFinancialBudget",
        "summary": "Read an account-owned budget, including its deletion tombstone.",
        "description": "Requires usage:read and session MFA. Foreign or missing policies return 404.",
        "responses": {
          "200": {
            "description": "Saved intent and explicit enforcement readiness.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinancialBudgetResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "billing"
        ],
        "operationId": "updateFinancialBudget",
        "summary": "Replace a budget policy at its expected revision.",
        "description": "Requires admin scope, session MFA and Idempotency-Key. expected_revision\nmust match the current policy; stale edits return 409. Monitored notify and compute-only stop_previews\npolicies can activate, along with strict app/job gross compute or account net compute (optionally combined with egress) suspend_workloads with zero drain and no alert thresholds. A limit below committed and reserved funding returns 422 financial_compute_budget_too_low. Other policies remain disabled drafts.\nScope ownership and action eligibility are revalidated. Payment, security and user holds are independent of this intent.\n",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Retry key for this replacement at its expected policy revision.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateFinancialBudgetRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated draft and incremented revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinancialBudgetResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "description": "financial_budget_activation_unavailable; the existing policy revision is unchanged.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "billing"
        ],
        "operationId": "deleteFinancialBudget",
        "summary": "Tombstone a policy while retaining its immutable revision history.",
        "description": "Requires admin scope, session MFA and Idempotency-Key. expected_revision prevents stale deletion. Does not change account status or unrelated holds.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Retry identity for this policy tombstone operation.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteFinancialBudgetRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tombstone and incremented revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinancialBudgetResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/billing/budgets/{id}/revisions": {
      "get": {
        "tags": [
          "billing"
        ],
        "operationId": "listFinancialBudgetRevisions",
        "summary": "Page through immutable budget revisions, including deleted policies.",
        "description": "Requires usage:read and session MFA. Ownership is checked before history is read. Use next_revision as after_revision for continuation; a final full page may be followed by an empty page.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Budget identity whose immutable revision audit is being listed.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "after_revision",
            "in": "query",
            "description": "Exclusive revision cursor; use the previous response's next_revision.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0,
              "maximum": 9007199254740991,
              "default": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum number of immutable revision records in this page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Revision page in ascending order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinancialBudgetHistoryResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/billing/budgets/{id}/channels": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Stable identity of a live account-owned budget policy.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "billing"
        ],
        "operationId": "getFinancialBudgetChannels",
        "summary": "List the notification channels a budget's threshold alerts also go to.",
        "description": "Requires usage:read and session MFA. Each channel\nreports its latest delivery outcome. Alerts always go to the account\nemail; channels are in addition to it. Deleted or foreign policies\nreturn 404.\n",
        "responses": {
          "200": {
            "description": "Bound channels in name order; empty when only the account email is used.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinancialBudgetChannelsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "billing"
        ],
        "operationId": "setFinancialBudgetChannels",
        "summary": "Replace the notification channels a budget's threshold alerts also go to.",
        "description": "Requires admin scope, session MFA and Idempotency-Key.\nEvery id must be one of the account's notification channels, at most 5,\nwithout duplicates. Each threshold alert is delivered once per channel\nand retried with backoff for up to 12 attempts. A channel added later\nreceives a threshold already crossed this month when it is next\nre-evaluated. Removing a channel holds its pending deliveries; deleting\nthe channel discards them. Does not change the policy revision.\n",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Retry key for this replacement.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetFinancialBudgetChannelsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The budget's channels after the replacement.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinancialBudgetChannelsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/billing/budgets/preview": {
      "post": {
        "tags": [
          "billing"
        ],
        "operationId": "previewFinancialBudget",
        "summary": "Preview a scoped budget and its workload consequences without writes.",
        "description": "Requires usage:read and session MFA. Uses the current UTC usage period.\nValidates account ownership and authoritative workload eligibility.\nReports known attributed cost, coverage, affected and continuing targets.\nNet usage shares the account allowance once; strict scoped policies use\ngross compute. Rejecting traffic does not stop background or idle compute.\nA broad strict policy must suspend every covered workload; selective\npreview/background actions cannot cap continuing production spending.\nEnvironment targets are discovered from current live deployment scopes.\nNo policies, holds, decisions, dispatches or instances are written.\nEnforcement remains unavailable while owner integrations and native\nlifecycle acceptance are pending, as reported by enforcement_ready=false.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FinancialBudgetPreviewRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Financial observation, workload consequences and enforcement readiness.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinancialBudgetPreviewResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/billing/focus": {
      "get": {
        "tags": [
          "billing"
        ],
        "operationId": "exportFOCUSInvoices",
        "summary": "Download a partial FOCUS 1.4 Invoice Detail projection.",
        "description": "Requires usage:read and the same session MFA gate as invoice history.\nIncludes only the authenticated account's locally persisted invoices\nwhose period_end falls in the requested UTC month. Draft and void\ninvoices are excluded and counted in metadata. The default ZIP binds\nCSV and metadata to one store snapshot; separate downloads may see\nnewer webhooks. Amounts use exact two-decimal ISO currencies and split\nnon-tax charges from tax. No current plan prices are substituted.\n\nThis projection remains partial. Stored provider line items are used\nonly when complete, classified, and exactly reconciled to invoice totals;\nother invoices retain aggregate rows with metadata fallback reasons.\nSupplied payment terms, issue/due dates, and issuer names are exported.\nMissingRequiredFields and SourceCoverage describe missing facts. Complete\nprovider history, correction/credit/refund documents, conditional FX/PO\nfields, and the Cost and Usage dataset remain unavailable. See\n/docs/billing#focus-invoice-export and the metadata limitations.\n\nAt most 1000 stored invoices are read per month (including excluded\ninvoices), with at most 10000 output rows and 3 MiB per artifact.\nExceeding any bound returns 422 without a truncated artifact. Invalid\nstored amounts, currencies, identifiers, or dates return 409 before\nany artifact bytes are sent.\n",
        "parameters": [
          {
            "name": "month",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
            },
            "description": "Required YYYY-MM; selects by invoice period_end, not issue date or usage month."
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "zip",
                "csv",
                "metadata"
              ],
              "default": "zip"
            },
            "description": "ZIP contains CSV plus metadata.json; metadata returns the metadata JSON file independently."
          }
        ],
        "responses": {
          "200": {
            "description": "Complete local invoice projection for the requested account and month; partial FOCUS support.",
            "headers": {
              "Content-Disposition": {
                "schema": {
                  "type": "string"
                },
                "description": "Attachment filename derived only from the validated month and format."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Gregale-FOCUS-Conformance": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "partial"
                  ]
                }
              },
              "X-Gregale-FOCUS-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "1.4"
                  ]
                }
              }
            },
            "content": {
              "application/zip": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "text/csv": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/json": {
                "schema": {
                  "type": "string",
                  "format": "binary",
                  "description": "Metadata file downloaded as bytes, with DataGenerator, DatasetInstance, Schema, and x_GregaleProjection sections."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/billing/status": {
      "get": {
        "tags": [
          "billing"
        ],
        "operationId": "getBillingStatus",
        "summary": "Get the authenticated customer's billing status.",
        "description": "Returns a provider-independent deployment and account billing\nprojection. This customer endpoint requires usage:read and never\ncalls an operator catalog surface. A scheduled cancellation\n(`subscription_ends_at`) or downgrade (`scheduled_plan`,\n`scheduled_plan_at`) is reported before it applies; asking for the\ncurrent plan with PATCH /v1/account/plan undoes it.\n",
        "responses": {
          "200": {
            "description": "Current deployment billing mode and customer attachment status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingStatusResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/billing/portal": {
      "get": {
        "tags": [
          "billing"
        ],
        "operationId": "getBillingPortal",
        "summary": "Get a provider billing portal URL (and the card-on-file summary).",
        "description": "Returns the URL the customer should be sent to in order to\nmanage their subscription (update card, view invoices,\ndownload receipts, cancel). When the active provider exposes\ncustomer sessions, the server creates a short-lived authenticated\nportal URL. Otherwise it renders the operator's\n`FAAS_BILLING_PORTAL_URL` template. The URL is a signed-in session\nthat can cancel the subscription and replace the card, so the route\ntakes an admin credential, MFA, a verified email and, for a dashboard\nsession, a step-up within the last 5 minutes.\n\nThe response also carries a `payment_method` block — the card-on-file summary (brand, last-4, expiry).\nThe CLI's `faas billing payment-method` renders from this\nfield; the dashboard's billing page does the same. The\nfield is omitempty so no-card-on-file responses stay clean.\n",
        "responses": {
          "200": {
            "description": "Portal URL + payment-method summary (any field may be empty when the box has no portal configured).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingPortalResponse"
                },
                "example": {
                  "url": "https://billing.example.com/portal?account=9f1d8e7c-6b5a-4d3c-2b1a-0fedcba98765",
                  "payment_method": {
                    "brand": "visa",
                    "last4": "4242",
                    "exp_month": 12,
                    "exp_year": 2027
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EmailVerificationRequired"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/billing/retry": {
      "post": {
        "tags": [
          "billing"
        ],
        "operationId": "retryLatestCharge",
        "summary": "Retry the latest unpaid invoice / transaction for this account.",
        "description": "The configured provider is asked to retry the most recent unpaid\ncharge. The Idempotency-Key header (auto UUIDv4 if absent) is\nforwarded where the provider supports it. Providers without a\ndirect retry API return 501 and the response includes a portal URL\nfor payment-method recovery.\n",
        "responses": {
          "200": {
            "description": "New charge attempt created. The CLI prints attempt + provider reference IDs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingRetryResponse"
                },
                "example": {
                  "attempt_id": "in_1abcd",
                  "provider_ref_id": "pi_1abcd",
                  "status": "pending_provider_confirmation",
                  "next_billing_at": null
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EmailVerificationRequired"
          },
          "404": {
            "description": "No open charge to retry — the account is in good standing, or the operator has not configured a billing provider.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "501": {
            "description": "The provider has no direct saved-card retry API; use the billing portal URL in the response.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "502": {
            "description": "Provider-side failure. The CLI surfaces this as 'retry failed'.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Provider-side failure. The CLI surfaces this as 'retry failed'. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/billing/cancel": {
      "post": {
        "tags": [
          "billing"
        ],
        "operationId": "cancelAtPeriodEnd",
        "summary": "Set cancel_at_period_end on the active subscription; keep the account active until period end.",
        "description": "Stripe: `Subscriptions.Update(cancel_at_period_end=true)`.\nPaddle: `Customer.Update(scheduled_change=cancel)` on the\ncustomer's stored object.\n\nReturns the effective cancel timestamp (`current_period_end`\non Stripe; the next month-rollover instant on Paddle) in\nRFC 3339 so the CLI can print \"your apps will stop on …\".\n",
        "responses": {
          "200": {
            "description": "Cancellation scheduled; account remains on the plan until period end.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingCancelResponse"
                },
                "example": {
                  "cancel_scheduled": true,
                  "effective_at": "2026-09-08T00:00:00Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/EmailVerificationRequired"
          },
          "409": {
            "description": "Already cancelled. CLI renders a friendly hint.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "502": {
            "description": "Provider-side failure.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Provider-side failure. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/accounts/{id}/credits": {
      "post": {
        "tags": [
          "admin"
        ],
        "operationId": "issueAccountCredit",
        "summary": "Issue a positive-cents credit to an account (admin-only).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Target account UUID."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "cents",
                  "reason"
                ],
                "properties": {
                  "cents": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Credit amount in EUR cents (integer)."
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 500,
                    "description": "Operator-supplied audit reason."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Credit issued. Returns the new credit row.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountCreditResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "code: admin_required — call requires a Bearer with the admin scope AND an email in FAAS_ADMIN_EMAILS.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/admin/accounts/{id}/abuse-hold": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Account UUID whose abuse hold changes."
        }
      ],
      "post": {
        "tags": [
          "admin"
        ],
        "operationId": "placeAccountAbuseHold",
        "summary": "Place an abuse hold on an account (operator-only).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountAbuseHoldAction"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The account's hold after the action. `changed` is false when a hold was already in place.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountAbuseHoldActionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "code: admin_required — placing a hold needs an operator session with MFA and recent step-up.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "tags": [
          "admin"
        ],
        "operationId": "releaseAccountAbuseHold",
        "summary": "Release an account's abuse hold (operator-only).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountAbuseHoldAction"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The account's hold after the action. `changed` is false when no hold was set.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountAbuseHoldActionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "code: admin_required — releasing a hold needs an operator session with MFA and recent step-up.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/admin/egress-flows": {
      "get": {
        "tags": [
          "admin"
        ],
        "operationId": "listEgressFlows",
        "summary": "Search the egress flow log (operator-only).",
        "description": "Destination addresses and TCP ports tenant guests opened new flows to,\nnewest first. Filter by remote address or CIDR, account, and a\n[from, to) window of at most the 30-day retention. Defaults to the\nlast 24 hours and 200 rows.\n",
        "parameters": [
          {
            "name": "remote",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Remote IP address or CIDR."
          },
          {
            "name": "account_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Only flows from this account's instances."
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Window start (inclusive); defaults to 24 hours before to."
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Window end (exclusive); defaults to now."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            },
            "description": "Maximum rows; defaults to 200."
          }
        ],
        "responses": {
          "200": {
            "description": "Matching flow log rows.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EgressFlowLogResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "code: admin_required — reading the flow log needs an operator session with MFA.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/accounts/{id}/refunds": {
      "post": {
        "tags": [
          "admin"
        ],
        "operationId": "refundAccountInvoice",
        "summary": "Refund a paid Polar invoice (admin-only).",
        "description": "`invoice_id` must identify a local Gregale invoice belonging to the\ntarget account. The current public-release implementation supports\nPolar order IDs and integer EUR cents. `Idempotency-Key` is required\nand is sent to the provider unchanged (up to 255 characters).\n",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Account UUID whose paid invoice will be refunded."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "description": "Stable key for this refund operation."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "invoice_id",
                  "amount_cents",
                  "reason"
                ],
                "properties": {
                  "invoice_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Local Gregale invoice UUID."
                  },
                  "amount_cents": {
                    "type": "integer",
                    "format": "int64",
                    "minimum": 1,
                    "description": "Refund amount in EUR cents."
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 500,
                    "description": "Reason recorded with the money-moving operation."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Refund accepted by the provider.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminRefundResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "code: admin_required or mfa_required — operator scope, email allowlist, and MFA gates apply.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Invoice is not refundable or has no paid amount/provider identity.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "description": "The selected billing provider does not expose this refund surface.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "502": {
            "description": "Provider rejected the refund or returned an incomplete response.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Provider rejected the refund or returned an incomplete response. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/github-webhook-secrets": {
      "post": {
        "tags": [
          "admin"
        ],
        "operationId": "setGithubWebhookSecret",
        "summary": "Set the per-tenant GitHub App webhook secret (admin-only).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminSetGithubWebhookSecretRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Secret persisted. The new upgraded_at/upgraded_by are returned for the audit trail.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminSetGithubWebhookSecretResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Code admin_required — admin-scoped Bearer + email in FAAS_ADMIN_EMAILS allowlist. widens the scope to cover per-tenant webhook secret rotation; the table-level pg_notify side-effect (installation_id) is intentional and consumed by the GitHub integration.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/invoices/{id}/consume-credits": {
      "post": {
        "tags": [
          "admin"
        ],
        "operationId": "consumeInvoiceCredits",
        "summary": "Drain active credits FIFO against an invoice's overage (admin-only, MFA-gated).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Invoice row UUID from GET /v1/invoices."
          }
        ],
        "responses": {
          "200": {
            "description": "Reducer ran (or replayed). consumed_cents is the floored integer cents drained against this invoice.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsumeInvoiceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "code: admin_required — call requires an admin-scoped Bearer with the caller email in FAAS_ADMIN_EMAILS AND a verified MFA factor.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Invoice was imported from history without a verifiable historical Gregale plan, so credit proration is not available; or the billing provider applies account credit as a discount on the next order (Polar), so credit is never drawn against a paid invoice.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/admin/billing-paddle-catalog": {
      "get": {
        "tags": [
          "admin"
        ],
        "operationId": "listPaddleCatalog",
        "summary": "Read the cached Paddle price + product catalog (admin-only).",
        "description": "Returns the in-memory catalog snapshot from *paddle.Provider.\nsynced_at is the timestamp of the most recent successful\nEnsurePlanProducts call; an empty string means no hydration\nhas run yet. On a Stripe deployment the handler returns 501\nwith code billing_op_unsupported — the type assertion at\nthe dispatcher fails and the surface is provider-scoped.\n",
        "responses": {
          "200": {
            "description": "Catalog snapshot. Entries may be empty if no hydration has run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingCatalogResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "code: admin_required — GET /v1/admin/billing-paddle-catalog requires a Bearer with the admin scope AND an email in FAAS_ADMIN_EMAILS.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "description": "code: billing_op_unsupported — active provider does not implement the paddle.OpProvider surface.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "admin"
        ],
        "operationId": "resetPaddleCatalog",
        "summary": "Signal a Paddle catalog reset (admin-only).",
        "description": "Paddle's catalog is durable on the platform — the in-memory\nreset is a no-op (returns nil immediately) and the handler\nrenders a 200 with empty entries so the CLI can print the\n\"delete products from the Paddle Dashboard, then call\nsync\" message. Future work may add\nmerchant-side cleanup; this handler will then return 502\non SDK failure rather than 200.\n",
        "responses": {
          "200": {
            "description": "Reset signal recorded. Always returns empty entries.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingCatalogResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "code: admin_required — DELETE /v1/admin/billing-paddle-catalog requires a Bearer with the admin scope AND an email in FAAS_ADMIN_EMAILS.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "description": "code: billing_op_unsupported — provider does not implement paddle.OpProvider.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/billing-paddle-catalog/sync": {
      "post": {
        "tags": [
          "admin"
        ],
        "operationId": "syncPaddleCatalog",
        "summary": "Force a Paddle catalog hydration (admin-only).",
        "description": "Idempotent: re-running on the same platform hits the\nStatus=active filter on ListProducts, finds existing\nproducts/prices, and skips POST. Idempotency-Key middleware\nreplays the same 200 for a flaky-network retry so the SDK\nround-trip is not re-issued. Returns the post-sync catalog.\n",
        "responses": {
          "200": {
            "description": "Post-sync catalog. synced_at is \"now\" by construction.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingCatalogResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "code: admin_required — POST /v1/admin/billing-paddle-catalog/sync requires a Bearer with the admin scope AND an email in FAAS_ADMIN_EMAILS.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "description": "code: billing_op_unsupported — active provider does not advertise paddle.OpProvider; the type assertion at the dispatcher fails.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "502": {
            "description": "code: billing_sync_failed — Paddle SDK round-trip failed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "code: billing_sync_failed — Paddle SDK round-trip failed. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/billing-paddle-overage/preflight": {
      "get": {
        "tags": [
          "admin"
        ],
        "operationId": "getBillingPaddleOveragePreflight",
        "summary": "Read the paddle_overage_dedupe schema probe (admin-only).",
        "description": "Operator-side guard for the Paddle overage pusher's\nper-window claim state machine. Returns\nwhich of the four new columns are present + the per-state\nrow counts so an operator can verify the metering service loop will\nnot crash on a 42703 (column missing) error before any\ncustomer-facing push is attempted.\n\nReturned by the pre-flight CLI subcommand. A response\nwith table_exists=true and any of has_window_start /\nhas_state / has_claimed_at / has_claimed_by=false means\nwas not (fully) applied. A response with\ntable_exists=false means migrations 00034 + 00041 are\nboth unapplied (the table has never been created).\n",
        "responses": {
          "200": {
            "description": "Schema probe result. Booleans reflect the current DB shape.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingPaddleOveragePreflightResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "code: admin_required — GET /v1/admin/billing-paddle-overage/preflight requires a Bearer with the admin scope AND an email in FAAS_ADMIN_EMAILS.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/admin/billing-reconcile/{id}": {
      "post": {
        "tags": [
          "admin"
        ],
        "operationId": "reconcileAccount",
        "summary": "Run a single-account reconcile against the active billing Provider (admin-only).",
        "description": "Loads the account, calls billing.Provider.ReconcileUsage for\na rolling 30-day window [start, end). Stripe implements\nthis; Paddle returns billing.ErrNotImplemented\nand the handler maps to 501. The response surfaces the\nSDK-returned mb_seconds total so an operator can diff\nagainst the local usage_minutes sum.\n",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Account UUID whose 30-day reconcile window the operator wants to inspect."
          }
        ],
        "responses": {
          "200": {
            "description": "Reconcile ran. mb_seconds is the SDK-returned total for [start, end).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingReconcileResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "code: admin_required — POST /v1/admin/billing-reconcile/{id} requires a Bearer with the admin scope AND an email in FAAS_ADMIN_EMAILS.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "501": {
            "description": "code: billing_reconcile_unsupported — provider does not implement ReconcileUsage.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "502": {
            "description": "code: billing_reconcile_failed — SDK round-trip failed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "code: billing_reconcile_failed — SDK round-trip failed. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/secrets/rekey-progress": {
      "get": {
        "tags": [
          "admin"
        ],
        "operationId": "getRekeyProgress",
        "summary": "Read the cumulative rekey walk progress (admin-only).",
        "description": "Returns the latest RekeyProgress snapshot the API rekey\nrunner has written — either to the in-process atomic pointer\n(memory-only mode) or to FAAS_REKEY_PROGRESS_FILE on disk.\nOperators poll this endpoint to monitor the walk after a\nhost identity rotation; the response shape mirrors\nrekey.RekeyProgress exactly so a future operator tool\n(e.g. `gregale rekey status`) can decode without a parallel\ntype.\n\n`total` is the running count of rows observed so far; it can\ngrow as the walk paginates through (account_id, app_id, key)\norder. `rekeyed` + `skipped` should approach `total` once\nthe walk drains. `failed` should stay at zero; a non-zero\nvalue means the unseal step threw for at least one row —\nthe operationally safe recovery is `git rm\nmigrations/*reserve_slot.sql`-style idempotent re-trigger\n(toggle FAAS_REKEY_ENABLED and restart the API; the seen-set\ninside Replayer dedupes already-done rows).\n\nWhen the runner is disabled (FAAS_REKEY_ENABLED unset), the\nendpoint returns 503 with code `rekey_disabled` so an\noperator can distinguish \"no work yet\" from \"feature off\".\nIf FAAS_REKEY_ENABLED=true is set but no host age identities\nloaded (mfaIdentities empty — typically FAAS_HOST_AGE_IDENTITY_PATH\nunset), the endpoint returns 503 with the distinct code\n`rekey_no_identities`; this avoids the\nmisleading \"set FAAS_REKEY_ENABLED and restart\" detail when\nthe operator already opted in.\n",
        "responses": {
          "200": {
            "description": "Current rekey progress snapshot.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RekeyProgress"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "code: admin_required — GET /v1/admin/secrets/rekey-progress requires a Bearer with the admin scope AND an email in FAAS_ADMIN_EMAILS.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Runner not running. The detail distinguishes two cases\nvia the `code` field:\n  - `rekey_disabled` — FAAS_REKEY_ENABLED is unset on\n    this API; the background re-seal runner is not\n    running. Set the env flag and restart the API to opt in.\n  - `rekey_no_identities` — FAAS_REKEY_ENABLED=true but\n    no host age identities loaded (FAAS_HOST_AGE_IDENTITY_PATH\n    missing or empty). Set the identity path alongside\n    the flag, then restart the API.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/instances/{id}/force-park": {
      "post": {
        "tags": [
          "admin"
        ],
        "operationId": "postForceParkInstance",
        "summary": "Enqueue a force-park intent for a wedged live instance (admin-only).",
        "description": "Operator-side recovery primitive for instances wedged in\n{RUNNING, WAKING, COLD_BOOTING} that the customer can't\nwait for the idle reaper to handle. redesign:\nThe API writes a row to `operator_intents`\nand emits `pg_notify('operator_intent', …)`; the scheduler\n(the ONLY writer to `instances`) is\nthe sole consumer and dispatches via\nits park path, so the instance state machine's transition guard fires. The handler returns 202\nAccepted with an intent_id; the operator polls\nGET /v1/admin/operator-intents/{id} for terminal state.\n\n`?confirm=true` is required as a tripwire against\noperator fat-fingering. Optional `?reason=<slug>` defaults\nto `operator_force_park`; values are clamped to the\n`[a-z0-9_]{1,64}` shape.\n\nRequires an MFA-verified operator session with step-up in\nthe last five minutes, admin scope, the operator allowlist and same\norigin. Bearer keys do not satisfy step-up. Requires one\nIdempotency-Key (1-255 visible ASCII characters), an empty body,\nexactly one confirm=true and at most one reason; other query\nparameters are rejected. The key is scoped to the actor across all\nthree recovery routes. Intent, exact 202 response and attributed\nrequest audit handoff commit atomically. Matching retries return\nthe original response before reading mutable target state, without\nexpiry; changed action, target or reason returns 409\noperator_submission_conflict. Trace changes do not change identity.\nAn existing legacy recovery cache/reservation returns 409\noperator_submission_legacy and requires reconciliation. Notification\nafter acceptance is best effort; the scheduler safety tick recovers\na lost notification.\n",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "pattern": "^[!-~]+$"
            },
            "description": "Park request key. Reuse with the original target and reason to recover an uncertain submission. No receipt expiry."
          },
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Instance UUID returned by /v1/apps/{slug}/instances or /v1/admin/obs/instances."
          },
          {
            "in": "query",
            "name": "confirm",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "true"
              ]
            },
            "description": "Must be the literal string \"true\" — tripwire on force-park against operator fat-fingering."
          },
          {
            "in": "query",
            "name": "reason",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9_]{1,64}$"
            },
            "description": "Audit-log slug. Default `operator_force_park`. Clamped to `[a-z0-9_]{1,64}`."
          }
        ],
        "responses": {
          "202": {
            "description": "Intent, response receipt and request audit handoff committed; notification attempted. Poll `status_url` for terminal state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperatorIntentAcceptedResponse"
                }
              }
            }
          },
          "400": {
            "description": "Force-park validation: `?confirm=true` is missing or `?reason=` failed validation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Force-park 403: code: admin_required — caller is not in the FAAS_ADMIN_EMAILS allowlist.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "code: instance_not_found — no instance row with the supplied id.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "code: instance_not_parkable — instance state is not in {RUNNING, WAKING, COLD_BOOTING}. Also operator_submission_conflict for changed parameters or operator_submission_legacy for an ambiguous pre-upgrade key.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/admin/apps/{slug}/force-cold-boot": {
      "post": {
        "tags": [
          "admin"
        ],
        "operationId": "postForceColdBootApp",
        "summary": "Enqueue a force-cold-boot intent for an app's latest deployment (admin-only).",
        "description": "Operator-side recovery primitive for the case where the\nlive instance is fine but the snapshot backing the warm\ntier is suspected to be the carrier of a customer-reported\nwedge. Because a snapshot of a wedged VM is a wedged\nVM, the recovery action is `MarkSnapshotStale` on the\ndeployment's latest warm + init snapshots — NOT a state-\nmachine transition. The instance row is NOT mutated;\nthe next customer Wake takes the cold-boot path through\n`engine.go::usableSnapshotForWake` returning `haveSnap=false`.\n\nThe API writes a row to `operator_intents`\nand emits `pg_notify('operator_intent', …)`; the scheduler is the\nsole consumer and dispatches via\n`engine.ForceColdBootNextWake`. The handler returns 202\nAccepted with an intent_id; the operator polls\nGET /v1/admin/operator-intents/{id} for the resolved\n`snap_ids_marked_stale` (unknown at enqueue time).\n\nRequires `?confirm=true` as a tripwire. Optional\n`?reason=<slug>` defaults to `operator_force_cold_boot`.\n\nRequires an MFA-verified operator session with step-up in\nthe last five minutes, admin scope, the operator allowlist and same\norigin. Bearer keys do not satisfy step-up. Requires one\nIdempotency-Key (1-255 visible ASCII characters), an empty body,\nexactly one confirm=true and at most one reason; other query\nparameters are rejected. The key is scoped to the actor across all\nthree recovery routes. Intent, exact 202 response and attributed\nrequest audit handoff commit atomically. Matching retries return\nthe original response before reading mutable target state, without\nexpiry; changed action, target or reason returns 409\noperator_submission_conflict. Trace changes do not change identity.\nAn existing legacy recovery cache/reservation returns 409\noperator_submission_legacy and requires reconciliation. Notification\nafter acceptance is best effort; the scheduler safety tick recovers\na lost notification.\n",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "pattern": "^[!-~]+$"
            },
            "description": "Cold-boot request key. Reuse with the original target and reason to recover an uncertain submission. No receipt expiry."
          },
          {
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "App slug (e.g. \"my-app\"). Resolved once at acceptance by `created_at DESC, id DESC`; retries retain the original deployment."
          },
          {
            "in": "query",
            "name": "confirm",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "true"
              ]
            },
            "description": "Must be the literal string \"true\" — tripwire on force-cold-boot against operator fat-fingering."
          },
          {
            "in": "query",
            "name": "reason",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9_]{1,64}$"
            },
            "description": "Audit-log slug. Default `operator_force_cold_boot`. Clamped to `[a-z0-9_]{1,64}`."
          }
        ],
        "responses": {
          "202": {
            "description": "Intent, response receipt and request audit handoff committed; notification attempted. Poll `status_url` for terminal state and `snap_ids_marked_stale`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperatorIntentAcceptedResponse"
                }
              }
            }
          },
          "400": {
            "description": "Force-cold-boot validation: `?confirm=true` is missing or `?reason=` failed validation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Force-cold-boot 403: code: admin_required — caller is not in the FAAS_ADMIN_EMAILS allowlist.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "code: app_not_found — no app with the supplied slug; OR code: deployment_not_found — app has no deployments to force-cold-boot.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "operator_submission_conflict for changed parameters; operator_submission_legacy for an ambiguous pre-upgrade request key.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/admin/instances/{id}/force-restart": {
      "post": {
        "tags": [
          "admin"
        ],
        "operationId": "postForceRestartInstance",
        "summary": "Enqueue a force-restart intent for a wedged RUNNING instance (admin-only).",
        "description": "Operator-side recovery primitive for instances wedged in\n{RUNNING} that the customer can't wait for the idle\nreaper to handle AND whose snapshot is suspected to be\nthe carrier of the wedge. Composes the two earlier\nprimitives: kill the instance (force-park) AND flip the\ndeployment's latest warm + init snapshots stale\n(force-cold-boot). (\"snapshot of a wedged\nVM is a wedged VM\"), the recovery action is destroy +\nsnap-stale so the next Wake is a guaranteed cold boot.\n\nThe API writes a row\nto `operator_intents` (kind = `force_restart`) and emits\n`pg_notify('operator_intent', …)`; the scheduler (the ONLY\nwriter to `instances`) is the sole\nconsumer and dispatches a forced restart, so the instance state\nmachine's transition guard fires on the locked re-read. The handler returns 202 Accepted with an\nintent_id; the operator polls\nGET /v1/admin/operator-intents/{id} for terminal state\nand `snap_ids_marked_stale`.\n\nGate is intentionally TIGHTER than force-park's\n({RUNNING, WAKING, COLD_BOOTING}): force-restart only\nacts on RUNNING instances because the engine's\nstate-machine validation\nrejects non-RUNNING states as\n`state.ErrInstanceNotRunning` (a wedged WAKING /\nCOLD_BOOTING instance's nodeID may be empty or its\ndestroy path may race with the Wake). Operators targeting\nWAKING / COLD_BOOTING instances get 409\n`instance_not_restartable` with no intent row written.\n\n`?confirm=true` is required as a tripwire against\noperator fat-fingering. Optional `?reason=<slug>` defaults\nto `operator_force_restart`; values are clamped to the\n`[a-z0-9_]{1,64}` shape.\n\nRequires an MFA-verified operator session with step-up in\nthe last five minutes, admin scope, the operator allowlist and same\norigin. Bearer keys do not satisfy step-up. Requires one\nIdempotency-Key (1-255 visible ASCII characters), an empty body,\nexactly one confirm=true and at most one reason; other query\nparameters are rejected. The key is scoped to the actor across all\nthree recovery routes. Intent, exact 202 response and attributed\nrequest audit handoff commit atomically. Matching retries return\nthe original response before reading mutable target state, without\nexpiry; changed action, target or reason returns 409\noperator_submission_conflict. Trace changes do not change identity.\nAn existing legacy recovery cache/reservation returns 409\noperator_submission_legacy and requires reconciliation. Notification\nafter acceptance is best effort; the scheduler safety tick recovers\na lost notification.\n",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "pattern": "^[!-~]+$"
            },
            "description": "Restart request key. Reuse with the original target and reason to recover an uncertain submission. No receipt expiry."
          },
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Force-restart target. Instance UUID returned by /v1/apps/{slug}/instances or /v1/admin/obs/instances."
          },
          {
            "in": "query",
            "name": "confirm",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "true"
              ]
            },
            "description": "Must be the literal string \"true\" — tripwire on force-restart against operator fat-fingering."
          },
          {
            "in": "query",
            "name": "reason",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9_]{1,64}$"
            },
            "description": "Audit-log slug. Default `operator_force_restart`. Clamped to `[a-z0-9_]{1,64}`."
          }
        ],
        "responses": {
          "202": {
            "description": "Force-restart 202: intent, response receipt and request audit handoff committed; notification attempted. Poll `status_url` for terminal state and `snap_ids_marked_stale`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperatorIntentAcceptedResponse"
                }
              }
            }
          },
          "400": {
            "description": "Force-restart validation: `?confirm=true` is missing or `?reason=` failed validation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Force-restart 403: code: admin_required — caller is not in the FAAS_ADMIN_EMAILS allowlist.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Force-restart 404: code: instance_not_found — no instance row with the supplied id.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Force-restart 409: code: instance_not_restartable — instance state is not RUNNING. WAKING / COLD_BOOTING / PARKED / STOPPED all return this code without writing an intent row. Also operator_submission_conflict for changed parameters or operator_submission_legacy for an ambiguous pre-upgrade key.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/admin/operator-intents/{id}": {
      "get": {
        "tags": [
          "admin"
        ],
        "operationId": "getOperatorIntent",
        "summary": "Read the current state of an operator intent (admin-only).",
        "description": "Returns the row written by the 202 Accepted response of\nPOST /v1/admin/instances/{id}/force-park, POST\n/v1/admin/instances/{id}/force-restart, or POST\n/v1/admin/apps/{slug}/force-cold-boot. Status is one of\n\"pending\" | \"running\" | \"succeeded\" | \"failed\" |\n\"cancelled\". SnapIDsMarkedStale is populated on terminal\nstatus for force_cold_boot and force_restart intents\n(warm + init tiers walked). On failure, Error carries\nthe bounded dispatch error message (1 KB cap).\n",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Operator intent UUID returned in the 202 Accepted body (`intent_id`)."
          }
        ],
        "responses": {
          "200": {
            "description": "Current state of the intent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperatorIntentResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "getOperatorIntent 403: code: admin_required — caller is not in the FAAS_ADMIN_EMAILS allowlist.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "code: operator_intent_not_found — no operator intent with the supplied id.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/admin/obs/collection-history": {
      "get": {
        "tags": [
          "admin"
        ],
        "operationId": "getObsAlertCollectionHistory",
        "summary": "Inspect prospective collection outcomes and missing-observation intervals.",
        "description": "Requires operator read scope, MFA and the operator allowlist. Accepts one\noptional nonempty since timestamp, default 24 hours and maximum 30 days,\nand an optional details=true or details=false flag.\nReads prospective immutable collection outcomes from one read-only\nsnapshot with a five-second budget. Success commits atomically with\nretained episode changes; failures contain closed sanitized reason codes.\nEach outcome supplies at most 60 seconds of collection cadence evidence,\nending sooner at the next outcome. Missing intervals, periods before\nrecording began, expired evidence and unrecordable outages remain unknown.\nThese intervals are not continuous availability or proof of expected\nrule inventory, metric coverage or complete incident history.\nMicrosecond duration partitions cover the full half-open [since, as_of)\nwindow exactly. Counts include outcomes at since and as_of; a retained\ncarry-in outcome can contribute duration without increasing those counts.\nOutcomes before the 30-day retention horizon or after as_of are excluded.\nMore than 100000 read outcomes returns 400 requiring a narrower since.\nTotals precede a newest-first preview of at most 200 coalesced intervals\nwith explicit truncation. Current disabled configuration does not erase\nhistorical evidence. With details=true, also returns up to 20 newest failed\nattempts inside [since, as_of] from the same snapshot, separately from\ncoalesced intervals. Every failure counts toward the complete total,\nincluding those without diagnostics. Recorded rejection diagnostics\ndescribe the exact bounded source snapshot at attempted_at, never a\nlater live rule-health read. Complete rule/group counts precede up to\n10 unhealthy rule/group items and 16 KiB of compact diagnostic JSON.\nMissing older diagnostics and unreadable sources remain unknown.\nObserved issues do not prove the underlying root cause or which issue\ntriggered the collector's first rejection. No raw query, evaluation\nerror, label, absolute path or arbitrary runbook URL is retained.\nNo lifecycle or triage writes occur on GET.\n",
        "parameters": [
          {
            "in": "query",
            "name": "since",
            "description": "Inclusive collection-outcome lower bound for a prospective retained coverage window.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "in": "query",
            "name": "details",
            "description": "Include a bounded newest-first preview of failed attempts and their captured rejection diagnostics; accepts exactly true or false once.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Exact cadence coverage totals and a bounded newest-first collection interval preview.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObsAlertCollectionHistory"
                }
              }
            }
          },
          "400": {
            "description": "Invalid collection-history query or read exceeding 100000 outcomes; narrow since."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Collection-history read denied by operator scope or MFA or allowlist policy."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Collection history could not be read within its bounded storage deadline."
          }
        }
      }
    },
    "/v1/admin/obs/rule-health": {
      "get": {
        "tags": [
          "admin"
        ],
        "operationId": "getObsRuleHealth",
        "summary": "Diagnose current alert-rule evaluation health.",
        "description": "Requires operator read scope, MFA and the operator allowlist. Accepts no\nquery parameters. Assesses the complete bounded Prometheus alert-rule\nsnapshot under a three-second deadline and returns at most 200 metadata\nitems, unhealthy first. Totals cover all loaded rules before preview\ntruncation. An empty loaded-rule snapshot is unavailable, never healthy.\nFailed, stale, unavailable, clock-invalid and structurally invalid rules\nremain explicit; pending/firing counts are null for unhealthy rules.\nReported state is the last reported rule state, not proof of recovery.\nGroup names and file basenames are bounded safe text; absolute paths,\nqueries, raw evaluation errors, labels and annotations are omitted.\nInvalid identity text is omitted and opaque hashes remain available.\nNo collection, history or triage writes occur. This current read does\nnot establish the cause of a past collection failure or completeness\nof an expected deployed rule inventory. Source errors return HTTP 200\nwith unavailable state and null totals. Disabled configuration is explicit.\n",
        "responses": {
          "200": {
            "description": "Loaded-rule assessment with complete totals and a bounded diagnostic preview.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObsRuleHealthResponse"
                }
              }
            }
          },
          "400": {
            "description": "Alert-rule diagnostics do not accept query parameters."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Rule assessment denied by operator scope or MFA or allowlist policy."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/admin/obs/rule-coverage": {
      "get": {
        "tags": [
          "admin"
        ],
        "operationId": "getObsRuleCoverage",
        "summary": "Compare loaded alert definitions with an explicitly selected expected set.",
        "description": "Requires operator read scope, MFA and the operator allowlist. Without\nexpected_set, returns unknown with available versioned set metadata and\ndoes not read Prometheus. Selection is per request and never establishes\ndeployment intent. gregale-core-v1 expects faas.rules.yml alerts;\ngregale-full-v1 also expects bridge.rules.yml, pg_backup.rules.yml and\ndata_placement.yaml alerts. Both are minimum sets; additional rules are\nallowed and counted. The embedded catalog revision identifies the exact\nexpected definitions shipped in this API binary.\nA complete bounded Prometheus alert-rule read and comparison share a\nthree-second deadline. Compares canonical PromQL syntax, for,\nkeep_firing_for and rule labels. Identity uses file basename, group and\nalert name; directory relocation is ignored and basename/group collisions\nare ambiguous. Missing fields and unattributed identities remain unknown.\nA complete empty source is degraded with known missing rules.\nDefinitions matching the selected set are covered, independently of\nevaluation, metric input, recording rule or notification health. Group\nintervals, offsets, annotations and source directories are not compared.\nTotals precede a 200-item preview ordered ambiguous, changed, missing,\nunknown, matching, with opaque identity hashes breaking ties. Raw queries,\nlabels, errors and absolute paths are omitted. Unselected or unreadable\nevidence returns HTTP 200 with unknown state and null totals. This read\nnever changes collection, history or triage state.\n",
        "parameters": [
          {
            "name": "expected_set",
            "in": "query",
            "required": false,
            "description": "Select exactly one known minimum expectation set; no automatic selection occurs.",
            "schema": {
              "type": "string",
              "enum": [
                "gregale-core-v1",
                "gregale-full-v1"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Explicit expectation metadata with complete comparison totals or an unknown reason.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObsRuleCoverage"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or empty or repeated expected_set or another query parameter."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Rule coverage read denied by operator scope or MFA or allowlist policy."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/admin/obs/input-health": {
      "get": {
        "tags": [
          "admin"
        ],
        "operationId": "getObsInputHealth",
        "summary": "Inspect critical telemetry inputs for an explicitly selected role.",
        "description": "Requires operator read scope, MFA and the operator allowlist. Without an\nexplicit expected_role, returns unknown with choices and reads no source.\nBoth roles expect at least one API, the gateway (public gateway) and the scheduler\nscrape target. Single-box also expects the VM manager. Control-plane adds the VM manager,\nthe gateway and the compute scheduler counts from fresh the API discovery.\nStatic counts are minimums, not a complete intended inventory. Compute\ncounts do not prove target identity membership. The default Prometheus\ncollision mapping job=the API plus exported_job selects discovery evidence.\nMissing, stale, conflicting or invalid discovery stays unknown. A fresh\nzero registry is legitimate; omitted invalid discovery targets degrade.\nPins strict Prometheus queries to one time under a three-second budget\nwith at most six concurrent fixed job readers. Compares original sample\ntimestamps, distinguishing fresh up, down, stale and missing minimum\ntargets, with unexpected compute counts reported separately. Checks one\nvetted always-instantiated daemon readiness gauge per job only on fresh\nup targets, preserving per-target gaps. Uses a ten-minute lookback at\nfifteen-second steps; freshness is 120 seconds. Gauge value zero is a\nvalid input and does not imply ready. Other metrics and rule evaluation\nor notification health are unassessed. A known zero expectation with no\nobserved targets makes metric checks not applicable. Failures remain\nunknown without cached values. Returns aggregate counts and closed codes,\nexcluding target addresses, labels, queries, URLs and raw errors. No writes.\n",
        "parameters": [
          {
            "name": "expected_role",
            "in": "query",
            "required": false,
            "description": "Operator-selected minimum role expectation; this does not discover deployment intent.",
            "schema": {
              "type": "string",
              "enum": [
                "single-box-v1",
                "control-plane-v1"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Independently scoped scrape expectations and critical gauge sample evidence.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObsInputHealth"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or empty or repeated expected_role or another input health query key."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Input health read denied by operator scope or MFA or allowlist policy."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/admin/obs/recording-coverage": {
      "get": {
        "tags": [
          "admin"
        ],
        "operationId": "getObsRecordingCoverage",
        "summary": "Compare expected recording definitions and their catalog alert references.",
        "description": "Requires operator read scope, MFA and the operator allowlist. Select a\nminimum expected file set explicitly with expected_set. Core selects\nfaas.rules.yml; full also selects bridge.rules.yml, pg_backup.rules.yml\nand data_placement.yaml. Without selection, returns unknown with available\nmetadata and makes no Prometheus request. Catalog presence is not\ndeployment intent. This recording catalog has its own exact revision.\nReads one complete bounded /api/v1/rules?type=record source and compares\ncanonical expressions and rule labels under a shared three-second budget.\nOmitted recording labels mean empty per the Prometheus wire contract;\nexplicit null labels or unsupported definitions remain unknown. Identity\nuses file basename, group and recording name. Duplicate candidates or\nbasename/group collisions are ambiguous. Additional valid identities are\nallowed. A complete empty source has known missing expected definitions.\nDefinition totals precede a 200-item preview ordered ambiguous, changed,\nmissing, unknown, matching and then identity hash. Recording comparisons\nonly report expression or labels as changed fields.\nEach item includes at most five syntactically dependent expected alerts,\nincluding transitive recording chains, with known-reference count and truncation.\nDependency metadata binds the exact expected alert catalog revision.\nNonexact metric selectors, duplicate producer names and reachable cycles\nleave explicit mapping uncertainty; its alert preview is also capped at\nfive with full counts. Known references can coexist with uncertain links.\nDependencies describe selected expected catalog syntax, not current\ndeployed alert definitions, series presence, execution impact or cause.\nCovered definitions do not prove evaluation or input or notification\nhealth. Group intervals, offsets and annotations are outside comparison.\nSource failures return unknown with null totals; selected catalog mapping\nremains independently available. Raw queries, labels, errors, source URLs\nand absolute paths are omitted. No collection, history or triage writes.\n",
        "parameters": [
          {
            "name": "expected_set",
            "in": "query",
            "required": false,
            "description": "Select exactly one known minimum file-set expectation for recording definitions and expected alert references.",
            "schema": {
              "type": "string",
              "enum": [
                "gregale-core-v1",
                "gregale-full-v1"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Recording definition comparison and independently scoped expected alert references.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObsRecordingCoverage"
                }
              }
            }
          },
          "400": {
            "description": "Unknown or empty or repeated expected_set or another recording coverage query key."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Recording coverage read denied by operator scope or MFA or allowlist policy."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/admin/obs/notification-health": {
      "get": {
        "tags": [
          "admin"
        ],
        "operationId": "getObsNotificationHealth",
        "summary": "Inspect alert notification pipeline evidence.",
        "description": "Requires operator read scope, MFA and the operator allowlist. Accepts no\nquery parameters. Reads bounded Alertmanager alert status and Prometheus\nobservations under one shared three-second deadline. Signals distinguish\nfresh zero values from missing, invalid, stale or failed evidence.\nIntegration counters cover all receivers, including watchdog traffic;\ncounter presence does not imply that an integration is configured.\nincreases over ten minutes are extrapolated and can be fractional.\nHealthy signal state describes evidence quality. Overall degraded means\nan observed failure, dropped notification, unhealthy target or reload,\nzero queue capacity or current queue pressure above 80 percent. Partial\nmeans some evidence is unavailable. This read never confirms delivery\nof a specific episode, human receipt, or external watchdog receipt.\nReceiver configuration, addresses, webhook credentials and silence\ncomments are never read or returned. A disabled or invalidly configured\nlocal Alertmanager reader is explicit. Source failures produce a partial\nHTTP 200 observation with null unavailable values.\n",
        "responses": {
          "200": {
            "description": "Independent notification signals and integration counters with evidence quality.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObsNotificationHealth"
                }
              }
            }
          },
          "400": {
            "description": "Notification health does not accept query parameters."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Notification pipeline observation denied by operator scope or MFA or allowlist."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/admin/obs/incidents/platform_alert/recurrence": {
      "get": {
        "tags": [
          "admin"
        ],
        "operationId": "getObsAlertRecurrence",
        "summary": "Diagnose repeated retained alert activations and observed recovery gaps.",
        "description": "Requires operator read scope, MFA and the operator allowlist. Reads one\nretained activation cohort between since and as_of inclusive, default\n24 hours and maximum 30 days. Groups by rule definition and exact series;\nchanged rules and different resources never share a recurrence sequence.\nRepeat activations equal episodes minus one within each group. Durations\nmeasure activation to confirmed resolution observation. Recovery gaps\ncompare adjacent activations only when the previous confirmed resolution\nprecedes or equals the next activation; unknown recovery, overlapping\nobservations and invalid clocks are counted separately. Minimum and\nnearest-rank median use valid whole-second samples; absent samples are\nnull. This does not establish exact recovery time, continuous collection,\nlifetime recurrence, false positives or notification volume.\nCohorts above 1000 episodes return 400 requiring a narrower since.\nComplete totals precede a preview of at most 200 series ranked by repeat\ncount descending, latest activation descending, rule key then series ID.\nEach preview includes at most five recent episodes newest first with\nexplicit truncation. One read-only database snapshot has a five-second\nbudget. Current collection and retention metadata do not reconstruct\nexpected inventory or per-rule coverage gaps. Prospective cadence evidence\naccompanies this report; its own 100000-outcome bound also requires a\nnarrower since on overflow. Reads perform no lifecycle or triage writes.\n",
        "parameters": [
          {
            "in": "query",
            "name": "since",
            "description": "Inclusive recurrence activation lower bound; defaults to 24 hours before as_of.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Complete bounded recurrence totals and a ranked series preview with evidence coverage.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObsAlertRecurrence"
                }
              }
            }
          },
          "400": {
            "description": "Invalid recurrence window or query or cohort exceeding 1000 episodes; narrow since."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Recurrence read denied by operator scope or MFA or allowlist policy."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Recurrence storage snapshot could not be read within its deadline."
          }
        }
      }
    },
    "/v1/admin/obs/incidents/platform_alert/response-times": {
      "get": {
        "tags": [
          "admin"
        ],
        "operationId": "getObsAlertResponseTimes",
        "summary": "Measure retained alert acknowledgment and observed resolution timing.",
        "description": "Reads retained platform alert episodes activated between since and as_of,\ninclusive. The default window is 24 hours with a maximum of 30 days.\nReceipt coverage must prove the complete revision sequence before first\nacknowledgment is included. Invalid timestamps are excluded from samples.\nUnknown and unobserved outcomes remain in explicit cohort denominators.\nResolution measures confirmed rule recovery rather than actual repair.\nDiscrete nearest-rank percentiles use whole-second valid samples only.\nCohorts above 1000 episodes or 10000 matching receipts return 400 and\nrequire a narrower since; results are never silently sampled. Reads\nshare one database snapshot and a five-second query budget. Retention\nand collection metadata do not guarantee a complete historical window.\nProspective cadence coverage is read in the same snapshot. Its separate\n100000-outcome read bound also returns 400 requiring a narrower since.\n",
        "parameters": [
          {
            "in": "query",
            "name": "since",
            "description": "Inclusive activation-cohort lower bound; defaults to 24 hours before as_of.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retained-cohort timing totals and bounded severity/component aggregates.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObsAlertResponseTimes"
                }
              }
            }
          },
          "400": {
            "description": "Invalid timing query or cohort above the bounded read capacity; narrow since."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Timing read denied by operator scope or MFA or allowlist policy."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Response timing storage could not be read within its deadline."
          }
        }
      }
    },
    "/v1/admin/obs/wakes/{wake_id}": {
      "get": {
        "tags": [
          "admin"
        ],
        "operationId": "getObsWakeTimeline",
        "summary": "Read every platform event recorded for one wake.",
        "description": "Returns the events whose data carries this wake_id, oldest first, for an\noperator who has only the wake_id (from a log line, a latency exemplar or\na customer report) and not the app or account. At most 1000 events are\nreturned; truncated is true when the wake recorded more. Reads use the\nevents wake_id index and a five-second budget. gregalectl obs wake\nmerges these events with the wake's platform log lines.\n",
        "parameters": [
          {
            "in": "path",
            "name": "wake_id",
            "required": true,
            "description": "The wake's id, 8-64 letters, digits or dashes.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9-]{8,64}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The wake's events, oldest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObsWakeTimeline"
                }
              }
            }
          },
          "400": {
            "description": "Malformed wake_id or unexpected query parameters."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Wake read denied by operator scope or MFA or allowlist policy."
          },
          "404": {
            "description": "No events are recorded for this wake_id."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Event storage could not be read within its deadline."
          }
        }
      }
    },
    "/v1/admin/obs/incidents/platform_alert/summary": {
      "get": {
        "tags": [
          "admin"
        ],
        "operationId": "getObsAlertWorkloadSummary",
        "summary": "Summarize retained platform alert workload and observation freshness.",
        "description": "Requires operator read authorization, MFA and the operator allowlist.\nCounts all physically retained platform alert episodes in one database\nsnapshot, including expired rows awaiting retention cleanup. There is\nno look-back window, pagination or query filter. Groups are exact\nintersections of status, severity, acknowledgment, ownership and snooze.\nNeeds-attention includes unsnoozed unresolved episodes that are either\nunacknowledged or unowned, including unknown observations. Collection\nfailure, stale rules and disabled collection cannot resolve an alert.\nCounts are null before the first successful collection. Age is elapsed\ntime since episode activation, not time since assignment or acknowledgment.\nSQL failure returns unavailable rather than an empty workload.\n",
        "responses": {
          "200": {
            "description": "Exact retained-alert workload with bounded dimension groups and oldest evidence links.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObsAlertWorkloadSummary"
                }
              }
            }
          },
          "400": {
            "description": "Query parameters are unsupported for this fixed scope."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Summary read denied by operator scope, MFA or allowlist."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Workload storage could not be read within the summary budget."
          }
        }
      }
    },
    "/v1/admin/obs/incidents/platform_alert/{id}/triage-history": {
      "get": {
        "tags": [
          "admin"
        ],
        "operationId": "getObsAlertTriageHistory",
        "summary": "Read revision-bounded triage receipts for one retained alert episode.",
        "description": "Requires operator read authorization, MFA and the operator allowlist.\nInitial reads accept an immutable episode ID or a legacy series alias.\nThe response identifies the canonical episode. Cursors pin that episode\nand the initial upper revision for 15 minutes; an alias moving to a\nrecurrence invalidates an earlier cursor. Entries are ordered by\ndescending revision even if receipt clocks move backwards. Each page\nis a consistent database read, but retention can change between pages.\nCoverage reports missing receipts without claiming why they disappeared.\nHistory excludes actor identities and raw audit payloads.\n",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "description": "Retained episode hash or legacy series alias resolving to its latest episode.",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "description": "Maximum receipts on this page; changing the limit between pages is allowed.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "description": "Opaque next_cursor from this episode history; expires 15 minutes after the first page.",
            "schema": {
              "type": "string",
              "maxLength": 1024
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sanitized triage page with whole-snapshot receipt coverage.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObsAlertTriageHistory"
                }
              }
            }
          },
          "400": {
            "description": "Invalid bounds, cursor, episode binding or expired cursor."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Operator read scope, MFA or allowlist rejected."
          },
          "404": {
            "description": "No retained episode exists for this reference."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Receipt storage or integrity could not be verified within the read budget."
          }
        }
      }
    },
    "/v1/admin/obs/incidents/platform_alert/{id}/triage": {
      "post": {
        "tags": [
          "admin"
        ],
        "operationId": "mutateObsAlertTriage",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "summary": "Update human triage on one immutable retained alert episode.",
        "description": "Requires an allowlisted operator session, MFA with recent step-up,\ntrusted browser origin and Idempotency-Key. Bearer keys cannot mutate.\nSeries aliases cannot be mutated. Every accepted action increments the\nepisode revision and commits with its audit entry. Claims cannot take\nover another operator's ownership. Snooze affects inbox triage only;\nobserved firing/resolved/unknown status and notification delivery remain\nindependent. Obtain the current revision from incident evidence.\n",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "description": "Immutable retained episode ID; a series alias cannot be mutated.",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "description": "Unique request key used to replay an identical mutation receipt.",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ObsAlertTriageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated workflow state, independent of observed alert status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObsAlertTriageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid action, revision, body or snooze deadline."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Operator session, MFA step-up, allowlist or origin rejected."
          },
          "404": {
            "description": "Immutable episode ID is not retained."
          },
          "409": {
            "description": "Revision changed or another operator owns the episode."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Required storage or audit write failed; no triage mutation committed."
          }
        }
      }
    },
    "/v1/admin/obs/health": {
      "get": {
        "tags": [
          "admin"
        ],
        "operationId": "getObsHealth",
        "summary": "Meta-obs health snapshot — audit write rates, outcome-missing counts, trace_id completeness, alert firing count (admin-only).",
        "description": "Operator-side meta-observation endpoint. Composes a single\nJSON snapshot from:\n\n  - `apid_audit_log_write_total[5m]` / `apid_audit_log_write_failures_total[5m]`\n    — the API's own Prometheus counters.\n  - `audit_log_coverage_ratio_5m` — SQL trace coverage over the durable\n    audit_log table, including every audit kind.\n  - `SELECT kind, count(*) FROM operator_intents WHERE\n    status = 'running' AND started_at < now() - interval\n    '5 minutes' GROUP BY kind` — single SQL query.\n  - `SELECT kind, count(*) FILTER (WHERE trace_id IS NOT\n    NULL)::float / count(*) FROM events WHERE kind LIKE\n    'operator.action.%' AND at > now() - interval '5\n    minutes' GROUP BY kind` — reads events (live), NOT\n    audit_log (FK-free post-deletion copy).\n  - A Prometheus count of firing alerts, excluding FaasWatchdog\n    and info-only alerts.\n\nFederation is out of scope (each daemon owns its own\n/metrics); this endpoint is the local API's view. Kinds\nwith zero rows in the SQL-derived fields are seeded to\n0 (counts) or 1.0 (ratios, vacuous truth) so the JSON\nshape stays stable.\n",
        "responses": {
          "200": {
            "description": "Health snapshot. Every closed-set field is present.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObsHealthResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "obs health 403: code: admin_required — caller is not in the FAAS_ADMIN_EMAILS allowlist.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/admin/builds/sweep-stuck": {
      "post": {
        "tags": [
          "admin"
        ],
        "operationId": "postSweepStuckBuilds",
        "summary": "Flip every build row stuck in 'running' past the threshold to 'failed/timeout' (admin-only).",
        "description": "Operator-side recovery primitive for builder microVMs that\ncrashed (OOM, kernel panic, host reboot) and left their\n`builds` row in 'running' indefinitely. Mirrors the\nin-process reaper — the\noperator-facing endpoint is the manual escape hatch for\nwhen the reaper's grace period is too long for an\nincident.\n\n`?older_than=` is clamped to [1m, 60m] so a fat-fingered\n\"1ns\" cannot sweep in-flight builds. Default 15m.\n\nAudit row: operator.action.reclaim_build with\naccount_id=NULL (fleet-level, not tenant-scoped), including\nthe normalized operator reason.\n",
        "parameters": [
          {
            "in": "query",
            "name": "confirm",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "true"
              ]
            },
            "description": "Must be the literal string \"true\" — tripwire on sweep-stuck against operator fat-fingering."
          },
          {
            "in": "query",
            "name": "older_than",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+(ns|us|ms|s|m|h)$",
              "example": "15m"
            },
            "description": "Threshold duration. Clamped to [1m, 60m]. Default 15m."
          },
          {
            "in": "query",
            "name": "reason",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9_]{1,64}$",
              "default": "operator_reclaim_build"
            },
            "description": "Optional durable audit reason. Lowercase letters, numbers, and underscores only."
          }
        ],
        "responses": {
          "200": {
            "description": "Sweep complete. `swept_count` may be 0 when no rows match the threshold.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SweepStuckBuildsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Sweep-stuck validation: `?confirm=true` is missing or `?older_than=` failed validation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Sweep-stuck 403: code: admin_required — caller is not in the FAAS_ADMIN_EMAILS allowlist.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "description": "Store call failed (transient PG hiccup; retry with the same threshold).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/ops/data-repairs": {
      "get": {
        "tags": [
          "admin"
        ],
        "operationId": "getDataRepairHealth",
        "summary": "Observe active data repairs and retained rehearsal capacity.",
        "description": "Operator metadata from one primary-database snapshot. Summary counts\nand oldest phase clocks cover the whole active set; only detail rows\nare paginated. Source data, SQL and native ownership frames are excluded.\nRequires admin scope, MFA and membership in FAAS_ADMIN_EMAILS.\nA failed observation returns 503 instead of a healthy empty queue.\nResponses use Cache-Control no-store and grant no recovery authority.\n",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Maximum detail rows; values outside 1 through 500 are rejected.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 64
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "description": "Opaque next_cursor from the preceding response.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Global repair health and a bounded page of operator metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataRepairHealth"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/admin/ops/github/recovery": {
      "get": {
        "tags": [
          "admin"
        ],
        "operationId": "getGithubRecoveryStatus",
        "summary": "List operator-safe GitHub webhook and Check Run recovery queue items.",
        "description": "Returns bounded queue metadata from the GitHub integration. Webhook payloads and\ninstallation credentials are deliberately excluded. Requires admin\nscope, MFA, and membership in FAAS_ADMIN_EMAILS.\n",
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "description": "Queue status to select; omit to list every status.",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "processing",
                "succeeded",
                "dead"
              ],
              "default": "dead"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 100
            },
            "description": "Maximum rows returned from each queue."
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded recovery queue projections.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GithubRecoveryStatusResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/admin/ops/github/deliveries/{id}/retry": {
      "post": {
        "tags": [
          "admin"
        ],
        "operationId": "retryGithubWebhookDelivery",
        "summary": "Move one dead GitHub webhook delivery back to pending.",
        "description": "Strict operator-session mutation requiring a recent MFA step-up,\nIdempotency-Key, explicit confirmation, and a durable reason. The\ncompare-and-swap write is owned by the GitHub integration and emits a trace-linked\noperator.action.github_delivery_retry audit event.\n",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "description": "UUID of the dead webhook delivery to retry.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "query",
            "name": "confirm",
            "required": true,
            "description": "Explicit acknowledgement that customer webhook work will be retried.",
            "schema": {
              "type": "string",
              "enum": [
                "true"
              ]
            }
          },
          {
            "in": "query",
            "name": "reason",
            "required": true,
            "description": "Durable lowercase audit reason slug for the webhook retry.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9_]{1,64}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Delivery moved back to pending.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GithubRecoveryRetryResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/admin/ops/github/check-updates/{id}/retry": {
      "post": {
        "tags": [
          "admin"
        ],
        "operationId": "retryGithubCheckUpdate",
        "summary": "Move one dead GitHub Check Run update back to pending.",
        "description": "Strict operator-session mutation requiring a recent MFA step-up,\nIdempotency-Key, explicit confirmation, and a durable reason. The\ncompare-and-swap write is owned by the GitHub integration and emits a trace-linked\noperator.action.github_check_update_retry audit event.\n",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "description": "Deployment UUID whose dead Check Run update should be retried.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "query",
            "name": "confirm",
            "required": true,
            "description": "Explicit acknowledgement that customer Check Run work will be retried.",
            "schema": {
              "type": "string",
              "enum": [
                "true"
              ]
            }
          },
          {
            "in": "query",
            "name": "reason",
            "required": true,
            "description": "Durable lowercase audit reason slug for the Check Run retry.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9_]{1,64}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Check Run update moved back to pending.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GithubRecoveryRetryResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/orgs": {
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "listOrgs",
        "summary": "List orgs the caller has an active membership in.",
        "description": "Returns the personal org + every shared org the caller\nbelongs to. Account-scoped (no `X-Active-Org` header needed).\nThe list is sorted by slug.\n",
        "responses": {
          "200": {
            "description": "The org list (may contain at most 1 personal + N shared).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgListResponse"
                },
                "example": {
                  "orgs": [
                    {
                      "id": "0123456789abcdef0123456789abcdef",
                      "slug": "acme",
                      "name": "Acme Inc.",
                      "personal": false,
                      "plan": "pro",
                      "status": "active",
                      "created_at": "2026-08-02T11:25:00Z",
                      "updated_at": "2026-08-02T11:25:00Z"
                    },
                    {
                      "id": "abcdef0123456789abcdef0123456789",
                      "slug": "u-1a2b3c4d5e6f",
                      "name": "Personal",
                      "personal": true,
                      "plan": "free",
                      "status": "active",
                      "created_at": "2026-06-15T08:00:00Z",
                      "updated_at": "2026-06-15T08:00:00Z"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "orgs"
        ],
        "operationId": "createOrg",
        "summary": "Create a shared org (caller becomes the first owner).",
        "description": "Mints a new shared (non-personal) org + the caller's owner\nmembership in one transaction. The slug must match\n`^[a-z0-9][a-z0-9-]{1,30}[a-z0-9]$` (3..32 chars); name is\ntrimmed-non-empty (1..256 chars). Personal orgs cannot be\ncreated via this endpoint — every account already has a\npersonal org (backfill). A new org starts on the Free plan,\nand an account may own one Free org at a time.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOrgRequest"
              },
              "example": {
                "slug": "acme",
                "name": "Acme Inc."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new shared org.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`403 Forbidden` — the caller already owns as many Free orgs\nas an account may (`org_free_limit_exceeded`, with the limit\nand the observed count). Upgrade or delete one first.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "`409 Conflict` — slug already taken (`org_slug_taken`) or the\ncaller is already a member of an org with the same slug\n(`org_already_member`).\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "`422 Unprocessable Entity` — slug violates the `OrgSlugPattern`\nregex (lowercase alphanumeric + dashes, 3..32 chars).\nStable code `org_slug_invalid`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "getOrg",
        "summary": "Get one org by slug.",
        "description": "Returns the org row + the caller's role on the org. Authz:\nany active member of the org (`org.view`); non-members see\n403 `org_role_forbidden`. Unknown slugs are 404\n`org_not_found` (IDOR-safe — the same wire shape as every org route).\n",
        "responses": {
          "200": {
            "description": "The org + the caller's role.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`403 Forbidden` — caller is authenticated but lacks the\n`org.view` action on the target org. Stable code\n`org_role_forbidden`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "tags": [
          "orgs"
        ],
        "operationId": "updateOrg",
        "summary": "Update the org (name and/or plan).",
        "description": "Partial update; both fields are pointer-typed so the\nhandler distinguishes \"omitted\" from \"clear\". Authz\nrouting:\n  - `name` → `org.manage_billing` (owner + billing)\n  - `plan` → `org.change_plan` (owner only)\nPersonal orgs are immutable (`org_personal_immutable` 409).\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchOrgRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated org.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`403 Forbidden` — caller lacks `org.manage_billing` (name)\nor `org.change_plan` (plan), OR the resulting member count\nwould exceed the plan cap (`OrgMembersMax`).\nStable codes `org_role_forbidden` | `org_member_cap_exceeded`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "`409 Conflict` — the target org is the caller's personal\norg (created by the backfill); personal orgs cannot be soft-deleted.\nimmutable and cannot be modified by PATCH. Stable code\n`org_personal_immutable`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "`422 Unprocessable Entity` — slug violates the\n`OrgSlugPattern` regex (lowercase alphanumeric + dashes,\n3..32 chars). Stable code `org_slug_invalid`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "orgs"
        ],
        "operationId": "deleteOrg",
        "summary": "Soft-delete the org.",
        "description": "Marks the company organization as deleted_pending. Live managed\nPostgreSQL databases must complete deletion first. Owner-only\n(`org.delete`); personal organizations are immutable.\n",
        "responses": {
          "204": {
            "description": "Org soft-deleted."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`403 Forbidden` — caller is authenticated but lacks the\n`org.delete` action. Owner-only. Stable code\n`org_role_forbidden`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Personal organizations cannot be deleted (`org_personal_immutable`).\nA company with live managed PostgreSQL databases must delete them\nfirst (`conflict`).\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/activity": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "listOrgActivity",
        "summary": "List the organization's global infrastructure activity.",
        "description": "Returns one newest-first timeline across applications, deployments,\nenvironment configuration, domains, certificates, and automated\nplatform actions. Every active member may read it (`org.view`).\n\nEntries are a curated customer-facing projection, not raw provider or\nsecurity audit payloads. Labels are captured at write time and `data`\ncontains non-secret display metadata only; environment values and\ncredentials are never included. Pass `next_before` back unchanged as\n`before` to fetch the next older page.\n",
        "parameters": [
          {
            "name": "before",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Opaque cursor returned as `next_before` by the prior page."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Maximum number of activity items to return in this page."
          },
          {
            "name": "kind_prefix",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Optional namespaced kind prefix, such as `deploy.`."
          },
          {
            "name": "actor_type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "user",
                "api_key",
                "github",
                "system",
                "operator"
              ]
            },
            "description": "Restrict results to one captured actor category."
          },
          {
            "name": "app_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Restrict results to activity associated with this application."
          }
        ],
        "responses": {
          "200": {
            "description": "A stable keyset page of organization activity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListOrgActivityResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Workspace app inventory requires the `org.view` action.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/application-standard-assignments": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "listApplicationStandardAssignments",
        "summary": "Page retained assignments and their current admission versions",
        "description": "Includes retained inactive assignments. The admission version governs new services; per-application adoption and persisted/observed progress are separate. Read a fresh revision before a reviewed update, deactivation or rollback. Read routes remain available while mutation admission is disabled. All organization roles require read scope and completed MFA.",
        "parameters": [
          {
            "in": "query",
            "name": "after",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Last assignment UUID from the previous page."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            },
            "description": "Maximum retained assignments to return in this page."
          }
        ],
        "responses": {
          "200": {
            "description": "Organization-scoped assignment metadata with no credentials or private rollout proofs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationStandardAssignmentList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Caller lacks read scope, current organization membership or completed MFA.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Assignment inventory storage is unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{slug}/application-standard-assignments/{assignment}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        },
        {
          "in": "path",
          "name": "assignment",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "UUID of the retained assignment to inspect."
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "getApplicationStandardAssignment",
        "summary": "Read a retained assignment and its current revision",
        "description": "Returns the retained assignment even when inactive. Its admission version governs new services; application adoption and consumer progress remain separate. Use its current revision to preview an update, deactivation or rollback. Available while mutations are disabled; requires organization membership, read scope and completed MFA.",
        "responses": {
          "200": {
            "description": "Retained assignment identity, admission version and revision for the selected organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationStandardAssignment"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Assignment inspection requires read scope, current organization membership and completed MFA.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "The selected assignment could not be read because storage is unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{slug}/application-standard-reviews": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        }
      ],
      "post": {
        "tags": [
          "orgs"
        ],
        "operationId": "previewApplicationStandardAssignment",
        "summary": "Preview an assignment change without activating it",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplicationStandardReviewRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Saved review preview; assignments and applications are unchanged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationStandardReview"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Caller lacks the required scope, organization action or completed MFA.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Assignment changed or inputs are busy; refresh and retry the preview.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Application standards storage is temporarily unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{slug}/application-standard-reviews/{review}/approve": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        },
        {
          "in": "path",
          "name": "review",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "UUID of the saved review to approve with its exact hash."
        }
      ],
      "post": {
        "tags": [
          "orgs"
        ],
        "operationId": "approveApplicationStandardReview",
        "summary": "Approve an exact saved review and queue a controlled rollout",
        "description": "Release gated and disabled by default. Requires a current organization owner or administrator, write scope and completed MFA. Approval rechecks the exact saved plan; operator controls compare the exact expected_updated_at from a current read. Installed settings and consumer observation remain separate. Aborting does not undo installed targets; rollback requires a fresh assignment preview and approval under current constraints.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApproveApplicationStandardReviewRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Durable operation intent and retained target progress; consumer convergence is pending.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationStandardOperation"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Caller lacks the required scope, current organization action or completed MFA.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Review changed or expired, inputs are busy, or the operation timestamp or state changed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Application standards mutations are disabled or storage is unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{slug}/application-standard-operations/{operation}/pause": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        },
        {
          "in": "path",
          "name": "operation",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "UUID of the rollout operation to pause."
        }
      ],
      "post": {
        "tags": [
          "orgs"
        ],
        "operationId": "pauseApplicationStandardOperation",
        "summary": "Pause outstanding targets in a controlled rollout",
        "description": "Pauses outstanding rollout targets without undoing installed settings. Requires the exact expected_updated_at from a current operation read, organization owner or administrator access, write scope and completed MFA. Release gated and disabled by default.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ControlApplicationStandardOperationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Paused operation with retained target progress and installed facts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationStandardOperation"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The caller lacks the organization authorization, write scope or completed MFA required to pause this operation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The operation timestamp or state changed; refresh before retrying pause.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "The pause request cannot proceed while standards mutations are disabled or storage is unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{slug}/application-standard-operations/{operation}/resume": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        },
        {
          "in": "path",
          "name": "operation",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "UUID of the paused rollout operation to resume."
        }
      ],
      "post": {
        "tags": [
          "orgs"
        ],
        "operationId": "resumeApplicationStandardOperation",
        "summary": "Resume a paused controlled rollout",
        "description": "Resumes an eligible paused operation using its exact current expected_updated_at. Requires organization owner or administrator access, write scope and completed MFA. Installed targets retain their progress; consumer observation continues separately. Release gated and disabled by default.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ControlApplicationStandardOperationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Resumed operation whose outstanding targets can continue their controlled rollout.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationStandardOperation"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The caller lacks the organization authorization, write scope or completed MFA required to resume this operation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The operation timestamp or state changed; refresh before retrying resume.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "The resume request cannot proceed while standards mutations are disabled or storage is unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{slug}/application-standard-operations/{operation}/abort": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        },
        {
          "in": "path",
          "name": "operation",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "UUID of the rollout operation to abort."
        }
      ],
      "post": {
        "tags": [
          "orgs"
        ],
        "operationId": "abortApplicationStandardOperation",
        "summary": "Abort outstanding targets while retaining installed facts",
        "description": "Aborts outstanding targets and retains already installed facts. Requires the exact expected_updated_at from a current operation read, organization owner or administrator access, write scope and completed MFA. Undoing installed settings requires a fresh rollback preview and approval. Release gated and disabled by default.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ControlApplicationStandardOperationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Aborted operation with outstanding targets stopped and installed facts retained.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationStandardOperation"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The caller lacks the organization authorization, write scope or completed MFA required to abort this operation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The operation timestamp or state changed; refresh before retrying abort.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "The abort request cannot proceed while standards mutations are disabled or storage is unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{slug}/application-standard-reviews/{review}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        },
        {
          "in": "path",
          "name": "review",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "UUID of the saved review to inspect."
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "getApplicationStandardReview",
        "summary": "Inspect a saved review, including expiry and blockers",
        "responses": {
          "200": {
            "description": "Saved review with its exact proposed changes, expiry and blockers.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationStandardReview"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Saved review access requires the corresponding organization action, scope and completed MFA.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Saved review storage is temporarily unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{slug}/application-standard-operations/{operation}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        },
        {
          "in": "path",
          "name": "operation",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "UUID of the retained rollout operation to inspect."
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "getApplicationStandardOperation",
        "summary": "Inspect saved rollout targets and progress",
        "responses": {
          "200": {
            "description": "Retained rollout operation and individual application target progress.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationStandardOperation"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Rollout operation access requires the corresponding organization action, scope and completed MFA.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Rollout operation storage is temporarily unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{slug}/application-standard-enrollments/{app}/exceptions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        },
        {
          "in": "path",
          "name": "app",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "UUID of the live application enrolled in standards."
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "listApplicationStandardExceptions",
        "summary": "List approval, revocation and expiry history for a live application",
        "description": "UUID-ordered history with status evaluated at as_of. A full page has a next cursor; the final follow-up page may be empty. Historical approval does not imply that the exception contributes to current effective settings.",
        "parameters": [
          {
            "in": "query",
            "name": "after",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Exclusive exception UUID from the preceding page."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            },
            "description": "Maximum records to return in this page."
          }
        ],
        "responses": {
          "200": {
            "description": "Exception approval and revocation history evaluated at the returned server timestamp.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationStandardExceptionList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Exception history access requires the corresponding organization action, scope and completed MFA.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Exception history storage is temporarily unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "orgs"
        ],
        "operationId": "approveApplicationStandardException",
        "summary": "Approve a bounded application exception",
        "description": "Requires an active owner or admin. Approves one field for an adopted immutable standard version; all independent constraints and platform controls still apply. The server enforces a future expiry within 30 days and queues a new desired revision.\nDisabled by default until the application standards release acceptance gates pass.\nIdempotency replay requires the current role and release gate. Saved intent is not consumer observation.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApproveApplicationStandardExceptionRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Saved intent or retained exception approval; worker installation and consumer convergence remain separate.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationStandardException"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Caller lacks the write scope, required organization action or completed MFA.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Exception history conflicts with the current enrollment revision, exception state or pending installation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Exception history is disabled by the standards release gate or storage is unavailable. Disabled requests return application_standards_pending without changing intent.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{slug}/application-standard-enrollments/{app}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        },
        {
          "name": "app",
          "in": "path",
          "required": true,
          "description": "UUID of a live application belonging to this organization.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "getApplicationStandardEnrollment",
        "summary": "Read application standards intent, installed settings and observation progress.",
        "description": "Requires org.view_application_standards and a read-scoped credential, with MFA for sessions.\nLocal choices and desired revision describe saved intent. installed_effective describes\nthe last installed projection and is absent before installation. Neither persisted\nsettings nor this read establish consumer observation. Reads remain available while mutations are disabled.\n",
        "responses": {
          "200": {
            "description": "Scoped enrollment with saved adoption pins and installed field provenance.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationStandardEnrollment"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Caller lacks the read scope or organization action, or must complete MFA.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Enrollment status storage is temporarily unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{slug}/application-standard-enrollments/{app}/local-intent": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        },
        {
          "in": "path",
          "name": "app",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "UUID of the enrolled application whose local settings will be replaced."
        }
      ],
      "put": {
        "tags": [
          "orgs"
        ],
        "operationId": "setApplicationStandardLocalIntent",
        "summary": "Replace permitted local application settings",
        "description": "Requires an active owner, admin or developer. settings and additional_log_destinations replace the complete local intent; explicit empty values clear it. Mandatory settings and permitted extensions are checked atomically against the current desired revision. The response retains the last installed projection while a changed desired revision waits for installation.\nDisabled by default until the application standards release acceptance gates pass.\nIdempotency replay requires the current role and release gate. Saved intent is not consumer observation.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetApplicationStandardLocalIntentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Enrollment with replacement local intent, pending desired revision and the last installed projection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationStandardEnrollment"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Updating local settings requires write scope, the enrollment mutation action and completed MFA.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Local enrollment intent conflicts with the current enrollment revision, exception state or pending installation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Local enrollment intent is disabled by the standards release gate or storage is unavailable. Disabled requests return application_standards_pending without changing intent.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{slug}/application-standard-enrollments/{app}/exceptions/{exception}/revoke": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        },
        {
          "in": "path",
          "name": "app",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "UUID of the enrolled application whose exception will be revoked."
        },
        {
          "in": "path",
          "name": "exception",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "UUID of the retained exception approval to revoke."
        }
      ],
      "post": {
        "tags": [
          "orgs"
        ],
        "operationId": "revokeApplicationStandardException",
        "summary": "Revoke an application exception and retain its approval history",
        "description": "Requires an active owner or admin and the current desired revision. The original approval, reason and value remain immutable; revocation queues reevaluation under the ordinary inherited controls. A conflicting local setting can leave the application blocked until it is corrected.\nDisabled by default until the application standards release acceptance gates pass.\nIdempotency replay requires the current role and release gate. Saved intent is not consumer observation.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevokeApplicationStandardExceptionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Retained exception approval with its revocation actor and timestamp; installation of inherited settings remains pending.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationStandardException"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Revoking an exception requires write scope, the organization exception action and completed MFA.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Exception revocation conflicts with the current enrollment revision, exception state or pending installation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "description": "Exception revocation is disabled by the standards release gate or storage is unavailable. Disabled requests return application_standards_pending without changing intent.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{slug}/application-standards": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "listApplicationStandards",
        "summary": "List the latest published application standard versions.",
        "description": "Requires org.view_application_standards. Publication does not activate a standard.",
        "parameters": [
          {
            "name": "after",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9-]{1,62}[a-z0-9]$"
            },
            "description": "Exclusive standard slug from next_page_after."
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum standard versions returned in this page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Latest versions, ordered by standard slug.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationStandardList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Caller cannot list standards in this organization.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/application-standards/{standard}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        },
        {
          "name": "standard",
          "in": "path",
          "required": true,
          "description": "Organization-local standard slug.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{1,62}[a-z0-9]$"
          }
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "getApplicationStandardVersion",
        "summary": "Read an immutable application standard version.",
        "description": "Requires org.view_application_standards. Omitting version returns the latest published candidate.",
        "parameters": [
          {
            "name": "version",
            "in": "query",
            "description": "Immutable candidate version; omit to read the latest.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Immutable version with canonical definition hash and publishing identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationStandardVersion"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Caller cannot inspect the requested standard version.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/application-standards/{standard}/versions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        },
        {
          "name": "standard",
          "in": "path",
          "required": true,
          "description": "Slug receiving the new immutable version.",
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{1,62}[a-z0-9]$"
          }
        }
      ],
      "post": {
        "tags": [
          "orgs"
        ],
        "operationId": "publishApplicationStandardVersion",
        "summary": "Publish a candidate application standard version.",
        "description": "Requires org.manage_application_standards (owner or admin), MFA and deploy-write scope.\nexpected_version is 0 for a new standard and the latest version for an update.\nPublication creates immutable history and does not change an assignment or application.\nA concurrent publication returns application_standard_version_stale without writes.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApplicationStandardVersionRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Published candidate version.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationStandardVersion"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Caller cannot manage application standards in this organization.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/application-standard-log-destinations": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "listApplicationStandardLogDestinations",
        "summary": "List immutable organization-owned standard log-destinations.",
        "description": "Requires org.view_application_standards to list logging destination references.",
        "parameters": [
          {
            "name": "after",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Exclusive logging destination ID from next_page_after."
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum logging destination references in this page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Page of logging destination references ordered by ID.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationStandardLogDestinationList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Caller cannot list logging destination references.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "orgs"
        ],
        "operationId": "createApplicationStandardLogDestination",
        "summary": "Create an immutable organization-owned logging destination.",
        "description": "Requires org.manage_application_standards to create logging destination references (owner or admin).\nExisting resources cannot be edited. Rotation creates a new reference and\nrequires a new standard version to adopt it. Resource creation does not\nenroll or change any service. Customer responses and audit events omit sealed credentials.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApplicationStandardLogDestinationRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created immutable logging destination reference.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationStandardLogDestination"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Caller cannot create logging destination references in this organization.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/application-standard-log-destinations/{resource}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        },
        {
          "name": "resource",
          "in": "path",
          "required": true,
          "description": "Immutable logging destination UUID.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "getApplicationStandardLogDestination",
        "summary": "Read an immutable logging destination reference.",
        "description": "Requires org.view_application_standards to read this logging destination in its owning organization.",
        "responses": {
          "200": {
            "description": "Requested logging destination metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationStandardLogDestination"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Caller cannot read this logging destination.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/application-standard-publishers": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "listApplicationStandardPublishers",
        "summary": "List immutable organization-owned standard publishers.",
        "description": "Requires org.view_application_standards to list publisher key references.",
        "parameters": [
          {
            "name": "after",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Exclusive publisher key ID from next_page_after."
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum publisher key references in this page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Page of publisher key references ordered by ID.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationStandardPublisherList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Caller cannot list publisher key references.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "orgs"
        ],
        "operationId": "createApplicationStandardPublisher",
        "summary": "Create an immutable organization-owned publisher key.",
        "description": "Requires org.manage_application_standards to create publisher key references (owner or admin).\nExisting resources cannot be edited. Rotation creates a new reference and\nrequires a new standard version to adopt it. Resource creation does not\nenroll or change any service. Customer responses and audit events omit sealed credentials.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApplicationStandardPublisherRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created immutable publisher key reference.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationStandardPublisher"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Caller cannot create publisher key references in this organization.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/application-standard-publishers/{resource}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        },
        {
          "name": "resource",
          "in": "path",
          "required": true,
          "description": "Immutable publisher key UUID.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "getApplicationStandardPublisher",
        "summary": "Read an immutable publisher key reference.",
        "description": "Requires org.view_application_standards to read this publisher key in its owning organization.",
        "responses": {
          "200": {
            "description": "Requested publisher key metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationStandardPublisher"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Caller cannot read this publisher key.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/apps": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "listOrgApps",
        "summary": "List apps attributed to this workspace.",
        "description": "Returns a newest-first inventory of non-deleted apps whose persisted\n`org_id` matches this workspace. Any active member with `org.view`\nmay read the minimal summary; creator identity and app configuration\nare intentionally omitted while app-specific routes remain\ncreator-scoped.\n",
        "responses": {
          "200": {
            "description": "Safe summary of apps attributed to this workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgAppListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Caller is not an active member with `org.view`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "orgs"
        ],
        "operationId": "createOrgApp",
        "summary": "Create an app attributed to the organization.",
        "description": "Creates an app in this workspace and records the workspace id on the\napp row, so app lifecycle activity is attributed to this organization.\nThe creator remains the account-level quota and billing identity in\nthis rollout slice; existing app-specific routes remain creator-scoped\nuntil shared app access is migrated in follow-up work. Owners, admins,\nand developers may create apps (`org.create_app`).\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "App creation payload. See CreateAppRequest.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAppRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The newly created organization-attributed app.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Caller is not verified or lacks `org.create_app`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/InvalidCPURAMPair"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/members": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "listOrgMembers",
        "summary": "List active members of the org.",
        "description": "Returns the active membership rows (the store returns\nboth active + removed; the handler filters at the API\nboundary). Each row carries the joined `account.email`\nso the dashboard can render `bob@acme.com` without a\nsecond round-trip. Removed rows do NOT count toward the\nmember cap.\n",
        "responses": {
          "200": {
            "description": "The active member list.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MemberListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`403 Forbidden` — caller is authenticated but lacks the\n`org.view` action. Stable code `org_role_forbidden`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "orgs"
        ],
        "operationId": "addOrgMember",
        "summary": "Invite a new member (returns plaintext token ONCE).",
        "description": "Mints a 32-byte plaintext token, hashes it via SHA-256 for\nstorage, and returns the plaintext ONCE in the response.\nThe token expires after 14 days; admins can revoke earlier by\nrow ID via `DELETE /v1/orgs/{slug}/invitations/{invitation_id}` (owns\nthe accept surface too — see\n`POST /v1/invitations/{token}/accept`). Role cannot be\n`owner`; transfer-ownership is the only path to owner.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InviteMemberRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The invitation + the one-time plaintext token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvitationWithTokenResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`403 Forbidden` — caller lacks `org.invite_members`, OR\nthe resulting pending-invitation count would exceed the\nplan cap (`OrgPendingInvitationsMax`).\nStable codes `org_role_forbidden` | `org_invitation_cap_exceeded`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "`409 Conflict` — the target org is the caller's personal\norg (created by the backfill); personal orgs are immutable on POST /members (invite).\nimmutable and cannot be modified by PATCH. Stable code\n`org_personal_immutable`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/previews": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "listOrgPreviews",
        "summary": "List the platform previews the organization can join.",
        "description": "Like `GET /v1/previews`, for the organization: `joined` is the\ncompany's opt-in, and `enabled` is decided for you acting under the\ncompany. Previews released per account only are not listed. Requires\n`org.view`.\n",
        "responses": {
          "200": {
            "description": "The previews the organization can join or already joined.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreviewList"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`org_role_forbidden`: you are not a member of the organization.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/previews/{key}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        },
        {
          "$ref": "#/components/parameters/PreviewKey"
        }
      ],
      "put": {
        "tags": [
          "orgs"
        ],
        "operationId": "joinOrgPreview",
        "summary": "Join a platform preview for the organization.",
        "description": "Opts the organization in: every member gets the preview while acting\nfor the company, if their plan is eligible. Requires\n`org.manage_previews` (owner or admin).\n",
        "responses": {
          "200": {
            "description": "The preview after the organization joined.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Preview"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`org_role_forbidden` or `preview_plan_not_eligible`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "`preview_not_offered`, or the organization does not exist.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "`preview_full`, `preview_org_unsupported` (the preview is released per account only) or a concurrent change.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "orgs"
        ],
        "operationId": "leaveOrgPreview",
        "summary": "Leave a platform preview for the organization.",
        "description": "Removes the organization's opt-in. Requires `org.manage_previews` (owner or admin).",
        "responses": {
          "200": {
            "description": "The preview after the organization left.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Preview"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`org_role_forbidden`: only an owner or admin can leave for the organization.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "`preview_not_offered` (not a platform preview), or the organization does not exist.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "`preview_org_unsupported`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/members/{user_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        },
        {
          "$ref": "#/components/parameters/OrgAccountID"
        }
      ],
      "patch": {
        "tags": [
          "orgs"
        ],
        "operationId": "updateOrgMemberRole",
        "summary": "Change a member's role.",
        "description": "Owner-only (`org.change_role`). Role cannot be `owner` on\nthis endpoint; transfer-ownership is the only path to owner.\nThe exactly-one-owner invariant lives::UpdateOrgMemberRole`'s tx; demoting the last\nactive owner surfaces as 409 `org_last_owner`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChangeMemberRoleRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated member row.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgMemberResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`403 Forbidden` — caller is authenticated but lacks the\n`org.change_role` action. Owner-only. Stable code\n`org_role_forbidden`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "`404 Not Found` — caller is authenticated but the\n`{user_id}` path param does not correspond to any active\nmember of the target org, OR the target org belongs to\nanother tenant (IDOR-safe cross-tenant collapse).\nStable code `org_role_forbidden`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "`409 Conflict` — caller attempted to demote or remove\nthe only remaining active owner of the org. The\nexactly-one-owner invariant lives on the\n`org_memberships_one_owner_idx` partial unique index. Stable code `org_last_owner`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "orgs"
        ],
        "operationId": "removeOrgMember",
        "summary": "Remove a member.",
        "description": "Owner-only (`org.remove_members`). Stamps `removed_at` on\nthe row (the row stays for audit; live-cap count drops).\nSelf-removal is rejected at the boundary; the last-owner\ninvariant surfaces as 409 `org_last_owner`. The member whose email\nthe organization bills to cannot be removed while the organization\nhas a billing customer (409 `billing_contact_member`); set another\nbilling email with `PUT /v1/orgs/{slug}/billing/email` first.\nIf the billing-contact check cannot complete, returns retryable 503\nwithout removing the member.\n",
        "responses": {
          "204": {
            "description": "Member removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`403 Forbidden` — caller is authenticated but lacks the\n`org.remove_members` action. Owner-only. Self-removal\nis refused at the boundary. Stable code\n`org_role_forbidden`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "`404 Not Found` — caller is authenticated but the\ntarget slug is unknown, OR `{user_id}` does not\ncorrespond to an active member, OR the org belongs\nto another tenant (IDOR-safe cross-tenant collapse).\nStable codes `org_role_forbidden` | `NotFound`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "`409 Conflict` — caller attempted to remove (DELETE) the only\nthe only remaining active owner of the org. The\nexactly-one-owner invariant lives on the\n`org_memberships_one_owner_idx` partial unique index. Stable code `org_last_owner`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/orgs/{slug}/leave": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        }
      ],
      "post": {
        "tags": [
          "orgs"
        ],
        "operationId": "leaveOrg",
        "summary": "Leave an org.",
        "description": "Ends the caller's own membership. Any role except owner may leave;\nthe owner transfers ownership first. A personal org cannot be left,\nand the org's billing contact must be replaced first\n(`billing_contact_member`).\n",
        "responses": {
          "204": {
            "description": "Left the org."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "The caller is not an active member.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The caller is the owner (`org_last_owner`), the org is personal, or the caller is the billing contact.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/transfer_ownership": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        }
      ],
      "post": {
        "tags": [
          "orgs"
        ],
        "operationId": "transferOrgOwnership",
        "summary": "Transfer ownership to another active member.",
        "description": "Atomically promotes `new_owner_account_id` to owner and\ndemotes the caller to admin via `Store.TransferOrgOwnership`\n(a single PostgreSQL tx with `FOR UPDATE` locks on both\nrows). The exactly-one-owner invariant is enforced by the\npartial unique `org_memberships_one_owner_idx`. The new owner must already be an active\nmember of the org. For a Free organization, the recipient must have\navailable Free-organization ownership capacity; admission is serialized\nwith organization creation and other incoming transfers.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransferOwnershipRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The org (post-transfer).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`403 Forbidden` — caller is authenticated but is not the\nactive owner of the target org (`org_role_forbidden`), or the\nrecipient already owns the maximum number of Free organizations\n(`org_free_limit_exceeded`, with limit and observed count).\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "code: NotFound (new owner is not a member)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "code: org_last_owner (caller not the active owner OR new owner already owner)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/invitations/{token}": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Plaintext or base64url-encoded invitation token. Tokens are\nreturned ONCE on the create call (`POST /v1/orgs/{slug}/members`)\nand never re-served.\n",
          "schema": {
            "type": "string",
            "description": "Plaintext or base64url-encoded invitation token."
          }
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "peekInvitation",
        "summary": "Peek at a pending invitation by token (no consumption).",
        "description": "Read-only lookup that returns the invitation metadata\n(email, role, org slug, expires_at) without consuming the\ntoken. Used by the dashboard to render \"you've been invited\nto Acme Inc. as developer\" without forcing the invitee\nto accept yet. added the accept surface at\n`POST /v1/invitations/{token}/accept`.\n",
        "responses": {
          "200": {
            "description": "The pending invitation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgInvitationResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "410": {
            "description": "code: org_invitation_invalid | org_invitation_expired | org_invitation_invalid (already consumed/revoked)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/invitations/{token}/accept": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Plaintext or base64url-encoded invitation token (same\nshape as the GET /v1/invitations/{token} parameter).\n",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "tags": [
          "orgs"
        ],
        "operationId": "acceptInvitation",
        "summary": "Accept an invitation token (consume + add as member).",
        "description": "Consumes the invitation via `Store.ConsumeOrgInvitation` —\nthe load-bearing tx stamps `consumed_at`, inserts the active\nmembership, and reads the live member cap (cap-in-tx\nback-stop; documents). Two audit\nrows fire post-mutation: `org.invitation.accepted`\n(invitation-side record) and `org.member.added` (member-side\nrecord). The bearer must have a valid session or API key but\nno `X-Active-Org` — the invitation IS how they get one. adds step-up at accept time.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "The new membership row.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgMemberResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`403 Forbidden` — the org is at the member cap (stable code\n`org_member_cap_exceeded`), the caller has no fresh step-up\n(`step_up_required`), or the accepting account has not\nverified its email address (`email_verification_required`).\nThe invitation's email match binds acceptance to the invitee\nonly for a verified address.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "`409 Conflict` — the bearer is already an active member\nof the target org. The wire detail carries the\ncaller's current role. Stable code `org_already_member`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "410": {
            "description": "`410 Gone` — the token is unknown, already consumed,\nalready revoked, or expired. Stable codes\n`org_invitation_invalid` | `org_invitation_expired`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/invitations/{invitation_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        },
        {
          "name": "invitation_id",
          "in": "path",
          "required": true,
          "description": "Stable invitation row ID returned by organization invitation list\nresponses. The URL is org-scoped, so an ID from another organization\nis treated as an invalid invitation.\n",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "delete": {
        "tags": [
          "orgs"
        ],
        "operationId": "revokeInvitation",
        "summary": "Revoke a pending invitation.",
        "description": "Stamps `revoked_at` on a still-pending invitation via\n`Store.RevokeOrgInvitation`. Owner + admin only\n(`org.invite_members`, symmetric with the create-invite\npath). Already-consumed / already-revoked / unknown IDs\ncollapse to a single `org_invitation_invalid` 410 (don't\nleak which row state was reached). Emits\n`org.invitation.revoked` with the stable invitation ID for dashboard\ncorrelation. Plaintext tokens and hashes are never written to audit.\n",
        "responses": {
          "204": {
            "description": "Revoked."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`403 Forbidden` — caller lacks `org.invite_members`.\nStable code `org_role_forbidden`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "410": {
            "description": "`410 Gone` — the ID is unknown, already consumed,\nor already revoked. Stable code `org_invitation_invalid`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/seat_usage": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "getOrgSeatUsage",
        "summary": "Seat usage visibility for the active org.",
        "description": "Returns `{used, limit, plan}` from `Store.CountActiveOrgMembers`\n(the same row the cap-in-tx inside `ConsumeOrgInvitation`\nreads). `limit` comes from `org.Plan.OrgMembersMax` — the\n`free` plan returns `0` to render \"personal org only\" in the\ndashboard rather than \"0 of 0 used\". Visibility-only; ships the per-seat pricing cut-over §\"Out of\nscope\". Every role may read (gated by `org.view`).\n",
        "responses": {
          "200": {
            "description": "The seat usage.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SeatUsageResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`403 Forbidden` — caller lacks `org.view`. Stable code\n`org_role_forbidden`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/invitations": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        },
        {
          "in": "query",
          "name": "before",
          "schema": {
            "type": "string"
          },
          "description": "Opaque cursor for the row immediately preceding the\nnext page. Base64-url encoding of a JSON object\n`{\"created_at\":\"...\",\"id\":\"...\"}` (the compound key,\nencoded by the server in `next_before`). Pass the\nprior response's `next_before` unchanged. Omit on\nthe first page. Malformed cursors return 400 with\nthe stable code `invalid_cursor`.\n"
        },
        {
          "name": "limit",
          "in": "query",
          "schema": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 25
          },
          "description": "Max invitations to return per page. Silently capped at 100."
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "listOrgInvitations",
        "summary": "List org invitations (every state).",
        "description": "Cursor-paginated list of every invitation minted on the\norg — pending, consumed, revoked, expired — in\n`created_at DESC` order (id tiebreak). The cursor is a\nopaque (base64-url-of-JSON) compound key `(created_at,\nid)`; `?before=<cursor>` partitions the next page so\nthe row at the boundary is visited exactly once even\nunder random UUIDs. Default limit\n25, max 100 (the strict-mode pagination contract).\nEvery role may read (gated by `org.view`,\nthe same access model as GET /v1/orgs/{slug}/members).\nThe dashboard renders it as a \"Pending invitations\" table\nnext to the \"Members\" table. Each successful render emits one\n`org.invitation.viewed` audit row.\n",
        "responses": {
          "200": {
            "description": "The page of invitations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvitationListResponse"
                }
              }
            }
          },
          "400": {
            "description": "`400 Bad Request` — `?limit=` is malformed, < 1, or\n> 100. Stable code `validation_failed`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`403 Forbidden` — caller is not a member of the\nactive org. Stable code `org_role_forbidden`.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/openapi.yaml": {
      "get": {
        "tags": [
          "meta"
        ],
        "operationId": "getOpenAPISpec",
        "summary": "This spec, as YAML.",
        "description": "Machine-readable API description. Same bytes as\n`api/openapi.yaml` at the repo HEAD; embedded at build time\nvia `//go:embed`. No auth.\n",
        "security": [],
        "responses": {
          "200": {
            "description": "The OpenAPI 3.1 document for this API.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "example": "public, max-age=300"
                }
              }
            },
            "content": {
              "application/yaml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/v1/openapi.json": {
      "get": {
        "tags": [
          "meta"
        ],
        "operationId": "getOpenAPISpecJSON",
        "summary": "This spec, as JSON.",
        "description": "Same spec, YAML parsed and re-emitted as JSON. Preferred by\nSDK generators (`openapi-generator`, `oapi-codegen`).\n",
        "security": [],
        "responses": {
          "200": {
            "description": "The OpenAPI 3.1 document for this API, as JSON.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "example": "public, max-age=300"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/docs": {
      "get": {
        "tags": [
          "meta"
        ],
        "operationId": "getDocs",
        "summary": "Human-readable API reference.",
        "description": "Anonymous Swagger UI page backed by the exact JSON document served\nat `/v1/openapi.json`. The page does not persist bearer tokens.\n",
        "security": [],
        "responses": {
          "200": {
            "description": "Swagger UI HTML.",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/v1/traces/{trace_id}": {
      "get": {
        "tags": [
          "observability"
        ],
        "operationId": "getTrace",
        "summary": "Retrieve a stored OpenTelemetry trace.",
        "description": "Returns the full span tree for a single trace_id\n(32-hex, the same as the request's `wake_id`). The trace is\nsourced from the public edge in-memory ring (24h\nretention, 100k default cap). When no OTLP endpoint is set\nthe ring is the only source — when OTLP is set, the ring\nstill operates as the customer-facing query layer.\n\nAuthentication: the `X-Faas-Trace-Auth` header must carry\nthe operator's observer token (env: `FAAS_TRACE_OBSERVER_TOKEN`).\nThe endpoint is gated even when the dashboard session cookie is\npresent — tracing is an operator surface, not a customer one.\nAn empty token disables the endpoint (returns 404).\n",
        "security": [],
        "parameters": [
          {
            "name": "trace_id",
            "in": "path",
            "required": true,
            "description": "32-hex W3C trace_id (or wake_id UUIDv7 hex form).",
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-f]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The trace tree.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Trace"
                }
              }
            }
          },
          "401": {
            "description": "Missing or wrong observer token. The endpoint is operator-\ngated; the customer-facing dashboard session does not\ngrant access.\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Trace not in the ring (never seen, or evicted by the 24h\nretention sweep / LRU cap).\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/flags": {
      "parameters": [
        {
          "$ref": "#/components/parameters/FlagsProjectSlug"
        },
        {
          "$ref": "#/components/parameters/FlagsEnvironment"
        }
      ],
      "get": {
        "tags": [
          "flags"
        ],
        "operationId": "getProjectFlags",
        "summary": "Read current or historical feature flag configuration.",
        "description": "Requires operator enablement via FAAS_FLAGS_ENABLED. Account-scoped read credentials only; app deploy tokens cannot read project-wide targeting lists.",
        "parameters": [
          {
            "name": "version",
            "in": "query",
            "description": "Historical version; omit for current.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current or selected historical configuration publication.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FeatureFlagVersion"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "put": {
        "tags": [
          "flags"
        ],
        "operationId": "publishProjectFlags",
        "summary": "Publish an atomic feature flag configuration.",
        "description": "Requires deploy-write scope and MFA when configured. expected_version zero creates the first version; conflicting writes return 409. Customers must belong to the account. Allocation seeds are immutable.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateFeatureFlagsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Newly committed configuration with its assigned version.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FeatureFlagVersion"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/flags/versions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/FlagsProjectSlug"
        },
        {
          "$ref": "#/components/parameters/FlagsEnvironment"
        }
      ],
      "get": {
        "tags": [
          "flags"
        ],
        "operationId": "listProjectFlagVersions",
        "summary": "List up to 100 immutable configuration versions.",
        "description": "Returns publication audit metadata in descending order; use before_version to continue history.",
        "parameters": [
          {
            "name": "before_version",
            "in": "query",
            "description": "Exclusive version boundary for older history pages.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Configuration history in descending version order.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/FeatureFlagVersion"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/flags/rollback": {
      "parameters": [
        {
          "$ref": "#/components/parameters/FlagsProjectSlug"
        },
        {
          "$ref": "#/components/parameters/FlagsEnvironment"
        }
      ],
      "post": {
        "tags": [
          "flags"
        ],
        "operationId": "rollbackProjectFlags",
        "summary": "Publish a previous flag configuration as a new version.",
        "description": "Requires the current expected_version and preserves allocation seeds; history remains immutable.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RollbackFeatureFlagsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "New publication restored from the requested historical configuration.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FeatureFlagVersion"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/flags/{key}/inspect": {
      "parameters": [
        {
          "$ref": "#/components/parameters/FlagsProjectSlug"
        },
        {
          "$ref": "#/components/parameters/FlagsEnvironment"
        },
        {
          "$ref": "#/components/parameters/FlagsKey"
        }
      ],
      "post": {
        "tags": [
          "flags"
        ],
        "operationId": "inspectProjectFlag",
        "summary": "Explain a current or historical customer decision without exposure.",
        "description": "Simulates ordered customer rules against the selected immutable configuration; this call records no application exposure.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InspectFeatureFlagRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Evaluation explanation for the supplied customer context.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FlagDecision"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/flags/{key}/requests": {
      "parameters": [
        {
          "$ref": "#/components/parameters/FlagsProjectSlug"
        },
        {
          "$ref": "#/components/parameters/FlagsEnvironment"
        },
        {
          "$ref": "#/components/parameters/FlagsKey"
        }
      ],
      "get": {
        "tags": [
          "flags"
        ],
        "operationId": "listProjectFlagRequests",
        "summary": "Inspect retained requests with application-reported flag evidence.",
        "description": "Debugger entitlement and retention apply. Counts weight collapsed telemetry rows; rows with different decisions remain separate. These are operational observations, not exactly-once exposure counts or causal experiment results.",
        "parameters": [
          {
            "name": "customer_id",
            "in": "query",
            "description": "Verified platform tenant UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "value",
            "in": "query",
            "description": "Filter the evaluated boolean.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "variant",
            "in": "query",
            "description": "Filter the selected named variant; mutually exclusive with value.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_-]{0,63}$"
            }
          },
          {
            "name": "used",
            "in": "query",
            "description": "Filter application-reported exposure.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "since",
            "in": "query",
            "description": "Lookback clamped to plan retention.",
            "schema": {
              "type": "string",
              "default": "24h"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Cursor from the preceding page; preserve filters.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retained request cohort page with stable pagination window.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FlagEvidencePage"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/flags/{key}/outcomes": {
      "parameters": [
        {
          "$ref": "#/components/parameters/FlagsProjectSlug"
        },
        {
          "$ref": "#/components/parameters/FlagsEnvironment"
        },
        {
          "$ref": "#/components/parameters/FlagsKey"
        }
      ],
      "get": {
        "tags": [
          "flags"
        ],
        "operationId": "getProjectFlagOutcomes",
        "summary": "Compare retained request outcomes by evaluated flag value.",
        "description": "Debugger entitlement and retention apply. Counts weight collapsed telemetry rows; used is application-reported. Optional rule and configuration-version filters isolate a targeting decision. HTTP 5xx rates and request-weighted latency percentiles are operational observations, not causal experiment results. Latencies use conservative bucket upper bounds.",
        "parameters": [
          {
            "name": "customer_id",
            "in": "query",
            "description": "Restrict the rollup to one gateway-attributed customer UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "rule_id",
            "in": "query",
            "description": "Restrict the rollup to decisions matched by one targeting rule.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_-]{0,63}$"
            }
          },
          {
            "name": "config_version",
            "in": "query",
            "description": "Restrict the rollup to one immutable flag configuration version.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            }
          },
          {
            "name": "since",
            "in": "query",
            "description": "Aggregation duration capped by the account's debugger retention.",
            "schema": {
              "type": "string",
              "default": "24h"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded retained request outcomes grouped by decision type and value.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FlagOutcomesResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/flags/{key}/rollout/promote": {
      "parameters": [
        {
          "$ref": "#/components/parameters/FlagsProjectSlug"
        },
        {
          "$ref": "#/components/parameters/FlagsEnvironment"
        },
        {
          "$ref": "#/components/parameters/FlagsKey"
        }
      ],
      "post": {
        "tags": [
          "flags"
        ],
        "operationId": "promoteProjectFlagRollout",
        "summary": "Promote one progressive flag rollout stage when its health gates pass.",
        "description": "Requires deploy-write scope and MFA. Evidence is isolated to the target rule and its configured window. A held result is a successful evaluation with no configuration change; latency is the conservative upper bound of retained telemetry buckets.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FlagRolloutPromotionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Stage promotion, health hold, or completed rollout with evidence summary.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FlagRolloutPromotion"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/runtime/flags": {
      "get": {
        "tags": [
          "flags"
        ],
        "operationId": "getRuntimeFlags",
        "summary": "Read the live workload’s project-environment flag bundle.",
        "description": "Requires an RS256 workload identity token with audience gregale:flags from an active app instance. Project and environment are derived from the deployment; query parameters cannot select another scope. Clients advertise runtime evaluation capabilities; a bundle using a capability is withheld from older clients that do not advertise it.",
        "parameters": [
          {
            "name": "X-Faas-Flags-Capabilities",
            "in": "header",
            "required": false,
            "description": "Comma-separated optional runtime SDK capabilities. Subject-aware SDKs advertise subject-targeting-v1.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          }
        ],
        "security": [
          {
            "flagsWorkloadIdentity": []
          }
        ],
        "responses": {
          "200": {
            "description": "Runtime configuration for the authenticated workload environment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FlagsBundle"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "426": {
            "description": "Runtime SDK does not support a capability used by the current flag bundle."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/operation-policies": {
      "get": {
        "tags": [
          "exclusive-operations"
        ],
        "operationId": "listExclusiveOperationPolicies",
        "summary": "List account-managed exclusive operation policies.",
        "responses": {
          "200": {
            "description": "Account policies and current revisions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExclusiveWorkPolicyList"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/operation-policies/{name}": {
      "delete": {
        "tags": [
          "exclusive-operations"
        ],
        "operationId": "retireExclusiveOperationPolicy",
        "summary": "Retire an idle exclusive operation policy while preserving ownership history.",
        "description": "Requires deploy-write scope and MFA when configured. Pending or running\noperations and existing trigger bindings block retirement with 409.\nRetirement is idempotent, releases the active-policy quota slot, and\npreserves policy identity, operation receipts and ownership generations.\nA retired name cannot be recreated or used to submit new work.\n",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "description": "Account-owned policy name to retire permanently.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,62}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retired policy revision; repeated retirement returns the same revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExclusiveWorkPolicyRecord"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "put": {
        "tags": [
          "exclusive-operations"
        ],
        "operationId": "upsertExclusiveOperationPolicy",
        "summary": "Create or revise a named exclusive operation policy.",
        "description": "The policy explicitly chooses account or platform-tenant scope and\nqueue, reject, or join_existing contention. Member app IDs and the\noptional project environment are validated against this account.\nAccount and customer identity are derived from authentication; the\nbusiness key never selects a security scope.\n",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "description": "Account-owned policy name to create or replace.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,62}$"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExclusiveOperationPolicy"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved policy revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExclusiveWorkPolicyRecord"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/operation-trigger-bindings/{source}/{id}": {
      "parameters": [
        {
          "name": "source",
          "in": "path",
          "required": true,
          "description": "Account-owned cron, inbound webhook, broker/queue trigger, or recurring Job schedule whose exclusive-operation binding is being inspected or changed.",
          "schema": {
            "type": "string",
            "enum": [
              "cron",
              "inbound_webhook",
              "broker",
              "job_schedule"
            ]
          }
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Account-owned trigger ID; for broker bindings this is a non-cron trigger resource.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "exclusive-operations"
        ],
        "operationId": "getExclusiveOperationTriggerBinding",
        "summary": "Inspect the operation policy attached to an account-owned trigger.",
        "responses": {
          "200": {
            "description": "Trigger binding and configured business key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExclusiveTriggerBindingRecord"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "tags": [
          "exclusive-operations"
        ],
        "operationId": "upsertExclusiveOperationTriggerBinding",
        "summary": "Route an account-owned trigger through a managed operation policy.",
        "description": "App triggers and recurring Job schedules are resolved from account-owned state. A tenant-scoped policy requires an active tenant-to-app link; tenant identity is not read from the business key. Job schedules require an account-scoped policy that explicitly includes the Job.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExclusiveTriggerBindingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved trigger binding.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExclusiveTriggerBindingRecord"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "exclusive-operations"
        ],
        "operationId": "deleteExclusiveOperationTriggerBinding",
        "summary": "Remove exclusive-operation routing from a trigger.",
        "responses": {
          "204": {
            "description": "Trigger routing was removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/operations": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "listAccountOperations",
        "summary": "List retained customer operations for an account-owned app.",
        "description": "Requires account read scope and MFA. Explicit scope and optional tenant filter select data within account ownership. Descending keyset pages exclude private inputs and results. Customer tokens cannot access this operator route.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "in": "query",
            "name": "scope",
            "description": "Deployment environment whose customer operations are listed.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "tenant_id",
            "description": "Optional account-owned platform tenant filter.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "query",
            "name": "name",
            "description": "Operation definition name.",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "in": "query",
            "name": "state",
            "description": "Business state filter.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "accepted",
                "running",
                "waiting",
                "succeeded",
                "failed",
                "cancelled",
                "requires_reconciliation"
              ]
            }
          },
          {
            "name": "subject_type",
            "description": "Business reference type for this account-owned app. Requires subject_id; supply both selectors together.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          },
          {
            "name": "subject_id",
            "description": "Exact public entity identifier within the account app and environment. Requires subject_type. Maximum 256 UTF-8 bytes; ASCII controls are rejected.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256,
              "pattern": "^[^\\x00-\\x1f\\x7f]+$"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "description": "Number of account-owned operation summaries to include.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "description": "Opaque cursor bound to the account and exact filters.",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Account app history page with optional tenant selection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "post": {
        "tags": [
          "exclusive-operations"
        ],
        "operationId": "submitExclusiveOperation",
        "summary": "Submit app work through a named exclusive-operation policy.",
        "description": "The account scope is authenticated. For platform-tenant policies use the account tenant route or the tenant-self route so the customer scope comes from trusted platform context.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/GregaleRevision"
          },
          {
            "$ref": "#/components/parameters/GregaleRelease"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExclusiveOperationRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The durable operation was accepted or joined to an equivalent active operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExclusiveOperationAccepted"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PlanSourceBytes"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/operations/tasks": {
      "post": {
        "tags": [
          "exclusive-operations"
        ],
        "operationId": "submitExclusiveAppTaskOperation",
        "summary": "Submit a deployment-attached command through managed exclusive ownership.",
        "description": "The authenticated account and app identify the target; deployment selection and ownership generation are platform-controlled.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExclusiveAppTaskOperationRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The task operation was accepted or joined to equivalent active work.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExclusiveOperationAccepted"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PlanSourceBytes"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/account/platform-tenants/{tenant_id}/apps/{slug}/operations": {
      "post": {
        "tags": [
          "exclusive-operations"
        ],
        "operationId": "submitTenantExclusiveOperation",
        "summary": "Submit work for an account-authorized platform customer.",
        "description": "The account credential must own the selected tenant. The tenant ID is checked against account state and never inferred from the concurrency key.",
        "parameters": [
          {
            "name": "tenant_id",
            "in": "path",
            "required": true,
            "description": "Platform tenant owned by the authenticated account.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/GregaleRevision"
          },
          {
            "$ref": "#/components/parameters/GregaleRelease"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExclusiveOperationRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The operation was accepted or joined for the customer tenant selected by the account owner.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExclusiveOperationAccepted"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PlanSourceBytes"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/platform-tenant-self/apps/{slug}/operations": {
      "post": {
        "tags": [
          "exclusive-operations"
        ],
        "operationId": "submitPlatformTenantSelfExclusiveOperation",
        "summary": "Submit work for the customer bound to this tenant credential.",
        "description": "Requires platform_tenant:invocations:manage. The tenant is derived from the bearer token; callers cannot choose another tenant.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/GregaleRevision"
          },
          {
            "$ref": "#/components/parameters/GregaleRelease"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExclusiveOperationRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The operation was accepted or joined for the customer identified by this tenant credential.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExclusiveOperationAccepted"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/PlanSourceBytes"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/operations/{id}": {
      "get": {
        "tags": [
          "exclusive-operations"
        ],
        "operationId": "getExclusiveOperation",
        "summary": "Read an account-owned operation and its committed result.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Operation receipt ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation receipt; claim tokens and accepted request contents are never returned.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ExclusiveOperationRecord"
                    },
                    {
                      "$ref": "#/components/schemas/CommitOperationResponse"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/operations/{id}/cancel": {
      "post": {
        "tags": [
          "exclusive-operations"
        ],
        "operationId": "cancelExclusiveOperation",
        "summary": "Cancel pending or active account-owned work.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Operation receipt ID to cancel.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Cancellation was accepted for this account-owned operation."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/platform-tenant-self/operations/{id}": {
      "get": {
        "tags": [
          "exclusive-operations"
        ],
        "operationId": "getPlatformTenantSelfExclusiveOperation",
        "summary": "Read an operation belonging to the authenticated platform customer.",
        "description": "Requires platform_tenant:invocations:read. The tenant is derived from the bearer token.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Operation receipt ID owned by the authenticated tenant.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Customer-owned operation receipt; claim tokens and request contents are never returned.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExclusiveOperationRecord"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/platform-tenant-self/operations/{id}/cancel": {
      "post": {
        "tags": [
          "exclusive-operations"
        ],
        "operationId": "cancelPlatformTenantSelfExclusiveOperation",
        "summary": "Cancel work belonging to the authenticated platform customer.",
        "description": "Requires platform_tenant:invocations:manage. The tenant is derived from the bearer token.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Tenant-owned operation receipt ID to cancel.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Cancellation was accepted for this tenant-owned operation."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/apps/{slug}/operations/{id}/delivery": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "getOperationDelivery",
        "summary": "Inspect completion delivery independently of the business result.",
        "description": "Requires account read scope and MFA. Business work is never restarted. Reads remain available with admission closed. Retention expiry returns 410. Receiver observations are local ledger snapshots, not connectivity probes. Raw receiver errors, target URLs and payloads are excluded.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationId"
          }
        ],
        "responses": {
          "200": {
            "description": "Current completion delivery and independently retained business outcome.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationDeliveryInspection"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "410": {
            "description": "The operation retention window for delivery inspection has expired."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/operations/{id}/delivery-attempts": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "getOperationDeliveryAttempts",
        "summary": "Read retained notification attempts for one owned operation.",
        "description": "Requires account read scope and MFA. Business work is never restarted. Attempt history stays readable while admission is closed. Expired operations return 410. This endpoint pages the existing notification ledger and excludes raw errors, destination URLs and payloads.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "in": "query",
            "name": "limit",
            "description": "Maximum retained notification attempts in this page, newest replay and attempt first.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "description": "Opaque continuation bound to this operation and its completion delivery.",
            "schema": {
              "type": "string",
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retained completion attempt evidence and an optional continuation cursor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationDeliveryAttemptsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "410": {
            "description": "The operation retention window for attempt history has expired."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/operations/{id}/delivery-retries": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "retryOperationDeliveryWithReceipt",
        "summary": "Commit an idempotent decision to retry a dead completion delivery.",
        "description": "Requires account deploy write scope and MFA. Business work is never restarted. Retry IDs are scoped to the retained operation, with at most 32 decisions. An exact replay returns the immutable original receipt even after later delivery failures or delivery cleanup. Changed payloads and stale replay generations conflict. Receipt insertion and notification reset are atomic; receiver cooldowns and destination policy remain in force. Queued denotes the recorded decision, not live delivery status.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationDeliveryRetryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Immutable retry decision; use the delivery read for current transport state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationDeliveryRetryResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "410": {
            "description": "The operation retention window for completion retry has expired."
          },
          "413": {
            "description": "Retry request exceeds 4096 bytes."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/deployments/{deployment_id}/operation-doctor": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "getOperationDoctor",
        "summary": "Observe Operations submission prerequisites on the responding API node.",
        "description": "Account read scope and MFA are required. Select an owned deployment and tenant, optionally one operation name. This read reserves no quota, grants no admission, probes no external services and does not qualify native lifecycle or fleet availability. Completion warnings are independent of submission blockers. Eligibility is an advisory observation, not an execution guarantee.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationDeploymentId"
          },
          {
            "in": "query",
            "name": "tenant_id",
            "required": true,
            "description": "Owned platform tenant whose submission prerequisites will be observed.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "query",
            "name": "name",
            "description": "Optional immutable operation name; omit to inspect the deployment's definitions.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded read-only report, including blocked or unverified prerequisites.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationDoctorResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/deployments/{deployment_id}/operation-definitions": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "listOperationDefinitions",
        "summary": "List immutable Operations contracts for one owned deployment.",
        "description": "Requires account read scope and MFA. Deployment identity selects the environment and pins; reads remain available while admission is closed. No mutable active-deployment selector is inferred.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationDeploymentId"
          }
        ],
        "responses": {
          "200": {
            "description": "Name-ordered contracts, bounded by the deployment definition allowance.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationDefinitionsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/deployments/{deployment_id}/operation-definitions/{name}": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "getOperationDefinition",
        "summary": "Read one named contract pinned to an owned deployment.",
        "description": "Requires account read scope and MFA. Returns the immutable definition ID, revision, schemas, deployment, environment and completion destination, without changing admission.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationDeploymentId"
          },
          {
            "$ref": "#/components/parameters/OperationName"
          }
        ],
        "responses": {
          "200": {
            "description": "Resolved immutable contract selected by deployment and name.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationDefinitionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "operations"
        ],
        "operationId": "putOperationDefinition",
        "summary": "Install an immutable operation definition.",
        "description": "Requires deploy:write. Normal source deployment resolves schemas and installs definitions automatically. Repeating the same resolved contract returns the same definition. Changing a definition on the same deployment conflicts. This staged API has no production admission switch; definition registration and submission return 503 until the HTTP execution adapter is qualified.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationDeploymentId"
          },
          {
            "$ref": "#/components/parameters/OperationName"
          },
          {
            "$ref": "#/components/parameters/OperationXGregaleRelease"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationDefinitionSpec"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Installed contract with immutable revision and deployment pins.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationDefinitionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/operations/{id}": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "getOperation",
        "summary": "Read an account-owned operation.",
        "description": "Requires read scope. Business outcome and completion delivery are independent. The response omits original input and execution capabilities.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationId"
          }
        ],
        "responses": {
          "200": {
            "description": "Account-authorized projection of customer business work.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/operations/{id}/signals": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "signalOperation",
        "summary": "Deliver a named event to an operation that waits for it.",
        "description": "Requires deploy:write and MFA. The event must be one the operation's workflow waits for. signal_id makes delivery idempotent per operation; a repeat with the same event and payload returns the original receipt, a different event or payload under it conflicts. A signal that arrives before its wait is held until the wait starts. Settled operations take no new signals.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationSignalRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The delivery receipt; duplicate marks a repeat of an earlier signal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationSignalReceipt"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/operation-signals": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "signalOperationsBySubject",
        "summary": "Deliver a named event to every active operation about one business subject.",
        "description": "Requires deploy:write and MFA. Reaches at most 16 active operations of the named definition in the scope whose subject matches, oldest first; more is a limit error. Operations that settle during delivery are skipped. Each delivery is idempotent per operation by signal_id.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationSubjectSignalRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "One receipt per operation reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationSubjectSignalResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/operations/{id}/cancel": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "cancelOperation",
        "summary": "Request cancellation of account-owned work.",
        "description": "Requires deploy:write. Expected generation prevents cancelling a recovered execution. Pending work can be cancelled; dispatching work may finish successfully or require reconciliation. A cancellation request does not prove an external effect was undone.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationCancellationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Account cancellation intent and the resulting business projection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/operations/{id}/approvals/{step}": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "decideOperationApproval",
        "summary": "Decide an account approval on waiting work.",
        "description": "Requires deploy:write and MFA. Only a step whose definition names the account approver. The same decision is idempotent; a different one conflicts. Rejection settles the operation failed with approval_rejected.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "name": "step",
            "in": "path",
            "required": true,
            "description": "Approval step declared by the operation definition.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationApprovalRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The decision is recorded; the operation resumes or settles approval_rejected.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/customer-operations": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "listPlatformTenantSelfOperations",
        "summary": "Discover and reopen this customer's retained work.",
        "description": "Requires platform_tenant:operations:read and an explicit app_id and environment scope. Identity comes only from the authenticated tenant token. Pages contain status summaries, never source input, result bytes, artifact locations or execution authority. Active work remains visible; expired settled work is omitted. Creation time and ID determine descending order. An opaque cursor is bound to the account, tenant, app, scope and filters. This is a live view, not a transaction snapshot: state filters and retention can change membership. Closed preview admission does not disable history reads.",
        "parameters": [
          {
            "name": "app_id",
            "description": "Owning app identifier, scoped to the authenticated customer.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "scope",
            "description": "Exact deployment environment; no all-environments selector.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 40,
              "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
            }
          },
          {
            "name": "name",
            "description": "Stable operation name across definition revisions.",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          },
          {
            "name": "subject_type",
            "description": "Exact business reference type. Requires subject_id; both must be supplied together.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          },
          {
            "name": "subject_id",
            "description": "Exact business reference ID, within the authenticated owner/app/environment. Requires subject_type. Maximum 256 UTF-8 bytes; ASCII controls are rejected.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256,
              "pattern": "^[^\\x00-\\x1f\\x7f]+$"
            }
          },
          {
            "name": "state",
            "description": "Current business state filter, independent of delivery.",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "accepted",
                "running",
                "waiting",
                "succeeded",
                "failed",
                "cancelled",
                "requires_reconciliation"
              ]
            }
          },
          {
            "name": "limit",
            "description": "Maximum summaries in this page.",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "description": "Opaque continuation from the same identity and filters.",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Customer-scoped summaries and an optional continuation cursor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "startPlatformTenantSelfOperation",
        "summary": "Start work owned by the authenticated customer.",
        "description": "Requires platform_tenant:operations:manage and an active customer identity. Idempotency-Key is required and scoped to account, app, environment, authenticated platform tenant and operation name. Canonically equivalent JSON inputs reuse the same operation across deployment changes; different input conflicts. Retention follows the admitted plan: Hobby/Pro/Scale results 7/30/90 days and deduplication 30/90/180 days. An expired retained result returns 410 during the deduplication window. Fresh work is unavailable on Free. Production admission remains disabled in this staged API.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationIdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationStartRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Durable acceptance for this logical customer submission.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationAcceptedResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/customer-operations/submissions/lookup": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "lookupPlatformTenantSelfOperationSubmission",
        "summary": "Resolve a customer's retained submission without admitting work.",
        "description": "Requires platform_tenant:operations:read. Reads the idempotency ledger scoped to the authenticated account/customer, app, environment, operation name and key. Available while admission is closed, independently of current code or definition availability. accepted includes the original acceptance time and receipt; fetch status for current business state. expired means a known identity no longer has a retained usable acceptance. unresolved is not proof of rejection: admission may be in flight or a receipt pruned. No work is submitted and Cache-Control is no-store. expected_identity is an optional principal fence, never an ownership grant. Selectors belong in the bounded JSON body, not query parameters.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationSubmissionLookupRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Retained acceptance observation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationSubmissionLookupResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/customer-operations/identity": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "getPlatformTenantSelfOperationIdentity",
        "summary": "Verify the authenticated customer identity for submission receipts.",
        "description": "Requires platform_tenant:operations:manage and a tenant credential. Account credentials cannot supply a tenant selector. Identity verification remains available while admission is closed.",
        "responses": {
          "200": {
            "description": "Verified account and tenant IDs without the bearer credential.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationTenantIdentity"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/customer-operations/{id}": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "getPlatformTenantSelfOperation",
        "summary": "Read this customer's operation.",
        "description": "Requires platform_tenant:operations:read. Missing and foreign operation identities return the same 404. Completion delivery failure does not change business success.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          }
        ],
        "responses": {
          "200": {
            "description": "Status, typed result and delivery visible to this owner.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/customer-operations/{id}/events": {
      "get": {
        "tags": [
          "operations"
        ],
        "operationId": "getPlatformTenantSelfOperationEvents",
        "summary": "Read or subscribe to durable operation progress.",
        "description": "Requires platform_tenant:operations:read. application/json returns a bounded ordered page. Accept: text/event-stream streams durable events plus snapshot/resync frames; reconnect at least every five minutes with a current credential. after overrides Last-Event-ID. Authorization is rechecked during streams; revocation and suspension close them. When history expired or the cursor is ahead, a resync frame instructs a fresh status read. Event retention is Hobby/Pro/Scale 1/7/30 days; PostgreSQL notifications are only wake hints.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "$ref": "#/components/parameters/OperationAfter"
          },
          {
            "$ref": "#/components/parameters/OperationLastEventId"
          }
        ],
        "responses": {
          "200": {
            "description": "Retained ordered history with an explicit resynchronization indication.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationEventsResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                },
                "example": "id: 3\nevent: operation\ndata: {\"operation_id\":\"d1018236-95f4-4f60-ab75-459ae01d6b16\",\"sequence\":3,\"type\":\"progress\",\"data\":{\"stage\":\"export\",\"completed\":1,\"total\":4}}\n\n"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/customer-operations/{id}/cancel": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "cancelPlatformTenantSelfOperation",
        "summary": "Request cancellation of this customer's operation.",
        "description": "Requires platform_tenant:operations:manage. Only authenticated ownership authorizes cancellation. Expected generation is required. Running side effects can still succeed or need reconciliation.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationCancellationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Customer cancellation intent accepted for the current generation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/customer-operations/{id}/approvals/{step}": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "decidePlatformTenantSelfOperationApproval",
        "summary": "Decide this customer's approval on its waiting operation.",
        "description": "Requires platform_tenant:operations:manage. Only a step whose definition names the customer approver, on the customer's own operation. The same decision is idempotent; a different one conflicts.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          },
          {
            "name": "step",
            "in": "path",
            "required": true,
            "description": "Approval step that the definition assigns to the customer.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationApprovalRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The customer's decision is recorded; its operation resumes or settles approval_rejected.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/customer-operations/{id}/signals": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "signalPlatformTenantSelfOperation",
        "summary": "Deliver a named event to this customer's own waiting operation.",
        "description": "Requires platform_tenant:operations:manage. Works like the account signal route on the customer's own operation only; another customer's operation is not found. The operation's history records the signal with source customer. signal_id is shared with the account route, so a repeat from either is the same signal.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OperationId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationSignalRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The customer's delivery receipt; duplicate marks a repeat of an earlier signal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationSignalReceipt"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/customer-operation-signals": {
      "post": {
        "tags": [
          "operations"
        ],
        "operationId": "signalPlatformTenantSelfOperationsBySubject",
        "summary": "Deliver a named event to this customer's own active operations about one business subject.",
        "description": "Requires platform_tenant:operations:manage. The definition fixes the app, environment and operation name. Reaches at most 16 of the customer's own active operations whose subject matches; other customers' operations about the same subject are never reached. Each delivery is idempotent per operation by signal_id and recorded with source customer.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformTenantSubjectSignalRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "One receipt per customer operation reached; empty when none is active.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationSubjectSignalResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "410": {
            "$ref": "#/components/responses/OperationGone"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/retained-messages/{message_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedRealtimeSlugPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeIdPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeChannelPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeMessageIdPath"
        }
      ],
      "patch": {
        "tags": [
          "realtime"
        ],
        "operationId": "updateManagedRealtimeChannelMessage",
        "summary": "Update a retained channel message",
        "responses": {
          "200": {
            "description": "Update a retained channel message result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeMessageMutationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimeMessageMutationRequest"
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "realtime"
        ],
        "operationId": "deleteManagedRealtimeChannelMessage",
        "summary": "Delete a retained channel message",
        "responses": {
          "200": {
            "description": "Delete a retained channel message result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeMessageMutationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimeMessageMutationRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/channels/{channel}/read-progress": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedRealtimeSlugPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeIdPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeChannelPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimePrincipalQuery"
        }
      ],
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "getManagedRealtimeChannelReadProgress",
        "summary": "Read principal channel read progress",
        "responses": {
          "200": {
            "description": "Read principal channel read progress result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeReadProgressResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "advanceManagedRealtimeChannelReadProgress",
        "summary": "Advance principal channel read progress",
        "responses": {
          "200": {
            "description": "Advance principal channel read progress result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeReadProgressResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimeReadProgressRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/principals/inbox/{message_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedRealtimeSlugPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeIdPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimePrincipalQuery"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeMessageIdPath"
        }
      ],
      "patch": {
        "tags": [
          "realtime"
        ],
        "operationId": "updateManagedRealtimeInboxMessage",
        "summary": "Update a retained inbox message",
        "responses": {
          "200": {
            "description": "Update a retained inbox message result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeMessageMutationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimeMessageMutationRequest"
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "realtime"
        ],
        "operationId": "deleteManagedRealtimeInboxMessage",
        "summary": "Delete a retained inbox message",
        "responses": {
          "200": {
            "description": "Delete a retained inbox message result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeMessageMutationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimeMessageMutationRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/principals/inbox/read-progress": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedRealtimeSlugPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeIdPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimePrincipalQuery"
        }
      ],
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "getManagedRealtimeInboxReadProgress",
        "summary": "Read principal inbox read progress",
        "responses": {
          "200": {
            "description": "Read principal inbox read progress result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeReadProgressResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "realtime"
        ],
        "operationId": "advanceManagedRealtimeInboxReadProgress",
        "summary": "Advance principal inbox read progress",
        "responses": {
          "200": {
            "description": "Advance principal inbox read progress result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeReadProgressResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManagedRealtimeReadProgressRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/principals/inbox": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedRealtimeSlugPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeIdPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimePrincipalQuery"
        },
        {
          "name": "after",
          "in": "query",
          "description": "Exclusive inbox sequence cursor",
          "schema": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        },
        {
          "name": "limit",
          "in": "query",
          "description": "Maximum inbox messages per page",
          "schema": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 100
          }
        },
        {
          "name": "consumer",
          "in": "query",
          "description": "Durable inbox consumer name",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      ],
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "readManagedRealtimeInbox",
        "summary": "Read retained principal inbox messages",
        "responses": {
          "200": {
            "description": "Read retained principal inbox messages result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimeInboxResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/realtime/endpoints/{id}/principals/messages/{message_id}/receipt": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ManagedRealtimeSlugPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeIdPath"
        },
        {
          "$ref": "#/components/parameters/ManagedRealtimeMessageIdPath"
        }
      ],
      "get": {
        "tags": [
          "realtime"
        ],
        "operationId": "getManagedRealtimePrincipalReceipt",
        "summary": "Get principal message receipt state",
        "responses": {
          "200": {
            "description": "Get principal message receipt state result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedRealtimePrincipalReceiptResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflow-readiness/subscriptions": {
      "post": {
        "operationId": "CreateAccountWorkflowReadinessSubscription",
        "summary": "Account create WorkflowReadinessSubscription",
        "description": "Account durable readiness subscription create operation. Observations are bounded and advisory; execution remains application-owned. Requires account deploy-write scope and MFA.",
        "tags": [
          "operations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "CreateAccountWorkflowReadinessSubscription. Application slug.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Account Create readiness subscription result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowReadinessSubscription"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "requestBody": {
          "required": true,
          "description": "Account subscription selectors; bounded to 4096 bytes.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationWorkflowReadinessSubscriptionRequest"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "ListAccountWorkflowReadinessSubscriptions",
        "summary": "Account list WorkflowReadinessSubscriptions",
        "description": "Account durable readiness subscription list operation. Observations are bounded and advisory; execution remains application-owned. Requires account read scope and MFA.",
        "tags": [
          "operations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "ListAccountWorkflowReadinessSubscriptions. Application slug.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": true,
            "description": "ListAccountWorkflowReadinessSubscriptions. Application environment scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tenant_id",
            "in": "query",
            "required": false,
            "description": "ListAccountWorkflowReadinessSubscriptions. Optional account customer selector.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Account List readiness subscription result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowReadinessSubscriptionsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflow-readiness/subscriptions/{id}": {
      "delete": {
        "operationId": "DeleteAccountWorkflowReadinessSubscription",
        "summary": "Account delete WorkflowReadinessSubscription",
        "description": "Account durable readiness subscription delete operation. Observations are bounded and advisory; execution remains application-owned. Requires account deploy-write scope and MFA.",
        "tags": [
          "operations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "DeleteAccountWorkflowReadinessSubscription. Application slug.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "DeleteAccountWorkflowReadinessSubscription. Subscription UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": true,
            "description": "DeleteAccountWorkflowReadinessSubscription. Application environment scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tenant_id",
            "in": "query",
            "required": false,
            "description": "DeleteAccountWorkflowReadinessSubscription. Optional account customer selector.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Account Delete readiness subscription result."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflow-readiness/subscriptions/{id}/notifications": {
      "get": {
        "operationId": "GetAccountWorkflowReadinessInbox",
        "summary": "Account get WorkflowReadinessInbox",
        "description": "Account durable readiness subscription get operation. Observations are bounded and advisory; execution remains application-owned. Requires account read scope and MFA.",
        "tags": [
          "operations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "GetAccountWorkflowReadinessInbox. Application slug.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "GetAccountWorkflowReadinessInbox. Subscription UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": true,
            "description": "GetAccountWorkflowReadinessInbox. Application environment scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tenant_id",
            "in": "query",
            "required": false,
            "description": "GetAccountWorkflowReadinessInbox. Optional account customer selector.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "after_sequence",
            "in": "query",
            "description": "GetAccountWorkflowReadinessInbox. Last consumed sequence; defaults to zero.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "GetAccountWorkflowReadinessInbox. Page size; defaults to 20.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Account Get readiness inbox page.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowReadinessInboxResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflow-readiness/subscriptions": {
      "post": {
        "operationId": "CreatePlatformTenantSelfWorkflowReadinessSubscription",
        "summary": "Customer create WorkflowReadinessSubscription",
        "description": "Customer durable readiness subscription create operation. Observations are bounded and advisory; execution remains application-owned. Requires platform-tenant Operations manage scope.",
        "tags": [
          "operations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "responses": {
          "201": {
            "description": "Customer Create readiness subscription result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowReadinessSubscription"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "requestBody": {
          "required": true,
          "description": "Customer subscription selectors; bounded to 4096 bytes.",
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/OperationWorkflowReadinessSubscriptionRequest"
                  },
                  {
                    "type": "object",
                    "required": [
                      "app_id"
                    ]
                  }
                ]
              }
            }
          }
        }
      },
      "get": {
        "operationId": "ListPlatformTenantSelfWorkflowReadinessSubscriptions",
        "summary": "Customer list WorkflowReadinessSubscriptions",
        "description": "Customer durable readiness subscription list operation. Observations are bounded and advisory; execution remains application-owned. Requires platform-tenant Operations read scope.",
        "tags": [
          "operations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "scope",
            "in": "query",
            "required": true,
            "description": "ListPlatformTenantSelfWorkflowReadinessSubscriptions. Application environment scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "app_id",
            "in": "query",
            "required": true,
            "description": "ListPlatformTenantSelfWorkflowReadinessSubscriptions. Application UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Customer List readiness subscription result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowReadinessSubscriptionsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflow-readiness/subscriptions/{id}": {
      "delete": {
        "operationId": "DeletePlatformTenantSelfWorkflowReadinessSubscription",
        "summary": "Customer delete WorkflowReadinessSubscription",
        "description": "Customer durable readiness subscription delete operation. Observations are bounded and advisory; execution remains application-owned. Requires platform-tenant Operations manage scope.",
        "tags": [
          "operations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "DeletePlatformTenantSelfWorkflowReadinessSubscription. Subscription UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": true,
            "description": "DeletePlatformTenantSelfWorkflowReadinessSubscription. Application environment scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "app_id",
            "in": "query",
            "required": true,
            "description": "DeletePlatformTenantSelfWorkflowReadinessSubscription. Application UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Customer Delete readiness subscription result."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflow-readiness/subscriptions/{id}/notifications": {
      "get": {
        "operationId": "GetPlatformTenantSelfWorkflowReadinessInbox",
        "summary": "Customer get WorkflowReadinessInbox",
        "description": "Customer durable readiness subscription get operation. Observations are bounded and advisory; execution remains application-owned. Requires platform-tenant Operations read scope.",
        "tags": [
          "operations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "GetPlatformTenantSelfWorkflowReadinessInbox. Subscription UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": true,
            "description": "GetPlatformTenantSelfWorkflowReadinessInbox. Application environment scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "app_id",
            "in": "query",
            "required": true,
            "description": "GetPlatformTenantSelfWorkflowReadinessInbox. Application UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "after_sequence",
            "in": "query",
            "description": "GetPlatformTenantSelfWorkflowReadinessInbox. Last consumed sequence; defaults to zero.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "GetPlatformTenantSelfWorkflowReadinessInbox. Page size; defaults to 20.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Customer Get readiness inbox page.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowReadinessInboxResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflow-readiness/subscriptions/{id}/notifications/{sequence}": {
      "get": {
        "operationId": "CheckAccountWorkflowReadinessNotification",
        "summary": "Check Account readiness notification",
        "description": "CheckAccountWorkflowReadinessNotification. Recheck retained application evidence; does not execute actions.",
        "tags": [
          "operations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "CheckAccountWorkflowReadinessNotification. Application slug.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "CheckAccountWorkflowReadinessNotification. Subscription UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": true,
            "description": "CheckAccountWorkflowReadinessNotification. Application environment scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tenant_id",
            "in": "query",
            "required": false,
            "description": "CheckAccountWorkflowReadinessNotification. Optional account customer selector.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "sequence",
            "in": "path",
            "required": true,
            "description": "CheckAccountWorkflowReadinessNotification. Retained subscription-local notification sequence.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          }
        ],
        "responses": {
          "200": {
            "description": "CheckAccountWorkflowReadinessNotification. Result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowReadinessNotificationCheck"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "patch": {
        "operationId": "UpdateAccountWorkflowReadinessNotification",
        "summary": "Update Account readiness notification",
        "description": "UpdateAccountWorkflowReadinessNotification. Replace shared inbox coordination with a matching revision. Requires account deploy-write and MFA or customer operations manage. Actor derives from authentication. Revision zero addresses an untouched notification.",
        "tags": [
          "operations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "UpdateAccountWorkflowReadinessNotification. Application slug.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "UpdateAccountWorkflowReadinessNotification. Subscription UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": true,
            "description": "UpdateAccountWorkflowReadinessNotification. Application environment scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tenant_id",
            "in": "query",
            "required": false,
            "description": "UpdateAccountWorkflowReadinessNotification. Optional account customer selector.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "sequence",
            "in": "path",
            "required": true,
            "description": "UpdateAccountWorkflowReadinessNotification. Retained subscription-local notification sequence.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          }
        ],
        "responses": {
          "200": {
            "description": "UpdateAccountWorkflowReadinessNotification. Result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowReadinessNotification"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationWorkflowReadinessCoordinationRequest"
              }
            }
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflow-readiness/subscriptions/{id}/notifications/{sequence}": {
      "get": {
        "operationId": "CheckPlatformTenantSelfWorkflowReadinessNotification",
        "summary": "Check PlatformTenantSelf readiness notification",
        "description": "CheckPlatformTenantSelfWorkflowReadinessNotification. Recheck retained application evidence; does not execute actions.",
        "tags": [
          "operations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "CheckPlatformTenantSelfWorkflowReadinessNotification. Subscription UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": true,
            "description": "CheckPlatformTenantSelfWorkflowReadinessNotification. Application environment scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "app_id",
            "in": "query",
            "required": true,
            "description": "CheckPlatformTenantSelfWorkflowReadinessNotification. Application UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "sequence",
            "in": "path",
            "required": true,
            "description": "CheckPlatformTenantSelfWorkflowReadinessNotification. Retained subscription-local notification sequence.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          }
        ],
        "responses": {
          "200": {
            "description": "CheckPlatformTenantSelfWorkflowReadinessNotification. Result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowReadinessNotificationCheck"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "patch": {
        "operationId": "UpdatePlatformTenantSelfWorkflowReadinessNotification",
        "summary": "Update PlatformTenantSelf readiness notification",
        "description": "UpdatePlatformTenantSelfWorkflowReadinessNotification. Replace shared inbox coordination with a matching revision. Requires account deploy-write and MFA or customer operations manage. Actor derives from authentication. Revision zero addresses an untouched notification.",
        "tags": [
          "operations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "UpdatePlatformTenantSelfWorkflowReadinessNotification. Subscription UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": true,
            "description": "UpdatePlatformTenantSelfWorkflowReadinessNotification. Application environment scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "app_id",
            "in": "query",
            "required": true,
            "description": "UpdatePlatformTenantSelfWorkflowReadinessNotification. Application UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "sequence",
            "in": "path",
            "required": true,
            "description": "UpdatePlatformTenantSelfWorkflowReadinessNotification. Retained subscription-local notification sequence.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          }
        ],
        "responses": {
          "200": {
            "description": "UpdatePlatformTenantSelfWorkflowReadinessNotification. Result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowReadinessNotification"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/OperationConflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationWorkflowReadinessCoordinationRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/workflow-readiness/follow-ups": {
      "get": {
        "operationId": "ListAccountWorkflowReadinessFollowUps",
        "summary": "List Account readiness follow-up work queue",
        "description": "ListAccountWorkflowReadinessFollowUps. Read retained pending follow-ups across subscriptions for an explicit application and environment. Due-time ordering puts overdue first. Pages are live and may move; refresh after edits. Account reads require read scope and MFA; customer reads require Operations read.",
        "tags": [
          "operations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "ListAccountWorkflowReadinessFollowUps.view. Select follow-ups (default) or current cross-case next actions. Next-action view uses action ownership/deadlines; reminder and business-impact selectors are incompatible.",
            "schema": {
              "type": "string",
              "enum": [
                "follow_ups",
                "next_actions"
              ]
            }
          },
          {
            "name": "action_kind",
            "in": "query",
            "required": false,
            "description": "ListAccountWorkflowReadinessFollowUps.action_kind. Exact action kind in next-action view.",
            "schema": {
              "type": "string",
              "enum": [
                "response_check_in",
                "decision_revalidation",
                "handoff_acceptance",
                "handoff_reassignment",
                "escalation_acknowledgment",
                "coordinator_completion",
                "scheduled_evidence_check",
                "coordinator_evidence_review",
                "coordinator_revision",
                "dependency_review",
                "follow_up",
                "fulfillment_review"
              ]
            }
          },
          {
            "name": "action_trigger",
            "in": "query",
            "required": false,
            "description": "ListAccountWorkflowReadinessFollowUps.action_trigger. Exact trigger in next-action view.",
            "schema": {
              "type": "string",
              "enum": [
                "human",
                "automatic",
                "suggested"
              ]
            }
          },
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "ListAccountWorkflowReadinessFollowUps. Application slug.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": true,
            "description": "ListAccountWorkflowReadinessFollowUps. Application environment scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tenant_id",
            "in": "query",
            "required": false,
            "description": "ListAccountWorkflowReadinessFollowUps.tenant_id. Optional customer selector matches notification evidence or a customer-specific subscription, including broader account watches.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "owner",
            "in": "query",
            "description": "ListAccountWorkflowReadinessFollowUps.owner. Exact coordination owner, distinct from application blocker ownership.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "workflow",
            "in": "query",
            "description": "ListAccountWorkflowReadinessFollowUps.workflow. Exact workflow name; global evaluation failures have no workflow.",
            "schema": {
              "type": "string",
              "maxLength": 63
            }
          },
          {
            "name": "due",
            "in": "query",
            "description": "ListAccountWorkflowReadinessFollowUps.due. Defaults to all pending follow-ups.",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "overdue",
                "upcoming"
              ]
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "ListAccountWorkflowReadinessFollowUps.offset. Live zero-based offset, defaults to zero.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 278000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "ListAccountWorkflowReadinessFollowUps.limit. Page size, defaults to 20.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "reminder_only",
            "in": "query",
            "description": "ListAccountWorkflowReadinessFollowUps.reminder_only. Defaults to false; true selects active durable due reminders using the same owner, customer, workflow and environment filters.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "impact_priority",
            "in": "query",
            "description": "ListAccountWorkflowReadinessFollowUps.impact_priority. Exact pinned priority on an unresolved validity review; excludes ordinary follow-ups without review impact.",
            "schema": {
              "type": "string",
              "enum": [
                "normal",
                "high",
                "critical"
              ]
            }
          },
          {
            "name": "impact_kind",
            "in": "query",
            "description": "ListAccountWorkflowReadinessFollowUps.impact_kind. Protected business result category on an unresolved review.",
            "schema": {
              "type": "string",
              "enum": [
                "milestone",
                "outcome"
              ]
            }
          },
          {
            "name": "impact_code",
            "in": "query",
            "description": "ListAccountWorkflowReadinessFollowUps.impact_code. Exact protected result code; requires impact_kind to avoid milestone/outcome ambiguity.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "sort",
            "in": "query",
            "description": "ListAccountWorkflowReadinessFollowUps.sort. Defaults to due. Business impact ordering puts overdue follow-ups first, then critical/high/normal unresolved review priority, then due time and stable notification identity. Other follow-ups have no declared review priority. Filtering and sorting precede live pagination within the retained candidate window.",
            "schema": {
              "type": "string",
              "enum": [
                "due",
                "business_impact"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "ListAccountWorkflowReadinessFollowUps. Retained follow-up page.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowReadinessFollowUpsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflow-readiness/follow-ups": {
      "get": {
        "operationId": "ListPlatformTenantSelfWorkflowReadinessFollowUps",
        "summary": "List PlatformTenantSelf readiness follow-up work queue",
        "description": "ListPlatformTenantSelfWorkflowReadinessFollowUps. Read retained pending follow-ups across subscriptions for an explicit application and environment. Due-time ordering puts overdue first. Pages are live and may move; refresh after edits. Account reads require read scope and MFA; customer reads require Operations read.",
        "tags": [
          "operations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "ListPlatformTenantSelfWorkflowReadinessFollowUps.view. Select follow-ups (default) or current cross-case next actions. Next-action view uses action ownership/deadlines; reminder and business-impact selectors are incompatible.",
            "schema": {
              "type": "string",
              "enum": [
                "follow_ups",
                "next_actions"
              ]
            }
          },
          {
            "name": "action_kind",
            "in": "query",
            "required": false,
            "description": "ListPlatformTenantSelfWorkflowReadinessFollowUps.action_kind. Exact action kind in next-action view.",
            "schema": {
              "type": "string",
              "enum": [
                "response_check_in",
                "decision_revalidation",
                "handoff_acceptance",
                "handoff_reassignment",
                "escalation_acknowledgment",
                "coordinator_completion",
                "scheduled_evidence_check",
                "coordinator_evidence_review",
                "coordinator_revision",
                "dependency_review",
                "follow_up",
                "fulfillment_review"
              ]
            }
          },
          {
            "name": "action_trigger",
            "in": "query",
            "required": false,
            "description": "ListPlatformTenantSelfWorkflowReadinessFollowUps.action_trigger. Exact trigger in next-action view.",
            "schema": {
              "type": "string",
              "enum": [
                "human",
                "automatic",
                "suggested"
              ]
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": true,
            "description": "ListPlatformTenantSelfWorkflowReadinessFollowUps. Application environment scope.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "app_id",
            "in": "query",
            "required": true,
            "description": "ListPlatformTenantSelfWorkflowReadinessFollowUps. Application UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "owner",
            "in": "query",
            "description": "ListPlatformTenantSelfWorkflowReadinessFollowUps.owner. Exact coordination owner, distinct from application blocker ownership.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "workflow",
            "in": "query",
            "description": "ListPlatformTenantSelfWorkflowReadinessFollowUps.workflow. Exact workflow name; global evaluation failures have no workflow.",
            "schema": {
              "type": "string",
              "maxLength": 63
            }
          },
          {
            "name": "due",
            "in": "query",
            "description": "ListPlatformTenantSelfWorkflowReadinessFollowUps.due. Defaults to all pending follow-ups.",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "overdue",
                "upcoming"
              ]
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "ListPlatformTenantSelfWorkflowReadinessFollowUps.offset. Live zero-based offset, defaults to zero.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 278000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "ListPlatformTenantSelfWorkflowReadinessFollowUps.limit. Page size, defaults to 20.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "reminder_only",
            "in": "query",
            "description": "ListPlatformTenantSelfWorkflowReadinessFollowUps.reminder_only. Defaults to false; true selects active durable due reminders using the same owner, customer, workflow and environment filters.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "impact_priority",
            "in": "query",
            "description": "ListPlatformTenantSelfWorkflowReadinessFollowUps.impact_priority. Exact pinned priority on an unresolved validity review; excludes ordinary follow-ups without review impact.",
            "schema": {
              "type": "string",
              "enum": [
                "normal",
                "high",
                "critical"
              ]
            }
          },
          {
            "name": "impact_kind",
            "in": "query",
            "description": "ListPlatformTenantSelfWorkflowReadinessFollowUps.impact_kind. Protected business result category on an unresolved review.",
            "schema": {
              "type": "string",
              "enum": [
                "milestone",
                "outcome"
              ]
            }
          },
          {
            "name": "impact_code",
            "in": "query",
            "description": "ListPlatformTenantSelfWorkflowReadinessFollowUps.impact_code. Exact protected result code; requires impact_kind to avoid milestone/outcome ambiguity.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "sort",
            "in": "query",
            "description": "ListPlatformTenantSelfWorkflowReadinessFollowUps.sort. Defaults to due. Business impact ordering puts overdue follow-ups first, then critical/high/normal unresolved review priority, then due time and stable notification identity. Other follow-ups have no declared review priority. Filtering and sorting precede live pagination within the retained candidate window.",
            "schema": {
              "type": "string",
              "enum": [
                "due",
                "business_impact"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "ListPlatformTenantSelfWorkflowReadinessFollowUps. Retained follow-up page.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowReadinessFollowUpsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflow-readiness/timeline": {
      "get": {
        "operationId": "GetAccountWorkflowCoordinationTimeline",
        "summary": "Read account workflow coordination timeline",
        "description": "GetAccountWorkflowCoordinationTimeline. Read a bounded chronological projection from current retained readiness inboxes for an exact subject and workflow instance. Observation clocks are server times; latest snapshots do not reconstruct every past edit. This is not a complete audit trail and does not authorize execution. Sources are read independently and live offset pages may move. Account access requires read scope and MFA; customer access requires Operations read.",
        "tags": [
          "operations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "GetAccountWorkflowCoordinationTimeline.slug. Application slug.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": true,
            "description": "GetAccountWorkflowCoordinationTimeline.scope. Explicit application environment.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tenant_id",
            "in": "query",
            "required": false,
            "description": "GetAccountWorkflowCoordinationTimeline.tenant_id. Exact customer identity. Omission selects account-owned workflows only, not all customers.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "subject_type",
            "in": "query",
            "required": true,
            "description": "GetAccountWorkflowCoordinationTimeline.subject_type. Exact business subject type.",
            "schema": {
              "type": "string",
              "maxLength": 63
            }
          },
          {
            "name": "subject_id",
            "in": "query",
            "required": true,
            "description": "GetAccountWorkflowCoordinationTimeline.subject_id. Exact business subject identifier.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "workflow",
            "in": "query",
            "required": true,
            "description": "GetAccountWorkflowCoordinationTimeline.workflow. Exact declared workflow name.",
            "schema": {
              "type": "string",
              "maxLength": 63
            }
          },
          {
            "name": "instance_id",
            "in": "query",
            "required": true,
            "description": "GetAccountWorkflowCoordinationTimeline.instance_id. Exact business workflow instance.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "GetAccountWorkflowCoordinationTimeline.offset. Live zero-based event offset. Refresh after edits or retention changes.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 65700,
              "default": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "GetAccountWorkflowCoordinationTimeline.limit. Maximum events per page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "GetAccountWorkflowCoordinationTimeline. Retained workflow coordination timeline with source coverage and limitations.",
            "content": {
              "application/json": {
                "example": {
                  "items": [],
                  "sources": [],
                  "subject": {
                    "type": "order",
                    "id": "order-1"
                  },
                  "workflow": "checkout",
                  "instance_id": "order-1",
                  "scope": "prod",
                  "evaluated_at": "2026-10-11T08:00:00Z",
                  "total_count": 0,
                  "next_offset": 0,
                  "has_more": false,
                  "retention_limited": true,
                  "sources_truncated": false,
                  "history_truncated": false,
                  "limitations": [
                    "Only retained inbox history is available."
                  ]
                },
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowCoordinationTimeline"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflow-readiness/timeline": {
      "get": {
        "operationId": "GetPlatformTenantSelfWorkflowCoordinationTimeline",
        "summary": "Read customer workflow coordination timeline",
        "description": "GetPlatformTenantSelfWorkflowCoordinationTimeline. Read a bounded chronological projection from current retained readiness inboxes for an exact subject and workflow instance. Observation clocks are server times; latest snapshots do not reconstruct every past edit. This is not a complete audit trail and does not authorize execution. Sources are read independently and live offset pages may move. Account access requires read scope and MFA; customer access requires Operations read.",
        "tags": [
          "operations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "app_id",
            "in": "query",
            "required": true,
            "description": "GetPlatformTenantSelfWorkflowCoordinationTimeline.app_id. Application UUID; customer identity comes from authentication.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": true,
            "description": "GetPlatformTenantSelfWorkflowCoordinationTimeline.scope. Explicit application environment.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subject_type",
            "in": "query",
            "required": true,
            "description": "GetPlatformTenantSelfWorkflowCoordinationTimeline.subject_type. Exact business subject type.",
            "schema": {
              "type": "string",
              "maxLength": 63
            }
          },
          {
            "name": "subject_id",
            "in": "query",
            "required": true,
            "description": "GetPlatformTenantSelfWorkflowCoordinationTimeline.subject_id. Exact business subject identifier.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "workflow",
            "in": "query",
            "required": true,
            "description": "GetPlatformTenantSelfWorkflowCoordinationTimeline.workflow. Exact declared workflow name.",
            "schema": {
              "type": "string",
              "maxLength": 63
            }
          },
          {
            "name": "instance_id",
            "in": "query",
            "required": true,
            "description": "GetPlatformTenantSelfWorkflowCoordinationTimeline.instance_id. Exact business workflow instance.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "GetPlatformTenantSelfWorkflowCoordinationTimeline.offset. Live zero-based event offset. Refresh after edits or retention changes.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 65700,
              "default": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "GetPlatformTenantSelfWorkflowCoordinationTimeline.limit. Maximum events per page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "GetPlatformTenantSelfWorkflowCoordinationTimeline. Retained workflow coordination timeline with source coverage and limitations.",
            "content": {
              "application/json": {
                "example": {
                  "items": [],
                  "sources": [],
                  "subject": {
                    "type": "order",
                    "id": "order-1"
                  },
                  "workflow": "checkout",
                  "instance_id": "order-1",
                  "scope": "prod",
                  "evaluated_at": "2026-10-11T08:00:00Z",
                  "total_count": 0,
                  "next_offset": 0,
                  "has_more": false,
                  "retention_limited": true,
                  "sources_truncated": false,
                  "history_truncated": false,
                  "limitations": [
                    "Only retained inbox history is available."
                  ]
                },
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowCoordinationTimeline"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflow-readiness/case": {
      "get": {
        "operationId": "GetAccountWorkflowCase",
        "summary": "Read account workflow case overview",
        "description": "GetAccountWorkflowCase. Combine retained current application state, blockers, dependencies, verification and readiness with exact matching open follow-ups, advisory next steps and a retained coordination timeline. Evidence and coordination are independently read. Missing or stale reports cannot establish readiness or business success. The application retains outcome interpretation, authorization and execution. Account reads require an explicit customer selector, read scope and MFA; customer identity derives from authentication.",
        "tags": [
          "operations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "GetAccountWorkflowCase.slug. Application slug.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": true,
            "description": "GetAccountWorkflowCase.scope. Explicit application environment.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tenant_id",
            "in": "query",
            "required": true,
            "description": "GetAccountWorkflowCase.tenant_id. Required exact customer UUID; broad business-reference projections are not accepted.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "subject_type",
            "in": "query",
            "required": true,
            "description": "GetAccountWorkflowCase.subject_type. Exact business subject type.",
            "schema": {
              "type": "string",
              "maxLength": 63
            }
          },
          {
            "name": "subject_id",
            "in": "query",
            "required": true,
            "description": "GetAccountWorkflowCase.subject_id. Exact business subject identifier.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "workflow",
            "in": "query",
            "required": true,
            "description": "GetAccountWorkflowCase.workflow. Exact declared workflow name.",
            "schema": {
              "type": "string",
              "maxLength": 63
            }
          },
          {
            "name": "instance_id",
            "in": "query",
            "required": true,
            "description": "GetAccountWorkflowCase.instance_id. Exact business workflow instance.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "GetAccountWorkflowCase.offset. Live event offset for the nested timeline only; follow-ups return their own bounded overview.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 65700,
              "default": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "GetAccountWorkflowCase.limit. Nested timeline page size; defaults to 20 with maximum 100.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "GetAccountWorkflowCase. Current evidence and retained coordination for one exact business workflow case.",
            "content": {
              "application/json": {
                "example": {
                  "guidance": [],
                  "guidance_status": "evidence_unavailable",
                  "guidance_truncated": false,
                  "status": "unknown",
                  "summary": "No retained application report is available.",
                  "follow_ups": [],
                  "follow_up_count": 0,
                  "overdue_follow_up_count": 0,
                  "follow_ups_truncated": false,
                  "actions": [],
                  "actions_truncated": false,
                  "timeline": {
                    "items": [],
                    "sources": [],
                    "subject": {
                      "type": "order",
                      "id": "order-1"
                    },
                    "workflow": "checkout",
                    "instance_id": "order-1",
                    "scope": "prod",
                    "evaluated_at": "2026-10-11T08:00:00Z",
                    "total_count": 0,
                    "next_offset": 0,
                    "has_more": false,
                    "retention_limited": true,
                    "sources_truncated": false,
                    "history_truncated": false,
                    "limitations": [
                      "Only retained inbox history is available."
                    ]
                  },
                  "evidence_checked_at": "2026-10-11T08:00:00Z",
                  "coordination_checked_at": "2026-10-11T08:00:00Z",
                  "evaluated_at": "2026-10-11T08:00:00Z",
                  "limitations": [
                    "Independent live reads; application owns business execution."
                  ]
                },
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowCase"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflow-readiness/case": {
      "get": {
        "operationId": "GetPlatformTenantSelfWorkflowCase",
        "summary": "Read customer workflow case overview",
        "description": "GetPlatformTenantSelfWorkflowCase. Combine retained current application state, blockers, dependencies, verification and readiness with exact matching open follow-ups, advisory next steps and a retained coordination timeline. Evidence and coordination are independently read. Missing or stale reports cannot establish readiness or business success. The application retains outcome interpretation, authorization and execution. Account reads require an explicit customer selector, read scope and MFA; customer identity derives from authentication.",
        "tags": [
          "operations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "app_id",
            "in": "query",
            "required": true,
            "description": "GetPlatformTenantSelfWorkflowCase.app_id. Application UUID; customer identity comes from authentication.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": true,
            "description": "GetPlatformTenantSelfWorkflowCase.scope. Explicit application environment.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subject_type",
            "in": "query",
            "required": true,
            "description": "GetPlatformTenantSelfWorkflowCase.subject_type. Exact business subject type.",
            "schema": {
              "type": "string",
              "maxLength": 63
            }
          },
          {
            "name": "subject_id",
            "in": "query",
            "required": true,
            "description": "GetPlatformTenantSelfWorkflowCase.subject_id. Exact business subject identifier.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "workflow",
            "in": "query",
            "required": true,
            "description": "GetPlatformTenantSelfWorkflowCase.workflow. Exact declared workflow name.",
            "schema": {
              "type": "string",
              "maxLength": 63
            }
          },
          {
            "name": "instance_id",
            "in": "query",
            "required": true,
            "description": "GetPlatformTenantSelfWorkflowCase.instance_id. Exact business workflow instance.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "GetPlatformTenantSelfWorkflowCase.offset. Live event offset for the nested timeline only; follow-ups return their own bounded overview.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 65700,
              "default": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "GetPlatformTenantSelfWorkflowCase.limit. Nested timeline page size; defaults to 20 with maximum 100.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "GetPlatformTenantSelfWorkflowCase. Current evidence and retained coordination for one exact business workflow case.",
            "content": {
              "application/json": {
                "example": {
                  "guidance": [],
                  "guidance_status": "evidence_unavailable",
                  "guidance_truncated": false,
                  "status": "unknown",
                  "summary": "No retained application report is available.",
                  "follow_ups": [],
                  "follow_up_count": 0,
                  "overdue_follow_up_count": 0,
                  "follow_ups_truncated": false,
                  "actions": [],
                  "actions_truncated": false,
                  "timeline": {
                    "items": [],
                    "sources": [],
                    "subject": {
                      "type": "order",
                      "id": "order-1"
                    },
                    "workflow": "checkout",
                    "instance_id": "order-1",
                    "scope": "prod",
                    "evaluated_at": "2026-10-11T08:00:00Z",
                    "total_count": 0,
                    "next_offset": 0,
                    "has_more": false,
                    "retention_limited": true,
                    "sources_truncated": false,
                    "history_truncated": false,
                    "limitations": [
                      "Only retained inbox history is available."
                    ]
                  },
                  "evidence_checked_at": "2026-10-11T08:00:00Z",
                  "coordination_checked_at": "2026-10-11T08:00:00Z",
                  "evaluated_at": "2026-10-11T08:00:00Z",
                  "limitations": [
                    "Independent live reads; application owns business execution."
                  ]
                },
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowCase"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflow-readiness/playbook-progress": {
      "post": {
        "operationId": "StartAccountWorkflowPlaybookProgress",
        "summary": "Start pinned workflow playbook progress",
        "description": "StartAccountWorkflowPlaybookProgress. Start from a currently matched fresh application playbook. Pin exact rule, workflow version and immutable reporting definition. Repeated starts return the existing checklist. Requires account write scope and MFA or customer operations-manage scope. Customer identity derives from authentication. Checklist completion does not establish readiness, authorize execution or report business success. At most 100 records per exact case; the latest 64 review changes per record are retained.",
        "tags": [
          "operations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "StartAccountWorkflowPlaybookProgress.slug. Application slug.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": true,
            "description": "StartAccountWorkflowPlaybookProgress.scope. Explicit application environment.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tenant_id",
            "in": "query",
            "required": true,
            "description": "StartAccountWorkflowPlaybookProgress.tenant_id. Required exact customer UUID; broad business-reference projections are not accepted.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "subject_type",
            "in": "query",
            "required": true,
            "description": "StartAccountWorkflowPlaybookProgress.subject_type. Exact business subject type.",
            "schema": {
              "type": "string",
              "maxLength": 63
            }
          },
          {
            "name": "subject_id",
            "in": "query",
            "required": true,
            "description": "StartAccountWorkflowPlaybookProgress.subject_id. Exact business subject identifier.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "workflow",
            "in": "query",
            "required": true,
            "description": "StartAccountWorkflowPlaybookProgress.workflow. Exact declared workflow name.",
            "schema": {
              "type": "string",
              "maxLength": 63
            }
          },
          {
            "name": "instance_id",
            "in": "query",
            "required": true,
            "description": "StartAccountWorkflowPlaybookProgress.instance_id. Exact business workflow instance.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationWorkflowPlaybookProgressStartRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "StartAccountWorkflowPlaybookProgress. Durable pinned checklist after the accepted start or review.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowPlaybookProgress"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflow-readiness/playbook-progress/{id}": {
      "patch": {
        "operationId": "UpdateAccountWorkflowPlaybookProgress",
        "summary": "Update pinned workflow playbook progress",
        "description": "UpdateAccountWorkflowPlaybookProgress. Replace one frozen checklist item using the expected revision. Record authenticated reviewer, note and scoped operation or milestone evidence. Conflicts return 409. Existing guidance is never upgraded. Requires account write scope and MFA or customer operations-manage scope. Customer identity derives from authentication. Checklist completion does not establish readiness, authorize execution or report business success. At most 100 records per exact case; the latest 64 review changes per record are retained.",
        "tags": [
          "operations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "UpdateAccountWorkflowPlaybookProgress.slug. Application slug.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": true,
            "description": "UpdateAccountWorkflowPlaybookProgress.scope. Explicit application environment.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tenant_id",
            "in": "query",
            "required": true,
            "description": "UpdateAccountWorkflowPlaybookProgress.tenant_id. Required exact customer UUID; broad business-reference projections are not accepted.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "subject_type",
            "in": "query",
            "required": true,
            "description": "UpdateAccountWorkflowPlaybookProgress.subject_type. Exact business subject type.",
            "schema": {
              "type": "string",
              "maxLength": 63
            }
          },
          {
            "name": "subject_id",
            "in": "query",
            "required": true,
            "description": "UpdateAccountWorkflowPlaybookProgress.subject_id. Exact business subject identifier.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "workflow",
            "in": "query",
            "required": true,
            "description": "UpdateAccountWorkflowPlaybookProgress.workflow. Exact declared workflow name.",
            "schema": {
              "type": "string",
              "maxLength": 63
            }
          },
          {
            "name": "instance_id",
            "in": "query",
            "required": true,
            "description": "UpdateAccountWorkflowPlaybookProgress.instance_id. Exact business workflow instance.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "UpdateAccountWorkflowPlaybookProgress.id. Durable checklist UUID belonging to this exact case.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationWorkflowPlaybookProgressUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "UpdateAccountWorkflowPlaybookProgress. Durable pinned checklist after the accepted start or review.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowPlaybookProgress"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflow-readiness/playbook-progress": {
      "post": {
        "operationId": "StartPlatformTenantSelfWorkflowPlaybookProgress",
        "summary": "Start customer pinned workflow playbook progress",
        "description": "StartPlatformTenantSelfWorkflowPlaybookProgress. Start from a currently matched fresh application playbook. Pin exact rule, workflow version and immutable reporting definition. Repeated starts return the existing checklist. Requires account write scope and MFA or customer operations-manage scope. Customer identity derives from authentication. Checklist completion does not establish readiness, authorize execution or report business success. At most 100 records per exact case; the latest 64 review changes per record are retained.",
        "tags": [
          "operations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "app_id",
            "in": "query",
            "required": true,
            "description": "StartPlatformTenantSelfWorkflowPlaybookProgress.app_id. Application UUID; customer identity comes from authentication.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": true,
            "description": "StartPlatformTenantSelfWorkflowPlaybookProgress.scope. Explicit application environment.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subject_type",
            "in": "query",
            "required": true,
            "description": "StartPlatformTenantSelfWorkflowPlaybookProgress.subject_type. Exact business subject type.",
            "schema": {
              "type": "string",
              "maxLength": 63
            }
          },
          {
            "name": "subject_id",
            "in": "query",
            "required": true,
            "description": "StartPlatformTenantSelfWorkflowPlaybookProgress.subject_id. Exact business subject identifier.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "workflow",
            "in": "query",
            "required": true,
            "description": "StartPlatformTenantSelfWorkflowPlaybookProgress.workflow. Exact declared workflow name.",
            "schema": {
              "type": "string",
              "maxLength": 63
            }
          },
          {
            "name": "instance_id",
            "in": "query",
            "required": true,
            "description": "StartPlatformTenantSelfWorkflowPlaybookProgress.instance_id. Exact business workflow instance.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationWorkflowPlaybookProgressStartRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "StartPlatformTenantSelfWorkflowPlaybookProgress. Durable pinned checklist after the accepted start or review.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowPlaybookProgress"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflow-readiness/playbook-progress/{id}": {
      "patch": {
        "operationId": "UpdatePlatformTenantSelfWorkflowPlaybookProgress",
        "summary": "Update customer pinned workflow playbook progress",
        "description": "UpdatePlatformTenantSelfWorkflowPlaybookProgress. Replace one frozen checklist item using the expected revision. Record authenticated reviewer, note and scoped operation or milestone evidence. Conflicts return 409. Existing guidance is never upgraded. Requires account write scope and MFA or customer operations-manage scope. Customer identity derives from authentication. Checklist completion does not establish readiness, authorize execution or report business success. At most 100 records per exact case; the latest 64 review changes per record are retained.",
        "tags": [
          "operations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "app_id",
            "in": "query",
            "required": true,
            "description": "UpdatePlatformTenantSelfWorkflowPlaybookProgress.app_id. Application UUID; customer identity comes from authentication.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": true,
            "description": "UpdatePlatformTenantSelfWorkflowPlaybookProgress.scope. Explicit application environment.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subject_type",
            "in": "query",
            "required": true,
            "description": "UpdatePlatformTenantSelfWorkflowPlaybookProgress.subject_type. Exact business subject type.",
            "schema": {
              "type": "string",
              "maxLength": 63
            }
          },
          {
            "name": "subject_id",
            "in": "query",
            "required": true,
            "description": "UpdatePlatformTenantSelfWorkflowPlaybookProgress.subject_id. Exact business subject identifier.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "workflow",
            "in": "query",
            "required": true,
            "description": "UpdatePlatformTenantSelfWorkflowPlaybookProgress.workflow. Exact declared workflow name.",
            "schema": {
              "type": "string",
              "maxLength": 63
            }
          },
          {
            "name": "instance_id",
            "in": "query",
            "required": true,
            "description": "UpdatePlatformTenantSelfWorkflowPlaybookProgress.instance_id. Exact business workflow instance.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "UpdatePlatformTenantSelfWorkflowPlaybookProgress.id. Durable checklist UUID belonging to this exact case.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationWorkflowPlaybookProgressUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "UpdatePlatformTenantSelfWorkflowPlaybookProgress. Durable pinned checklist after the accepted start or review.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowPlaybookProgress"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflow-readiness/playbook-progress/{id}/evidence-watch": {
      "post": {
        "operationId": "ConfigureAccountWorkflowPlaybookEvidenceWatch",
        "summary": "Configure account checklist evidence monitoring",
        "description": "ConfigureAccountWorkflowPlaybookEvidenceWatch. Explicitly enroll or stop a pinned checklist in an existing readiness inbox. Requires the exact checklist revision and watch configuration revision (zero for a new watch). Enabling captures a baseline without delivering a notice. Status or reason changes subsequently publish one grouped notification; clocks and report revisions alone do not notify. Account write scope and MFA or tenant operations-manage scope are required. Closure and revision are rechecked under the shared writer lock before publication. Polling does not change checklist progress or business state. At most 20 retained watches per subscription; stopped entries may be reclaimed for new watches.",
        "tags": [
          "operations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "ConfigureAccountWorkflowPlaybookEvidenceWatch.slug. Application slug.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": true,
            "description": "ConfigureAccountWorkflowPlaybookEvidenceWatch.scope. Explicit application environment.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tenant_id",
            "in": "query",
            "required": true,
            "description": "ConfigureAccountWorkflowPlaybookEvidenceWatch.tenant_id. Required exact customer UUID; broad business-reference projections are not accepted.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "subject_type",
            "in": "query",
            "required": true,
            "description": "ConfigureAccountWorkflowPlaybookEvidenceWatch.subject_type. Exact business subject type.",
            "schema": {
              "type": "string",
              "maxLength": 63
            }
          },
          {
            "name": "subject_id",
            "in": "query",
            "required": true,
            "description": "ConfigureAccountWorkflowPlaybookEvidenceWatch.subject_id. Exact business subject identifier.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "workflow",
            "in": "query",
            "required": true,
            "description": "ConfigureAccountWorkflowPlaybookEvidenceWatch.workflow. Exact declared workflow name.",
            "schema": {
              "type": "string",
              "maxLength": 63
            }
          },
          {
            "name": "instance_id",
            "in": "query",
            "required": true,
            "description": "ConfigureAccountWorkflowPlaybookEvidenceWatch.instance_id. Exact business workflow instance.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "ConfigureAccountWorkflowPlaybookEvidenceWatch.id. Durable checklist UUID belonging to this exact case.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationWorkflowPlaybookEvidenceWatchRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "ConfigureAccountWorkflowPlaybookEvidenceWatch. Watch configuration and saved evidence baseline.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowPlaybookEvidenceWatch"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflow-readiness/playbook-progress/{id}/reviews": {
      "post": {
        "operationId": "ReviewAccountWorkflowPlaybookProgress",
        "summary": "Record account playbook review decision",
        "description": "ReviewAccountWorkflowPlaybookProgress. Record continue, retire or replace with a required human reason and expected source revision. Retire and replace permanently close source coordination. Replacement requires an already-started active applicable target in the same exact case, its expected revision, and an atomic target-state check. No item evidence, pinned guidance, business outcome or execution authority is changed. Account write scope and MFA or customer operations-manage scope are required; customer ownership derives from authentication. Applicability is observed before the write, not transactionally locked application evidence.",
        "tags": [
          "operations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "ReviewAccountWorkflowPlaybookProgress.slug. Application slug.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": true,
            "description": "ReviewAccountWorkflowPlaybookProgress.scope. Explicit application environment.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tenant_id",
            "in": "query",
            "required": true,
            "description": "ReviewAccountWorkflowPlaybookProgress.tenant_id. Required exact customer UUID; broad business-reference projections are not accepted.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "subject_type",
            "in": "query",
            "required": true,
            "description": "ReviewAccountWorkflowPlaybookProgress.subject_type. Exact business subject type.",
            "schema": {
              "type": "string",
              "maxLength": 63
            }
          },
          {
            "name": "subject_id",
            "in": "query",
            "required": true,
            "description": "ReviewAccountWorkflowPlaybookProgress.subject_id. Exact business subject identifier.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "workflow",
            "in": "query",
            "required": true,
            "description": "ReviewAccountWorkflowPlaybookProgress.workflow. Exact declared workflow name.",
            "schema": {
              "type": "string",
              "maxLength": 63
            }
          },
          {
            "name": "instance_id",
            "in": "query",
            "required": true,
            "description": "ReviewAccountWorkflowPlaybookProgress.instance_id. Exact business workflow instance.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "ReviewAccountWorkflowPlaybookProgress.id. Durable checklist UUID belonging to this exact case.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationWorkflowPlaybookReviewRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "ReviewAccountWorkflowPlaybookProgress. Source checklist with the committed durable decision and updated shared revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowPlaybookProgress"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflow-readiness/playbook-progress/{id}/evidence-watch": {
      "post": {
        "operationId": "ConfigurePlatformTenantSelfWorkflowPlaybookEvidenceWatch",
        "summary": "Configure customer checklist evidence monitoring",
        "description": "ConfigurePlatformTenantSelfWorkflowPlaybookEvidenceWatch. Explicitly enroll or stop a pinned checklist in an existing readiness inbox. Requires the exact checklist revision and watch configuration revision (zero for a new watch). Enabling captures a baseline without delivering a notice. Status or reason changes subsequently publish one grouped notification; clocks and report revisions alone do not notify. Account write scope and MFA or tenant operations-manage scope are required. Closure and revision are rechecked under the shared writer lock before publication. Polling does not change checklist progress or business state. At most 20 retained watches per subscription; stopped entries may be reclaimed for new watches.",
        "tags": [
          "operations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "app_id",
            "in": "query",
            "required": true,
            "description": "ConfigurePlatformTenantSelfWorkflowPlaybookEvidenceWatch.app_id. Application UUID; customer identity comes from authentication.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": true,
            "description": "ConfigurePlatformTenantSelfWorkflowPlaybookEvidenceWatch.scope. Explicit application environment.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subject_type",
            "in": "query",
            "required": true,
            "description": "ConfigurePlatformTenantSelfWorkflowPlaybookEvidenceWatch.subject_type. Exact business subject type.",
            "schema": {
              "type": "string",
              "maxLength": 63
            }
          },
          {
            "name": "subject_id",
            "in": "query",
            "required": true,
            "description": "ConfigurePlatformTenantSelfWorkflowPlaybookEvidenceWatch.subject_id. Exact business subject identifier.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "workflow",
            "in": "query",
            "required": true,
            "description": "ConfigurePlatformTenantSelfWorkflowPlaybookEvidenceWatch.workflow. Exact declared workflow name.",
            "schema": {
              "type": "string",
              "maxLength": 63
            }
          },
          {
            "name": "instance_id",
            "in": "query",
            "required": true,
            "description": "ConfigurePlatformTenantSelfWorkflowPlaybookEvidenceWatch.instance_id. Exact business workflow instance.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "ConfigurePlatformTenantSelfWorkflowPlaybookEvidenceWatch.id. Durable checklist UUID belonging to this exact case.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationWorkflowPlaybookEvidenceWatchRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "ConfigurePlatformTenantSelfWorkflowPlaybookEvidenceWatch. Watch configuration and saved evidence baseline.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowPlaybookEvidenceWatch"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/platform-tenant-self/workflow-readiness/playbook-progress/{id}/reviews": {
      "post": {
        "operationId": "ReviewPlatformTenantSelfWorkflowPlaybookProgress",
        "summary": "Record customer playbook review decision",
        "description": "ReviewPlatformTenantSelfWorkflowPlaybookProgress. Record continue, retire or replace with a required human reason and expected source revision. Retire and replace permanently close source coordination. Replacement requires an already-started active applicable target in the same exact case, its expected revision, and an atomic target-state check. No item evidence, pinned guidance, business outcome or execution authority is changed. Account write scope and MFA or customer operations-manage scope are required; customer ownership derives from authentication. Applicability is observed before the write, not transactionally locked application evidence.",
        "tags": [
          "operations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "app_id",
            "in": "query",
            "required": true,
            "description": "ReviewPlatformTenantSelfWorkflowPlaybookProgress.app_id. Application UUID; customer identity comes from authentication.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": true,
            "description": "ReviewPlatformTenantSelfWorkflowPlaybookProgress.scope. Explicit application environment.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subject_type",
            "in": "query",
            "required": true,
            "description": "ReviewPlatformTenantSelfWorkflowPlaybookProgress.subject_type. Exact business subject type.",
            "schema": {
              "type": "string",
              "maxLength": 63
            }
          },
          {
            "name": "subject_id",
            "in": "query",
            "required": true,
            "description": "ReviewPlatformTenantSelfWorkflowPlaybookProgress.subject_id. Exact business subject identifier.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "workflow",
            "in": "query",
            "required": true,
            "description": "ReviewPlatformTenantSelfWorkflowPlaybookProgress.workflow. Exact declared workflow name.",
            "schema": {
              "type": "string",
              "maxLength": 63
            }
          },
          {
            "name": "instance_id",
            "in": "query",
            "required": true,
            "description": "ReviewPlatformTenantSelfWorkflowPlaybookProgress.instance_id. Exact business workflow instance.",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "ReviewPlatformTenantSelfWorkflowPlaybookProgress.id. Durable checklist UUID belonging to this exact case.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OperationWorkflowPlaybookReviewRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "ReviewPlatformTenantSelfWorkflowPlaybookProgress. Source checklist with the committed durable decision and updated shared revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationWorkflowPlaybookProgress"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/stored/{name}/live-baselines": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "description": "Stored workflow whose baseline catalog is being listed.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "listStoredWorkflowLiveBaselines",
        "summary": "Discover named baseline heads and current retained evidence health.",
        "description": "Read-only coherent snapshot, sorted by baseline name and bounded by the 20-name quota. Requires app read scope. Never runs workflows, checks assertions, repairs evidence or promotes. Evidence availability and renewal readiness are separate observations, not CI gate verdicts: historical baseline targets and baseline age remain allowed by CI. Renewal evaluates original run age and the current target against each promoted policy.",
        "responses": {
          "200": {
            "description": "Current heads and current retained evidence observations; historical audit receipts remain immutable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListStoredWorkflowLiveBaselinesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/stored/{name}/live-baselines/{baseline}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "description": "Stored workflow whose current baseline receipt is being read.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        },
        {
          "name": "baseline",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z0-9]([a-z0-9-]*[a-z0-9])?$"
          },
          "description": "Baseline name whose current promotion receipt is requested."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "getStoredWorkflowLiveBaseline",
        "summary": "Read the current named stored workflow baseline promotion receipt.",
        "description": "Read-only; requires app read scope. Records the exact suite, revision, actor, promotion time and reviewed coverage/age policy.",
        "responses": {
          "200": {
            "description": "Current immutable promotion receipt; inspect retained evidence separately for current validity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoredWorkflowLiveBaseline"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict"
          },
          "410": {
            "description": "This baseline name is permanently retired; its retirement audit remains available from history.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/stored/{name}/live-baselines/{baseline}/history": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "description": "Stored workflow whose baseline audit history is being read.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        },
        {
          "name": "baseline",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z0-9]([a-z0-9-]*[a-z0-9])?$"
          },
          "description": "Baseline name whose immutable promotion and retirement history is requested."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "getStoredWorkflowLiveBaselineHistory",
        "summary": "Read the last 100 promotions for a named stored workflow baseline.",
        "description": "Newest revision first. History is immutable until bounded retention or stored workflow deletion. Requires app read scope.",
        "responses": {
          "200": {
            "description": "Bounded immutable promotion history, including the permanent retirement receipt when present.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoredWorkflowLiveBaselineHistory"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/stored/{name}/live-baselines/{baseline}/promotions/{promotion_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "description": "Stored workflow whose passing suite is being promoted.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        },
        {
          "name": "baseline",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z0-9]([a-z0-9-]*[a-z0-9])?$"
          },
          "description": "Release track to promote within this stored workflow; execution routing is unchanged."
        },
        {
          "name": "promotion_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Stable caller-selected UUID. Retry uncertain requests only with the original ID and identical semantic request."
        }
      ],
      "put": {
        "tags": [
          "workflows"
        ],
        "operationId": "promoteStoredWorkflowLiveBaseline",
        "summary": "Deliberately promote passing retained evidence to a named baseline.",
        "description": "Requires deploy write scope. Atomically checks the explicit current target and version 2 required-case/evidence-age policy, compares expected_revision, appends an attributed receipt and changes the head. expected_revision 0 creates. An identical retained promotion ID replays its original receipt without moving the head or rechecking. Never executes or checks assertions. At most 20 active and 100 lifetime names per stored workflow, with 100 receipts per name; active current suite groups are pinned within the existing suite limit, while linked run retention still applies. Retired names cannot be reused; original promotion retries return historical receipts without reactivation.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PromoteStoredWorkflowLiveBaselineRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Attributed promotion receipt for this request, replayed unchanged on an identical retained retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoredWorkflowLiveBaseline"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict"
          },
          "410": {
            "description": "Promotion cannot reuse a retired baseline name. Choose a different active name explicitly.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/stored/{name}/live-baselines/{baseline}/retirements/{retirement_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "description": "Stored workflow whose named baseline is being retired.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        },
        {
          "name": "baseline",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z0-9]([a-z0-9-]*[a-z0-9])?$"
          },
          "description": "Baseline name to retire permanently within this stored workflow."
        },
        {
          "name": "retirement_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Stable caller-selected retirement UUID; preserve this ID and expected revision for uncertain retries."
        }
      ],
      "put": {
        "tags": [
          "workflows"
        ],
        "operationId": "retireStoredWorkflowLiveBaseline",
        "summary": "Permanently retire a named baseline and release its evidence pin.",
        "description": "Requires deploy write scope and verified email. Atomically compares the positive expected revision and records the authenticated actor. Retirement permanently reserves the name, frees an active-name slot and releases its suite pin for normal retention; no evidence is immediately deleted. Promotion history remains available. Exact retries return the original retirement receipt. Old promotion retries never reactivate the name. At most 20 active and 100 lifetime names per stored workflow.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RetireStoredWorkflowLiveBaselineRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Attributed immutable retirement receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoredWorkflowLiveBaselineRetirement"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict"
          },
          "410": {
            "description": "The requested baseline was previously retired by another retirement request. Read its audit history.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/stored/{name}/live-suites/{suite_id}/start": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "Saved stored workflow whose managed suite is being started.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        },
        {
          "name": "suite_id",
          "in": "path",
          "required": true,
          "description": "Fresh UUIDv7 for creation; reuse the original ID for start recovery.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "startStoredWorkflowLiveSuite",
        "summary": "Start a durable live suite with explicit real-action confirmation.",
        "description": "Creates an immutable ordered selection and admits its first case atomically with the saved run link. Retry this same suite ID and body after a lost response. A retained start replay only reads progress; it never advances later cases. New IDs must be UUIDv7 generated within the last ten minutes. Existing metadata-only suites cannot be taken over.",
        "requestBody": {
          "required": true,
          "description": "Frozen target, saved-case names and real-action confirmation.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartStoredWorkflowLiveSuiteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "startStoredWorkflowLiveSuite returns the original suite identities and current server-derived observations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoredWorkflowLiveSuite"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/stored/{name}/live-suites/{suite_id}/advance": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "Saved stored workflow whose managed suite is being continued.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        },
        {
          "name": "suite_id",
          "in": "path",
          "required": true,
          "description": "Original retained managed suite ID; missing records are never recreated.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "advanceStoredWorkflowLiveSuite",
        "summary": "Check retained results and admit at most one next case of a managed suite.",
        "description": "Requires explicit real-action confirmation on every call. Checks earlier original run IDs and stops on failed, unavailable, outdated or nonterminal results. The next admission and its immutable link commit together. Never recreates missing suites, replaces runs, resumes workflows or cancels them. Repeat while pending to observe execution; reopening history is read-only.",
        "requestBody": {
          "required": true,
          "description": "Explicit authorization to check and continue the original suite.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdvanceStoredWorkflowLiveSuiteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "advanceStoredWorkflowLiveSuite returns the original suite identities and current server-derived observations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoredWorkflowLiveSuite"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/stored/{name}/live-suites": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Saved stored workflow whose shared verification suites are accessed."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "listStoredWorkflowLiveSuites",
        "summary": "List recent shared suite identities without executing or checking workflows.",
        "responses": {
          "200": {
            "description": "listStoredWorkflowLiveSuites returns safe retained suite metadata and server-derived observations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListStoredWorkflowLiveSuitesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/stored/{name}/live-suites/{suite_id}/compare/{baseline_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Stored workflow owning both retained suites."
        },
        {
          "name": "suite_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Candidate suite UUID; direction is baseline to candidate."
        },
        {
          "name": "baseline_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Baseline suite UUID within the same app and stored workflow."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "compareStoredWorkflowLiveSuites",
        "summary": "Compare recorded results in one read-only snapshot without executing or checking runs.",
        "description": "Cases match by name and require equal frozen definition/input/assertion hashes for regression or recovery classification. Historical target drift alone does not invalidate a report. Pending, missing, unchecked and stale reports are unknown. Added and removed refer to the suite selection. No release approval or CI gate is implied.",
        "responses": {
          "200": {
            "description": "Safe comparison of retained evidence, ordered by candidate cases followed by removed baseline cases.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoredWorkflowLiveSuiteComparison"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/stored/{name}/live-suites/{suite_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Stored workflow owning the retained shared suite record."
        },
        {
          "name": "suite_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Stable caller-selected suite UUID. Retry the same immutable selection and ID to attach progress."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "getStoredWorkflowLiveSuite",
        "summary": "Read current retained suite results in a consistent database snapshot.",
        "responses": {
          "200": {
            "description": "getStoredWorkflowLiveSuite returns safe retained suite metadata and server-derived observations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoredWorkflowLiveSuite"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "put": {
        "tags": [
          "workflows"
        ],
        "operationId": "saveStoredWorkflowLiveSuite",
        "summary": "Save a frozen suite selection and monotonically attach existing run IDs; never execute workflows.",
        "responses": {
          "200": {
            "description": "saveStoredWorkflowLiveSuite returns safe retained suite metadata and server-derived observations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoredWorkflowLiveSuite"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "description": "The frozen selection and existing run links to retain. No execution or verdict fields are accepted. Managed execution records cannot be modified here.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveStoredWorkflowLiveSuiteRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/stored/{name}/live-verifications": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Stored workflow whose recent live verification history is requested."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "listStoredWorkflowLiveVerifications",
        "summary": "List recent live verifications and the current published deployment target.",
        "responses": {
          "200": {
            "description": "listStoredWorkflowLiveVerifications returns safe verification identities and observations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListStoredWorkflowLiveVerificationsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/StoredWorkflowInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "startStoredWorkflowLiveVerification",
        "summary": "Explicitly execute one saved case input with atomic target fences and idempotency.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "description": "Stable request key; retry the same key and body to recover the original run."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartStoredWorkflowLiveVerificationRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "startStoredWorkflowLiveVerification returns safe verification identities and observations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoredWorkflowLiveVerification"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/StoredWorkflowInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/stored/{name}/live-verifications/{run_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Stored workflow containing the retained live verification to read."
        },
        {
          "name": "run_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Specific workflow run whose live provenance is requested."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "getStoredWorkflowLiveVerification",
        "summary": "Read one verification without starting a run or evaluating live assertions.",
        "responses": {
          "200": {
            "description": "getStoredWorkflowLiveVerification returns safe verification identities and observations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoredWorkflowLiveVerification"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/StoredWorkflowInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/workflows/stored/{name}/live-verifications/{run_id}/check": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Stored workflow whose frozen live assertions will be checked."
        },
        {
          "name": "run_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Retained live run whose terminal outcomes will be evaluated."
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "checkStoredWorkflowLiveVerification",
        "summary": "Check terminal run outcomes against frozen live assertions and retain a safe summary.",
        "responses": {
          "200": {
            "description": "checkStoredWorkflowLiveVerification returns safe verification identities and observations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoredWorkflowLiveVerification"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/StoredWorkflowConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/StoredWorkflowInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/release-sets/verification-runs/{run}/diagnostics": {
      "get": {
        "operationId": "getProjectBindingVerificationRunDiagnostics",
        "tags": [
          "projects"
        ],
        "summary": "Explain verification blockers and safe public changes without admitting work",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Slug of the project for diagnosing blockers in a project verification graph."
          },
          {
            "name": "environment",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Project environment for diagnosing blockers in a project verification graph."
          },
          {
            "name": "run",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Verification receipt UUID for diagnosing blockers in a project verification graph."
          }
        ],
        "responses": {
          "200": {
            "description": "Read-only public observations and suggested recovery; grants no admission or activation authority.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectBindingVerificationRunDiagnostics"
                }
              }
            }
          },
          "400": {
            "description": "Invalid receipt UUID."
          },
          "403": {
            "description": "Read access to every reviewed binding domain is required."
          },
          "404": {
            "description": "No owned receipt was found."
          },
          "503": {
            "description": "Receipt metadata could not be read."
          }
        }
      }
    },
    "/v1/apps/{slug}/bindings/verification-runs/{run}/diagnostics": {
      "get": {
        "operationId": "getBindingVerificationRunDiagnostics",
        "tags": [
          "apps"
        ],
        "summary": "Explain blockers and recovery for an app verification receipt",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Slug of the app for diagnosing an app binding verification receipt."
          },
          {
            "name": "run",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Verification receipt UUID for diagnosing an app binding verification receipt."
          }
        ],
        "responses": {
          "200": {
            "description": "App receipt diagnostics. Read-only public observations and suggested recovery; grants no admission or activation authority.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BindingVerificationRunDiagnostics"
                }
              }
            }
          },
          "400": {
            "description": "App receipt diagnostics. Invalid receipt UUID."
          },
          "403": {
            "description": "App receipt diagnostics. Read access to every reviewed binding domain is required."
          },
          "404": {
            "description": "App receipt diagnostics. No owned receipt was found."
          },
          "503": {
            "description": "App receipt diagnostics. Receipt metadata could not be read."
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/release-sets/verification-runs/review": {
      "post": {
        "operationId": "reviewProjectBindingVerification",
        "tags": [
          "projects"
        ],
        "summary": "Review verification without creating receipts or admitting work",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Slug of the project for reviewing project graph verification before receipt creation."
          },
          {
            "name": "environment",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Project environment for reviewing project graph verification before receipt creation."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReviewProjectBindingVerificationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Server plan, blockers, required consent and opaque review digests. Ready means the plan is available; it is not verification evidence.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectBindingVerificationReview"
                }
              }
            }
          },
          "403": {
            "description": "Project verification review. Read access to every reviewed binding domain is required."
          },
          "409": {
            "description": "The selected deployment, policy or prepared manifest changed."
          },
          "503": {
            "description": "A complete review could not be read."
          }
        }
      }
    },
    "/v1/apps/{slug}/bindings/verification-runs/review": {
      "post": {
        "operationId": "reviewBindingVerification",
        "tags": [
          "apps"
        ],
        "summary": "Review app binding verification selection and consent without admitting work",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Slug of the app for reviewing an app binding plan before admitting work."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReviewBindingVerificationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "App verification review. Server plan, blockers, required consent and opaque review digests. Ready means the plan is available; it is not verification evidence.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BindingVerificationReview"
                }
              }
            }
          },
          "403": {
            "description": "App verification review. Read access to every reviewed binding domain is required."
          },
          "409": {
            "description": "App verification review. The selected deployment, policy or prepared manifest changed."
          },
          "503": {
            "description": "App verification review. A complete review could not be read."
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/release-sets/verification-runs/{run}/complete": {
      "post": {
        "operationId": "completeProjectBindingVerificationRun",
        "tags": [
          "projects"
        ],
        "summary": "completeProjectBindingVerificationRun",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Slug of the project for finalizing a retained project verification graph."
          },
          {
            "name": "environment",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Project environment for finalizing a retained project verification graph."
          },
          {
            "name": "run",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Verification receipt UUID for finalizing a retained project verification graph."
          }
        ],
        "responses": {
          "200": {
            "description": "Frozen graph verification run; qualification does not change traffic.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectBindingVerificationRun"
                }
              }
            }
          },
          "202": {
            "description": "Original receipt remains pending while recognized final readiness conditions settle. No new work was admitted and its expiry is unchanged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectBindingVerificationRun"
                }
              }
            }
          },
          "409": {
            "description": "Frozen membership, routing, policy, configuration or evidence changed."
          },
          "429": {
            "description": "Normal admission or receipt capacity reached."
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/release-sets/verification-runs/{run}/resume": {
      "post": {
        "operationId": "resumeProjectBindingVerificationRun",
        "tags": [
          "projects"
        ],
        "summary": "resumeProjectBindingVerificationRun",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Slug of the project for reconciling unfinished project verification work."
          },
          {
            "name": "environment",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Project environment for reconciling unfinished project verification work."
          },
          {
            "name": "run",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Verification receipt UUID for reconciling unfinished project verification work."
          }
        ],
        "responses": {
          "200": {
            "description": "Project graph reconciliation. Frozen graph verification run; qualification does not change traffic.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectBindingVerificationRun"
                }
              }
            }
          },
          "409": {
            "description": "Project graph reconciliation. Frozen membership, routing, policy, configuration or evidence changed."
          },
          "429": {
            "description": "Project graph reconciliation. Normal admission or receipt capacity reached."
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/release-sets/verification-runs/{run}": {
      "get": {
        "operationId": "getProjectBindingVerificationRun",
        "tags": [
          "projects"
        ],
        "summary": "getProjectBindingVerificationRun",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Slug of the project for reading retained project graph verification status."
          },
          {
            "name": "environment",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Project environment for reading retained project graph verification status."
          },
          {
            "name": "run",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Verification receipt UUID for reading retained project graph verification status."
          }
        ],
        "responses": {
          "200": {
            "description": "Project graph status. Frozen graph verification run; qualification does not change traffic.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectBindingVerificationRun"
                }
              }
            }
          },
          "409": {
            "description": "Project graph status. Frozen membership, routing, policy, configuration or evidence changed."
          },
          "429": {
            "description": "Project graph status. Normal admission or receipt capacity reached."
          }
        }
      },
      "delete": {
        "operationId": "cancelProjectBindingVerificationRun",
        "tags": [
          "projects"
        ],
        "summary": "cancelProjectBindingVerificationRun",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Slug of the project for requesting cancellation of a project verification graph."
          },
          {
            "name": "environment",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Project environment for requesting cancellation of a project verification graph."
          },
          {
            "name": "run",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Verification receipt UUID for requesting cancellation of a project verification graph."
          }
        ],
        "responses": {
          "200": {
            "description": "Project graph cancellation. Frozen graph verification run; qualification does not change traffic.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectBindingVerificationRun"
                }
              }
            }
          },
          "409": {
            "description": "Project graph cancellation. Frozen membership, routing, policy, configuration or evidence changed."
          },
          "429": {
            "description": "Project graph cancellation. Normal admission or receipt capacity reached."
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/release-sets/verification-runs": {
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "listProjectBindingVerificationRuns",
        "summary": "List retained verification receipt summaries without requalifying evidence.",
        "description": "Newest first with creation-time and UUID keyset pagination. Reuse filters with next_cursor. observed_at freezes the expiry cutoff; recorded state may change between pages. Listings grant no admission or release authority.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Slug of the project for listing retained project graph verification receipts."
          },
          {
            "name": "environment",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Project environment for listing retained project graph verification receipts."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "description": "Maximum retained project verification receipts returned on this page."
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 2048
            },
            "description": "Opaque continuation cursor from the previous project verification receipt page."
          },
          {
            "name": "deployment_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Restrict retained project verification receipts to this exact deployment UUID."
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "passed",
                "cancelled",
                "expired"
              ]
            },
            "description": "Restrict project verification receipt discovery to this effective retained status."
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded retained receipt summaries; not a permanent history or proof of current qualification.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BindingVerificationRunList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "createProjectBindingVerificationRun",
        "tags": [
          "projects"
        ],
        "summary": "createProjectBindingVerificationRun",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Slug of the project for creating a reviewed project verification graph."
          },
          {
            "name": "environment",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Project environment for creating a reviewed project verification graph."
          }
        ],
        "responses": {
          "201": {
            "description": "Project graph creation. Frozen graph verification run; qualification does not change traffic.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectBindingVerificationRun"
                }
              }
            }
          },
          "409": {
            "description": "Project graph creation. Frozen membership, routing, policy, configuration or evidence changed."
          },
          "429": {
            "description": "Project graph creation. Normal admission or receipt capacity reached."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateProjectBindingVerificationRunRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/bindings/verification-runs/{run}/steps/{step}/admit": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Slug of the app for admitting one frozen app verification step."
        },
        {
          "name": "run",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Verification receipt UUID for admitting one frozen app verification step."
        },
        {
          "name": "step",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer",
            "minimum": 0,
            "maximum": 127
          },
          "description": "Frozen step index selected for admission within this app receipt."
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "admitBindingVerificationRunStep",
        "summary": "Atomically admit one frozen step or return its previously recorded resource.",
        "responses": {
          "200": {
            "description": "Durable receipt with original identity and deadline.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BindingVerificationRunStep"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/bindings/verification-runs/{run}/complete": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Slug of the app for finalizing an app verification receipt."
        },
        {
          "name": "run",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Verification receipt UUID for finalizing an app verification receipt."
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "completeBindingVerificationRun",
        "summary": "Complete only after fresh server-side policy preflight.",
        "responses": {
          "200": {
            "description": "App receipt completion. Durable receipt with original identity and deadline.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BindingVerificationRun"
                }
              }
            }
          },
          "202": {
            "description": "App receipt completion. Original receipt remains pending while recognized final readiness conditions settle. No new work was admitted and its expiry is unchanged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BindingVerificationRun"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/bindings/verification-runs/{run}/resume": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Slug of the app for reconciling unfinished app verification work."
        },
        {
          "name": "run",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Verification receipt UUID for reconciling unfinished app verification work."
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "resumeBindingVerificationRun",
        "summary": "Confirm the original review without extending deadlines or replacing work.",
        "responses": {
          "200": {
            "description": "App receipt reconciliation. Durable receipt with original identity and deadline.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BindingVerificationRun"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/bindings/verification-runs/{run}": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Slug of the app for inspecting or cancelling an app verification receipt."
        },
        {
          "name": "run",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Verification receipt UUID for inspecting or cancelling an app verification receipt."
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getBindingVerificationRun",
        "summary": "Observe the original plan and current owned or reused resource status.",
        "responses": {
          "200": {
            "description": "App receipt status. Durable receipt with original identity and deadline.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BindingVerificationRun"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "apps"
        ],
        "operationId": "cancelBindingVerificationRun",
        "summary": "Block admissions and cancel only unfinished work owned by this run.",
        "responses": {
          "200": {
            "description": "App receipt cancellation. Durable receipt with original identity and deadline.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BindingVerificationRun"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/bindings/verification-runs": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Slug of the app for discovering or creating app verification receipts."
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "listBindingVerificationRuns",
        "summary": "List retained app binding verification receipt summaries",
        "description": "App receipt discovery. Newest first with creation-time and UUID keyset pagination. Reuse filters with next_cursor. observed_at freezes the expiry cutoff; recorded state may change between pages. Listings grant no admission or release authority.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "description": "Maximum retained app verification receipts returned on this page."
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 2048
            },
            "description": "Opaque continuation cursor from the previous app verification receipt page."
          },
          {
            "name": "deployment_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Restrict retained app verification receipts to this exact deployment UUID."
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "passed",
                "cancelled",
                "expired"
              ]
            },
            "description": "Restrict app verification receipt discovery to this effective retained status."
          },
          {
            "name": "scope",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Only app receipts whose frozen binding scope matches this value are returned."
          },
          {
            "name": "include_members",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "Include app receipts created as members of project verification graphs."
          }
        ],
        "responses": {
          "200": {
            "description": "App receipt discovery. Bounded retained receipt summaries; not a permanent history or proof of current qualification.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BindingVerificationRunList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "createBindingVerificationRun",
        "summary": "Create a reviewed fixed-deadline single-app verification receipt.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBindingVerificationRunRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "App receipt creation. Durable receipt with original identity and deadline.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BindingVerificationRun"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/bindings/queue-canaries/{canary}": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Slug of the app for inspecting or cancelling an existing queue completion canary."
        },
        {
          "name": "canary",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Identifier of the push queue completion canary selected for inspection or cancellation."
        }
      ],
      "get": {
        "tags": [
          "apps"
        ],
        "operationId": "getQueueBindingCanary",
        "summary": "Observe exact-deployment queue completion evidence.",
        "responses": {
          "200": {
            "description": "Current evidence; an in-flight handler may finish after cancellation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueBindingCanary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "apps"
        ],
        "operationId": "cancelQueueBindingCanary",
        "summary": "Cancel the canary and revoke its evidence.",
        "responses": {
          "200": {
            "description": "Queue canary cancellation. Current evidence; an in-flight handler may finish after cancellation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueBindingCanary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/bindings/queue-canaries": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Slug of the app for publishing a consented push queue completion canary."
        }
      ],
      "post": {
        "tags": [
          "apps"
        ],
        "operationId": "createQueueBindingCanary",
        "summary": "Publish one explicitly consented safe message through a push queue binding.",
        "description": "Requires a live pinned deployment declaring this binding in GREGALE_QUEUE_CANARY_BINDINGS. Uses normal queue and runtime capacity; no traffic change.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateQueueBindingCanaryRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Published canary; publication does not prove delivery or handler completion.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueBindingCanary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/release-sets/deactivate": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Slug of the project for deactivating a checked project release set."
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Project environment for deactivating a checked project release set."
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "deactivateCheckedProjectRelease",
        "summary": "Deactivate a checked project release set after verifying fallback recipients",
        "description": "Requires one eligible materialized live 100% fallback per current workload,\na current active graph and enforced binding policies on every fallback.\nPreparation observes routes without changing them. Use the returned manifest\nto qualify exact fallback service dependencies, then deactivate explicitly.\nttl_seconds is zero because the retired graph keeps its existing TTL.\nDeactivation compares active graph, complete fallback routing, current policies,\nfresh evidence, artifacts and service readiness atomically. PostgreSQL rechecks\nrouting and evidence expiry at commit. Missing routes and traffic splits block.\nThe retired release contains an immutable deactivation receipt. Use an\nIdempotency-Key for retries. GitOps-managed workloads remain blocked.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckedProjectReleaseManifest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Deactivate the current graph after checking every fallback recipient.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckedProjectReleaseResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/release-sets/prepare-deactivation": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Slug of the project for reviewing exact weighted fallbacks before graph deactivation."
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Project environment for reviewing exact weighted fallbacks before graph deactivation."
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "prepareCheckedProjectDeactivation",
        "summary": "Prepare checked release-set deactivation to exact weighted fallback routes",
        "description": "Checked release-set deactivation preparation. Requires one eligible materialized live 100% fallback per current workload,\na current active graph and enforced binding policies on every fallback.\nPreparation observes routes without changing them. Use the returned manifest\nto qualify exact fallback service dependencies, then deactivate explicitly.\nttl_seconds is zero because the retired graph keeps its existing TTL.\nDeactivation compares active graph, complete fallback routing, current policies,\nfresh evidence, artifacts and service readiness atomically. PostgreSQL rechecks\nrouting and evidence expiry at commit. Missing routes and traffic splits block.\nThe retired release contains an immutable deactivation receipt. Use an\nIdempotency-Key for retries. GitOps-managed workloads remain blocked.\n",
        "responses": {
          "200": {
            "description": "Prepare checked return to exact 100% weighted fallback routes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckedProjectReleaseManifest"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/release-sets/rollback": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Slug of the project for restoring a retained graph with fresh binding qualification."
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Project environment for restoring a retained graph with fresh binding qualification."
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "rollbackCheckedProjectRelease",
        "summary": "Restore a historical project release set using fresh binding checks",
        "description": "Selects an inactive, unexpired historical release in this project environment.\nRequires a different expected active release, exact historical membership,\ncurrent enforced policies, fresh target-specific evidence and ready artifacts\nand service replicas. Historical expiry is checked again at commit.\nPublishes a new immutable release recording rollback_source_release_id and\nrollback_previous_release_id; history never grants a policy waiver.\nUse an Idempotency-Key for mutation retries. No deployments are awakened.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckedProjectReleaseManifest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Recover a retained historical graph with fresh binding evidence.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckedProjectReleaseResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/release-sets/prepare-rollback": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Slug of the project for reviewing recovery to a selected historical release graph."
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Project environment for reviewing recovery to a selected historical release graph."
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "prepareCheckedProjectRollback",
        "summary": "Prepare checked release-set recovery to a selected retained graph",
        "description": "Checked release-set rollback preparation. Selects an inactive, unexpired historical release in this project environment.\nRequires a different expected active release, exact historical membership,\ncurrent enforced policies, fresh target-specific evidence and ready artifacts\nand service replicas. Historical expiry is checked again at commit.\nPublishes a new immutable release recording rollback_source_release_id and\nrollback_previous_release_id; history never grants a policy waiver.\nUse an Idempotency-Key for mutation retries. No deployments are awakened.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PrepareProjectRollbackRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Prepare recovery to an explicit retained historical graph.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckedProjectReleaseManifest"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/release-sets/activate": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Slug of the project for activating a pinned project graph after binding checks."
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Project environment for activating a pinned project graph after binding checks."
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "activateCheckedProjectRelease",
        "summary": "Activate a checked project release set with pinned binding evidence",
        "description": "Requires an enforced binding release policy on every project member scope.\nPreparation freezes exact deployments, active graph or weighted fallback,\npolicy revisions and internal service targets. It is a metadata observation,\nnot an evidence grant. Qualification uses candidate-specific task probes.\nActivation independently checks all member evidence, service edges, artifacts,\nfull project membership, current policy, evidence expiry, active graph CAS\nand service replica readiness in one transaction. A blocked graph keeps\ncurrent routes. No target handler calls or wakes are made by service probes.\nGeneric graph publication and deactivation remain fail closed under enforcement.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckedProjectReleaseManifest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Activate a pinned graph with fresh checked binding evidence.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckedProjectReleaseResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/release-sets/prepare": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Slug of the project for preparing binding qualification for a pinned release-set manifest."
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Project environment for preparing binding qualification for a pinned release-set manifest."
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "prepareCheckedProjectRelease",
        "summary": "Prepare a project release-set manifest for checked binding qualification",
        "description": "Checked release-set preparation. Requires an enforced binding release policy on every project member scope.\nPreparation freezes exact deployments, active graph or weighted fallback,\npolicy revisions and internal service targets. It is a metadata observation,\nnot an evidence grant. Qualification uses candidate-specific task probes.\nActivation independently checks all member evidence, service edges, artifacts,\nfull project membership, current policy, evidence expiry, active graph CAS\nand service replica readiness in one transaction. A blocked graph keeps\ncurrent routes. No target handler calls or wakes are made by service probes.\nGeneric graph publication and deactivation remain fail closed under enforcement.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublishProjectReleaseSetRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Prepare a pinned graph manifest without changing routes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckedProjectReleaseManifest"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/release-sets/staging/{stage}": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Slug of the project for observing or cancelling a candidate service staging lease."
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Project environment for observing or cancelling a candidate service staging lease."
        },
        {
          "name": "stage",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Identifier of the candidate service staging lease selected for status or cancellation."
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getProjectReleaseStage",
        "summary": "Observe a candidate staging lease.",
        "responses": {
          "200": {
            "description": "Current staging lease and observed service readiness; this conveys no binding evidence.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectReleaseStage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "projects"
        ],
        "operationId": "cancelProjectReleaseStage",
        "summary": "Cancel temporary candidate capacity; active graph and traffic allocations remain authoritative.",
        "responses": {
          "200": {
            "description": "Candidate service staging cancellation. Current staging lease and observed service readiness; this conveys no binding evidence.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectReleaseStage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/projects/{slug}/environments/{environment}/release-sets/staging": {
      "parameters": [
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Slug of the project for temporarily admitting selected candidate services for staging."
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Project environment for temporarily admitting selected candidate services for staging."
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "stageCheckedProjectRelease",
        "summary": "Lease candidate service capacity without publishing routes.",
        "description": "Stages the exact service deployments in a complete prepared forward or rollback manifest.\nNon-GitOps live materialized candidates only; mirror recipients and active service rollouts are excluded.\nPolicy and routing changes fail closed.\nSchedd uses normal admission, preserves serving allocations and never grants extra concurrency.\nCapacity is billable. Repeating the same manifest reuses its unexpired lease without extending it.\nA different manifest conflicts until the current stage is cancelled or expires.\nQualification and activation remain explicit and independently recheck readiness and evidence.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StageProjectReleaseRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Candidate service staging admission. Current staging lease and observed service readiness; this conveys no binding evidence.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectReleaseStage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/apps/{slug}/bindings/release-policy-with-queues": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "scope",
          "in": "query",
          "description": "Deployment scope whose queue release requirements will be replaced. Omit for default.",
          "schema": {
            "type": "string",
            "default": "default",
            "maxLength": 40,
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
          }
        }
      ],
      "put": {
        "tags": [
          "apps"
        ],
        "operationId": "setQueueBindingReleasePolicy",
        "summary": "Replace release policy with explicit per-binding queue readiness requirements.",
        "description": "Requires deploy:write or admin and completed MFA. queue_requirements is\nexplicit, including an empty object to clear it. Names select one shared\nor selected-environment push binding; consumer_readiness requires a\nconfirmed queue environment and an enabled, active, healthy scheduler\nconsumer with a poll at most thirty seconds old. Missing, ambiguous,\ndisabled, external pull, unobserved or\nstale consumers block. Connectivity and message delivery remain\nunverified; passed readiness policies retain partial coverage. Unlisted\nqueues retain strict unsupported coverage. Existing storage requirements\nmust be explicitly retained or cleared. Policy and queue facts, and poll\nexpiry, are checked at the traffic write. This call sends no messages and\nperforms no probes. Older servers return 404 before mutation.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetQueueBindingReleasePolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved policy with explicit queue requirements and incremented revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BindingReleasePolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/acknowledgment-history/pages": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "listEventAcknowledgmentHistoryPage",
        "summary": "Page through retained acknowledgment outcome groups.",
        "description": "Requires apps:read or admin. Orders immutable first occurrence and identity fields descending so renewals cannot move groups between pages. A fixed first-page cutoff excludes later-created groups. Counts and last_at remain live; deletion, retention and initially uncommitted inserts prevent a database snapshot guarantee. Filters select groups by first_at, not individual occurrences. Repeat all filters and the page size with the cursor. Cursors expire one hour after the cutoff and grant no authority. The existing acknowledgment-history operation keeps its latest-update ordering.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Application slug owning the paginated outcome view.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "Consumer subscription used to bind page cursors.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "invocation_id",
            "in": "query",
            "description": "Restrict all pages to the specified delivery UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "description": "Restrict pages to one deferred outcome kind.",
            "schema": {
              "type": "string",
              "enum": [
                "accepted",
                "renewed",
                "renewal_rejected",
                "completed",
                "expired",
                "retry_requested",
                "dead_letter_requested"
              ]
            }
          },
          {
            "name": "from",
            "in": "query",
            "description": "Inclusive first occurrence lower bound, normalized to UTC microseconds.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "until",
            "in": "query",
            "description": "Exclusive first occurrence upper bound, normalized to UTC microseconds.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum groups per page, fixed for the cursor traversal.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Opaque continuation bound to account, application, consumer, filters and page size.",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retained outcome page with stable ordering and an optional continuation cursor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventAcknowledgmentHistoryPage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid, expired or mismatched history page cursor or filters.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Paginated acknowledgment read exceeded its request deadline. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Paginated acknowledgment read exceeded its request deadline.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/acknowledgment-history": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "listEventAcknowledgmentHistory",
        "summary": "Inspect retained deferred acknowledgment outcomes.",
        "description": "Requires apps:read or admin. Returns the 100 most recently updated outcome groups for this consumer, optionally restricted to one delivery. Repeated operations coalesce per attempt and kind; occurrences saturates at 2147483647. Retention ends seven days after the attempt deadline, or earlier when the invocation is deleted. Invalid and replaced tokens produce no history. This is diagnostic coverage since rollout, not a complete audit log or a rate denominator.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Application slug owning acknowledgment history.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "Consumer subscription whose retained outcomes are inspected.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "invocation_id",
            "in": "query",
            "description": "Optional delivery UUID restricting consumer outcome history.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded coalesced acknowledgment history, with explicit truncation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventAcknowledgmentHistory"
                }
              }
            }
          },
          "400": {
            "description": "Malformed acknowledgment history scope or delivery filter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Acknowledgment history read exceeded its time budget. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Acknowledgment history read exceeded its time budget.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-subscriptions/{subscriptionID}/acknowledgment-policy": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventAcknowledgmentPolicy",
        "summary": "Inspect future delivery acknowledgment policy.",
        "description": "Requires apps:read or admin. Tokens are never returned by inspection. Policies affect future acceptances and explicit backfills only. Zero preserves HTTP-success acknowledgment; 1–300 seconds enables a deferred lease after HTTP 202.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "slug identifying the target for getEventAcknowledgmentPolicy.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "subscriptionID identifying the target for getEventAcknowledgmentPolicy.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Inspect future delivery acknowledgment policy result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventAcknowledgmentPolicy"
                }
              }
            }
          },
          "400": {
            "description": "Invalid scope, token or policy for getEventAcknowledgmentPolicy.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Expired lease, replaced attempt or incompatible completion for getEventAcknowledgmentPolicy.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Acknowledgment request timed out for getEventAcknowledgmentPolicy. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Acknowledgment request timed out for getEventAcknowledgmentPolicy.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "events"
        ],
        "operationId": "setEventAcknowledgmentPolicy",
        "summary": "Configure future delivery acknowledgment policy.",
        "description": "Requires deploy:write or admin. Writes remain app-scoped; delivery callbacks additionally require the opaque token. Never log tokens. Policies affect future acceptances and explicit backfills only. Zero preserves HTTP-success acknowledgment; 1–300 seconds enables a deferred lease after HTTP 202.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "slug identifying the target for setEventAcknowledgmentPolicy.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subscriptionID",
            "in": "path",
            "required": true,
            "description": "subscriptionID identifying the target for setEventAcknowledgmentPolicy.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventAcknowledgmentPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Configure future delivery acknowledgment policy result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventAcknowledgmentPolicy"
                }
              }
            }
          },
          "400": {
            "description": "Invalid scope, token or policy for setEventAcknowledgmentPolicy.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Expired lease, replaced attempt or incompatible completion for setEventAcknowledgmentPolicy.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Acknowledgment request timed out for setEventAcknowledgmentPolicy. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Acknowledgment request timed out for setEventAcknowledgmentPolicy.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-deliveries/{invocationID}/acknowledgment": {
      "get": {
        "tags": [
          "events"
        ],
        "operationId": "getEventAcknowledgment",
        "summary": "Inspect retained delivery processing state.",
        "description": "Requires apps:read or admin. Tokens are never returned by inspection. Processing state distinguishes waiting, delivering, processing, expired and terminal invocation states. It does not prove business effects outside the consumer transaction.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "slug identifying the target for getEventAcknowledgment.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "invocationID",
            "in": "path",
            "required": true,
            "description": "invocationID identifying the target for getEventAcknowledgment.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Inspect retained delivery processing state result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventAcknowledgmentStatus"
                }
              }
            }
          },
          "400": {
            "description": "Invalid scope, token or policy for getEventAcknowledgment.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Expired lease, replaced attempt or incompatible completion for getEventAcknowledgment.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Acknowledgment request timed out for getEventAcknowledgment. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Acknowledgment request timed out for getEventAcknowledgment.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-deliveries/{invocationID}/acknowledgment/renew": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "renewEventAcknowledgment",
        "summary": "Renew a deferred delivery processing lease.",
        "description": "Requires deploy:write or admin. Writes remain app-scoped; delivery callbacks additionally require the opaque token. Never log tokens. Renewal requires an unexpired awaiting lease and cannot exceed the one-hour attempt deadline. A 409 during the 202 handoff may be retried with the same token.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "slug identifying the target for renewEventAcknowledgment.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "invocationID",
            "in": "path",
            "required": true,
            "description": "invocationID identifying the target for renewEventAcknowledgment.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventAcknowledgmentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Renew a deferred delivery processing lease result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventAcknowledgmentStatus"
                }
              }
            }
          },
          "400": {
            "description": "Invalid scope, token or policy for renewEventAcknowledgment.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Expired lease, replaced attempt or incompatible completion for renewEventAcknowledgment.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Acknowledgment request timed out for renewEventAcknowledgment. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Acknowledgment request timed out for renewEventAcknowledgment.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-deliveries/{invocationID}/acknowledgment/complete": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "completeEventAcknowledgment",
        "summary": "Complete a deferred delivery attempt.",
        "description": "Requires deploy:write or admin. Writes remain app-scoped; delivery callbacks additionally require the opaque token. Never log tokens. Complete only after durable business processing. Matching successful repeats return the saved completion state. Replaced attempts and changed results return 409. Completion can precede the scheduler observing 202.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "slug identifying the target for completeEventAcknowledgment.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "invocationID",
            "in": "path",
            "required": true,
            "description": "invocationID identifying the target for completeEventAcknowledgment.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventAcknowledgmentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Complete a deferred delivery attempt result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventAcknowledgmentStatus"
                }
              }
            }
          },
          "400": {
            "description": "Invalid scope, token or policy for completeEventAcknowledgment.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Expired lease, replaced attempt or incompatible completion for completeEventAcknowledgment.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Acknowledgment request timed out for completeEventAcknowledgment. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Acknowledgment request timed out for completeEventAcknowledgment.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-deliveries/{invocationID}/acknowledgment/retry": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "retryEventAcknowledgment",
        "summary": "Retry a deferred delivery attempt.",
        "description": "Requires deploy:write or admin and the current delivery token. Atomically releases the claim and quota and schedules the captured backoff; an exhausted captured attempt budget dead-letters instead. Matching repeats return the saved disposition until the attempt or replay generation is replaced. Changed reason or action returns 409. May precede the scheduler observing 202. Reason is a bounded non-sensitive code. Does not undo consumer effects.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "slug identifying the target for retryEventAcknowledgment.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "invocationID",
            "in": "path",
            "required": true,
            "description": "invocationID identifying the target for retryEventAcknowledgment.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventAcknowledgmentFailureRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Retry a deferred delivery attempt result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventAcknowledgmentStatus"
                }
              }
            }
          },
          "400": {
            "description": "Invalid scope, token or policy for retryEventAcknowledgment.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Expired lease, replaced attempt or incompatible completion for retryEventAcknowledgment.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Acknowledgment request timed out for retryEventAcknowledgment. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Acknowledgment request timed out for retryEventAcknowledgment.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/event-deliveries/{invocationID}/acknowledgment/dead-letter": {
      "post": {
        "tags": [
          "events"
        ],
        "operationId": "deadLetterEventAcknowledgment",
        "summary": "Dead-letter a deferred delivery attempt.",
        "description": "Requires deploy:write or admin and the current delivery token. Atomically releases the claim and quota and dead-letters this delivery independently of other consumers. Matching repeats return the saved disposition until replacement; changed reason or action returns 409. May precede the scheduler observing 202. Reason is a bounded non-sensitive code. Does not undo consumer effects.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "slug identifying the target for deadLetterEventAcknowledgment.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "invocationID",
            "in": "path",
            "required": true,
            "description": "invocationID identifying the target for deadLetterEventAcknowledgment.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventAcknowledgmentFailureRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dead-letter a deferred delivery attempt result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventAcknowledgmentStatus"
                }
              }
            }
          },
          "400": {
            "description": "Invalid scope, token or policy for deadLetterEventAcknowledgment.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Expired lease, replaced attempt or incompatible completion for deadLetterEventAcknowledgment.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Acknowledgment request timed out for deadLetterEventAcknowledgment. Sent as 503 by the public edge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "Acknowledgment request timed out for deadLetterEventAcknowledgment.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{slug}/billing/status": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "getOrgBillingStatus",
        "summary": "Get organization billing status.",
        "description": "Requires current organization membership and usage:read. Billing attachment belongs to the organization.",
        "responses": {
          "200": {
            "description": "Organization billing attachment status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingStatusResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/usage": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "getOrgUsage",
        "summary": "Get organization monthly application usage.",
        "description": "Requires current organization membership and usage:read. Historical personal usage keeps its original billing subject.",
        "parameters": [
          {
            "name": "month",
            "in": "query",
            "description": "Billing month in YYYY-MM form (UTC). Defaults to the current month.",
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Monthly usage billed to this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/UsageResponse"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/invoices": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "listOrgInvoices",
        "summary": "List organization invoices.",
        "description": "Requires owner or billing role and usage:read. Returns invoices recorded under the organization billing subject.",
        "parameters": [
          {
            "name": "month",
            "in": "query",
            "description": "Optional billing month filter (UTC).",
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}$"
            }
          },
          {
            "name": "before",
            "in": "query",
            "description": "Cursor for the next older page.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Invoice page size.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of organization invoices, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/billing/portal": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "getOrgBillingPortal",
        "summary": "Get the organization billing portal.",
        "description": "Requires the organization owner, admin credential scope, verified email, MFA and recent step-up. The provider session uses the organization customer identity.",
        "responses": {
          "200": {
            "description": "Organization provider portal and payment method summary.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingPortalResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/plan": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        }
      ],
      "patch": {
        "tags": [
          "orgs"
        ],
        "operationId": "changeOrgPlan",
        "summary": "Change the organization plan after provider confirmation.",
        "description": "Requires the organization owner, admin credential scope, verified email,\nMFA and recent step-up. Paid entitlements activate only after provider\nconfirmation. Existing personal subscriptions are never reassigned.\nA payment-required response carries checkout_url, or billing_portal_url\nwhen the upgrade charge of an existing subscription is declined. The\nfirst checkout bills the acting owner's email until\n`PUT /v1/orgs/{slug}/billing/email` sets the organization's own.\nAsking for the organization's current plan keeps its subscription,\nundoing a scheduled cancellation or downgrade; while a cancellation is\nscheduled any other plan answers 409 `billing_subscription_ending`.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Target plan to submit to the organization billing provider.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChangePlanRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The confirmed organization plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgPlanResponse"
                }
              }
            }
          },
          "202": {
            "description": "A deferred change awaiting provider confirmation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgPlanResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/overage-cap": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "getOrgOverageCap",
        "summary": "Read the organization's monthly spend cap.",
        "description": "Requires current organization membership and usage:read. Integer cents, zero when no overage is allowed, or null when no cap is set. An organization that owns its resources is billed, and capped, apart from its members.",
        "responses": {
          "200": {
            "description": "The saved monthly spend cap.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountOverageCapResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "orgs"
        ],
        "operationId": "setOrgOverageCap",
        "summary": "Set or clear the organization's monthly spend cap.",
        "description": "Requires the organization owner, admin credential scope, verified email,\nMFA and recent step-up. `{\"overage_cap_cents\": <int|null>}`: null clears\nthe cap, 0 allows no overage. Once the organization's overage this month\nmeets the cap, the scheduler stops its apps' wakes (HTTP 402\n`admission_refused`) until the cap is raised or the month ends. A paid\norganization starts with its plan's default cap.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RaiseOverageCapRequest"
              },
              "example": {
                "overage_cap_cents": 10000
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The organization's spend cap after the change.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountOverageCapResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/egress-overage": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "getOrgEgressOverage",
        "summary": "Read the organization's egress overage election.",
        "description": "Requires current organization membership and usage:read. An organization that owns its resources elects egress overage apart from its members.",
        "responses": {
          "200": {
            "description": "The organization's election.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EgressOverageResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "put": {
        "tags": [
          "orgs"
        ],
        "operationId": "setOrgEgressOverage",
        "summary": "Turn the organization's egress overage election on or off.",
        "description": "Requires the organization owner, admin credential scope, verified email,\nMFA and recent step-up. `{\"enabled\": true|false}`; turning it on needs a\npaid plan (HTTP 402 `plan_egress_overage_not_allowed`).\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EgressOverageRequest"
              },
              "example": {
                "enabled": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The organization's election after the change.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EgressOverageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "code: plan_egress_overage_not_allowed — the organization's plan stops at its egress allowance; move the organization to a paid plan.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{slug}/billing/costs": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "getOrgFinancialCosts",
        "summary": "Read the organization's attributable usage costs.",
        "description": "Requires current organization membership, usage:read and session MFA.\nAn organization that owns its resources pays for its apps, so their\nusage evidence is recorded under it rather than under the members who\ncreated them. Same report as GET /v1/billing/costs, for the organization.\n",
        "parameters": [
          {
            "name": "month",
            "in": "query",
            "description": "UTC usage month of the organization's report; defaults to the current month.",
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Organization-owned cost breakdown, coverage, forecasts, and separate invoice facts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinancialCostsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/orgs/{slug}/billing/budgets": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "listOrgFinancialBudgets",
        "summary": "List the organization's budget policies.",
        "description": "Requires current organization membership, usage:read and session MFA. Deleted policies are omitted. Drafts do not enforce limits.",
        "responses": {
          "200": {
            "description": "Organization-owned policies, bounded to 128.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinancialBudgetListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "post": {
        "tags": [
          "orgs"
        ],
        "operationId": "createOrgFinancialBudget",
        "summary": "Save an organization budget policy.",
        "description": "Requires the organization owner or billing role, admin scope, session MFA\nand an Idempotency-Key (1..255 bytes). A budget covers what the\norganization pays for: its apps, projects and environments, and its\nwhole account scope. The organization must own its resources. Monitored\nnotify and compute-only stop_previews policies can activate; alerts go\nto the organization's billing contact. Strict policies return 422\nfinancial_budget_activation_unavailable.\n",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Stable identity of this organization budget creation, required for retries.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateFinancialBudgetRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Saved policy with revision 1; retries retain its identity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinancialBudgetResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "description": "Invalid organization policy count, or a strict or unsupported activation; nothing was written.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/orgs/{slug}/billing/budgets/preview": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        }
      ],
      "post": {
        "tags": [
          "orgs"
        ],
        "operationId": "previewOrgFinancialBudget",
        "summary": "Preview an organization budget and its workload consequences without writes.",
        "description": "Requires current organization membership, usage:read and session MFA. Same preview as POST /v1/billing/budgets/preview, over the apps the organization pays for. No policies, holds or decisions are written.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FinancialBudgetPreviewRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The organization's financial observation, affected workloads and readiness.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinancialBudgetPreviewResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/orgs/{slug}/billing/budgets/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Stable identity of an organization-owned budget policy.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "getOrgFinancialBudget",
        "summary": "Read an organization budget, including its deletion tombstone.",
        "description": "Requires current organization membership, usage:read and session MFA. Foreign or missing policies return 404.",
        "responses": {
          "200": {
            "description": "The organization budget's saved intent and enforcement readiness.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinancialBudgetResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "put": {
        "tags": [
          "orgs"
        ],
        "operationId": "updateOrgFinancialBudget",
        "summary": "Replace an organization budget at its expected revision.",
        "description": "Requires the organization owner or billing role, admin scope, session MFA and Idempotency-Key. expected_revision must match the current policy; stale edits return 409. Strict policies return 422 financial_budget_activation_unavailable.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Retry key for replacing this organization budget at its expected revision.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateFinancialBudgetRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated policy and incremented revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinancialBudgetResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "description": "Strict or unsupported activation for an organization; its current revision is kept.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "orgs"
        ],
        "operationId": "deleteOrgFinancialBudget",
        "summary": "Tombstone an organization budget while retaining its revision history.",
        "description": "Requires the organization owner or billing role, admin scope, session MFA and Idempotency-Key. expected_revision prevents stale deletion.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Retry identity for tombstoning this organization budget.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteFinancialBudgetRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The organization budget's tombstone at its next revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinancialBudgetResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/orgs/{slug}/billing/budgets/{id}/revisions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        }
      ],
      "get": {
        "tags": [
          "orgs"
        ],
        "operationId": "listOrgFinancialBudgetRevisions",
        "summary": "Page through an organization budget's immutable revisions.",
        "description": "Requires current organization membership, usage:read and session MFA. Use next_revision as after_revision for continuation.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Organization budget whose immutable revision audit is listed.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "after_revision",
            "in": "query",
            "description": "Exclusive cursor over the organization budget's revisions; pass the last next_revision.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0,
              "maximum": 9007199254740991,
              "default": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum organization budget revisions returned in this page.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The organization budget's revisions, oldest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinancialBudgetHistoryResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/orgs/{slug}/billing/email": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgSlug"
        }
      ],
      "put": {
        "tags": [
          "orgs"
        ],
        "operationId": "setOrgBillingEmail",
        "summary": "Set the email the organization bills to.",
        "description": "Requires the organization owner, admin credential scope, verified email,\nMFA and recent step-up. The billing provider sends this address the\norganization's invoices and signs it in to the organization's billing\nportal, so use an address the organization controls rather than a\nmember's. The first organization checkout bills the member who starts\nit until this is set. When the organization already has a billing\ncustomer, the customer moves to the new email first and nothing changes\nif the provider refuses. The provider keeps one customer per email: an\nemail another Gregale account or organization already pays with is\nrefused with 409 `billing_email_in_use`. While a member's email is the\nbilling email, that member cannot be removed (409\n`billing_contact_member`).\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrgBillingEmailRequest"
              },
              "example": {
                "billing_email": "billing@example.com"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The organization's billing email after the change.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgBillingEmailResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "502": {
            "description": "The billing provider could not move the customer (`billing_email_change_failed`); the billing email is unchanged.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{organization}/github/installations": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        }
      ],
      "get": {
        "tags": [
          "github"
        ],
        "operationId": "listOrgGitHubInstallations",
        "summary": "List the GitHub installations a company organization owns.",
        "description": "Company projects link repositories only through these installations. An owner or admin connects one from Connect GitHub with the organization selected. Members' personal installations are not listed; tokens are never returned.",
        "responses": {
          "200": {
            "description": "The organization's installations; empty before one is connected or before billing adoption.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/GitHubInstallationSummary"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "listOrgProjects",
        "summary": "List projects owned by a company organization.",
        "responses": {
          "200": {
            "description": "Projects visible to the current company member.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ProjectSummaryResponse"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "applyOrgProject",
        "summary": "Create or apply an organization project from uploaded source.",
        "description": "Upload source and project_slug using the existing multipart contract. An adopted organization supplies the new project resource namespace and deployment budget. Database and async-route manifest bindings are rejected before personal services are resolved.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OrgProjectPlanToken"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ProjectApplyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Applied organization project and workload results.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplyResponse"
                },
                "example": {
                  "project_id": "0123456789abcdef0123456789abcdef",
                  "apps": [
                    {
                      "slug": "api",
                      "id": "0123456789abcdef0123456789abcdef"
                    },
                    {
                      "slug": "worker",
                      "id": "0123456789abcdef0123456789abcdef"
                    }
                  ],
                  "scan_source": "compose",
                  "can_apply": true,
                  "will_deploy": [
                    {
                      "name": "api",
                      "root_dir": "",
                      "class": "http",
                      "action": "create"
                    },
                    {
                      "name": "worker",
                      "root_dir": "",
                      "class": "http",
                      "action": "update"
                    }
                  ],
                  "unaffected": [],
                  "skipped": [],
                  "removed": [],
                  "persisted_exclusions": []
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/CronInvalid"
          },
          "403": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "413": {
            "$ref": "#/components/responses/SourceTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlug"
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getOrgProject",
        "summary": "Inspect an organization project and its workloads.",
        "responses": {
          "200": {
            "description": "Company project metadata, exclusions and recovery state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "tags": [
          "projects"
        ],
        "operationId": "updateOrgProject",
        "summary": "Update an organization project production branch.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateProjectRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated company project source settings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "projects"
        ],
        "operationId": "deleteOrgProject",
        "summary": "Delete a company project and detach its workloads.",
        "description": "Owners and admins may remove the company project. Its workloads remain live and are detached from the deleted project.",
        "responses": {
          "204": {
            "description": "Company project deleted; detached workloads remain live."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/environments": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlug"
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "listOrgProjectEnvironments",
        "summary": "List an organization project environment registry.",
        "responses": {
          "200": {
            "description": "Registered environments for this company project.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ProjectEnvironmentResponse"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "createOrgProjectEnvironment",
        "summary": "Create an empty organization project environment.",
        "description": "Developers may create an empty environment. Creating it protected requires an owner or admin. from_environment and full cloning return a conflict until shared resource cloning is supported.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateProjectEnvironmentRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "New empty company environment and protection policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/environments/{environment}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlug"
        },
        {
          "$ref": "#/components/parameters/OrgProjectEnvironment"
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getOrgProjectEnvironment",
        "summary": "Inspect a registered company project environment.",
        "responses": {
          "200": {
            "description": "Company environment metadata and current release state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "tags": [
          "projects"
        ],
        "operationId": "updateOrgProjectEnvironment",
        "summary": "Change protection on an organization project environment.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateProjectEnvironmentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated company environment protection settings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "tags": [
          "projects"
        ],
        "operationId": "deleteOrgProjectEnvironment",
        "summary": "Delete an unused company project environment.",
        "description": "An owner or admin may delete an unprotected, unused, non-production company environment. Existing release, configuration and resource guards still apply.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "202": {
            "description": "Unused company project environment deleted."
          },
          "204": {
            "description": "Company environment removed without a response body."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/environments/{environment}/releases": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlug"
        },
        {
          "$ref": "#/components/parameters/OrgProjectEnvironment"
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getOrgProjectEnvironmentReleases",
        "summary": "Read live workload releases in a company environment.",
        "description": "Each company workload contributes non-secret live release metadata. Stable environment URLs become available when a live deployment exists.",
        "responses": {
          "200": {
            "description": "Non-secret live release metadata for the company environment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentReleaseListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/environments/{environment}/release-sets": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlug"
        },
        {
          "$ref": "#/components/parameters/OrgProjectEnvironment"
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "listOrgProjectReleaseSets",
        "summary": "List organization project release-set history.",
        "description": "Company release graphs are ordered newest first. Supply next_before as before to continue through retained history.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OrgProjectBefore"
          },
          {
            "$ref": "#/components/parameters/OrgProjectLimit"
          }
        ],
        "responses": {
          "200": {
            "description": "Newest-first release graphs retained by this company project.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectReleaseSetListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "publishOrgProjectReleaseSet",
        "summary": "Activate an immutable organization project release graph.",
        "description": "Every company workload must have a live deployment with revision pinning that covers the requested TTL. Earlier organization release sets stay addressable until expiry.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublishProjectReleaseSetRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Newly activated company project deployment graph.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectReleaseSetResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/environments/{environment}/release-sets/active": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlugb08370"
        },
        {
          "$ref": "#/components/parameters/OrgProjectEnvironment6f0a6f"
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getActiveOrgProjectReleaseSet",
        "summary": "Read the active organization project release graph.",
        "description": "The addressed company environment must have an active release graph; otherwise this operation returns 404.",
        "responses": {
          "200": {
            "description": "Active release graph in the requested company environment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectReleaseSetResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/environments/{environment}/release-sets/{release}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlugb08370"
        },
        {
          "$ref": "#/components/parameters/OrgProjectEnvironment6f0a6f"
        },
        {
          "$ref": "#/components/parameters/OrgProjectRelease"
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getOrgProjectReleaseSet",
        "summary": "Inspect a retained organization project release set.",
        "description": "Retired and expired company graphs remain inspectable for diagnosis. Inspecting one does not reactivate its routing.",
        "responses": {
          "200": {
            "description": "Retained company release graph, including retired or expired members.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectReleaseSetResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/environments/{environment}/state": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlug"
        },
        {
          "$ref": "#/components/parameters/OrgProjectEnvironment"
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getOrgProjectEnvironmentState",
        "summary": "Read effective state for a company project environment.",
        "description": "Returns the company environment configuration, live releases, runtime variables and secret metadata without revealing secret values.",
        "responses": {
          "200": {
            "description": "Effective company configuration, routes and live release references.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentStateResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/environments/{environment}/diff": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlug"
        },
        {
          "$ref": "#/components/parameters/OrgProjectEnvironment"
        },
        {
          "$ref": "#/components/parameters/OrgProjectFrom"
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getOrgProjectEnvironmentDiff",
        "summary": "Compare effective state between company project environments.",
        "description": "Compares effective company environment configuration, workload releases, variables, secret metadata and declared routes.",
        "responses": {
          "200": {
            "description": "Non-secret effective-state differences within the company project.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentDiffResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/environments/{environment}/config": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlug"
        },
        {
          "$ref": "#/components/parameters/OrgProjectEnvironment"
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getOrgProjectEnvironmentConfig",
        "summary": "Read organization project environment configuration.",
        "responses": {
          "200": {
            "description": "Latest immutable non-secret configuration for the company environment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentConfigResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "put": {
        "tags": [
          "projects"
        ],
        "operationId": "updateOrgProjectEnvironmentConfig",
        "summary": "Append an organization environment configuration version.",
        "description": "Publishes a new immutable company configuration snapshot. Secret-shaped keys are refused; use the reviewed application secret APIs for sensitive values.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateProjectEnvironmentConfigRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Published company environment configuration version and hash.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentConfigResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/environments/{environment}/config/diff": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlug"
        },
        {
          "$ref": "#/components/parameters/OrgProjectEnvironment"
        },
        {
          "$ref": "#/components/parameters/OrgProjectFrom"
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getOrgProjectEnvironmentConfigDiff",
        "summary": "Compare company environment configuration snapshots.",
        "responses": {
          "200": {
            "description": "Key-level differences between company configuration snapshots.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentConfigDiffResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/environments/{environment}/promotion-preview": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlug"
        },
        {
          "$ref": "#/components/parameters/OrgProjectEnvironment"
        }
      ],
      "get": {
        "parameters": [
          {
            "$ref": "#/components/parameters/OrgProjectFrom"
          },
          {
            "$ref": "#/components/parameters/OrgProjectSyncConfig"
          }
        ],
        "tags": [
          "projects"
        ],
        "operationId": "getOrgProjectEnvironmentPromotionPreview",
        "summary": "Preview promotion between organization project environments.",
        "description": "Builds a company promotion plan from current source and target state. Protected target environments require an owner or admin to approve the exact returned plan.",
        "responses": {
          "200": {
            "description": "Current company promotion plan and its bound preview token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentPromotionPreviewResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "previewOrgProjectEnvironmentPromotionSecrets",
        "summary": "Preview a company promotion with destination production secret changes.",
        "description": "Read-only, bounded preview with immutable secret version references, with the same rules as the personal secret preview. Requires MFA, secrets write permission and deployment permission in the organization.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectEnvironmentPromotionSecretPreviewRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Company promotion preview listing secret key changes as version references only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentPromotionPreviewResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "description": "Company secret releases or destination verification are unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/environments/{environment}/approvals/{approval}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlug"
        },
        {
          "$ref": "#/components/parameters/OrgProjectEnvironment"
        },
        {
          "$ref": "#/components/parameters/OrgProjectApproval"
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getOrgProjectEnvironmentApprovalStatus",
        "summary": "Inspect a protected company environment approval.",
        "description": "Reads the company approval lifecycle without returning its raw one-time approval token.",
        "responses": {
          "200": {
            "description": "Lifecycle metadata for a company approval, without its raw token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentApprovalStatusResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/environments/{environment}/promotions/{promotion}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlug"
        },
        {
          "$ref": "#/components/parameters/OrgProjectEnvironment"
        },
        {
          "$ref": "#/components/parameters/OrgProjectPromotion"
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getOrgProjectEnvironmentPromotionStatus",
        "summary": "Inspect an organization project promotion operation.",
        "description": "Includes the company promotion cutover state, post-cutover verification result and safe workload checkpoints.",
        "responses": {
          "200": {
            "description": "Company promotion status, verification and workload checkpoints.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentPromotionStatusResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/environments/{environment}/promotions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlug"
        },
        {
          "$ref": "#/components/parameters/OrgProjectEnvironment"
        },
        {
          "$ref": "#/components/parameters/OrgProjectBeforeade0c4"
        },
        {
          "$ref": "#/components/parameters/OrgProjectLimit65fc92"
        },
        {
          "$ref": "#/components/parameters/OrgProjectFrom237d99"
        },
        {
          "$ref": "#/components/parameters/OrgProjectStatus"
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "listOrgProjectEnvironmentPromotions",
        "summary": "List organization project environment promotions.",
        "description": "Returns compact company promotion history. Read a specific promotion operation for its complete workload checkpoints.",
        "responses": {
          "200": {
            "description": "Newest-first company promotion history with continuation cursor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentPromotionListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/delete-preview": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlug"
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "previewDeleteOrgProject",
        "summary": "Preview deletion of an organization project.",
        "responses": {
          "200": {
            "description": "Company workloads and related state affected by project deletion.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectDeletePreviewResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/environments/{environment}/workloads/{workload}/routes": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlugb08370"
        },
        {
          "$ref": "#/components/parameters/OrgProjectEnvironment6f0a6f"
        },
        {
          "$ref": "#/components/parameters/OrgProjectWorkload"
        }
      ],
      "put": {
        "tags": [
          "projects"
        ],
        "operationId": "updateOrgProjectEnvironmentRoutes",
        "summary": "Replace declared routes in a company project environment.",
        "description": "The declared contract applies to the company workload environment URLs. The ordinary app hostname keeps its application-wide contract.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateProjectEnvironmentRoutePolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated company workload route contract and revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentRoutePolicyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/exclusions/{slug2}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlugb08370"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlug2"
        }
      ],
      "delete": {
        "tags": [
          "projects"
        ],
        "operationId": "orgProjectDeleteDeploymentScopeExclusion",
        "summary": "Remove a persisted company project deployment exclusion.",
        "description": "Removes a company workload exclusion saved by a previous persist-exclude deployment so a later source apply can include it again.",
        "responses": {
          "200": {
            "description": "Company workload exclusion removed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "The company project or saved workload exclusion was not found; both return scope_exclusion_not_found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/scan": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "scanOrgProject",
        "summary": "Preview an organization source upload before applying it.",
        "description": "Accepts a source tarball and project_slug without mutating the organization project. Existing projects in a legacy creator namespace must use their project-specific scan URL.",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ProjectScanRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Company source scan, workload partitions and deployment plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlanResponse"
                },
                "example": {
                  "project_slug": "my-app",
                  "scan_source": "compose",
                  "tier": "compose",
                  "workloads": [
                    {
                      "name": "api",
                      "root_dir": "",
                      "command": [],
                      "ports": [
                        8080
                      ]
                    },
                    {
                      "name": "worker",
                      "root_dir": "",
                      "command": [],
                      "ports": []
                    }
                  ],
                  "managed": [
                    {
                      "name": "db",
                      "kind": "postgres",
                      "env_hint": "DATABASE_URL"
                    }
                  ],
                  "crons": [
                    {
                      "workload_name": "nightly",
                      "schedule": "0 3 * * *",
                      "path": "/",
                      "enabled": true
                    }
                  ],
                  "observed_apps": 3,
                  "observed_crons": 1,
                  "limit_apps": 5,
                  "limit_crons": 5,
                  "can_apply": true,
                  "plan_token": "eyJoYXMiOiI...",
                  "will_deploy": [
                    {
                      "name": "api",
                      "root_dir": "",
                      "class": "http",
                      "action": "create"
                    },
                    {
                      "name": "worker",
                      "root_dir": "",
                      "class": "http",
                      "action": "update"
                    }
                  ],
                  "unaffected": [
                    {
                      "name": "legacy-job",
                      "root_dir": "jobs/legacy",
                      "class": "http",
                      "action": "noop",
                      "id": "0123456789abcdef0123456789abcdef"
                    }
                  ],
                  "skipped": [
                    {
                      "name": "risky-migration",
                      "root_dir": "jobs/migrate",
                      "class": "http",
                      "action": "noop"
                    }
                  ],
                  "removed": []
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/CronInvalid"
          },
          "403": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/SourceTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/environments/{environment}/qualifications": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlug"
        },
        {
          "$ref": "#/components/parameters/OrgProjectEnvironment"
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "createOrgProjectEnvironmentQualification",
        "summary": "Record qualification of a company project release set.",
        "description": "Binds closed-schema health and smoke evidence to the exact active release set in this company environment.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateProjectEnvironmentQualificationRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Qualification evidence bound to the active company release graph.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentQualificationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/environments/{environment}/promote": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlug"
        },
        {
          "$ref": "#/components/parameters/OrgProjectEnvironment"
        },
        {
          "$ref": "#/components/parameters/OrgProjectIdempotencyKey"
        },
        {
          "$ref": "#/components/parameters/EnvironmentPromotionAttemptHeader"
        },
        {
          "$ref": "#/components/parameters/EnvironmentPromotionRequestHashHeader"
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "promoteOrgProjectEnvironment",
        "summary": "Promote live workloads between company project environments.",
        "description": "Revalidates current company source and target state before cutover. A protected target consumes an approval bound to that exact plan. The authenticated teammate is recorded as the deployment actor.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PromoteProjectEnvironmentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Durable company promotion result and per-workload deployment references.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentPromotionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/environments/{environment}/promotion-attempts/{attempt_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlug"
        },
        {
          "$ref": "#/components/parameters/OrgProjectEnvironment"
        },
        {
          "$ref": "#/components/parameters/EnvironmentPromotionAttempt"
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getOrgEnvironmentPromotionReceipt",
        "summary": "Read original company environment promotion acceptance.",
        "description": "Returns an immutable acceptance receipt within the authenticated company project. Current membership and original source/target identities remain required; replacement environments cannot inherit it. Native progress and workload health require explicit observations. A missing receipt leaves acceptance unresolved, and this read cannot execute a promotion.",
        "responses": {
          "200": {
            "description": "Company-scoped original admission metadata; completion requires separate observation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvironmentPromotionReceipt"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/environments/{environment}/promotions/{promotion}/rollback-attempts/{attempt_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlug"
        },
        {
          "$ref": "#/components/parameters/OrgProjectEnvironment"
        },
        {
          "name": "promotion",
          "in": "path",
          "required": true,
          "description": "Original company promotion UUID.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "$ref": "#/components/parameters/EnvironmentRollbackAttempt"
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getOrgEnvironmentRollbackReceipt",
        "summary": "Read original company environment rollback acceptance.",
        "description": "Returns an immutable acceptance receipt within the authenticated company project. Current membership and original source/target identities remain required; replacement environments cannot inherit it. Native restoration and workload health require explicit observations. A missing receipt leaves acceptance unresolved, and this read cannot execute a rollback.",
        "responses": {
          "200": {
            "description": "Company-scoped original admission metadata; restoration requires separate observation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvironmentRollbackReceipt"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/environments/{environment}/promotions/{promotion}/rollback": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlug"
        },
        {
          "$ref": "#/components/parameters/OrgProjectEnvironment"
        },
        {
          "$ref": "#/components/parameters/OrgProjectPromotion"
        },
        {
          "$ref": "#/components/parameters/OrgProjectIdempotencyKey"
        },
        {
          "$ref": "#/components/parameters/EnvironmentRollbackAttemptHeader"
        },
        {
          "$ref": "#/components/parameters/EnvironmentRollbackRequestHashHeader"
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "rollbackOrgProjectEnvironmentPromotion",
        "summary": "Restore company workloads from a recorded promotion.",
        "description": "Restores the target deployments captured before this company promotion. Membership and deployment permission are checked before replaying an existing rollback receipt.",
        "responses": {
          "200": {
            "description": "Company rollback result restoring captured target deployments.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentPromotionStatusResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/environments/{environment}/promotions/{promotion}/abort": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlug"
        },
        {
          "$ref": "#/components/parameters/OrgProjectEnvironment"
        },
        {
          "$ref": "#/components/parameters/OrgProjectPromotion"
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "abortOrgProjectEnvironmentPromotion",
        "summary": "Abort an in-progress company environment promotion.",
        "description": "Generation-fenced operator decision on a company promotion, with the same semantics as the personal abort route. Requires deployment permission in the organization.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectPromotionControlRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Terminal acknowledgement of the company abort decision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectPromotionControl"
                }
              }
            }
          },
          "202": {
            "description": "Company abort accepted; fresh baseline checks run before restoration.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectPromotionControl"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Company abort refused: the generation, request identity, phase or destination intent changed; inspect the promotion."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/environments/{environment}/promotions/{promotion}/recover": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlug"
        },
        {
          "$ref": "#/components/parameters/OrgProjectEnvironment"
        },
        {
          "$ref": "#/components/parameters/OrgProjectPromotion"
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "recoverOrgProjectEnvironmentPromotion",
        "summary": "Retry guarded restoration of a blocked company environment promotion.",
        "description": "Retries a blocked company restoration with fresh baseline health and worker startup proof, like the personal recover route. Requires deployment permission in the organization.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectPromotionControlRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Terminal acknowledgement of the company restoration retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectPromotionControl"
                }
              }
            }
          },
          "202": {
            "description": "Company restoration retry accepted; baseline and worker checks are pending.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectPromotionControl"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Company restoration retry refused: the inspected generation, request identity, phase or destination intent no longer allows it."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/environments/{environment}/promotions/{promotion}/recover-migration": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlug"
        },
        {
          "$ref": "#/components/parameters/OrgProjectEnvironment"
        },
        {
          "$ref": "#/components/parameters/OrgProjectPromotion"
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "recoverOrgProjectEnvironmentPromotionMigration",
        "summary": "Recover an interrupted company promotion migration without replaying SQL.",
        "description": "Records explicit database inspection and resumes or resolves an interrupted company promotion migration, like the personal recover-migration route. Requires deployment permission in the organization.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectPromotionMigrationRecoveryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Existing terminal acknowledgement of the company migration recovery.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectPromotionMigrationRecovery"
                }
              }
            }
          },
          "202": {
            "description": "Company migration recovery accepted; teardown or verification is pending.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectPromotionMigrationRecovery"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Company migration recovery refused: the task, generation, runtime or destination intent changed."
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/environments/{environment}/workloads/{workload}/policies": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlugb08370"
        },
        {
          "$ref": "#/components/parameters/OrgProjectEnvironment6f0a6f"
        },
        {
          "$ref": "#/components/parameters/OrgProjectWorkload"
        }
      ],
      "put": {
        "tags": [
          "projects"
        ],
        "operationId": "updateOrgProjectEnvironmentPolicies",
        "summary": "Replace company environment headers and CORS policy.",
        "description": "An owner or admin may replace environment-specific headers and CORS rules. An explicit empty list disables inherited rules on that company environment URL.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateProjectEnvironmentEdgePolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Published company workload headers and CORS revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentEdgePolicyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/environments/{environment}/approvals": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        },
        {
          "$ref": "#/components/parameters/OrgProjectSlug"
        },
        {
          "$ref": "#/components/parameters/OrgProjectEnvironment"
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "approveOrgProjectEnvironment",
        "summary": "Approve an exact protected organization environment plan.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateProjectEnvironmentApprovalRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Company approval receipt and one-time plan-bound token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentApprovalResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/scan": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "scanOrgProjectDeployment",
        "summary": "Preview source for an existing organization project.",
        "description": "The uploaded project_slug must match the addressed company project. This preview preserves existing resource IDs and works with legacy creator namespaces after erasure.",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ProjectScanRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Deployment preview bound to the addressed company project.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlanResponse"
                },
                "example": {
                  "project_slug": "my-app",
                  "scan_source": "compose",
                  "tier": "compose",
                  "workloads": [
                    {
                      "name": "api",
                      "root_dir": "",
                      "command": [],
                      "ports": [
                        8080
                      ]
                    },
                    {
                      "name": "worker",
                      "root_dir": "",
                      "command": [],
                      "ports": []
                    }
                  ],
                  "managed": [
                    {
                      "name": "db",
                      "kind": "postgres",
                      "env_hint": "DATABASE_URL"
                    }
                  ],
                  "crons": [
                    {
                      "workload_name": "nightly",
                      "schedule": "0 3 * * *",
                      "path": "/",
                      "enabled": true
                    }
                  ],
                  "observed_apps": 3,
                  "observed_crons": 1,
                  "limit_apps": 5,
                  "limit_crons": 5,
                  "can_apply": true,
                  "plan_token": "eyJoYXMiOiI...",
                  "will_deploy": [
                    {
                      "name": "api",
                      "root_dir": "",
                      "class": "http",
                      "action": "create"
                    },
                    {
                      "name": "worker",
                      "root_dir": "",
                      "class": "http",
                      "action": "update"
                    }
                  ],
                  "unaffected": [
                    {
                      "name": "legacy-job",
                      "root_dir": "jobs/legacy",
                      "class": "http",
                      "action": "noop",
                      "id": "0123456789abcdef0123456789abcdef"
                    }
                  ],
                  "skipped": [
                    {
                      "name": "risky-migration",
                      "root_dir": "jobs/migrate",
                      "class": "http",
                      "action": "noop"
                    }
                  ],
                  "removed": []
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/CronInvalid"
          },
          "403": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/SourceTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/OrgProjectSlug"
          }
        ]
      }
    },
    "/v1/orgs/{organization}/projects/{slug}/deploy": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrgProjectOrganization"
        }
      ],
      "post": {
        "tags": [
          "projects"
        ],
        "operationId": "deployOrgProject",
        "summary": "Deploy uploaded source to an existing company project.",
        "description": "Uses the existing company project resource namespace even after creator erasure. The uploaded slug must match the URL; protected environments require an exact approved plan.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OrgProjectSlug"
          },
          {
            "$ref": "#/components/parameters/OrgProjectPlanToken"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ProjectApplyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Applied source results in the existing company resource namespace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplyResponse"
                },
                "example": {
                  "project_id": "0123456789abcdef0123456789abcdef",
                  "apps": [
                    {
                      "slug": "api",
                      "id": "0123456789abcdef0123456789abcdef"
                    },
                    {
                      "slug": "worker",
                      "id": "0123456789abcdef0123456789abcdef"
                    }
                  ],
                  "scan_source": "compose",
                  "can_apply": true,
                  "will_deploy": [
                    {
                      "name": "api",
                      "root_dir": "",
                      "class": "http",
                      "action": "create"
                    },
                    {
                      "name": "worker",
                      "root_dir": "",
                      "class": "http",
                      "action": "update"
                    }
                  ],
                  "unaffected": [],
                  "skipped": [],
                  "removed": [],
                  "persisted_exclusions": []
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/CronInvalid"
          },
          "403": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "413": {
            "$ref": "#/components/responses/SourceTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/postgres/databases": {
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization selected to list the organization's managed postgresql databases.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z0-9][a-z0-9-]*$"
          }
        }
      ],
      "get": {
        "operationId": "listOrgManagedPostgresDatabases",
        "summary": "List the organization's managed PostgreSQL databases.",
        "description": "Returns the company inventory across current and legacy storage namespaces. Current membership is required; personal databases are excluded.",
        "tags": [
          "managed_postgres"
        ],
        "responses": {
          "200": {
            "description": "Result of the request to list the organization's managed PostgreSQL databases.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresDatabaseList"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "default": {
            "description": "Problem while attempting to list the organization's managed PostgreSQL databases.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createOrgManagedPostgresDatabase",
        "summary": "Create a database owned by the organization.",
        "description": "An owner or admin reserves the database in the company namespace. Organization billing adoption, plan allowances and the shared database quota apply before provisioning.",
        "tags": [
          "managed_postgres"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateManagedPostgresDatabaseRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Result of the request to create a database owned by the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresDatabase"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "default": {
            "description": "Problem while attempting to create a database owned by the organization.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{organization}/postgres/capabilities": {
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization selected to read postgresql capabilities for the company plan.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z0-9][a-z0-9-]*$"
          }
        }
      ],
      "get": {
        "operationId": "getOrgManagedPostgresCapabilities",
        "summary": "Read PostgreSQL capabilities for the company plan.",
        "description": "Reports qualified provider capabilities intersected with the organization's plan. Reading capabilities does not open the provisioning rollout gate.",
        "tags": [
          "managed_postgres"
        ],
        "parameters": [
          {
            "name": "region",
            "in": "query",
            "required": false,
            "description": "Placement region used to read postgresql capabilities for the company plan.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Result of the request to read PostgreSQL capabilities for the company plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresCapabilities"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "default": {
            "description": "Problem while attempting to read PostgreSQL capabilities for the company plan.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{organization}/postgres/databases/{id}": {
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization selected to inspect a company postgresql database.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z0-9][a-z0-9-]*$"
          }
        },
        {
          "$ref": "#/components/parameters/ManagedPostgresID"
        }
      ],
      "get": {
        "operationId": "getOrgManagedPostgresDatabase",
        "summary": "Inspect a company PostgreSQL database.",
        "description": "Reads the database under its persisted organization owner. Existing resource and provider identities remain stable after the creator leaves.",
        "tags": [
          "managed_postgres"
        ],
        "responses": {
          "200": {
            "description": "Result of the request to inspect a company PostgreSQL database.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresDatabase"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "default": {
            "description": "Problem while attempting to inspect a company PostgreSQL database.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteOrgManagedPostgresDatabase",
        "summary": "Delete a company PostgreSQL resource.",
        "description": "An owner or admin requests provider cleanup. Active bindings and retained restore dependencies must be removed first; accounting evidence remains available. A ready database is kept for 7 days and can be undeleted until restorable_until; purge=true deletes at once.",
        "tags": [
          "managed_postgres"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "name": "purge",
            "in": "query",
            "required": false,
            "description": "true deletes the company database at once, even during its undelete window. It cannot be undone.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Result of the request to delete a company PostgreSQL resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresDatabase"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "default": {
            "description": "Problem while attempting to delete a company PostgreSQL resource.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{organization}/postgres/databases/{id}/bindings": {
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization selected to list the company database's app bindings.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z0-9][a-z0-9-]*$"
          }
        },
        {
          "$ref": "#/components/parameters/ManagedPostgresID"
        }
      ],
      "get": {
        "operationId": "listOrgManagedPostgresBindings",
        "summary": "List the company database's app bindings.",
        "description": "Returns app and environment binding metadata for this organization-owned database. Connection credentials remain sealed and are not included in the response.",
        "tags": [
          "managed_postgres"
        ],
        "responses": {
          "200": {
            "description": "Result of the request to list the company database's app bindings.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresBindingList"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "default": {
            "description": "Problem while attempting to list the company database's app bindings.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createOrgManagedPostgresBinding",
        "summary": "Attach the company database to an app environment.",
        "description": "The app and database must belong to the addressed company. Their storage namespaces may differ. Owners, admins and developers may attach bindings with the required database scope.",
        "tags": [
          "managed_postgres"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateManagedPostgresBindingRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Result of the request to attach the company database to an app environment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresBinding"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "default": {
            "description": "Problem while attempting to attach the company database to an app environment.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{organization}/postgres/bindings/{id}": {
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization selected to inspect a company database binding.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z0-9][a-z0-9-]*$"
          }
        },
        {
          "$ref": "#/components/parameters/ManagedPostgresID"
        }
      ],
      "get": {
        "operationId": "getOrgManagedPostgresBinding",
        "summary": "Inspect a company database binding.",
        "description": "Resolves ownership through the binding's database before exposing metadata. Current organization membership is required even when the binding retains a creator namespace.",
        "tags": [
          "managed_postgres"
        ],
        "responses": {
          "200": {
            "description": "Result of the request to inspect a company database binding.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresBinding"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "default": {
            "description": "Problem while attempting to inspect a company database binding.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteOrgManagedPostgresBinding",
        "summary": "Detach a company database binding.",
        "description": "Revokes the managed provider credential and removes its sealed app-secret target. Other bindings on the same company database remain usable.",
        "tags": [
          "managed_postgres"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Result of the request to detach a company database binding.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresBinding"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "default": {
            "description": "Problem while attempting to detach a company database binding.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{organization}/postgres/databases/{id}/resizes/{resize_id}": {
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization selected to read a company database resize operation.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z0-9][a-z0-9-]*$"
          }
        },
        {
          "$ref": "#/components/parameters/ManagedPostgresID"
        },
        {
          "name": "resize_id",
          "in": "path",
          "required": true,
          "description": "UUID of the resize request whose company database progress is returned.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getOrgManagedPostgresResize",
        "summary": "Read a company database resize operation.",
        "description": "Returns progress for a durable resize UUID owned by this database and organization. Reading progress does not submit another resize.",
        "tags": [
          "managed_postgres"
        ],
        "responses": {
          "200": {
            "description": "Result of the request to read a company database resize operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresResize"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "default": {
            "description": "Problem while attempting to read a company database resize operation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{organization}/postgres/databases/{id}/compute-policy-changes/{change_id}": {
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization selected to read a company database compute-policy operation.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z0-9][a-z0-9-]*$"
          }
        },
        {
          "$ref": "#/components/parameters/ManagedPostgresID"
        },
        {
          "name": "change_id",
          "in": "path",
          "required": true,
          "description": "UUID of the compute-policy change recorded for the company database.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "getOrgManagedPostgresComputePolicyChange",
        "summary": "Read a company database compute-policy operation.",
        "description": "Returns the durable policy change recorded for the addressed company database. The organization permission check also applies to old operation UUIDs.",
        "tags": [
          "managed_postgres"
        ],
        "responses": {
          "200": {
            "description": "Result of the request to read a company database compute-policy operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresComputePolicyChange"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "default": {
            "description": "Problem while attempting to read a company database compute-policy operation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{organization}/postgres/databases/{id}/undelete": {
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization that owns the company database to undelete.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z0-9][a-z0-9-]*$"
          }
        },
        {
          "$ref": "#/components/parameters/ManagedPostgresID"
        }
      ],
      "post": {
        "operationId": "undeleteOrgManagedPostgresDatabase",
        "summary": "Undelete a company PostgreSQL database.",
        "description": "An owner or admin returns a company database whose delete is scheduled to ready while restorable_until is in the future. The company plan must still allow the database's spec.",
        "tags": [
          "managed_postgres"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Result of the request to undelete a company PostgreSQL database.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresDatabase"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "default": {
            "description": "Problem while attempting to undelete a company PostgreSQL database.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{organization}/postgres/databases/{id}/restore": {
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization selected to restore the company database to a separate resource.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z0-9][a-z0-9-]*$"
          }
        },
        {
          "$ref": "#/components/parameters/ManagedPostgresID"
        }
      ],
      "post": {
        "operationId": "restoreOrgManagedPostgresDatabase",
        "summary": "Restore the company database to a separate resource.",
        "description": "An owner or admin creates a restore within the source database's organization. The company plan, restore window and aggregate database reservation quota are enforced.",
        "tags": [
          "managed_postgres"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RestoreManagedPostgresDatabaseRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Result of the request to restore the company database to a separate resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresDatabase"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "default": {
            "description": "Problem while attempting to restore the company database to a separate resource.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{organization}/postgres/databases/{id}/resize": {
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization selected to change the company database service class.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z0-9][a-z0-9-]*$"
          }
        },
        {
          "$ref": "#/components/parameters/ManagedPostgresID"
        }
      ],
      "post": {
        "operationId": "resizeOrgManagedPostgresDatabase",
        "summary": "Change the company database service class.",
        "description": "An owner or admin submits a durable resize request. The requested class must fit the company plan and provider capabilities; connection interruption may occur.",
        "tags": [
          "managed_postgres"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResizeManagedPostgresDatabaseRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Result of the request to change the company database service class.",
            "headers": {
              "Location": {
                "description": "Company database resize progress endpoint returned for this request",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresResize"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "default": {
            "description": "Problem while attempting to change the company database service class.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{organization}/postgres/databases/{id}/compute-policy": {
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization selected to change the company database compute policy.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z0-9][a-z0-9-]*$"
          }
        },
        {
          "$ref": "#/components/parameters/ManagedPostgresID"
        }
      ],
      "post": {
        "operationId": "changeOrgManagedPostgresComputePolicy",
        "summary": "Change the company database compute policy.",
        "description": "An owner or admin changes scale-to-zero policy with a durable request UUID. Current organization entitlements govern the request, including legacy databases.",
        "tags": [
          "managed_postgres"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChangeManagedPostgresComputePolicyRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Result of the request to change the company database compute policy.",
            "headers": {
              "Location": {
                "description": "Company database compute-policy progress endpoint for the accepted change",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresComputePolicyChange"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "default": {
            "description": "Problem while attempting to change the company database compute policy.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{organization}/postgres/bindings/{id}/rotate": {
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization selected to rotate a credential for a company app binding.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z0-9][a-z0-9-]*$"
          }
        },
        {
          "$ref": "#/components/parameters/ManagedPostgresID"
        }
      ],
      "post": {
        "operationId": "rotateOrgManagedPostgresBinding",
        "summary": "Rotate a credential for a company app binding.",
        "description": "An owner or admin starts the existing credential refresh protocol. The previous generation stays valid until runtime delivery completes; the binding ID is preserved.",
        "tags": [
          "managed_postgres"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Result of the request to rotate a credential for a company app binding.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresBinding"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "default": {
            "description": "Problem while attempting to rotate a credential for a company app binding.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{organization}/postgres/usage": {
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization selected to read the organization's postgresql usage totals.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z0-9][a-z0-9-]*$"
          }
        }
      ],
      "get": {
        "operationId": "getOrgManagedPostgresUsage",
        "summary": "Read the organization's PostgreSQL usage totals.",
        "description": "Aggregates normalized usage across company database namespaces after billing adoption. Billing seats may read these totals without receiving database names or credentials.",
        "tags": [
          "managed_postgres"
        ],
        "responses": {
          "200": {
            "description": "Result of the request to read the organization's PostgreSQL usage totals.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManagedPostgresUsageResponse"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "default": {
            "description": "Problem while attempting to read the organization's PostgreSQL usage totals.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{organization}/apps/{slug}/buckets": {
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Company bucket catalog: Organization owning this application and its storage catalog.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "slug",
          "description": "Company bucket catalog: App whose bucket catalog is being managed.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "operationId": "listOrgObjectBuckets",
        "summary": "List organization buckets and creation capabilities",
        "description": "Owners, admins, developers and viewers can inspect bucket metadata. Requires the corresponding storage scope and current organization membership. Mutations require organization billing adoption. storage:manage lists every bucket. storage:read/storage:write keys see only buckets with an explicit grant. Admin and dashboard sessions list every bucket.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "List organization buckets and creation capabilities. Buckets across this app's environment scopes; backend credentials are never exposed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectBucketList"
                }
              }
            }
          },
          "default": {
            "description": "List organization buckets and creation capabilities. Authentication, authorization, or storage error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createOrgObjectBucket",
        "summary": "Create a bucket for an organization application",
        "description": "Owners and admins manage bucket credentials, access grants and bucket lifecycle. Requires the corresponding storage scope and current organization membership. Mutations require organization billing adoption. Requires storage:manage or admin. Idempotent by app, scope and name, not\nby Idempotency-Key. Retry provisioning by submitting the same name and\nscope. Existing buckets retain their backend when the default changes.\n",
        "tags": [
          "storage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9-]{0,62}$"
                  },
                  "scope": {
                    "type": "string",
                    "default": "default"
                  },
                  "region": {
                    "type": "string",
                    "description": "Create a bucket for an organization application. Gregale region, not upstream signing region. Omit to use the configured default."
                  },
                  "public": {
                    "type": "boolean",
                    "default": false,
                    "description": "Create a bucket for an organization application. Serve objects anonymously on the app hostname."
                  },
                  "serve_at": {
                    "type": "string",
                    "pattern": "^/[A-Za-z0-9][A-Za-z0-9._~/-]*$",
                    "description": "Create a bucket for an organization application. Immutable app path mounted when public is true."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Create a bucket for an organization application. Existing ready bucket",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectBucket"
                }
              }
            }
          },
          "201": {
            "description": "Create a bucket for an organization application. Bucket created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectBucket"
                }
              }
            }
          },
          "default": {
            "description": "Create a bucket for an organization application. Invalid request, access denied, bucket limit/conflict, or provider unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{organization}/apps/{slug}/buckets/{bucket}": {
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Company /{bucket}: Organization owning this application and its storage catalog.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "slug",
          "description": "Company /{bucket}: App that owns the bucket to remove.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Company /{bucket}: Identifier of the empty bucket to delete.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "delete": {
        "operationId": "deleteOrgObjectBucket",
        "summary": "Delete an empty organization bucket",
        "description": "Owners and admins manage bucket credentials, access grants and bucket lifecycle. Requires the corresponding storage scope and current organization membership. Mutations require organization billing adoption. Requires storage:manage or admin. Never recursively deletes data. Nonempty buckets return 409. Repeat after successful deletion returns 404.",
        "tags": [
          "storage"
        ],
        "responses": {
          "204": {
            "description": "Delete an empty organization bucket. Bucket deleted"
          },
          "default": {
            "description": "Delete an empty organization bucket. Access denied, bucket missing/nonempty/busy, or provider unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{organization}/apps/{slug}/buckets/{bucket}/access-grants": {
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Company /{bucket}/access-grants: Organization owning this application and its storage catalog.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "slug",
          "description": "Company /{bucket}/access-grants: App containing the bucket access binding.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Company /{bucket}/access-grants: Bucket whose API-key grants are being managed.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "listOrgObjectBucketAccessGrants",
        "summary": "List organization API-key bucket grants",
        "description": "Owners and admins manage bucket credentials, access grants and bucket lifecycle. Requires the corresponding storage scope and current organization membership. Mutations require organization billing adoption. Requires storage:manage or admin. Revoked keys remain visible until their key row is deleted.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "List organization API-key bucket grants. Logical grants; provider credentials are never exposed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectBucketAccessGrantList"
                }
              }
            }
          },
          "default": {
            "description": "List organization API-key bucket grants. Access denied or bucket unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{organization}/apps/{slug}/buckets/{bucket}/access-grants/{key}": {
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Company /{bucket}/access-grants/{key}: Organization owning this application and its storage catalog.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "slug",
          "description": "Company /{bucket}/access-grants/{key}: App whose API-key bucket grant is being managed.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Company /{bucket}/access-grants/{key}: Bucket whose API-key grant is being managed.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "key",
          "description": "Company /{bucket}/access-grants/{key}: Account API-key identifier.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "put": {
        "operationId": "setOrgObjectBucketAccessGrant",
        "summary": "Grant an organization API key access to a bucket",
        "description": "Owners and admins manage bucket credentials, access grants and bucket lifecycle. Requires the corresponding storage scope and current organization membership. Mutations require organization billing adoption. Requires storage:manage or admin. The target key must be active or in grace and carry the storage scopes needed by the requested permission. Admin keys do not need and cannot receive grants.",
        "tags": [
          "storage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetObjectBucketAccessGrantRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Grant an organization API key access to a bucket. Grant created or replaced",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectBucketAccessGrant"
                }
              }
            }
          },
          "default": {
            "description": "Grant an organization API key access to a bucket. Invalid request, missing key/bucket, scope mismatch, or access denied",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteOrgObjectBucketAccessGrant",
        "summary": "Revoke an organization API-key bucket grant",
        "description": "Owners and admins manage bucket credentials, access grants and bucket lifecycle. Requires the corresponding storage scope and current organization membership. Mutations require organization billing adoption. Requires storage:manage or admin. Revocation takes effect before this response returns; already-signed provider URLs remain valid until their short expiry.",
        "tags": [
          "storage"
        ],
        "responses": {
          "204": {
            "description": "Revoke an organization API-key bucket grant. Grant deleted"
          },
          "default": {
            "description": "Revoke an organization API-key bucket grant. Grant or bucket missing, or access denied",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{organization}/apps/{slug}/buckets/{bucket}/s3-credentials": {
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Company /{bucket}/s3-credentials: Organization owning this application and its storage catalog.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "slug",
          "description": "Company /{bucket}/s3-credentials: App whose new S3 credential will be bucket-scoped.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Company /{bucket}/s3-credentials: Bucket receiving the S3 credential.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "listOrgObjectS3Credentials",
        "summary": "List organization user S3 credentials",
        "description": "Owners and admins manage bucket credentials, access grants and bucket lifecycle. Requires the corresponding storage scope and current organization membership. Mutations require organization billing adoption. Requires storage:manage or admin. Secret access keys are never returned by this endpoint.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "List organization user S3 credentials. Active bucket-scoped S3 credentials; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectS3CredentialList"
                }
              }
            }
          },
          "default": {
            "description": "List organization user S3 credentials. S3 credential listing denied or its bucket is unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createOrgObjectS3Credential",
        "summary": "Create a user S3 key for an organization bucket",
        "description": "Owners and admins manage bucket credentials, access grants and bucket lifecycle. Requires the corresponding storage scope and current organization membership. Mutations require organization billing adoption. The secret access key is returned exactly once, sealed at rest, and never recoverable through the control-plane API. At most ten active credentials may exist per bucket.",
        "tags": [
          "storage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateObjectS3CredentialRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Create a user S3 key for an organization bucket. One-time S3 credential response; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectS3CredentialSecret"
                }
              }
            }
          },
          "default": {
            "description": "Create a user S3 key for an organization bucket. Invalid request, credential limit, unavailable sealing key, or access denied",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{organization}/apps/{slug}/buckets/{bucket}/s3-credentials/{credential}": {
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Company /{bucket}/s3-credentials/{credential}: Organization owning this application and its storage catalog.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "slug",
          "description": "Company /{bucket}/s3-credentials/{credential}: App whose S3 credential is being revoked.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Company /{bucket}/s3-credentials/{credential}: Bucket whose credential is being revoked.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "credential",
          "description": "Company /{bucket}/s3-credentials/{credential}: Gregale S3 credential identifier.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "delete": {
        "operationId": "revokeOrgObjectS3Credential",
        "summary": "Revoke an organization user S3 key",
        "description": "Owners and admins manage bucket credentials, access grants and bucket lifecycle. Requires the corresponding storage scope and current organization membership. Mutations require organization billing adoption. Revocation is immediate for new requests at s3.gregale.dev. Existing provider-signed internal requests are never exposed to the customer.",
        "tags": [
          "storage"
        ],
        "responses": {
          "204": {
            "description": "Revoke an organization user S3 key. Credential revoked"
          },
          "default": {
            "description": "Revoke an organization user S3 key. Credential or bucket missing, or access denied",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{organization}/apps/{slug}/buckets/{bucket}/compute-bindings": {
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Company /{bucket}/compute-bindings: Organization owning this application and its storage catalog.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "slug",
          "description": "Company /{bucket}/compute-bindings: App receiving the sealed storage connection settings.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Company /{bucket}/compute-bindings: Bucket exposed to the compute workload.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "listOrgObjectStorageComputeBindings",
        "summary": "List organization application bucket bindings",
        "description": "Owners, admins, developers and viewers can inspect application bindings. Requires storage:manage or admin and current organization membership. Secret values are never returned; only the sealed app-secret names are listed.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "List organization application bucket bindings. Active compute bindings; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectStorageComputeBindingList"
                }
              }
            }
          },
          "default": {
            "description": "List organization application bucket bindings. Binding listing denied or its bucket is unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createOrgObjectStorageComputeBinding",
        "summary": "Bind an organization bucket to its application environment",
        "description": "Owners, admins and developers can manage application bindings. Requires the corresponding storage scope and current organization membership. Mutations require organization billing adoption. Creates a bucket-scoped Gregale S3 credential and injects endpoint, region, bucket, access-key, secret-key, and addressing settings as sealed app secrets. The secret values are never returned.",
        "tags": [
          "storage"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateObjectStorageComputeBindingRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Bind an organization bucket to its application environment. Compute binding created; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectStorageComputeBinding"
                }
              }
            }
          },
          "default": {
            "description": "Bind an organization bucket to its application environment. Invalid request, secret quota/conflict, unavailable sealing key, or access denied",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{organization}/apps/{slug}/buckets/{bucket}/compute-bindings/{binding}": {
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Company /{bucket}/compute-bindings/{binding}: Organization owning this application and its storage catalog.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "slug",
          "description": "Company /{bucket}/compute-bindings/{binding}: App owning the compute binding.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Company /{bucket}/compute-bindings/{binding}: Bucket attached to the compute binding.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "binding",
          "description": "Company /{bucket}/compute-bindings/{binding}: Opaque compute binding identifier.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "delete": {
        "operationId": "deleteOrgObjectStorageComputeBinding",
        "summary": "Revoke an organization application bucket binding",
        "description": "Owners, admins and developers can manage application bindings. Requires the corresponding storage scope and current organization membership. Mutations require organization billing adoption. Revokes the bucket-scoped S3 credential before removing its sealed app secrets. The operation is idempotent after revocation.",
        "tags": [
          "storage"
        ],
        "responses": {
          "204": {
            "description": "Revoke an organization application bucket binding. Binding revoked and its managed secrets removed"
          },
          "default": {
            "description": "Revoke an organization application bucket binding. Binding or bucket missing, or access denied",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{organization}/apps/{slug}/buckets/{bucket}/compute-bindings/{binding}/rotate": {
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Company /{bucket}/compute-bindings/{binding}/rotate: Organization owning this application and its storage catalog.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "slug",
          "description": "Company /{bucket}/compute-bindings/{binding}/rotate: App whose workload receives the rotated credential.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Company /{bucket}/compute-bindings/{binding}/rotate: Logical bucket whose access key is being rotated.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "name": "binding",
          "description": "Company /{bucket}/compute-bindings/{binding}/rotate: Binding identifier retained across credential rotations.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "operationId": "rotateOrgObjectStorageComputeBinding",
        "summary": "Rotate an organization application bucket binding",
        "description": "Owners and admins can rotate application bindings. Requires the corresponding storage scope and current organization membership. Mutations require organization billing adoption. Atomically replaces the bucket-scoped access key and two sealed app secrets while keeping the binding and environment variable names stable. For a live app, the previous key remains valid until the rolling runtime refresh drains old instances; rotation_pending is true in the response. Retrying during a pending rotation requeues the same refresh. Secret values are never returned.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Rotate an organization application bucket binding. Binding rotated; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectStorageComputeBinding"
                }
              }
            }
          },
          "default": {
            "description": "Rotate an organization application bucket binding. Binding unavailable, sealing key unavailable, or access denied",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{organization}/apps/{slug}/buckets/{bucket}/objects": {
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Company /{bucket}/objects: Organization owning this application and its storage catalog.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "slug",
          "description": "Company /{bucket}/objects: App containing the objects being managed.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "bucket",
          "description": "Company /{bucket}/objects: Identifier of the bucket whose objects are being managed.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "listOrgBucketObjects",
        "summary": "List objects in an organization bucket",
        "description": "Owners, admins, developers and viewers can inspect bucket metadata. Requires the corresponding storage scope and current organization membership. Mutations require organization billing adoption. Requires storage:read or admin. Non-admin keys also require a read or read_write grant on this bucket.",
        "tags": [
          "storage"
        ],
        "parameters": [
          {
            "name": "prefix",
            "description": "List objects in an organization bucket. Only return keys starting with this prefix.",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 1024
            }
          },
          {
            "name": "cursor",
            "description": "List objects in an organization bucket. Opaque next_cursor from the preceding page.",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 8192
            }
          },
          {
            "name": "limit",
            "description": "List objects in an organization bucket. Maximum objects in this page.",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List objects in an organization bucket. One page, not a bucket-wide usage or billing total",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "items"
                  ],
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "key",
                          "size_bytes",
                          "last_modified"
                        ],
                        "properties": {
                          "key": {
                            "type": "string"
                          },
                          "size_bytes": {
                            "type": "integer",
                            "format": "int64"
                          },
                          "last_modified": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "next_cursor": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "List objects in an organization bucket. Invalid request, access denied, bucket unavailable, or provider error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orgs/{organization}/object-storage-usage": {
      "get": {
        "operationId": "getOrgObjectStorageUsage",
        "summary": "Read aggregate organization object storage usage",
        "description": "Owners, admins, developers, viewers and billing seats can read usage with usage:read or admin. Requires billing adoption. Aggregates company buckets across their retained storage namespaces; excludes personal buckets. Reservations are capacity commitments. Fresh false blocks further admission until allocated provider evidence arrives.",
        "tags": [
          "storage"
        ],
        "responses": {
          "200": {
            "description": "Read aggregate organization object storage usage. Organization storage accounting: Current account usage; Cache-Control no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectStorageUsageResponse"
                }
              }
            }
          },
          "default": {
            "description": "Read aggregate organization object storage usage. Organization storage accounting: Access denied or accounting unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Company whose aggregate object storage accounting is requested.",
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/v1/orgs/{organization}/projects/{slug}/environments/{environment}/workloads/{workload}/queue-bindings": {
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization queues: Read a stage workload's complete desired queue configuration. Company owning the application or project.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "slug",
          "in": "path",
          "required": true,
          "description": "Organization queues: Read a stage workload's complete desired queue configuration. Project containing the workload and stage.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "environment",
          "in": "path",
          "required": true,
          "description": "Organization queues: Read a stage workload's complete desired queue configuration. Registered stage. Production is managed through the app queue-bindings API.",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "workload",
          "in": "path",
          "required": true,
          "description": "Organization queues: Read a stage workload's complete desired queue configuration. Workload application slug belonging to this project.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "projects"
        ],
        "operationId": "getOrgProjectEnvironmentQueueBindings",
        "summary": "Organization queues: Read a stage workload's complete desired queue configuration",
        "description": "Organization queues: Read a stage workload's complete desired queue configuration. Owners, admins, developers and viewers can read metadata. Requires current membership and the corresponding credential scope. Mutations require organization billing adoption. IDs, messages, retries and receipts survive creator erasure. Returns logical definitions and the current workload revision. A missing\ncollection returns 409 environment_queue_collection_unavailable and never\ninherits production queues. X-Gregale-Workload-Revision identifies the\nhead to use when initializing or replacing the collection.\nConsumer activation is currently unavailable; saved definitions do not\nactivate delivery or qualify the stage for promotion.",
        "responses": {
          "200": {
            "description": "Organization queues: Read a stage workload's complete desired queue configuration. Complete stage-owned desired queue collection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentQueueBindingsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "put": {
        "tags": [
          "projects"
        ],
        "operationId": "replaceOrgProjectEnvironmentQueueBindings",
        "summary": "Organization queues: Replace a stage workload's complete desired queue configuration",
        "description": "Organization queues: Replace a stage workload's complete desired queue configuration. Owners, admins and developers can configure and operate queues. Requires current membership and the corresponding credential scope. Mutations require organization billing adoption. IDs, messages, retries and receipts survive creator erasure. Requires expected_revision to match the complete workload settings head,\nwith zero for an uninitialized workload. An explicit empty bindings list\nremoves all stage definitions. Stale revisions and protected stages\nreturn 409, including protected no-op writes. Definitions have logical\nnames and no production consumer IDs. Existing deployments retain their\npinned definitions. Consumer activation is currently unavailable.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReplaceProjectEnvironmentQueueBindingsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Organization queues: Replace a stage workload's complete desired queue configuration. Stored desired queue definitions and their workload revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectEnvironmentQueueBindingsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/apps/{slug}/queues/send": {
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "sendOrgQueueMessage",
        "summary": "Organization queues: Enqueue a row on the per-app FIFO queue",
        "description": "Organization queues: Enqueue a row on the per-app FIFO queue. Owners, admins and developers can configure and operate queues. Requires current membership and the corresponding credential scope. Mutations require organization billing adoption. IDs, messages, retries and receipts survive creator erasure. Cap-checked against the plan's MaxQueueDepth (Hobby 5, Pro 25,\nScale 100). The drain re-checks at dispatch tick. API keys require\n`queues:send`, `deploy:write`, or `admin`.",
        "x-faas-queue-leases": false,
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/GregaleRevision"
          },
          {
            "$ref": "#/components/parameters/GregaleRelease"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueueSendRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Organization queues: Enqueue a row on the per-app FIFO queue. The enqueued row.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueSendResponse"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/PlanQueueDepth"
          },
          "413": {
            "$ref": "#/components/responses/PlanSourceBytes"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization queues: Enqueue a row on the per-app FIFO queue. Company owning the application or project.",
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/v1/orgs/{organization}/apps/{slug}/queues/send-batch": {
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "sendOrgQueueMessageBatch",
        "summary": "Organization queues: Send up to 100 messages to one queue as one request",
        "description": "Organization queues: Send up to 100 messages to one queue as one request. Owners, admins and developers can configure and operate queues. Requires current membership and the corresponding credential scope. Mutations require organization billing adoption. The first refused message ends the batch; resend from the first message that was not accepted. API keys require `queues:send`, `deploy:write`, or `admin`.",
        "x-faas-queue-leases": false,
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueueSendBatchRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Organization queues: The outcome of every message, in input order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueSendBatchResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "403": {
            "$ref": "#/components/responses/PlanQueueDepth"
          },
          "413": {
            "$ref": "#/components/responses/PlanSourceBytes"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization queues: Send up to 100 messages to one queue as one request. Company owning the application or project.",
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/v1/orgs/{organization}/apps/{slug}/queue-bindings": {
      "description": "Organization queues: List first-class queue bindings for an app. Production queue bindings. Stage environment or scope queries are rejected before production access or idempotent replay. Stage definitions use the project environment workload queue-bindings endpoint.",
      "get": {
        "tags": [
          "queues"
        ],
        "operationId": "listOrgQueueBindings",
        "summary": "Organization queues: List first-class queue bindings for an app",
        "description": "Organization queues: List first-class queue bindings for an app. Owners, admins, developers and viewers can read metadata. Requires current membership and the corresponding credential scope. Mutations require organization billing adoption. IDs, messages, retries and receipts survive creator erasure. Returns the durable mappings between logical queues and worker/job\nworkloads. Bindings are the configuration source for push consumers\nand queue-depth autoscaling; queue messages remain under /queues/*.\nActive bindings are returned by default. Set include_retired=true to\nretrieve retained identities and retirement timestamps for reviewed recovery.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "include_retired",
            "in": "query",
            "required": false,
            "description": "Organization queues: List first-class queue bindings for an app. Include retained retired bindings belonging to this app.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Organization queues: List first-class queue bindings for an app. Queue bindings.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/QueueBindingResponse"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "createOrgQueueBinding",
        "summary": "Organization queues: Create a first-class queue binding",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateQueueBindingRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Organization queues: Create a first-class queue binding. Created queue binding.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueBindingResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "description": "Organization queues: Create a first-class queue binding. Owners, admins and developers can configure and operate queues. Requires current membership and the corresponding credential scope. Mutations require organization billing adoption. IDs, messages, retries and receipts survive creator erasure. "
      },
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization queues: List first-class queue bindings for an app. Company owning the application or project.",
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/v1/orgs/{organization}/apps/{slug}/queue-bindings/{id}": {
      "description": "Organization queues: Get one queue binding. Production queue binding identity. Stage environment or scope queries are rejected; stage definitions use logical names in the project environment workload queue-bindings endpoint.",
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization queues: Get one queue binding. Company owning the application or project.",
          "schema": {
            "type": "string"
          }
        },
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "queues"
        ],
        "operationId": "getOrgQueueBinding",
        "summary": "Organization queues: Get one queue binding",
        "responses": {
          "200": {
            "description": "Organization queues: Get one queue binding. Queue binding.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueBindingResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "description": "Organization queues: Get one queue binding. Owners, admins, developers and viewers can read metadata. Requires current membership and the corresponding credential scope. Mutations require organization billing adoption. IDs, messages, retries and receipts survive creator erasure. "
      },
      "patch": {
        "tags": [
          "queues"
        ],
        "operationId": "updateOrgQueueBinding",
        "summary": "Organization queues: Update one queue binding",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateQueueBindingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Organization queues: Update one queue binding. Updated queue binding.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueBindingResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "description": "Organization queues: Update one queue binding. Owners, admins and developers can configure and operate queues. Requires current membership and the corresponding credential scope. Mutations require organization billing adoption. IDs, messages, retries and receipts survive creator erasure. "
      },
      "delete": {
        "tags": [
          "queues"
        ],
        "operationId": "deleteOrgQueueBinding",
        "summary": "Organization queues: Delete one queue binding",
        "responses": {
          "204": {
            "description": "Organization queues: Delete one queue binding. Queue binding deleted."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "description": "Organization queues: Delete one queue binding. Owners, admins and developers can configure and operate queues. Requires current membership and the corresponding credential scope. Mutations require organization billing adoption. IDs, messages, retries and receipts survive creator erasure. "
      }
    },
    "/v1/orgs/{organization}/apps/{slug}/queue-bindings/{id}/status": {
      "description": "Organization queues: Read queue binding consumer state and queue counters. Production consumer status. Stage environment or scope queries are rejected before reading production counters.",
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization queues: Read queue binding consumer state and queue counters. Company owning the application or project.",
          "schema": {
            "type": "string"
          }
        },
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "$ref": "#/components/parameters/Id32"
        }
      ],
      "get": {
        "tags": [
          "queues"
        ],
        "operationId": "getOrgQueueBindingStatus",
        "summary": "Organization queues: Read queue binding consumer state and queue counters",
        "description": "Organization queues: Read queue binding consumer state and queue counters. Owners, admins, developers and viewers can read metadata. Requires current membership and the corresponding credential scope. Mutations require organization billing adoption. IDs, messages, retries and receipts survive creator erasure. Returns the durable push-consumer projection and binding-scoped\nqueue counters. `consumer_state` is control-plane state\n(`active`, `paused`, `not_configured`, or `external`), while\n`consumer_liveness` and the poll timestamps expose the scheduler's\nlast-known health. A push snapshot is stale after 30 seconds without\na completed poll; pull bindings report `external` liveness.",
        "responses": {
          "200": {
            "description": "Organization queues: Read queue binding consumer state and queue counters. Queue binding status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueBindingStatusResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/v1/orgs/{organization}/apps/{slug}/queues/receive": {
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "receiveOrgQueueResult",
        "summary": "Organization queues: Long-poll for the next dispatched row",
        "description": "Organization queues: Long-poll for the next dispatched row. Owners, admins and developers can configure and operate queues. Requires current membership and the corresponding credential scope. Mutations require organization billing adoption. IDs, messages, retries and receipts survive creator erasure. Returns 200 with the dequeued row, or 204 (no body) if the\nserver-side 30s budget elapses with no event. The customer\nretries on 204.",
        "x-faas-queue-leases": true,
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          }
        ],
        "responses": {
          "200": {
            "description": "Organization queues: Long-poll for the next dispatched row. A dispatched row.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueReceiveResponse"
                }
              }
            }
          },
          "204": {
            "description": "Organization queues: Long-poll for the next dispatched row. No row dispatched within the budget."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization queues: Long-poll for the next dispatched row. Company owning the application or project.",
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/v1/orgs/{organization}/apps/{slug}/queues/{id}/ack": {
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "ackOrgQueueRow",
        "summary": "Organization queues: Ack a queue row (idempotent)",
        "x-faas-queue-leases": false,
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/Id32"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "204": {
            "description": "Organization queues: Ack a queue row (idempotent). No body. The ack (or a re-ack) was accepted."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "description": "Organization queues: Ack a queue row (idempotent). Owners, admins and developers can configure and operate queues. Requires current membership and the corresponding credential scope. Mutations require organization billing adoption. IDs, messages, retries and receipts survive creator erasure. "
      },
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization queues: Ack a queue row (idempotent). Company owning the application or project.",
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/v1/orgs/{organization}/apps/{slug}/queues/{queue}/leases": {
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "leaseOrgQueueMessages",
        "summary": "Organization queues: Lease ready messages from a pull-bound queue",
        "description": "Organization queues: Lease ready messages from a pull-bound queue. Owners, admins and developers can configure and operate queues. Requires current membership and the corresponding credential scope. Mutations require organization billing adoption. IDs, messages, retries and receipts survive creator erasure. Leases up to `max_messages` ready messages from a queue with an\nenabled pull binding on this app. Each message stays hidden for the\nvisibility timeout and is redelivered with a new attempt if it is not\nacked, nacked or extended in time. Unexpired leases never exceed the\nbinding's `max_concurrency`. An empty list means nothing is ready;\npoll again with back-off. Authenticate with an API key carrying\n`queues:consume`, `deploy:write` or `admin`, or with a workload\nidentity token for audience `gregale:queues` from a live instance of\nthis app.",
        "x-faas-queue-leases": true,
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/QueueLeaseQueue"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueueLeaseRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Organization queues: Lease ready messages from a pull-bound queue. Leased messages, possibly none.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueLeaseResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization queues: Lease ready messages from a pull-bound queue. Company owning the application or project.",
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/v1/orgs/{organization}/apps/{slug}/queues/{queue}/leases:ack": {
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "ackOrgQueueLeases",
        "summary": "Organization queues: Complete leased messages",
        "x-faas-queue-leases": true,
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/QueueLeaseQueue"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueueLeaseReceiptsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Organization queues: Complete leased messages. Receipts that completed their messages, and receipts that no longer own one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueLeaseReceiptsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "description": "Organization queues: Complete leased messages. Owners, admins and developers can configure and operate queues. Requires current membership and the corresponding credential scope. Mutations require organization billing adoption. IDs, messages, retries and receipts survive creator erasure. "
      },
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization queues: Complete leased messages. Company owning the application or project.",
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/v1/orgs/{organization}/apps/{slug}/queues/{queue}/leases:nack": {
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "nackOrgQueueLeases",
        "summary": "Organization queues: Return leased messages for a retry",
        "description": "Organization queues: Return leased messages for a retry. Owners, admins and developers can configure and operate queues. Requires current membership and the corresponding credential scope. Mutations require organization billing adoption. IDs, messages, retries and receipts survive creator erasure. Applies the message's retry policy and the plan's attempt budget:\nthe message returns to the queue after the back-off (or after\n`delay_seconds` if later), or moves to the dead-letter queue once the\nbudget is spent. `error` is recorded as the attempt's last error.",
        "x-faas-queue-leases": true,
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/QueueLeaseQueue"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueueLeaseReceiptsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Organization queues: Return leased messages for a retry. Receipts whose messages went back for a retry or to the dead-letter queue, and receipts that no longer own one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueLeaseReceiptsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization queues: Return leased messages for a retry. Company owning the application or project.",
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/v1/orgs/{organization}/apps/{slug}/queues/{queue}/leases:extend": {
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "extendOrgQueueLeases",
        "summary": "Organization queues: Extend the visibility timeout of leased messages",
        "x-faas-queue-leases": true,
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/QueueLeaseQueue"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueueLeaseReceiptsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Organization queues: Extend the visibility timeout of leased messages. Receipts whose visibility deadline moved, and receipts that no longer own their message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueLeaseReceiptsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlanFeatureGated"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        },
        "description": "Organization queues: Extend the visibility timeout of leased messages. Owners, admins and developers can configure and operate queues. Requires current membership and the corresponding credential scope. Mutations require organization billing adoption. IDs, messages, retries and receipts survive creator erasure. "
      },
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization queues: Extend the visibility timeout of leased messages. Company owning the application or project.",
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/v1/orgs/{organization}/apps/{slug}/queues/state": {
      "get": {
        "tags": [
          "queues"
        ],
        "operationId": "getOrgQueueState",
        "summary": "Organization queues: Read queue depth, in-flight count, and oldest pending age",
        "description": "Organization queues: Read queue depth, in-flight count, and oldest pending age. Owners, admins, developers and viewers can read metadata. Requires current membership and the corresponding credential scope. Mutations require organization billing adoption. IDs, messages, retries and receipts survive creator erasure. Read-only depth / in-flight / oldest-pending stats. NO lease is\nacquired and no row is mutated — the response can be polled at\nany cadence without affecting drain behaviour. Free plans can\ncall this for diagnostics even though they cannot send.",
        "x-faas-queue-leases": false,
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          }
        ],
        "responses": {
          "200": {
            "description": "Organization queues: Read queue depth, in-flight count, and oldest pending age. Queue stats for the app.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueStateResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization queues: Read queue depth, in-flight count, and oldest pending age. Company owning the application or project.",
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/v1/orgs/{organization}/apps/{slug}/queues/peek": {
      "get": {
        "tags": [
          "queues"
        ],
        "operationId": "peekOrgQueue",
        "summary": "Organization queues: List pending queue rows without acquiring a lease",
        "description": "Organization queues: List pending queue rows without acquiring a lease. Owners, admins and developers can configure and operate queues. Requires current membership and the corresponding credential scope. Mutations require organization billing adoption. IDs, messages, retries and receipts survive creator erasure. Read-only peek at pending rows, oldest first. Repeated calls\nreturn the same rows in the same order — the underlying SQL has\nno FOR UPDATE / FOR SHARE / advisory lock, so attempts is\nnever incremented and no row state changes. Cursor pagination\nmatches the existing `?before=<id>` convention. NOT equivalent\nto `queues/receive` — peek never leases.",
        "x-faas-queue-leases": false,
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/QueueCursorLimit"
          },
          {
            "$ref": "#/components/parameters/QueueCursorBefore"
          }
        ],
        "responses": {
          "200": {
            "description": "Organization queues: List pending queue rows without acquiring a lease. A page of pending rows.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueuePeekResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization queues: List pending queue rows without acquiring a lease. Company owning the application or project.",
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/v1/orgs/{organization}/apps/{slug}/queues/dead_letter": {
      "get": {
        "tags": [
          "queues"
        ],
        "operationId": "listOrgQueueDeadLetters",
        "summary": "Organization queues: List queue rows that exhausted the plan's retry budget",
        "description": "Organization queues: List queue rows that exhausted the plan's retry budget. Owners, admins and developers can configure and operate queues. Requires current membership and the corresponding credential scope. Mutations require organization billing adoption. IDs, messages, retries and receipts survive creator erasure. Read-only list of rows in `state='dead_letter'`, newest first.\nThe drain transitions a row here once it has failed\n`MaxQueueAttempts` times for the app's plan (Hobby 3, Pro 10,\nScale 25). NO lease is acquired and no row is mutated. Replaying\na dead-letter row is out of scope for this endpoint — see\n`POST /v1/apps/{slug}/queues/dead_letter/{id}/replay`.",
        "x-faas-queue-leases": false,
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "$ref": "#/components/parameters/QueueCursorLimit"
          },
          {
            "$ref": "#/components/parameters/QueueCursorBefore"
          }
        ],
        "responses": {
          "200": {
            "description": "Organization queues: List queue rows that exhausted the plan's retry budget. A page of dead-letter rows.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueDeadLetterResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization queues: List queue rows that exhausted the plan's retry budget. Company owning the application or project.",
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/v1/orgs/{organization}/apps/{slug}/queues/dead_letter/{id}/replay": {
      "post": {
        "tags": [
          "queues"
        ],
        "operationId": "replayOrgQueueDeadLetter",
        "summary": "Organization queues: Reset a dead-letter queue row back to pending",
        "description": "Organization queues: Reset a dead-letter queue row back to pending. Owners and admins can replay dead letters. Requires current membership and the corresponding credential scope. Mutations require organization billing adoption. IDs, messages, retries and receipts survive creator erasure. Resets the row's `state` to `pending` with\n`attempts=0`, `last_error=null`, `due_at=now()`,\n`last_replayed_at=now()`. Distinct from\n`POST /v1/invocations/{id}/replay`, which enqueues a NEW row\ntagged Source=InvocationReplay. This endpoint mutates the\nexisting row in place so the dashboard's replay history view\ntracks the chain on a single row id.\n\nIdempotent: a second POST after the first has succeeded\nfinds the row in 'pending' and returns 404. The\nIdempotency-Key middleware (issued automatically by the SDK)\ncovers double-POST across network retries.",
        "x-faas-queue-leases": false,
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{32}$"
            },
            "description": "Organization queues: Reset a dead-letter queue row back to pending. The invocation id of the dead-letter row to replay."
          }
        ],
        "responses": {
          "202": {
            "description": "Organization queues: Reset a dead-letter queue row back to pending. Replay accepted; row is back to pending.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AsyncInvokeResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Organization queues: Reset a dead-letter queue row back to pending. Company owning the application or project.",
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/v1/orgs/{organization}/queue-usage": {
      "parameters": [
        {
          "name": "organization",
          "in": "path",
          "required": true,
          "description": "Read aggregate organization queue usage. Company whose aggregate queue usage is requested.",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "operationId": "getOrgQueueUsage",
        "summary": "Read aggregate organization queue usage",
        "tags": [
          "queues"
        ],
        "description": "Read aggregate organization queue usage. Owners, admins, developers, viewers and billing seats can read counts with usage:read or admin. Requires billing adoption. Includes company queues across retained creator namespaces and excludes personal queues. Reserved async counts include all invocation sources sharing the organization cap. Pull leases use binding concurrency and do not reserve async slots.",
        "responses": {
          "200": {
            "description": "Read aggregate organization queue usage. Current company queue counters and plan limits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgQueueUsageResponse"
                }
              }
            }
          },
          "default": {
            "description": "Read aggregate organization queue usage. Authentication, authorization or accounting error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/data/connections": {
      "get": {
        "operationId": "listDataConnections",
        "summary": "List sealed PostgreSQL pipeline source identities",
        "tags": [
          "data_pipelines"
        ],
        "responses": {
          "200": {
            "description": "Account-owned source identities with credentials omitted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataConnectionList"
                }
              }
            }
          },
          "default": {
            "description": "Problem returned by listDataConnections after account, credential or pipeline validation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createDataConnection",
        "summary": "Seal a credential for a PostgreSQL pipeline source",
        "tags": [
          "data_pipelines"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateDataConnectionRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Registered source identity and its initial credential revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataConnection"
                }
              }
            }
          },
          "default": {
            "description": "Problem returned by createDataConnection after account, credential or pipeline validation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/data/connections/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Sealed source connection to rotate or remove."
        }
      ],
      "put": {
        "operationId": "rotateDataConnection",
        "summary": "Replace the credential of a PostgreSQL pipeline source",
        "tags": [
          "data_pipelines"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RotateDataConnectionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Source identity with an incremented credential revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataConnection"
                }
              }
            }
          },
          "default": {
            "description": "Problem returned by rotateDataConnection after account, credential or pipeline validation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteDataConnection",
        "summary": "Remove an unused PostgreSQL pipeline source",
        "tags": [
          "data_pipelines"
        ],
        "responses": {
          "204": {
            "description": "Unused sealed source credential has been removed."
          },
          "default": {
            "description": "Problem returned by deleteDataConnection after account, credential or pipeline validation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/data/connections/{id}/check": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Account-owned sealed source connection.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "operationId": "requestDataConnectionCheck",
        "summary": "Queue a private worker connection check and table discovery",
        "description": "Staging only. Coalesces active or very recent checks for the same credential revision and optional mirror. No source SQL runs in the HTTP handler. Results are compatibility observations, not a production qualification.",
        "tags": [
          "data_pipelines"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RequestDataConnectionCheck"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted or coalesced durable connection check.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataConnectionCheck"
                }
              }
            }
          },
          "default": {
            "description": "Problem returned by requestDataConnectionCheck after account, revision or target validation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getDataConnectionCheck",
        "summary": "Read the latest connection check and discovered source schema",
        "description": "Account-scoped, bounded metadata only. A credential rotation makes earlier evidence stale; completed checks expire after 90 seconds. No source credentials or customer rows are returned.",
        "tags": [
          "data_pipelines"
        ],
        "responses": {
          "200": {
            "description": "Latest check, freshness, compatibility issues and discovered tables.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataConnectionCheck"
                }
              }
            }
          },
          "default": {
            "description": "Problem returned by getDataConnectionCheck after account or connection validation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/data/pipelines": {
      "get": {
        "operationId": "listDataPipelines",
        "summary": "List managed PostgreSQL table mirrors",
        "tags": [
          "data_pipelines"
        ],
        "responses": {
          "200": {
            "description": "Bounded account-owned pipeline intent and observation history.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataPipelineList"
                }
              }
            }
          },
          "default": {
            "description": "Problem returned by listDataPipelines after account, credential or pipeline validation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createDataPipeline",
        "summary": "Start a managed PostgreSQL table mirror",
        "tags": [
          "data_pipelines"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateDataPipelineRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Durable replication intent accepted for asynchronous reconciliation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataPipeline"
                }
              }
            }
          },
          "default": {
            "description": "Problem returned by createDataPipeline after account, credential or pipeline validation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/data/pipelines/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Managed table mirror whose progress to inspect."
        }
      ],
      "get": {
        "operationId": "getDataPipeline",
        "summary": "Read synchronization progress for a PostgreSQL table mirror",
        "tags": [
          "data_pipelines"
        ],
        "responses": {
          "200": {
            "description": "Current desired action and the most recent replication observation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataPipeline"
                }
              }
            }
          },
          "default": {
            "description": "Problem returned by getDataPipeline after account, credential or pipeline validation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/data/pipelines/{id}/control": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Managed table mirror receiving the lifecycle request."
        }
      ],
      "post": {
        "operationId": "controlDataPipeline",
        "summary": "Change managed PostgreSQL table mirror intent",
        "tags": [
          "data_pipelines"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ControlDataPipelineRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Updated intent revision accepted for worker reconciliation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataPipeline"
                }
              }
            }
          },
          "default": {
            "description": "Problem returned by controlDataPipeline after account, credential or pipeline validation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sales/inquiries/challenge": {
      "get": {
        "x-internal": true,
        "tags": [
          "auth"
        ],
        "operationId": "salesInquiryChallenge",
        "security": [],
        "summary": "Prepare an anonymous website sales inquiry",
        "description": "Requires the default-off sales intake flag. This opaque one-hour form token must be at least two seconds old when submitted. The challenge and submission share a separate ten-requests-per-minute IP budget.",
        "responses": {
          "200": {
            "description": "Form check prepared",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "challenge",
                    "ready_after_ms",
                    "expires_in_seconds"
                  ],
                  "properties": {
                    "challenge": {
                      "type": "string"
                    },
                    "ready_after_ms": {
                      "type": "integer"
                    },
                    "expires_in_seconds": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/sales/inquiries": {
      "post": {
        "x-internal": true,
        "tags": [
          "auth"
        ],
        "operationId": "submitSalesInquiry",
        "security": [],
        "summary": "Submit a contact or demo request from the website",
        "description": "Enabled only by FAAS_SALES_INTAKE_ENABLED and FAAS_SALES_ENABLED.\nBrowser writes must come from a trusted control-plane origin. A token\nis consumed atomically with intake; retrying that token is idempotent\nuntil expiry, including when a changed body is presented. Active emails\nare deduplicated without overwriting staff data or ownership. Unknown,\npaused, customer or unavailable salesperson codes enter manager review;\nthe response never reveals code validity or ownership. These messages\nare unverified and grant no referral attribution, rewards or account access.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "name",
                  "email",
                  "intent",
                  "message",
                  "challenge"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 254
                  },
                  "company": {
                    "type": "string",
                    "maxLength": 200,
                    "default": ""
                  },
                  "intent": {
                    "type": "string",
                    "enum": [
                      "contact",
                      "demo"
                    ]
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1500,
                    "description": "UTF-8 byte limit; other text limits are also measured in bytes."
                  },
                  "salesperson_code": {
                    "type": "string",
                    "pattern": "^([A-Za-z0-9]{6})?$",
                    "default": ""
                  },
                  "challenge": {
                    "type": "string"
                  },
                  "website": {
                    "type": "string",
                    "default": "",
                    "description": "Leave blank."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Inquiry accepted without disclosing routing details",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "accepted"
                  ],
                  "properties": {
                    "accepted": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid form input or sales_challenge_invalid; refresh the form check before resubmitting an expired challenge.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/referrals/checkout": {
      "get": {
        "x-internal": true,
        "tags": [
          "auth"
        ],
        "operationId": "checkoutReferralStatus",
        "security": [
          {
            "cookieAuth": []
          }
        ],
        "summary": "Check whether the signed-in account can add a salesperson code",
        "description": "Requires a verified browser session and the sales feature flag. API keys\nare rejected. Eligibility is a display hint; the plan mutation checks it\nagain atomically with referral selection before starting payment.\n",
        "responses": {
          "200": {
            "description": "Current first-purchase referral eligibility",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "Always no-store."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "eligible"
                  ],
                  "properties": {
                    "eligible": {
                      "type": "boolean"
                    },
                    "reason": {
                      "type": "string",
                      "enum": [
                        "already_attributed",
                        "not_first_purchase",
                        "unavailable"
                      ]
                    },
                    "code": {
                      "type": "string",
                      "description": "The already saved referral code; no referrer contact details are returned."
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/automations": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "listAutomations",
        "summary": "List drafts and published automations, including YAML definitions.",
        "responses": {
          "200": {
            "description": "listAutomations result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListAutomationsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AutomationConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/AutomationInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/automations:simulate": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "simulateAutomation",
        "summary": "Simulate automation data flow with sample input and successful action mocks.",
        "description": "Returns a deterministic hypothetical trace without saving a definition,\ncreating runs, invoking handlers, publishing events or calling integrations.\nRequires ownership, MFA and read scope. Works without a live deployment\nor enabled workflow runtime. Definition validation uses the account plan\nand checks managed integration bindings without opening credentials.\nMissing action results block dependent steps. Waits remain unresolved;\nfailure and timeout outcomes cannot be injected. Action mocks using the\nreserved exact {\"timeout\":true} output with an on_timeout route return\n400. Loop mocks form a\nsequential prefix. A complete trace means all roots resolved or skipped\nunder the supplied successful mocks, not that live execution will succeed.\nLimits: 3 MiB request, 1 MiB definition and each sample value, 128 roots,\n1024 trace entries and 4 MiB response, plus existing loop bounds.\nInvalid definitions return 200 with definition_valid=false and no trace.\n",
        "requestBody": {
          "description": "Candidate definition, workflow input and hypothetical successful action results.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SimulateAutomationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Definition validation and the bounded hypothetical execution trace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimulateAutomationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/automations:validate": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "validateAutomation",
        "summary": "Validate a definition without saving it or executing any steps.",
        "responses": {
          "200": {
            "description": "validateAutomation result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidateAutomationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AutomationConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/AutomationInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ValidateAutomationRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/automations/{name}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Automation name, shared with workflow run endpoints."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "getAutomation",
        "summary": "Read an automation draft and its published definition.",
        "responses": {
          "200": {
            "description": "getAutomation result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AutomationConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/AutomationInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "put": {
        "tags": [
          "workflows"
        ],
        "operationId": "saveAutomationDraft",
        "summary": "Save a draft with optimistic version checking; running definitions stay unchanged.",
        "responses": {
          "200": {
            "description": "saveAutomationDraft result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AutomationConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/AutomationInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveAutomationDraftRequest"
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "workflows"
        ],
        "operationId": "deleteAutomation",
        "summary": "Remove a dashboard definition; restoring YAML ownership requires explicit confirmation.",
        "responses": {
          "204": {
            "description": "deleteAutomation result."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AutomationConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/AutomationInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "parameters": [
          {
            "name": "expected_version",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            },
            "description": "Revision returned by the most recent read or save."
          },
          {
            "name": "restore_manifest",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "Explicitly return ownership to the current YAML definition after deletion."
          }
        ]
      }
    },
    "/v1/apps/{slug}/automations/{name}/failure-policy": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Published automation whose failure admission guard is inspected or changed."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "getAutomationFailurePolicy",
        "summary": "Inspect failure pause policy and resume preview.",
        "description": "Returns aggregate terminal outcomes since monitoring began or resumed, current pause generation, active run counts, retained event count and the latest 100 pause/resume transitions. Counts are advisory; no run payloads or error messages are included.",
        "responses": {
          "200": {
            "description": "Current monitoring policy, failure pause, retained work preview and recent transitions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationFailurePolicyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "code automation_failure_policy_conflict; reload failure guard state before a conflicting operation.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/AutomationInvalid"
          }
        }
      },
      "put": {
        "tags": [
          "workflows"
        ],
        "operationId": "setAutomationFailurePolicy",
        "summary": "Configure automatic pausing after repeated failures.",
        "description": "Opt-in policy for a published YAML or dashboard automation; requires deploy write scope. Compare-and-set expected_version starts at zero. Scheduler ticks latch a runtime pause when both failure count and minimum completed-run count are met. Policy edits, disabling monitoring, publishing, and ordinary enabled changes do not clear an existing failure pause.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetAutomationFailurePolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated failure monitoring configuration with the current independent admission guard.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationFailurePolicyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "code automation_failure_policy_conflict; the expected failure policy version changed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/AutomationInvalid"
          }
        }
      }
    },
    "/v1/apps/{slug}/automations/{name}/failure-policy/resume": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Published automation whose current failure pause is explicitly resumed."
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "resumeAutomationFailurePause",
        "summary": "Explicitly clear a failure pause after inspecting retained work.",
        "description": "Requires deploy write scope and the current positive pause generation. Starts a fresh monitoring epoch and re-arms schedules without catch-up for the paused interval. Existing runs continue and captured events remain subject to their routing retention; events received without an eligible recipient are not replayed. This action does not change manual pause intent.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResumeAutomationFailurePauseRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Explicitly resumed guard state with fresh monitoring counts and transition history.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationFailurePolicyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "code automation_failure_policy_conflict; the reviewed pause generation is stale or no pause remains.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/AutomationInvalid"
          }
        }
      }
    },
    "/v1/apps/{slug}/automations/{name}/health": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Automation whose recent execution health is summarized."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "getAutomationHealth",
        "summary": "Get bounded execution health for one automation.",
        "description": "Returns run counts by status, the completed-run success rate, median\nand p95 duration, recent run identities and the most common failed\nsteps. Inputs, outputs, and error text are never included. The default\nwindow is the previous seven days; the maximum window is 30 days.\ncreated_after and created_before are inclusive RFC3339 timestamps, and\ncreated_before may not be in the future. Failed loop items are grouped\nunder their parent step; at most ten failed steps are returned.\n",
        "parameters": [
          {
            "name": "created_after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Inclusive start of the summary window; defaults to seven days before created_before or now."
          },
          {
            "name": "created_before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Inclusive end of the summary window; defaults to now."
          }
        ],
        "responses": {
          "200": {
            "description": "Safe operational summary for the selected automation and time window.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationHealthResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/automations/{name}/revisions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Automation whose immutable published revisions are listed."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "listAutomationRevisions",
        "summary": "List published automation revisions, newest first.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Maximum number of revisions to return (1–100; defaults to 50)."
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0,
              "maximum": 2147483647,
              "default": 0
            },
            "description": "Number of newest revisions to skip before returning results (maximum 2147483647)."
          }
        ],
        "responses": {
          "200": {
            "description": "Immutable published definitions and pagination metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListAutomationRevisionsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/automations/{name}/revisions/{version}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Automation that owns the requested published revision."
        },
        {
          "name": "version",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "description": "Published revision identifier returned by the revision list."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "getAutomationRevision",
        "summary": "Read one immutable published automation revision.",
        "responses": {
          "200": {
            "description": "The selected published definition and its canonical hash.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationRevisionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/automations/{name}/revisions/{version}/restore": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Automation that receives the restored draft."
        },
        {
          "name": "version",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "description": "Published revision to copy into the current draft."
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "restoreAutomationRevision",
        "summary": "Restore a published revision as a new draft using optimistic version checking.",
        "description": "Copies the selected immutable revision into the automation's draft. It\ndoes not publish the copy or change running and accepted workflows.\nSend expected_version from the latest automation read; use zero when\ncreating a draft after the automation was deleted. YAML ownership still\nrequires explicit takeover when the restored draft is later published.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RestoreAutomationRevisionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated automation draft; publishing remains a separate operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AutomationConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/AutomationInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/automations:publish-policy": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "getAutomationPublishPolicy",
        "summary": "Inspect required publishing checks.",
        "responses": {
          "200": {
            "description": "Publishing policy currently configured for this app.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationPublishPolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AutomationConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/AutomationInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "put": {
        "tags": [
          "workflows"
        ],
        "operationId": "setAutomationPublishPolicy",
        "summary": "Set required publishing checks using admin scope and the current policy version.",
        "responses": {
          "200": {
            "description": "Publishing policy after the requested versioned update.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationPublishPolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AutomationConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/AutomationInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetAutomationPublishPolicyRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/automations/{name}/tests": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Automation whose reusable test suite is replaced or cleared."
        }
      ],
      "put": {
        "tags": [
          "workflows"
        ],
        "operationId": "saveAutomationTestSuite",
        "summary": "Save or clear reusable test data using the current draft version.",
        "responses": {
          "200": {
            "description": "Versioned saved test data.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AutomationConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/AutomationInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveAutomationTestSuiteRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/automations/{name}/tests/run": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Automation whose saved test cases are simulated."
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "runAutomationTests",
        "summary": "Simulate all saved cases against the saved draft and retain safe results.",
        "responses": {
          "200": {
            "description": "Case and assertion summaries without payloads or publishing authority.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationTestReport"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AutomationConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/AutomationInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RunAutomationTestsRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/automations/{name}/publish-check": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Saved automation draft to check."
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "checkAutomationPublication",
        "summary": "Evaluate scenario assertions and coverage on the server and issue a bound receipt.",
        "responses": {
          "200": {
            "description": "Server-issued publishing receipt and verified check metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckAutomationPublicationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AutomationConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/AutomationInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckAutomationPublicationRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/automations/{name}/publish": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Automation whose saved draft will be published."
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "publishAutomation",
        "summary": "Validate and publish the saved draft; taking over a YAML name requires explicit confirmation.",
        "responses": {
          "200": {
            "description": "publishAutomation result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AutomationConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/AutomationInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublishAutomationRequest"
              }
            }
          }
        },
        "description": "Published definitions survive future YAML deployments. A live default deployment is required. Runtime execution also requires workflows to be enabled on the platform. Events accepted before publication retain their captured definition.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/v1/apps/{slug}/automations/{name}/enabled": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Automation whose automatic starts will be paused or resumed."
        }
      ],
      "put": {
        "tags": [
          "workflows"
        ],
        "operationId": "setAutomationEnabled",
        "summary": "Pause or resume automatic starts without cancelling existing runs.",
        "responses": {
          "200": {
            "description": "setAutomationEnabled result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AutomationConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/AutomationInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetAutomationEnabledRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/inbound-webhooks/{id}/automation-binding": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Endpoint whose future verified events use this automation binding."
        }
      ],
      "put": {
        "tags": [
          "inbound_webhooks"
        ],
        "operationId": "putWebhookAutomationBinding",
        "summary": "Route a verified Stripe endpoint to a published automation.",
        "description": "One binding per endpoint, owned by the same app. expected_version is zero\nfor creation and the returned version for updates. take_over_delivery\nmust be true: bound endpoints start automations instead of app delivery.\nCallback and managed-operation bindings must be removed first.\nEvent types accept edge wildcards; filters use the existing event language.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "description": "Explicit delivery takeover and published automation selection.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutWebhookAutomationBindingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved binding with its new revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookAutomationBindingResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "Plan does not allow workflows.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Binding revision or routing mode conflict (webhook_automation_conflict).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "Request body exceeds 64 KiB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "get": {
        "tags": [
          "inbound_webhooks"
        ],
        "operationId": "getWebhookAutomationBinding",
        "summary": "Inspect an endpoint automation binding.",
        "description": "Returns the current event selection and revision for this endpoint.",
        "responses": {
          "200": {
            "description": "Current binding.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookAutomationBindingResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "inbound_webhooks"
        ],
        "operationId": "deleteWebhookAutomationBinding",
        "summary": "Restore ordinary delivery for future webhook events.",
        "description": "Already accepted receipts retain their captured routing decision.",
        "parameters": [
          {
            "name": "expected_version",
            "description": "Current binding revision returned by a previous read or update.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Binding removed."
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Binding revision conflict (webhook_automation_conflict).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/inbound-webhooks/{id}/automation-receipts/{event_id}": {
      "get": {
        "tags": [
          "inbound_webhooks"
        ],
        "operationId": "getWebhookAutomationReceipt",
        "summary": "Inspect a verified provider event and its automation admission.",
        "description": "Returns the captured decision and scheduler progress for a retained provider event.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          },
          {
            "name": "id",
            "description": "Endpoint that accepted the provider event being inspected.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "event_id",
            "description": "Stripe event ID returned in the verified provider receipt.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Receipt, routing status and admitted run ID when retained.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookAutomationReceiptResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/CapacityUnavailable"
          }
        }
      }
    },
    "/v1/apps/{slug}/automations/{name}/live-baselines": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "description": "Automation whose baseline catalog is being listed.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "listAutomationLiveBaselines",
        "summary": "Discover named baseline heads and current retained evidence health.",
        "description": "Read-only coherent snapshot, sorted by baseline name and bounded by the 20-name quota. Requires app read scope. Never runs workflows, checks assertions, repairs evidence or promotes. Evidence availability and renewal readiness are separate observations, not CI gate verdicts: historical baseline targets and baseline age remain allowed by CI. Renewal evaluates original run age and the current target against each promoted policy.",
        "responses": {
          "200": {
            "description": "Current heads and current retained evidence observations; historical audit receipts remain immutable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListAutomationLiveBaselinesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AutomationConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/automations/{name}/live-baselines/{baseline}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "description": "Automation whose current baseline receipt is being read.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        },
        {
          "name": "baseline",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z0-9]([a-z0-9-]*[a-z0-9])?$"
          },
          "description": "Baseline name whose current promotion receipt is requested."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "getAutomationLiveBaseline",
        "summary": "Read the current named automation baseline promotion receipt.",
        "description": "Read-only; requires app read scope. Records the exact suite, revision, actor, promotion time and reviewed coverage/age policy.",
        "responses": {
          "200": {
            "description": "Current immutable promotion receipt; inspect retained evidence separately for current validity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationLiveBaseline"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AutomationConflict"
          },
          "410": {
            "description": "This baseline name is permanently retired; its retirement audit remains available from history.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/automations/{name}/live-baselines/{baseline}/history": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "description": "Automation whose baseline audit history is being read.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        },
        {
          "name": "baseline",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z0-9]([a-z0-9-]*[a-z0-9])?$"
          },
          "description": "Baseline name whose immutable promotion and retirement history is requested."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "getAutomationLiveBaselineHistory",
        "summary": "Read the last 100 promotions for a named automation baseline.",
        "description": "Newest revision first. History is immutable until bounded retention or automation deletion. Requires app read scope.",
        "responses": {
          "200": {
            "description": "Bounded immutable promotion history, including the permanent retirement receipt when present.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationLiveBaselineHistory"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AutomationConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/automations/{name}/live-baselines/{baseline}/promotions/{promotion_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "description": "Automation whose passing suite is being promoted.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        },
        {
          "name": "baseline",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z0-9]([a-z0-9-]*[a-z0-9])?$"
          },
          "description": "Release track to promote within this automation; execution routing is unchanged."
        },
        {
          "name": "promotion_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Stable caller-selected UUID. Retry uncertain requests only with the original ID and identical semantic request."
        }
      ],
      "put": {
        "tags": [
          "workflows"
        ],
        "operationId": "promoteAutomationLiveBaseline",
        "summary": "Deliberately promote passing retained evidence to a named baseline.",
        "description": "Requires deploy write scope. Atomically checks the explicit current target and version 2 required-case/evidence-age policy, compares expected_revision, appends an attributed receipt and changes the head. expected_revision 0 creates. An identical retained promotion ID replays its original receipt without moving the head or rechecking. Never executes or checks assertions. At most 20 active and 100 lifetime names per automation, with 100 receipts per name; active current suite groups are pinned within the existing suite limit, while linked run retention still applies. Retired names cannot be reused; original promotion retries return historical receipts without reactivation.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PromoteAutomationLiveBaselineRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Attributed promotion receipt for this request, replayed unchanged on an identical retained retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationLiveBaseline"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AutomationConflict"
          },
          "410": {
            "description": "Promotion cannot reuse a retired baseline name. Choose a different active name explicitly.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/automations/{name}/live-baselines/{baseline}/retirements/{retirement_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "description": "Automation whose named baseline is being retired.",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        },
        {
          "name": "baseline",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z0-9]([a-z0-9-]*[a-z0-9])?$"
          },
          "description": "Baseline name to retire permanently within this automation."
        },
        {
          "name": "retirement_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Stable caller-selected retirement UUID; preserve this ID and expected revision for uncertain retries."
        }
      ],
      "put": {
        "tags": [
          "workflows"
        ],
        "operationId": "retireAutomationLiveBaseline",
        "summary": "Permanently retire a named baseline and release its evidence pin.",
        "description": "Requires deploy write scope and verified email. Atomically compares the positive expected revision and records the authenticated actor. Retirement permanently reserves the name, frees an active-name slot and releases its suite pin for normal retention; no evidence is immediately deleted. Promotion history remains available. Exact retries return the original retirement receipt. Old promotion retries never reactivate the name. At most 20 active and 100 lifetime names per automation.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RetireAutomationLiveBaselineRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Attributed immutable retirement receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationLiveBaselineRetirement"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AutomationConflict"
          },
          "410": {
            "description": "The requested baseline was previously retired by another retirement request. Read its audit history.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/automations/{name}/live-suites/{suite_id}/start": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "Saved automation whose managed suite is being started.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        },
        {
          "name": "suite_id",
          "in": "path",
          "required": true,
          "description": "Fresh UUIDv7 for creation; reuse the original ID for start recovery.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "startAutomationLiveSuite",
        "summary": "Start a durable live suite with explicit real-action confirmation.",
        "description": "Creates an immutable ordered selection and admits its first case atomically with the saved run link. Retry this same suite ID and body after a lost response. A retained start replay only reads progress; it never advances later cases. New IDs must be UUIDv7 generated within the last ten minutes. Existing metadata-only suites cannot be taken over.",
        "requestBody": {
          "required": true,
          "description": "Frozen target, saved-case names and real-action confirmation.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartAutomationLiveSuiteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "startAutomationLiveSuite returns the original suite identities and current server-derived observations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationLiveSuite"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AutomationConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/automations/{name}/live-suites/{suite_id}/advance": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "Saved automation whose managed suite is being continued.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        },
        {
          "name": "suite_id",
          "in": "path",
          "required": true,
          "description": "Original retained managed suite ID; missing records are never recreated.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "advanceAutomationLiveSuite",
        "summary": "Check retained results and admit at most one next case of a managed suite.",
        "description": "Requires explicit real-action confirmation on every call. Checks earlier original run IDs and stops on failed, unavailable, outdated or nonterminal results. The next admission and its immutable link commit together. Never recreates missing suites, replaces runs, resumes workflows or cancels them. Repeat while pending to observe execution; reopening history is read-only.",
        "requestBody": {
          "required": true,
          "description": "Explicit authorization to check and continue the original suite.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdvanceAutomationLiveSuiteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "advanceAutomationLiveSuite returns the original suite identities and current server-derived observations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationLiveSuite"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AutomationConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/automations/{name}/live-suites": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Saved automation whose shared verification suites are accessed."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "listAutomationLiveSuites",
        "summary": "List recent shared suite identities without executing or checking workflows.",
        "responses": {
          "200": {
            "description": "listAutomationLiveSuites returns safe retained suite metadata and server-derived observations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListAutomationLiveSuitesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AutomationConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/automations/{name}/live-suites/{suite_id}/compare/{baseline_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Automation owning both retained suites."
        },
        {
          "name": "suite_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Candidate suite UUID; direction is baseline to candidate."
        },
        {
          "name": "baseline_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Baseline suite UUID within the same app and automation."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "compareAutomationLiveSuites",
        "summary": "Compare recorded results in one read-only snapshot without executing or checking runs.",
        "description": "Cases match by name and require equal frozen definition/input/assertion hashes for regression or recovery classification. Historical target drift alone does not invalidate a report. Pending, missing, unchecked and stale reports are unknown. Added and removed refer to the suite selection. No release approval or CI gate is implied.",
        "responses": {
          "200": {
            "description": "Safe comparison of retained evidence, ordered by candidate cases followed by removed baseline cases.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationLiveSuiteComparison"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/automations/{name}/live-suites/{suite_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Automation owning the retained shared suite record."
        },
        {
          "name": "suite_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Stable caller-selected suite UUID. Retry the same immutable selection and ID to attach progress."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "getAutomationLiveSuite",
        "summary": "Read current retained suite results in a consistent database snapshot.",
        "responses": {
          "200": {
            "description": "getAutomationLiveSuite returns safe retained suite metadata and server-derived observations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationLiveSuite"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AutomationConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "put": {
        "tags": [
          "workflows"
        ],
        "operationId": "saveAutomationLiveSuite",
        "summary": "Save a frozen suite selection and monotonically attach existing run IDs; never execute workflows.",
        "responses": {
          "200": {
            "description": "saveAutomationLiveSuite returns safe retained suite metadata and server-derived observations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationLiveSuite"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AutomationConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "description": "The frozen selection and existing run links to retain. No execution or verdict fields are accepted. Managed execution records cannot be modified here.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveAutomationLiveSuiteRequest"
              }
            }
          }
        }
      }
    },
    "/v1/apps/{slug}/automations/{name}/live-verifications": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Automation whose recent live verification history is requested."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "listAutomationLiveVerifications",
        "summary": "List recent live verifications and the current published deployment target.",
        "responses": {
          "200": {
            "description": "listAutomationLiveVerifications returns safe verification identities and observations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListAutomationLiveVerificationsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AutomationConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/AutomationInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "startAutomationLiveVerification",
        "summary": "Explicitly execute one saved case input with atomic target fences and idempotency.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "description": "Stable request key; retry the same key and body to recover the original run."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartAutomationLiveVerificationRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "startAutomationLiveVerification returns safe verification identities and observations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationLiveVerification"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AutomationConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/AutomationInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/automations/{name}/live-verifications/{run_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Automation containing the retained live verification to read."
        },
        {
          "name": "run_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Specific workflow run whose live provenance is requested."
        }
      ],
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "getAutomationLiveVerification",
        "summary": "Read one verification without starting a run or evaluating live assertions.",
        "responses": {
          "200": {
            "description": "getAutomationLiveVerification returns safe verification identities and observations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationLiveVerification"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AutomationConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/AutomationInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/apps/{slug}/automations/{name}/live-verifications/{run_id}/check": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Slug"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": "Automation whose frozen live assertions will be checked."
        },
        {
          "name": "run_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          },
          "description": "Retained live run whose terminal outcomes will be evaluated."
        }
      ],
      "post": {
        "tags": [
          "workflows"
        ],
        "operationId": "checkAutomationLiveVerification",
        "summary": "Check terminal run outcomes against frozen live assertions and retain a safe summary.",
        "responses": {
          "200": {
            "description": "checkAutomationLiveVerification returns safe verification identities and observations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationLiveVerification"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/AutomationConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/AutomationInvalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "consumerKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "ck_<prefix>_<secret>",
        "description": "An app's consumer key with the billing scope; only the consumer billing endpoints accept it."
      },
      "realtimePublisherCredential": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "grp_",
        "description": "Endpoint-bound credential permitting exact channels and event types."
      },
      "realtimeWorkerCredential": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "grw_",
        "description": "Opaque credential restricted to one consumer group and explicit operations."
      },
      "jobOperationCapability": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Gregale-Operation-Job-Capability",
        "description": "Private capability derived from the current host task lease; injected into the single Job task by the scheduler."
      },
      "dataAPIConnectionsWorkloadIdentity": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Short-lived Gregale workload identity for audience gregale:data-api:connections, bound to a live Data API instance. Customer API keys cannot publish observations."
      },
      "dataAPIUsageWorkloadIdentity": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Short-lived Gregale workload identity for audience gregale:data-api:usage, naming the reporting app and instance. Customer API keys cannot publish usage."
      },
      "dataAPIBudgetWorkloadIdentity": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "A short-lived workload assertion with audience gregale:data-api:budget."
      },
      "dataAPIEventsWorkloadIdentity": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Short-lived Gregale workload identity for audience gregale:data-api:events, naming the publishing app and its live instance. Customer API keys cannot publish change events."
      },
      "operationsWorkloadIdentity": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Platform-issued short-lived RS256 workload JWT with audience gregale:operations. Current invocation claim proof is also required."
      },
      "flagsWorkloadIdentity": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Platform-issued short-lived RS256 workload JWT with audience gregale:flags."
      },
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Bearer credential. Account API keys use `fp_live_` + 48 hex chars and are\nreturned exactly once on `POST /v1/keys`. Downstream platform-tenant\nself-service tokens use the distinct `fp_tenant_` + 64 hex format and are\nlimited to the tenant's own usage and finalized statements.\n"
      },
      "cookieAuth": {
        "type": "apiKey",
        "in": "cookie",
        "name": "faas_sid",
        "description": "Browser dashboard session cookie. The browser sends this HttpOnly cookie automatically."
      }
    },
    "headers": {
      "EdgeRuleSetETag": {
        "description": "The app's current edge-rule set version, for If-Match on later mutations.",
        "schema": {
          "type": "string"
        }
      },
      "WWWAuthenticate": {
        "description": "RFC 6750 Bearer challenge emitted when a protected API resource\nneeds credentials, rejects an invalid bearer token, or requires\nadditional bearer scopes. The `scope` auth-param is space-delimited.\n",
        "schema": {
          "type": "string",
          "example": "Bearer realm=\"api\", error=\"invalid_token\""
        }
      },
      "Deprecation": {
        "description": "RFC 9745 Item Structured Field Date indicating when the operation\nentered its deprecated state. Gregale currently emits\n`@1789603200` (2026-09-17T00:00:00Z) on legacy routes.\n",
        "schema": {
          "type": "string",
          "pattern": "^@[0-9]+$",
          "example": "@1789603200"
        }
      },
      "Sunset": {
        "description": "RFC 8594 HTTP-date after which the operation is expected to be\nunavailable. Gregale currently emits `Thu, 01 Oct 2026 00:00:00 GMT`.\n",
        "schema": {
          "type": "string",
          "example": "Thu, 01 Oct 2026 00:00:00 GMT"
        }
      },
      "Link": {
        "description": "RFC 8288 links for the successor operation and the deprecation\ndocumentation. Multiple links are comma-separated in this field.\n",
        "schema": {
          "type": "string",
          "example": "</v1/uploads>; rel=\"successor-version\", <https://github.com/poyrazK/faas/blob/main/docs/adr/115-local-tarball-deploy-trust-root.md>; rel=\"deprecation\""
        }
      }
    },
    "parameters": {
      "AgentActivityBefore": {
        "name": "before",
        "in": "query",
        "required": false,
        "description": "The `next_before` value of an earlier activity page; omit it for the newest rows.",
        "schema": {
          "type": "string"
        }
      },
      "AgentActivityLimit": {
        "name": "limit",
        "in": "query",
        "required": false,
        "description": "Activity rows per page, 1 to 200. Default 50.",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 200
        }
      },
      "EnvironmentPromotionAttempt": {
        "name": "attempt_id",
        "in": "path",
        "required": true,
        "description": "Original opaque promotion attempt.",
        "schema": {
          "type": "string",
          "minLength": 32,
          "maxLength": 32,
          "pattern": "^[0-9a-f]{32}$"
        }
      },
      "EnvironmentPromotionAttemptHeader": {
        "name": "Environment-Promotion-Attempt-ID",
        "in": "header",
        "required": false,
        "description": "Optional original acceptance attempt. Requires Environment-Promotion-Request-Hash; accepted attempts cannot execute again. Omit both headers for legacy retry behavior.",
        "schema": {
          "type": "string",
          "minLength": 32,
          "maxLength": 32,
          "pattern": "^[0-9a-f]{32}$"
        }
      },
      "EnvironmentPromotionRequestHashHeader": {
        "name": "Environment-Promotion-Request-Hash",
        "in": "header",
        "required": false,
        "description": "SHA-256 binding of the reviewed promotion fingerprint and immutable project/source/target environment IDs. Must accompany Environment-Promotion-Attempt-ID.",
        "schema": {
          "type": "string",
          "minLength": 64,
          "maxLength": 64,
          "pattern": "^[0-9a-f]{64}$"
        }
      },
      "EnvironmentRollbackAttempt": {
        "name": "attempt_id",
        "in": "path",
        "required": true,
        "description": "Original opaque rollback attempt.",
        "schema": {
          "type": "string",
          "minLength": 32,
          "maxLength": 32,
          "pattern": "^[0-9a-f]{32}$"
        }
      },
      "EnvironmentRollbackAttemptHeader": {
        "name": "Environment-Rollback-Attempt-ID",
        "in": "header",
        "required": false,
        "description": "Optional original acceptance attempt. Requires Environment-Rollback-Request-Hash; accepted attempts cannot execute again. Omit both headers for legacy retry behavior.",
        "schema": {
          "type": "string",
          "minLength": 32,
          "maxLength": 32,
          "pattern": "^[0-9a-f]{32}$"
        }
      },
      "EnvironmentRollbackRequestHashHeader": {
        "name": "Environment-Rollback-Request-Hash",
        "in": "header",
        "required": false,
        "description": "SHA-256 binding of the original promotion ID/hash and immutable project/source/target environment IDs. Must accompany Environment-Rollback-Attempt-ID.",
        "schema": {
          "type": "string",
          "minLength": 64,
          "maxLength": 64,
          "pattern": "^[0-9a-f]{64}$"
        }
      },
      "OrgProjectOrganization": {
        "name": "organization",
        "in": "path",
        "required": true,
        "description": "Company organization slug that owns the addressed project; requires current membership and compatible organization credentials.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 63,
          "pattern": "^[a-z0-9][a-z0-9-]*$"
        }
      },
      "OrgProjectPlanToken": {
        "name": "plan_token",
        "in": "query",
        "required": false,
        "description": "Plan token returned by the organization source scan; must match the uploaded source and addressed project.",
        "schema": {
          "type": "string"
        }
      },
      "OrgProjectSlug": {
        "name": "slug",
        "in": "path",
        "required": true,
        "description": "Project slug within the organization named in the URL.",
        "schema": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
        }
      },
      "OrgProjectEnvironment": {
        "name": "environment",
        "in": "path",
        "required": true,
        "description": "Registered environment in the addressed organization project.",
        "schema": {
          "type": "string",
          "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$"
        }
      },
      "OrgProjectBefore": {
        "name": "before",
        "in": "query",
        "description": "Opaque next_before cursor from this company project history.",
        "schema": {
          "type": "string"
        }
      },
      "OrgProjectLimit": {
        "name": "limit",
        "in": "query",
        "description": "Maximum company history entries returned in one page; capped at 100.",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 50
        }
      },
      "OrgProjectSlugb08370": {
        "name": "slug",
        "in": "path",
        "required": true,
        "description": "Project slug within the organization named in the URL. The value is resolved in the selected project.",
        "schema": {
          "type": "string"
        }
      },
      "OrgProjectEnvironment6f0a6f": {
        "name": "environment",
        "in": "path",
        "required": true,
        "description": "Registered environment in the addressed organization project. The value is resolved in the selected project.",
        "schema": {
          "type": "string"
        }
      },
      "OrgProjectRelease": {
        "name": "release",
        "in": "path",
        "required": true,
        "description": "Immutable release-set UUID retained by the company project.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "OrgProjectFrom": {
        "name": "from",
        "in": "query",
        "required": true,
        "description": "Source environment filter within this company project.",
        "schema": {
          "type": "string",
          "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$"
        }
      },
      "OrgProjectSyncConfig": {
        "name": "sync_config",
        "in": "query",
        "required": false,
        "description": "Copy non-secret company source configuration together with the target promotion graph.",
        "schema": {
          "type": "boolean",
          "default": false
        }
      },
      "OrgProjectApproval": {
        "name": "approval",
        "in": "path",
        "required": true,
        "description": "Plan approval UUID belonging to this company project environment.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "OrgProjectPromotion": {
        "name": "promotion",
        "in": "path",
        "required": true,
        "description": "Durable promotion identifier in the company environment history.",
        "schema": {
          "type": "string",
          "minLength": 1
        }
      },
      "OrgProjectBeforeade0c4": {
        "name": "before",
        "in": "query",
        "required": false,
        "description": "Opaque next_before cursor from this company project history. The value is resolved in the selected project.",
        "schema": {
          "type": "string"
        }
      },
      "OrgProjectLimit65fc92": {
        "name": "limit",
        "in": "query",
        "required": false,
        "description": "Maximum company history entries returned in one page; capped at 100. The value is resolved in the selected project.",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 50
        }
      },
      "OrgProjectFrom237d99": {
        "name": "from",
        "in": "query",
        "required": false,
        "description": "Source environment filter within this company project. A slug pattern is validated.",
        "schema": {
          "type": "string",
          "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$"
        }
      },
      "OrgProjectStatus": {
        "name": "status",
        "in": "query",
        "required": false,
        "description": "Promotion lifecycle status to include from the company history.",
        "schema": {
          "type": "string",
          "enum": [
            "running",
            "succeeded",
            "failed"
          ]
        }
      },
      "OrgProjectWorkload": {
        "name": "workload",
        "in": "path",
        "required": true,
        "description": "Workload name registered in the company project environment.",
        "schema": {
          "type": "string"
        }
      },
      "OrgProjectSlug2": {
        "name": "slug2",
        "in": "path",
        "required": true,
        "description": "Company workload app slug whose saved deployment exclusion is removed.",
        "schema": {
          "type": "string"
        }
      },
      "OrgProjectIdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "description": "Company operation replay key, partitioned by the authenticated actor and credential.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255
        }
      },
      "ManagedRealtimeSlugPath": {
        "name": "slug",
        "description": "Application slug",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "ManagedRealtimeIdPath": {
        "name": "id",
        "description": "Realtime endpoint ID",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "ManagedRealtimeChannelPath": {
        "name": "channel",
        "description": "Channel name",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "ManagedRealtimeActivityScopePath": {
        "name": "activity_scope",
        "description": "Private activity scope",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64
        }
      },
      "ManagedRealtimeGroupQuery": {
        "name": "group",
        "description": "Schedule group filter",
        "in": "query",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      },
      "ManagedRealtimeStatusQuery": {
        "name": "status",
        "description": "Schedule status filter",
        "in": "query",
        "schema": {
          "type": "string",
          "enum": [
            "pending",
            "paused",
            "published",
            "failed",
            "skipped",
            "canceled"
          ]
        }
      },
      "ManagedRealtimeGroupPath": {
        "name": "group",
        "description": "Schedule group",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      },
      "ManagedRealtimeGroupActionPath": {
        "name": "group_action",
        "description": "Bulk schedule action",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "enum": [
            "pause",
            "resume",
            "cancel"
          ]
        }
      },
      "ManagedRealtimeScheduleIdPathBounded": {
        "name": "schedule_id",
        "description": "Bounded schedule identifier",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      },
      "ManagedRealtimeExpectedVersionQuery": {
        "name": "expected_version",
        "description": "Required current schedule version",
        "in": "query",
        "required": true,
        "schema": {
          "type": "integer",
          "format": "int64",
          "minimum": 1
        }
      },
      "ManagedRealtimeScheduleIdPath": {
        "name": "schedule_id",
        "description": "Schedule ID",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "ManagedRealtimeAfterVersionQuery": {
        "name": "after_version",
        "description": "Exclusive event version cursor",
        "in": "query",
        "schema": {
          "type": "integer",
          "format": "int64",
          "minimum": 0,
          "default": 0
        }
      },
      "ManagedRealtimeLimitQuery": {
        "name": "limit",
        "description": "Maximum history records",
        "in": "query",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 50
        }
      },
      "ManagedRealtimeEventTypePath": {
        "name": "event_type",
        "description": "Retained event type",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^[a-z0-9_.-]{1,64}$"
        }
      },
      "ManagedRealtimeVersionPath": {
        "name": "version",
        "description": "Current schema version",
        "in": "path",
        "required": true,
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 1000000
        }
      },
      "ManagedRealtimeMessageIdPath": {
        "name": "message_id",
        "description": "Notification message ID",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "ManagedRealtimePrincipalQuery": {
        "name": "principal",
        "description": "Verified principal ID",
        "in": "query",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "ManagedRealtimePrincipalQueryBounded": {
        "name": "principal",
        "description": "Verified push principal ID",
        "in": "query",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        }
      },
      "ManagedRealtimeProviderPath": {
        "name": "provider",
        "description": "Push provider name",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "enum": [
            "fcm",
            "apns",
            "webpush"
          ]
        }
      },
      "ManagedRealtimeDevicePath": {
        "name": "device",
        "description": "Registered device ID",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      },
      "EdgeRuleSetIfMatch": {
        "name": "If-Match",
        "in": "header",
        "required": false,
        "description": "Optional edge-rule set version (the ETag of the app's rule listing). The mutation is refused with 412 when it is no longer the app's latest version.",
        "schema": {
          "type": "string"
        }
      },
      "OperationArtifact": {
        "name": "artifact",
        "in": "path",
        "required": true,
        "description": "Attached result artifact identity.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "OperationXGregaleOperationExecutionKind": {
        "name": "X-Gregale-Operation-Execution-Kind",
        "in": "header",
        "required": true,
        "description": "Explicit native execution family; must be workflow.",
        "schema": {
          "type": "string",
          "enum": [
            "workflow"
          ]
        }
      },
      "OperationXGregaleOperationJobRunId": {
        "description": "Native Job run UUID retained by the accepted operation generation.",
        "name": "X-Gregale-Operation-Job-Run-Id",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "OperationXGregaleOperationJobInstanceId": {
        "description": "Current single-task instance UUID whose host claim grants runtime authority.",
        "name": "X-Gregale-Operation-Job-Instance-Id",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "OperationXGregaleOperationWorkflowRunId": {
        "name": "X-Gregale-Operation-Workflow-Run-Id",
        "in": "header",
        "required": true,
        "description": "Current operation workflow run UUID.",
        "schema": {
          "type": "string",
          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        }
      },
      "OperationXGregaleOperationWorkflowStep": {
        "name": "X-Gregale-Operation-Workflow-Step",
        "in": "header",
        "required": true,
        "description": "Final workflow action name.",
        "schema": {
          "type": "string"
        }
      },
      "OperationXGregaleOperationGeneration": {
        "name": "X-Gregale-Operation-Generation",
        "in": "header",
        "required": true,
        "description": "Current operation recovery generation.",
        "schema": {
          "type": "integer",
          "minimum": 1
        }
      },
      "OperationXGregaleOperationWorkflowCapability": {
        "name": "X-Gregale-Operation-Workflow-Capability",
        "in": "header",
        "required": true,
        "description": "Private current step nonce; never log or retain in application state.",
        "schema": {
          "type": "string",
          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        }
      },
      "OperationXFaasInvocationId": {
        "name": "X-Faas-Invocation-Id",
        "in": "header",
        "required": true,
        "description": "Current invocation UUID supplied by trusted dispatch.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "OperationXGregaleOperationAttempt": {
        "name": "X-Gregale-Operation-Attempt",
        "in": "header",
        "required": true,
        "description": "Current fenced claim attempt.",
        "schema": {
          "type": "integer",
          "minimum": 1
        }
      },
      "OperationXGregaleOperationCapability": {
        "name": "X-Gregale-Operation-Capability",
        "in": "header",
        "required": true,
        "description": "Ephemeral 256-bit claim capability supplied only to the active handler.",
        "schema": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        }
      },
      "OperationMilestoneLimit": {
        "name": "limit",
        "in": "query",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 20
        },
        "description": "Maximum retained public facts in a milestone page."
      },
      "OperationMilestoneCursor": {
        "name": "cursor",
        "in": "query",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        },
        "description": "Continuation for the same milestone feed, identity, workflow filter, and other selectors."
      },
      "OperationWorkflowStateCursor": {
        "name": "workflow_state_cursor",
        "in": "query",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        },
        "description": "Independent continuation for retained state changes. Requires the paired workflow and workflow_instance_id selectors."
      },
      "OperationWorkflowStaleOnly": {
        "name": "stale_only",
        "in": "query",
        "schema": {
          "type": "boolean",
          "default": false
        },
        "description": "When true, return only current workflow states that have passed an app-declared state_stale_after threshold. Applies only to workflow_states; milestone facts and state history are unchanged."
      },
      "OperationMilestoneScope": {
        "name": "scope",
        "in": "query",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 40,
          "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
        },
        "description": "Explicit environment containing the related business Operations."
      },
      "OperationMilestoneSubjectType": {
        "name": "subject_type",
        "in": "query",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64,
          "pattern": "^[a-z][a-z0-9-]{0,63}$"
        },
        "description": "Business reference type for a timeline spanning related Operations."
      },
      "OperationMilestoneSubjectID": {
        "name": "subject_id",
        "in": "query",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256,
          "pattern": "^[^\\x00-\\x1f\\x7f]+$"
        },
        "description": "Exact public business identifier for this timeline; maximum 256 UTF-8 bytes."
      },
      "OperationMilestoneWorkflow": {
        "name": "workflow",
        "in": "query",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 63,
          "pattern": "^[a-z][a-z0-9-]*$"
        },
        "description": "Optional workflow name. Supply with workflow_instance_id to read one workflow instance."
      },
      "OperationMilestoneWorkflowInstanceID": {
        "name": "workflow_instance_id",
        "in": "query",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256,
          "pattern": "^[^\\x00-\\x1f\\x7f]+$"
        },
        "description": "Optional app-provided workflow instance ID. Supply with workflow; the pair is bound into pagination."
      },
      "OperationMilestoneAppID": {
        "name": "app_id",
        "in": "query",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        },
        "description": "App selected within the authenticated customer's milestone feed."
      },
      "OperationMilestoneTenantID": {
        "name": "tenant_id",
        "in": "query",
        "schema": {
          "type": "string",
          "format": "uuid"
        },
        "description": "Optional account-owned customer selector on an operator milestone timeline."
      },
      "OperationDeploymentId": {
        "name": "deployment_id",
        "in": "path",
        "required": true,
        "description": "Deployment owning the contract.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "OperationName": {
        "name": "name",
        "in": "path",
        "required": true,
        "description": "Operation name matching the request contract.",
        "schema": {
          "type": "string",
          "maxLength": 64
        }
      },
      "OperationXGregaleRelease": {
        "name": "X-Gregale-Release",
        "in": "header",
        "required": false,
        "description": "Optional release-set identity pinned by this definition.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "OperationId": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "Stable logical operation identity.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "OperationIdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "description": "Stable submission key; retries must preserve it and the input.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      },
      "OperationAfter": {
        "name": "after",
        "in": "query",
        "required": false,
        "description": "Last durably consumed event sequence.",
        "schema": {
          "type": "integer",
          "minimum": 0
        }
      },
      "OperationLastEventId": {
        "name": "Last-Event-ID",
        "in": "header",
        "required": false,
        "description": "Reconnect cursor when after is absent.",
        "schema": {
          "type": "string",
          "pattern": "^[0-9]+$"
        }
      },
      "SecretReferenceEnvironment": {
        "name": "environment",
        "in": "query",
        "required": true,
        "description": "Registered project environment owning these references; default and __all__ are unavailable.",
        "schema": {
          "type": "string",
          "minLength": 3,
          "maxLength": 33,
          "pattern": "^[a-z0-9][a-z0-9-]*[a-z0-9]$"
        }
      },
      "EnvironmentGitOpsProjectSlug": {
        "name": "slug",
        "in": "path",
        "required": true,
        "description": "Project owning the environment Git authority.",
        "schema": {
          "type": "string"
        }
      },
      "EnvironmentGitOpsEnvironment": {
        "name": "environment",
        "in": "path",
        "required": true,
        "description": "Registered environment selected for Git intent management.",
        "schema": {
          "type": "string"
        }
      },
      "FlagsProjectSlug": {
        "name": "slug",
        "in": "path",
        "required": true,
        "description": "Project that owns this environment flag configuration.",
        "schema": {
          "type": "string"
        }
      },
      "FlagsEnvironment": {
        "name": "environment",
        "in": "path",
        "required": true,
        "description": "Named environment whose flag configuration is selected.",
        "schema": {
          "type": "string"
        }
      },
      "FlagsKey": {
        "name": "key",
        "in": "path",
        "required": true,
        "description": "Application flag key to evaluate or filter retained evidence.",
        "schema": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_-]{0,63}$"
        }
      },
      "PublicStatusEventID": {
        "name": "public_id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        },
        "description": "Stable public UUID used by status permalinks."
      },
      "CookieSession": {
        "name": "faas_sid",
        "in": "cookie",
        "required": false,
        "schema": {
          "type": "string"
        },
        "description": "Dashboard session cookie. Sealed; opaque to the client\n(`HttpOnly; Secure; SameSite=Lax`). 7-day fixed lifetime.\nThe browser sets it automatically on `/login` / `/signup`;\nthe SDK uses the device-code flow instead and never sets\nthis cookie.\n"
      },
      "DeploymentAttemptID": {
        "name": "Deployment-Attempt-ID",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string",
          "minLength": 32,
          "maxLength": 32,
          "pattern": "^[0-9a-f]{32}$"
        },
        "description": "Persist a random opaque ID before submission to recover lost acceptance\nreplies. The accepted attempt remains bound to its original deployment,\nincluding after failure or supersession. Missing receipts never authorize\nresubmission. Independent from Idempotency-Key replay.\nConcurrent accepted/in-progress attempts may return 409 with\ndeployment_attempt_accepted or deployment_attempt_pending; recover\nacceptance using the receipt instead of treating that conflict as rejection.\n"
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string",
          "maxLength": 255
        },
        "description": "Idempotency key for the POST. Stored for 24h. On replay the server\nreturns the original response with `Idempotent-Replayed: true`.\n"
      },
      "GregaleRevision": {
        "name": "X-Gregale-Revision",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string",
          "format": "uuid"
        },
        "description": "Exact deployment pin. Mutually exclusive with X-Gregale-Release; checked again at delivery."
      },
      "GregaleRelease": {
        "name": "X-Gregale-Release",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string",
          "format": "uuid"
        },
        "description": "Immutable project release set. Defaults to the active set for project apps and is checked again at delivery."
      },
      "Slug": {
        "name": "slug",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^[a-z0-9]([a-z0-9-]{1,38})[a-z0-9]$",
          "minLength": 3,
          "maxLength": 40
        },
        "description": "App slug. Lowercase letters, digits, hyphens; must start and end with alnum."
      },
      "LogSearchSince": {
        "name": "since",
        "in": "query",
        "description": "Window start, as a lookback duration (15m, 6h, 3d) or RFC 3339. Defaults to one hour before until and is clamped to the plan's log retention.",
        "schema": {
          "type": "string"
        }
      },
      "LogSearchUntil": {
        "name": "until",
        "in": "query",
        "description": "Exclusive window end (RFC 3339). Defaults to and is clamped to now.",
        "schema": {
          "type": "string",
          "format": "date-time"
        }
      },
      "LogSearchSource": {
        "name": "source",
        "in": "query",
        "description": "Keep one ledger source.",
        "schema": {
          "type": "string",
          "enum": [
            "runtime",
            "build",
            "deploy",
            "http",
            "network",
            "dns"
          ]
        }
      },
      "LogSearchLevel": {
        "name": "level",
        "in": "query",
        "description": "Comma list of severities to keep (trace, debug, info, warn, error, fatal).",
        "schema": {
          "type": "string",
          "example": "error,warn"
        }
      },
      "LogSearchRoute": {
        "name": "route",
        "in": "query",
        "description": "Exact route template without the method, such as /checkout/{id}.",
        "schema": {
          "type": "string",
          "maxLength": 256
        }
      },
      "LogSearchStatus": {
        "name": "status",
        "in": "query",
        "description": "Exact HTTP status (502) or a status class (5xx).",
        "schema": {
          "type": "string",
          "example": "5xx"
        }
      },
      "LogSearchDeployment": {
        "name": "deployment_id",
        "in": "query",
        "description": "Keep events from one deployment.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "LogSearchRequest": {
        "name": "request_id",
        "in": "query",
        "description": "Keep events whose request id or trace id equals this value.",
        "schema": {
          "type": "string",
          "maxLength": 256
        }
      },
      "LogSearchTrace": {
        "name": "trace_id",
        "in": "query",
        "description": "Keep events carrying this W3C trace id.",
        "schema": {
          "type": "string",
          "maxLength": 128
        }
      },
      "LogSearchText": {
        "name": "q",
        "in": "query",
        "description": "Case-insensitive literal substring of the message, 2 to 256 characters. Text searches cover at most 24 hours.",
        "schema": {
          "type": "string",
          "minLength": 2,
          "maxLength": 256
        }
      },
      "LogSearchSaved": {
        "name": "saved",
        "in": "query",
        "description": "Name of one of the app's saved log searches. Its filters apply unless the request sets the same parameter.",
        "schema": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
        }
      },
      "IncidentID": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "Incident id, prefixed with its source (`alert-`, `route-`, `platform-`).",
        "schema": {
          "type": "string"
        }
      },
      "DashboardID": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "Dashboard id.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "LogSavedSearchName": {
        "name": "name",
        "in": "path",
        "required": true,
        "description": "Saved log search name, 1 to 63 lowercase letters, digits and dashes.",
        "schema": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
        }
      },
      "QueueLeaseQueue": {
        "name": "queue",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9-]{0,62}$"
        },
        "description": "Queue name of an enabled pull binding on this app."
      },
      "Id32": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^[a-f0-9]{32}$"
        },
        "description": "32-hex-char opaque ID (NOT canonical UUID)."
      },
      "ExecutionID": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        },
        "description": "Canonical UUID for a disposable execution."
      },
      "ExecutionArtifactGrantID": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        },
        "description": "Canonical UUID for an execution artifact grant."
      },
      "AppTaskID": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        },
        "description": "Canonical UUID for a deployment-attached app task."
      },
      "CrashCaptureID": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        },
        "description": "Canonical UUID for a crash snapshot."
      },
      "AppForkID": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        },
        "description": "Canonical UUID for a production fork."
      },
      "ManagedPostgresID": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "description": "Opaque Gregale managed PostgreSQL resource identifier."
      },
      "ManagedPostgresCutoverID": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        },
        "description": "Gregale managed PostgreSQL cutover UUID."
      },
      "SecretKey": {
        "name": "key",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^[A-Z][A-Z0-9_]*$",
          "maxLength": 128
        },
        "description": "Secret key. Must start with a letter; A-Z, 0-9, underscore."
      },
      "ConfigGuardQuery": {
        "name": "guard",
        "in": "query",
        "required": false,
        "schema": {
          "type": "boolean"
        },
        "description": "`false` opts this env or secret write out of the config guard: no guard opens, and a guard already watching the scope\ncloses as superseded. Omitted or `true` guards the change when the\nscope has a live deployment.\n"
      },
      "EnvScope": {
        "name": "scope",
        "in": "query",
        "required": false,
        "schema": {
          "type": "string",
          "pattern": "^([a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?|__all__)$",
          "maxLength": 40
        },
        "description": "Env-var scope. A domain-valid slug (1..40 chars,\nlowercase alnum + dash, no leading/trailing dash) — e.g.\n`default`, `staging`, `prod-eu`. Or the reserved sentinel\n`__all__` on GET only, which returns the nested\n`env_by_scope` response shape (every scope on the app).\nOmitted = `scope=default` (legacy behaviour).\n"
      },
      "PreviewKey": {
        "name": "key",
        "in": "path",
        "required": true,
        "description": "Platform preview key, as GET /v1/previews lists it.",
        "schema": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_-]{0,63}$"
        }
      },
      "OrgSlug": {
        "name": "slug",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^[a-z0-9]([a-z0-9-]{1,30})[a-z0-9]$",
          "minLength": 3,
          "maxLength": 32
        },
        "description": "Org slug. Lowercase letters, digits, hyphens; must start\nand end with alnum. 3..32 chars. Mirrors `OrgSlugPattern` exactly so the spec drift gate\n(`make spec-check`) stays green.\n"
      },
      "OrgAccountID": {
        "name": "user_id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
        },
        "description": "Account UUID (the membership row's account_id). The\npath segment is named `user_id` for backwards\ncompatibility with the dashboard's existing\n/members/:user_id routes.\n"
      },
      "QueueCursorLimit": {
        "name": "limit",
        "in": "query",
        "required": false,
        "schema": {
          "type": "integer",
          "default": 20,
          "maximum": 200,
          "minimum": 1
        },
        "description": "Maximum number of rows to return; capped at 200."
      },
      "QueueCursorBefore": {
        "name": "before",
        "in": "query",
        "required": false,
        "schema": {
          "type": "string",
          "pattern": "^[a-f0-9]{32}$"
        },
        "description": "Cursor — the last id from the previous page (omit for the first page)."
      }
    },
    "schemas": {
      "SupportContext": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "request_id": {
            "type": "string",
            "maxLength": 200
          }
        },
        "description": "Optional identifiers supplied by the customer; no automatic log, secret or source-code collection."
      },
      "CreateSupportTicketRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "subject": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "category": {
            "type": "string",
            "enum": [
              "deployment",
              "billing",
              "account",
              "incident",
              "other"
            ]
          },
          "body": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10000
          },
          "priority": {
            "type": "string",
            "enum": [
              "low",
              "normal",
              "high",
              "urgent"
            ],
            "default": "normal"
          },
          "context": {
            "$ref": "#/components/schemas/SupportContext"
          }
        },
        "required": [
          "subject",
          "category",
          "body"
        ],
        "description": "Submit a support request within the authenticated personal or organization scope."
      },
      "SupportMessageRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "body": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10000
          }
        },
        "required": [
          "expected_revision",
          "body"
        ],
        "description": "Append one customer reply to an unresolved case at the expected revision."
      },
      "CloseSupportTicketRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        },
        "required": [
          "expected_revision"
        ],
        "description": "Close the current support resolution episode without extending a previous resolution timestamp."
      },
      "ReopenSupportTicketRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "body": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10000
          }
        },
        "required": [
          "expected_revision",
          "body"
        ],
        "description": "Reopen within the saved policy window and count; starts a fresh episode using that policy snapshot."
      },
      "SupportNotification": {
        "type": "object",
        "additionalProperties": false,
        "description": "An actor-specific support update containing metadata only.",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "sequence": {
            "type": "integer",
            "format": "int64"
          },
          "ticket_id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "staff_reply",
              "customer_reply",
              "ticket_created",
              "assigned"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "read_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "sequence",
          "ticket_id",
          "kind",
          "created_at"
        ]
      },
      "SupportNotificationPage": {
        "type": "object",
        "additionalProperties": false,
        "description": "Sequence-ordered page of at most fifty updates in the authorized scope.",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SupportNotification"
            }
          },
          "next_cursor": {
            "type": "integer",
            "format": "int64"
          },
          "unread_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        },
        "required": [
          "items",
          "unread_count"
        ]
      },
      "SupportReadRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Observed notification boundary; future rows are never acknowledged.",
        "properties": {
          "through_sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        },
        "required": [
          "through_sequence"
        ]
      },
      "SupportReadResult": {
        "type": "object",
        "additionalProperties": false,
        "description": "Remaining unread counts for the ticket and current support scope.",
        "properties": {
          "ticket_id": {
            "type": "string",
            "format": "uuid"
          },
          "unread_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unread_total": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        },
        "required": [
          "ticket_id",
          "unread_count",
          "unread_total"
        ]
      },
      "SupportTicket": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "subject": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "pending",
              "resolved"
            ]
          },
          "revision": {
            "type": "integer",
            "format": "int64"
          },
          "context": {
            "$ref": "#/components/schemas/SupportContext"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "resolved_at": {
            "type": "string",
            "format": "date-time"
          },
          "unread_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Unread support updates for the current caller and audience."
          },
          "can_reopen": {
            "type": "boolean"
          },
          "reopen_until": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "subject",
          "category",
          "status",
          "revision",
          "context",
          "created_at",
          "updated_at",
          "can_reopen"
        ],
        "description": "Customer-visible case metadata; staff assignments, targets, notes and engineering records stay private."
      },
      "SupportTicketPage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SupportTicket"
            }
          },
          "next_cursor": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "items"
        ],
        "description": "Creation-ordered page of at most fifty cases; pass next_cursor as cursor."
      },
      "SupportMessage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "sequence": {
            "type": "integer",
            "format": "int64"
          },
          "author": {
            "type": "string",
            "enum": [
              "customer",
              "staff"
            ]
          },
          "body": {
            "type": "string"
          },
          "redacted": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "sequence",
          "author",
          "body",
          "redacted",
          "created_at"
        ],
        "description": "One public conversation message, with a marker in place of redacted content."
      },
      "SupportMessagePage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SupportMessage"
            }
          },
          "next_cursor": {
            "type": "integer",
            "format": "int64"
          }
        },
        "required": [
          "items"
        ],
        "description": "Sequence-ordered page of at most fifty public messages; use next_cursor as after."
      },
      "SupportSubmission": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "ticket_id": {
            "type": "string",
            "format": "uuid"
          },
          "submission_id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "format": "int64"
          }
        },
        "required": [
          "ticket_id",
          "submission_id",
          "revision"
        ],
        "description": "Durable transaction receipt; UUID idempotency keys replay indefinitely while current scope access remains valid."
      },
      "SupportSatisfactionRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "episode_id": {
            "type": "string",
            "format": "uuid"
          },
          "rating": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 5
          }
        },
        "required": [
          "episode_id",
          "rating"
        ],
        "description": "One satisfaction rating for the currently resolved episode."
      },
      "SupportSatisfactionSubmission": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "episode_id": {
            "type": "string",
            "format": "uuid"
          },
          "rating": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 5
          }
        },
        "required": [
          "episode_id",
          "rating"
        ],
        "description": "Recorded satisfaction score for a resolution episode; retries return the same result."
      },
      "SupportSatisfaction": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "episode_id": {
            "type": "string",
            "format": "uuid"
          },
          "eligible": {
            "type": "boolean"
          },
          "rating": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 5
          }
        },
        "required": [
          "episode_id",
          "eligible"
        ],
        "description": "Current resolution survey eligibility and any previously submitted score."
      },
      "CreateProjectMigrationRequest": {
        "description": "Start one durable migration of selected reviewed services with request-only configuration.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "plan_token",
          "only"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Client-generated identity saved before submission.",
            "format": "uuid"
          },
          "plan_token": {
            "type": "string",
            "description": "Reviewed migration-mode source token; never persisted in the receipt."
          },
          "only": {
            "type": "array",
            "minItems": 1,
            "maxItems": 10,
            "uniqueItems": true,
            "items": {
              "type": "string"
            }
          },
          "initial_secrets": {
            "$ref": "#/components/schemas/ProjectInitialSecrets"
          },
          "service_connections": {
            "$ref": "#/components/schemas/ProjectServiceConnections"
          },
          "public_service_connections": {
            "$ref": "#/components/schemas/ProjectServiceConnections",
            "description": "Explicit public build URL mappings to selected declared dependencies. Resolves their reviewed public_url and saves it for retries. Public URL keys only."
          },
          "public_build_urls": {
            "$ref": "#/components/schemas/ProjectPublicBuildURLs"
          },
          "build_dependencies": {
            "type": "object",
            "maxProperties": 10,
            "description": "Optional caller-to-API build waits. Targets must be selected declared dependencies. Each attempt pins the saved API deployment, waits up to 30 minutes without using a builder slot, and requires it to be live with 100 percent traffic. Resume restores these choices.",
            "additionalProperties": {
              "type": "array",
              "maxItems": 10,
              "uniqueItems": true,
              "items": {
                "type": "string"
              }
            }
          }
        }
      },
      "ResumeProjectMigrationRequest": {
        "description": "Explicitly resume unfinished migration work against the original reviewed source checksum.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "plan_token",
          "expected_version",
          "only"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Version of the saved receipt reviewed before this resume; stale replays are rejected."
          },
          "only": {
            "type": "array",
            "minItems": 1,
            "maxItems": 10,
            "uniqueItems": true,
            "description": "Exact unfinished services approved for this resume action.",
            "items": {
              "type": "string"
            }
          },
          "plan_token": {
            "type": "string",
            "description": "Fresh migration-mode token for the original source checksum and project."
          },
          "initial_secrets": {
            "$ref": "#/components/schemas/ProjectInitialSecrets"
          }
        }
      },
      "ProjectMigrationBuildWait": {
        "type": "object",
        "description": "Durable readiness progress before a migration build consumes a builder slot. Public URLs still route normally; this is a point-in-time readiness check.",
        "required": [
          "status",
          "deadline_at"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "waiting",
              "ready",
              "failed"
            ],
            "description": "Whether selected API deployments satisfied build admission."
          },
          "code": {
            "type": "string",
            "description": "Stable build dependency blocker code, when present."
          },
          "detail": {
            "type": "string",
            "description": "Customer-safe explanation of a build dependency wait or failure."
          },
          "deadline_at": {
            "type": "string",
            "format": "date-time",
            "description": "Fixed deadline for this attempt's API readiness wait."
          }
        }
      },
      "ProjectMigrationService": {
        "description": "Progress and historical evidence pointers for one migration service and its current attempt.",
        "type": "object",
        "required": [
          "name",
          "attempt",
          "status",
          "depends_on",
          "required_env_keys",
          "configured_keys"
        ],
        "properties": {
          "build_dependencies": {
            "type": "array",
            "maxItems": 10,
            "uniqueItems": true,
            "description": "Saved declared API services required before this migration service builds.",
            "items": {
              "type": "string"
            }
          },
          "build_wait": {
            "$ref": "#/components/schemas/ProjectMigrationBuildWait"
          },
          "public_service_connections": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Saved public build variable-to-service choices."
          },
          "public_build_urls": {
            "type": "object",
            "maxProperties": 10,
            "additionalProperties": {
              "type": "string",
              "maxLength": 2048
            },
            "description": "Explicitly reviewed public HTTPS URLs. Saved values may appear in browser bundles; credentials, queries and fragments are rejected."
          },
          "name": {
            "type": "string",
            "description": "Selected workload name."
          },
          "app": {
            "type": "string",
            "description": "Current application slug."
          },
          "app_id": {
            "type": "string",
            "description": "Application identity bound before enqueue.",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "description": "Exact reserved deployment for this attempt.",
            "format": "uuid"
          },
          "build_id": {
            "type": "string",
            "description": "Exact reserved build for this attempt.",
            "format": "uuid"
          },
          "attempt": {
            "type": "integer",
            "minimum": 1,
            "maximum": 8
          },
          "status": {
            "type": "string",
            "description": "Observed state of the reserved deployment, waiting for build APIs, pending work or changed application."
          },
          "reason": {
            "type": "string",
            "description": "Metadata-only explanation for unfinished work."
          },
          "depends_on": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "required_env_keys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "configured_keys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "service_connections": {
            "type": "object",
            "maxProperties": 10,
            "description": "Saved runtime variable names mapped to selected declared services. Resumed automatically; contains no values.",
            "additionalProperties": {
              "type": "string"
            }
          },
          "verification_id": {
            "type": "string",
            "description": "Latest recorded verification identity for this exact deployment.",
            "format": "uuid"
          },
          "verification_status": {
            "type": "string",
            "description": "Last recorded verification result; reopen verification to validate current configuration."
          },
          "cutover_id": {
            "type": "string",
            "description": "Latest saved cutover identity for this exact deployment.",
            "format": "uuid"
          },
          "cutover_status": {
            "type": "string",
            "description": "Last recorded cutover state; reopen cutover to validate current configuration."
          }
        }
      },
      "ProjectMigration": {
        "description": "Creator-owned migration receipt linking selected services to exact deployment identities.",
        "type": "object",
        "required": [
          "id",
          "version",
          "project",
          "source_sha256",
          "status",
          "services",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Monotonic journal version required to resume the reviewed set of services."
          },
          "id": {
            "type": "string",
            "description": "Durable project migration identity.",
            "format": "uuid"
          },
          "project": {
            "type": "string",
            "description": "Creator-owned project slug."
          },
          "project_id": {
            "type": "string",
            "description": "Project identity after reconciliation.",
            "format": "uuid"
          },
          "source_sha256": {
            "type": "string",
            "description": "Checksum of the original reviewed source archive."
          },
          "status": {
            "type": "string",
            "enum": [
              "prepared",
              "applying",
              "tracking",
              "attention"
            ]
          },
          "reason": {
            "type": "string",
            "description": "Project migration recovery guidance."
          },
          "services": {
            "type": "array",
            "minItems": 1,
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/ProjectMigrationService"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "retry_after": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ProjectMigrationList": {
        "description": "Bounded newest-first inventory of saved migrations for the authenticated creator.",
        "type": "object",
        "required": [
          "migrations"
        ],
        "properties": {
          "migrations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectMigration"
            }
          }
        }
      },
      "SelectedTraceApp": {
        "description": "App identity pinned to an explicit selected-app trace lookup.",
        "type": "object",
        "required": [
          "id",
          "slug"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string"
          }
        }
      },
      "SelectedTraceRequest": {
        "type": "object",
        "description": "Retained metadata only; no spans, headers, payloads or infrastructure fields.",
        "required": [
          "app_id",
          "id",
          "route",
          "method",
          "status",
          "latency_ms",
          "count",
          "cold_boot",
          "received_at"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "route": {
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "latency_ms": {
            "type": "integer"
          },
          "count": {
            "type": "integer",
            "minimum": 1
          },
          "cold_boot": {
            "type": "boolean"
          },
          "received_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SelectedTraceInvocation": {
        "type": "object",
        "description": "Durable lifecycle metadata only. started_at is the latest claim, not the first attempt; no headers, traceparent, queue name, payload or result.",
        "required": [
          "app_id",
          "id",
          "source",
          "state",
          "attempts",
          "created_at"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "source": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "attempts": {
            "type": "integer",
            "minimum": 0
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SelectedTraceLookupResponse": {
        "type": "object",
        "description": "Independent selected-app source reads, not an atomic snapshot or a complete trace. Empty retained results do not establish health. Both unavailable sources still return an explicit partial response.",
        "required": [
          "selection",
          "trace_id",
          "apps",
          "generated_at",
          "limit",
          "request_window_start",
          "request_window_end",
          "request_retention_days",
          "requests",
          "requests_status",
          "requests_truncated",
          "invocations",
          "invocations_status",
          "invocations_truncated",
          "partial"
        ],
        "properties": {
          "selection": {
            "type": "string",
            "enum": [
              "explicit_app_ids_v1"
            ]
          },
          "trace_id": {
            "type": "string"
          },
          "apps": {
            "type": "array",
            "minItems": 1,
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/SelectedTraceApp"
            }
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20
          },
          "request_window_start": {
            "type": "string",
            "format": "date-time"
          },
          "request_window_end": {
            "type": "string",
            "format": "date-time"
          },
          "request_retention_days": {
            "type": "integer",
            "minimum": 1
          },
          "requests": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/SelectedTraceRequest"
            }
          },
          "requests_status": {
            "type": "string",
            "enum": [
              "ok",
              "unavailable"
            ]
          },
          "requests_truncated": {
            "type": "boolean"
          },
          "invocations": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/SelectedTraceInvocation"
            }
          },
          "invocations_status": {
            "type": "string",
            "enum": [
              "ok",
              "unavailable"
            ]
          },
          "invocations_truncated": {
            "type": "boolean"
          },
          "partial": {
            "type": "boolean"
          }
        }
      },
      "EventAcknowledgmentPolicy": {
        "type": "object",
        "description": "Acceptance-time deferred acknowledgment configuration for an application subscription.",
        "required": [
          "subscription_id",
          "lease_seconds"
        ],
        "properties": {
          "subscription_id": {
            "type": "string",
            "format": "uuid",
            "description": "Subscription whose future acceptance policy is configured."
          },
          "lease_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 300,
            "description": "Zero uses ordinary HTTP success; positive values enable deferred HTTP 202 processing."
          }
        }
      },
      "EventAcknowledgmentPolicyRequest": {
        "type": "object",
        "description": "Explicit replacement of a subscription policy for future acceptances.",
        "required": [
          "lease_seconds"
        ],
        "properties": {
          "lease_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 300,
            "description": "Requested processing lease duration; zero disables deferred acknowledgment for future acceptances."
          }
        }
      },
      "EventAcknowledgmentFailureRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "App-authorized negative acknowledgment for the current live attempt; repeat exactly after an uncertain response.",
        "required": [
          "token",
          "reason"
        ],
        "properties": {
          "token": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "writeOnly": true,
            "description": "Secret attempt token; never log it or put it in a URL."
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[a-z0-9_.-]+$",
            "description": "Non-sensitive failure code; no payloads or credentials."
          }
        }
      },
      "EventAcknowledgmentRequest": {
        "type": "object",
        "description": "App-authorized callback fenced by the current opaque delivery token.",
        "required": [
          "token"
        ],
        "properties": {
          "token": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "writeOnly": true,
            "description": "Secret attempt token from the authenticated internal delivery; never log or persist in diagnostic artifacts."
          },
          "result": {
            "description": "Optional JSON completion result up to one MiB; omitted means null and renewal forbids this field."
          }
        }
      },
      "EventAcknowledgmentOutcome": {
        "type": "object",
        "description": "Payload-free coalesced outcome for one deferred delivery attempt.",
        "required": [
          "invocation_id",
          "attempt",
          "replay_generation",
          "kind",
          "first_at",
          "last_at",
          "occurrences",
          "retain_until"
        ],
        "properties": {
          "invocation_id": {
            "type": "string",
            "format": "uuid",
            "description": "Delivery whose attempt produced this outcome."
          },
          "attempt": {
            "type": "integer",
            "minimum": 1,
            "description": "Fenced invocation attempt number."
          },
          "replay_generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Replay generation fenced by this outcome."
          },
          "kind": {
            "type": "string",
            "enum": [
              "accepted",
              "renewed",
              "renewal_rejected",
              "completed",
              "expired",
              "retry_requested",
              "dead_letter_requested"
            ],
            "description": "Deferred acknowledgment operation or scheduler expiry outcome."
          },
          "first_at": {
            "type": "string",
            "format": "date-time",
            "description": "Database time of the first retained occurrence."
          },
          "last_at": {
            "type": "string",
            "format": "date-time",
            "description": "Database time of the latest retained occurrence."
          },
          "occurrences": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 2147483647,
            "description": "Coalesced count saturating at the documented maximum."
          },
          "retain_until": {
            "type": "string",
            "format": "date-time",
            "description": "Fixed history expiry anchored to the attempt deadline."
          }
        }
      },
      "EventAcknowledgmentHistoryQuery": {
        "type": "object",
        "description": "Scope-bound page options selecting coalesced groups by first occurrence.",
        "properties": {
          "invocation_id": {
            "type": "string",
            "format": "uuid",
            "description": "Delivery filter shared by every continuation request."
          },
          "kind": {
            "type": "string",
            "enum": [
              "accepted",
              "renewed",
              "renewal_rejected",
              "completed",
              "expired",
              "retry_requested",
              "dead_letter_requested"
            ],
            "description": "Outcome kind shared by the page traversal."
          },
          "from": {
            "type": "string",
            "format": "date-time",
            "description": "Inclusive first_at bound for the traversal."
          },
          "until": {
            "type": "string",
            "format": "date-time",
            "description": "Exclusive first_at bound for the traversal."
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 100,
            "description": "Page size included in the cursor scope binding."
          },
          "cursor": {
            "type": "string",
            "maxLength": 2048,
            "description": "Previous page continuation retaining its initial cutoff."
          }
        }
      },
      "EventAcknowledgmentHistoryPage": {
        "type": "object",
        "description": "Bounded page of coalesced outcomes ordered by immutable group identity.",
        "required": [
          "outcomes",
          "has_more",
          "cutoff",
          "coverage"
        ],
        "properties": {
          "outcomes": {
            "type": "array",
            "maxItems": 100,
            "description": "Groups ordered by first_at, invocation UUID, attempt, generation and kind descending.",
            "items": {
              "$ref": "#/components/schemas/EventAcknowledgmentOutcome"
            }
          },
          "has_more": {
            "type": "boolean",
            "description": "Another retained matching group existed in this read."
          },
          "next_cursor": {
            "type": "string",
            "maxLength": 2048,
            "description": "Continuation emitted only when has_more is true."
          },
          "cutoff": {
            "type": "string",
            "format": "date-time",
            "description": "Fixed initial read time excluding groups with later first occurrences."
          },
          "coverage": {
            "type": "string",
            "enum": [
              "retained_coalesced_deferred_outcomes"
            ],
            "description": "Retained diagnostic groups with live aggregate values and no historical snapshot guarantee."
          }
        }
      },
      "EventAcknowledgmentHistory": {
        "type": "object",
        "description": "Most recently updated retained outcome groups for a scoped consumer.",
        "required": [
          "outcomes",
          "truncated",
          "coverage"
        ],
        "properties": {
          "outcomes": {
            "type": "array",
            "maxItems": 100,
            "description": "Outcome groups ordered by latest occurrence descending with stable tie breakers.",
            "items": {
              "$ref": "#/components/schemas/EventAcknowledgmentOutcome"
            }
          },
          "truncated": {
            "type": "boolean",
            "description": "More retained outcome groups existed at the read snapshot."
          },
          "coverage": {
            "type": "string",
            "enum": [
              "retained_coalesced_deferred_outcomes"
            ],
            "description": "Diagnostic retained invocation coverage since the ledger rollout."
          }
        }
      },
      "EventAcknowledgmentStatus": {
        "type": "object",
        "description": "Retained invocation and processing lease observation without secret token material.",
        "required": [
          "invocation_id",
          "attempt",
          "replay_generation",
          "state",
          "processing_state"
        ],
        "properties": {
          "disposition": {
            "type": "string",
            "enum": [
              "retry",
              "dead-letter"
            ],
            "description": "Requested negative acknowledgment action; retry may exhaust its captured budget and dead-letter."
          },
          "failure_reason": {
            "type": "string",
            "maxLength": 128,
            "pattern": "^[a-z0-9_.-]+$",
            "description": "Non-sensitive reason code retained for this attempt."
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time",
            "description": "Saved retry due time; absent for a terminal disposition."
          },
          "invocation_id": {
            "type": "string",
            "format": "uuid",
            "description": "Durable invocation receiving the deferred processing callback."
          },
          "attempt": {
            "type": "integer",
            "minimum": 0,
            "description": "Current execution claim number for this processing observation; zero follows an in-place replay reset."
          },
          "replay_generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Current in-place replay generation fencing old delivery attempts."
          },
          "state": {
            "type": "string",
            "description": "Underlying durable invocation lifecycle state."
          },
          "processing_state": {
            "type": "string",
            "enum": [
              "waiting",
              "delivering",
              "processing",
              "expired",
              "completed",
              "failed",
              "dead_letter",
              "cancelled",
              "superseded"
            ],
            "description": "Processing phase derived from the retained claim and current database clock."
          },
          "lease_expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "Current invocation lease expiry; absent after expiry recovery."
          },
          "deadline_at": {
            "type": "string",
            "format": "date-time",
            "description": "Absolute one-hour processing deadline of the matching attempt."
          }
        }
      },
      "MCPReadinessOAuthConnection": {
        "type": "object",
        "additionalProperties": false,
        "description": "App-local managed OAuth connection in the default environment scope, pinned to its current revision.",
        "required": [
          "role",
          "revision"
        ],
        "properties": {
          "scope": {
            "type": "string",
            "maxLength": 40,
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$",
            "description": "Connection environment. Omission preserves the default environment."
          },
          "role": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "revision": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "MCPReadinessMonitorConfig": {
        "description": "Schedule, failure threshold and connection settings for continuous readiness probes.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "oauth_connections": {
            "type": "object",
            "maxProperties": 32,
            "description": "Environment scope to pinned connection. Mutually exclusive with oauth_connection and secret_ref. Missing environments fail closed.",
            "additionalProperties": {
              "$ref": "#/components/schemas/MCPReadinessOAuthConnection"
            }
          },
          "oauth_connection": {
            "$ref": "#/components/schemas/MCPReadinessOAuthConnection"
          },
          "enabled": {
            "type": "boolean"
          },
          "interval_seconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 3600
          },
          "failure_threshold": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10
          },
          "secret_ref": {
            "type": "string",
            "description": "Scoped app-secret reference; no plaintext credentials."
          }
        },
        "required": [
          "enabled",
          "interval_seconds",
          "failure_threshold"
        ]
      },
      "MCPReadinessMonitorObservation": {
        "description": "One retained observation from a continuous readiness probe.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "passed": {
            "type": "boolean"
          },
          "reason": {
            "type": "string"
          }
        },
        "required": [
          "observed_at",
          "passed"
        ]
      },
      "MCPReadinessIncidentTimeline": {
        "description": "Paginated logical readiness events independent of notification delivery success.",
        "type": "object",
        "required": [
          "events"
        ],
        "properties": {
          "events": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/MCPReadinessIncidentEvent"
            }
          },
          "next_before": {
            "type": "string"
          }
        }
      },
      "CreateMCPReadinessMaintenanceRequest": {
        "description": "Exact-environment notification silence with a finite time range and audit reason.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "ends_at",
          "reason"
        ],
        "properties": {
          "scope": {
            "type": "string",
            "default": "default",
            "maxLength": 40,
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
          },
          "starts_at": {
            "type": "string",
            "format": "date-time",
            "description": "Omit to start now. Past starts older than one minute are rejected."
          },
          "ends_at": {
            "type": "string",
            "format": "date-time",
            "description": "Future end within 720 hours of start."
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "Nonblank UTF-8 reason of at most 500 bytes."
          }
        }
      },
      "CancelMCPReadinessMaintenanceRequest": {
        "description": "Reason for ending a maintenance window before its scheduled expiry.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "reason"
        ],
        "properties": {
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          }
        }
      },
      "MCPReadinessMaintenanceWindow": {
        "description": "Retained maintenance interval with its creator and optional cancellation attribution.",
        "type": "object",
        "required": [
          "id",
          "scope",
          "starts_at",
          "ends_at",
          "reason",
          "created_by",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "starts_at": {
            "type": "string",
            "format": "date-time"
          },
          "ends_at": {
            "type": "string",
            "format": "date-time"
          },
          "reason": {
            "type": "string"
          },
          "created_by": {
            "type": "string",
            "format": "uuid",
            "description": "Account that scheduled the window."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "cancelled_at": {
            "type": "string",
            "format": "date-time"
          },
          "cancelled_by": {
            "type": "string",
            "format": "uuid"
          },
          "cancel_reason": {
            "type": "string"
          }
        }
      },
      "MCPReadinessMaintenancePage": {
        "description": "Bounded page of maintenance windows ordered by creation time and ID.",
        "type": "object",
        "required": [
          "windows"
        ],
        "properties": {
          "windows": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/MCPReadinessMaintenanceWindow"
            }
          },
          "next_before": {
            "type": "string"
          }
        }
      },
      "SetMCPReadinessPagerDutyAcknowledgementsRequest": {
        "description": "Version-fenced replacement of a PagerDuty acknowledgement webhook binding and write-only signing secret.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version",
          "enabled"
        ],
        "properties": {
          "sync_unacknowledgements": {
            "type": "boolean",
            "default": false,
            "description": "Opt in to signed incident.unacknowledged events for this destination. Only tracked provider acknowledgements can be released; other destination and manual acknowledgements remain protected."
          },
          "destination": {
            "type": "string",
            "enum": [
              "primary",
              "fallback"
            ],
            "description": "Native PagerDuty receiver to bind or disable. Enabling defaults to primary; disabling without a destination selects the original callback binding."
          },
          "expected_fallback_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Required for fallback binding instead of expected_pagerduty_version; must match an enabled native PagerDuty fallback."
          },
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9223372036854776000,
            "description": "Current selected destination acknowledgement policy version; zero denotes unconfigured."
          },
          "enabled": {
            "type": "boolean",
            "description": "Enable signed inbound acknowledgements or immediately revoke the current signing secret."
          },
          "expected_pagerduty_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Current enabled native primary PagerDuty version; required for primary binding. Omit for fallback or disabled policies."
          },
          "service_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9_-]{1,128}$",
            "description": "PagerDuty service selected by the webhook subscription filter; required only when enabling."
          },
          "signing_secret": {
            "type": "string",
            "minLength": 16,
            "maxLength": 1024,
            "pattern": "^[!-~]{16,1024}$",
            "writeOnly": true,
            "description": "Exact ASCII v3 webhook subscription signing secret from PagerDuty; required when enabling and omitted when disabling."
          }
        }
      },
      "MCPReadinessPagerDutyAcknowledgementPolicy": {
        "description": "Current revocable webhook binding with a masked secret and the relative signed-ingress path.",
        "type": "object",
        "required": [
          "version",
          "enabled",
          "webhook_path"
        ],
        "properties": {
          "sync_unacknowledgements": {
            "type": "boolean",
            "default": false,
            "description": "Whether this destination currently accepts signed provider unacknowledgements. False or absent preserves acknowledgement-only behavior; true releases only matching tracked provider ownership."
          },
          "destination": {
            "type": "string",
            "enum": [
              "primary",
              "fallback"
            ],
            "description": "Selected native PagerDuty destination",
            "retained when disabled.": null
          },
          "fallback_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Captured fallback configuration version; present for a fallback binding."
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "enabled": {
            "type": "boolean"
          },
          "webhook_path": {
            "type": "string",
            "description": "Relative signed callback URL for this binding; explicit destination reads always return a destination-specific URL. Existing original callback URLs remain bound to their original destination."
          },
          "pagerduty_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Native primary receiver version captured when the acknowledgement binding was saved; omitted for fallback binding."
          },
          "region": {
            "type": "string",
            "enum": [
              "us",
              "eu"
            ],
            "description": "Regional PagerDuty receiver bound to this enabled webhook policy."
          },
          "service_id": {
            "type": "string",
            "description": "Exact provider service accepted by the enabled webhook binding."
          },
          "signing_secret_masked": {
            "type": "string",
            "enum": [
              "***"
            ],
            "description": "Fixed mask for an enabled signing credential; no plaintext or ciphertext is returned."
          }
        }
      },
      "MCPReadinessPagerDutyAcknowledgementEvent": {
        "description": "Immutable minimal receipt committed atomically with any provider acknowledgement and reminder suppression.",
        "type": "object",
        "required": [
          "id",
          "event_id",
          "incident_id",
          "provider_incident_id",
          "occurred_at",
          "received_at",
          "policy_version",
          "outcome",
          "attention_version",
          "region",
          "service_id"
        ],
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "acknowledge",
              "release"
            ],
            "description": "Provider decision; absent on legacy acknowledgement receipts. Release event receipts are independent per destination."
          },
          "destination": {
            "type": "string",
            "enum": [
              "primary",
              "fallback"
            ],
            "description": "Authenticated pinned receiver; absent on legacy primary receipts."
          },
          "region": {
            "type": "string",
            "enum": [
              "us",
              "eu"
            ],
            "description": "Authenticated receiver region retained in this provider event receipt."
          },
          "service_id": {
            "type": "string",
            "description": "Authenticated PagerDuty service retained in this provider event receipt."
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "event_id": {
            "type": "string",
            "maxLength": 128
          },
          "incident_id": {
            "type": "string",
            "format": "uuid"
          },
          "provider_incident_id": {
            "type": "string",
            "maxLength": 128
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "received_at": {
            "type": "string",
            "format": "date-time"
          },
          "policy_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "outcome": {
            "type": "string",
            "enum": [
              "acknowledged",
              "already_acknowledged",
              "stale",
              "resolved",
              "released",
              "retained",
              "not_acknowledged"
            ]
          },
          "attention_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "MCPReadinessPagerDutyAcknowledgementHold": {
        "description": "Minimal ownership of an active provider acknowledgement; no credentials or integration fingerprints are exposed.",
        "type": "object",
        "required": [
          "destination",
          "provider_incident_id",
          "provider_event_id",
          "service_id",
          "region",
          "occurred_at",
          "received_at",
          "policy_version",
          "release_sync_enabled"
        ],
        "properties": {
          "destination": {
            "type": "string",
            "enum": [
              "primary",
              "fallback"
            ]
          },
          "provider_incident_id": {
            "type": "string",
            "maxLength": 128
          },
          "provider_event_id": {
            "type": "string",
            "maxLength": 128
          },
          "service_id": {
            "type": "string",
            "maxLength": 128
          },
          "region": {
            "type": "string",
            "enum": [
              "us",
              "eu"
            ]
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "received_at": {
            "type": "string",
            "format": "date-time"
          },
          "policy_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "release_sync_enabled": {
            "type": "boolean",
            "description": "False requires local release; includes acknowledgement-only bindings and ambiguous ownership."
          }
        }
      },
      "MCPReadinessPagerDutyAcknowledgementEvents": {
        "description": "Receipt page scoped to an owned readiness rule; next_before is absent on its final page.",
        "type": "object",
        "required": [
          "events"
        ],
        "properties": {
          "events": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/MCPReadinessPagerDutyAcknowledgementEvent"
            }
          },
          "next_before": {
            "type": "string"
          }
        }
      },
      "SetMCPReadinessPagerDutyRequest": {
        "description": "Version-fenced PagerDuty primary receiver configuration with write-only credentials.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version",
          "enabled"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9223372036854776000,
            "description": "Current native PagerDuty policy version; zero is valid for first configuration."
          },
          "enabled": {
            "type": "boolean",
            "description": "Select PagerDuty primary for incidents not yet attempted; false restores webhook primary."
          },
          "integration_key": {
            "type": "string",
            "minLength": 32,
            "maxLength": 32,
            "pattern": "^[A-Za-z0-9]{32}$",
            "writeOnly": true,
            "description": "Events API v2 key for the selected region; required when enabling and omitted when disabling."
          },
          "region": {
            "type": "string",
            "enum": [
              "us",
              "eu"
            ],
            "description": "Events API region for this replacement configuration; defaults to US when omitted. Omit when disabling."
          }
        }
      },
      "MCPReadinessPagerDutyPolicy": {
        "description": "Masked native PagerDuty settings without plaintext, ciphertext or receiver fingerprint.",
        "type": "object",
        "required": [
          "version",
          "enabled",
          "region"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Monotonic PagerDuty receiver policy version; zero denotes webhook primary without native configuration."
          },
          "enabled": {
            "type": "boolean"
          },
          "region": {
            "type": "string",
            "enum": [
              "us",
              "eu"
            ],
            "description": "Effective Events API region; US for unconfigured or disabled policies."
          },
          "integration_key_masked": {
            "type": "string",
            "enum": [
              "***"
            ],
            "description": "Fixed mask returned only for an enabled PagerDuty integration."
          }
        }
      },
      "MCPReadinessReminderDefaults": {
        "description": "Versioned reminder policy captured when a new readiness webhook incident opens.",
        "type": "object",
        "required": [
          "version",
          "reminder_policy"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Zero means no defaults have been configured for this rule."
          },
          "reminder_policy": {
            "$ref": "#/components/schemas/MCPReadinessReminderPolicy"
          }
        }
      },
      "SetMCPReadinessReminderDefaultsRequest": {
        "description": "Complete replacement of rule reminder defaults with optimistic concurrency control.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version",
          "reminder_policy"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9223372036854776000,
            "description": "Current rule defaults version; required even when it is zero."
          },
          "reminder_policy": {
            "$ref": "#/components/schemas/MCPReadinessReminderPolicy"
          }
        }
      },
      "MCPReadinessReminderPolicy": {
        "description": "Per-incident lifetime creation budget. Both zero disables; otherwise interval is 60–86400 seconds and budget is 1–10. Reconfiguration never resets the count.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "interval_seconds",
          "max_reminders"
        ],
        "properties": {
          "interval_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400
          },
          "max_reminders": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10
          }
        }
      },
      "MCPReadinessAcknowledgement": {
        "description": "Retained acknowledgement metadata independent of readiness state.",
        "type": "object",
        "required": [
          "request_id",
          "created_by",
          "created_at",
          "reason"
        ],
        "properties": {
          "source": {
            "type": "string",
            "enum": [
              "pagerduty"
            ],
            "description": "Provider provenance for this MCPReadinessAcknowledgement; absence denotes a local account action."
          },
          "provider_event_id": {
            "type": "string",
            "maxLength": 128,
            "description": "PagerDuty event associated with this MCPReadinessAcknowledgement."
          },
          "provider_incident_id": {
            "type": "string",
            "maxLength": 128,
            "description": "Provider incident associated with this MCPReadinessAcknowledgement."
          },
          "provider_occurred_at": {
            "type": "string",
            "format": "date-time",
            "description": "Signed provider event time retained in this MCPReadinessAcknowledgement."
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "created_by": {
            "type": "string",
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "reason": {
            "type": "string"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "Omitted for acknowledgement until release or incident resolution."
          }
        }
      },
      "MCPReadinessAttentionAction": {
        "description": "Version-fenced attention decision. Acknowledge accepts optional expires_at; configure_reminders requires reminder_policy; release accepts neither.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "request_id",
          "expected_version",
          "action",
          "reason"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid",
            "description": "Reuse this UUID and identical body when retrying the same decision."
          },
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Current incident attention version; zero is valid."
          },
          "action": {
            "type": "string",
            "enum": [
              "acknowledge",
              "release",
              "configure_reminders"
            ]
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "Nonblank explanation limited to 500 UTF-8 bytes."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "Optional absolute acknowledgement expiry within the next 30 days."
          },
          "reminder_policy": {
            "$ref": "#/components/schemas/MCPReadinessReminderPolicy"
          }
        }
      },
      "MCPReadinessAttentionReceipt": {
        "description": "Immutable attention decision retained transactionally with the incident state change.",
        "type": "object",
        "required": [
          "request_id",
          "incident_id",
          "action",
          "reason",
          "created_by",
          "created_at",
          "version"
        ],
        "properties": {
          "source": {
            "type": "string",
            "enum": [
              "pagerduty"
            ],
            "description": "Provider provenance for this MCPReadinessAttentionReceipt; absence denotes a local account action."
          },
          "provider_event_id": {
            "type": "string",
            "maxLength": 128,
            "description": "PagerDuty event associated with this MCPReadinessAttentionReceipt."
          },
          "provider_incident_id": {
            "type": "string",
            "maxLength": 128,
            "description": "Provider incident associated with this MCPReadinessAttentionReceipt."
          },
          "provider_occurred_at": {
            "type": "string",
            "format": "date-time",
            "description": "Signed provider event time retained in this MCPReadinessAttentionReceipt."
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "incident_id": {
            "type": "string",
            "format": "uuid"
          },
          "action": {
            "type": "string",
            "enum": [
              "acknowledge",
              "release",
              "configure_reminders"
            ]
          },
          "reason": {
            "type": "string"
          },
          "created_by": {
            "type": "string",
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "reminder_policy": {
            "$ref": "#/components/schemas/MCPReadinessReminderPolicy"
          }
        }
      },
      "MCPReadinessIncidentAttention": {
        "description": "Incident acknowledgement and durable reminder schedule. Version changes on decisions and reminder creation, not routine evidence updates.",
        "type": "object",
        "required": [
          "incident_id",
          "rule_id",
          "rule_name",
          "rule_enabled",
          "opened_at",
          "version",
          "state",
          "reminder_policy",
          "reminders_created"
        ],
        "properties": {
          "provider_acknowledgements": {
            "type": "array",
            "maxItems": 2,
            "description": "Active tracked PagerDuty acknowledgements in primary then fallback order. Every remaining acknowledgement prevents automatic reminder resumption.",
            "items": {
              "$ref": "#/components/schemas/MCPReadinessPagerDutyAcknowledgementHold"
            }
          },
          "reminder_policy_source": {
            "type": "string",
            "enum": [
              "rule_default",
              "incident_override",
              "legacy"
            ],
            "description": "Whether the current incident policy was inherited or explicitly overridden; legacy denotes unavailable pre-upgrade provenance."
          },
          "reminder_defaults_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Rule defaults version captured at incident opening; retained after an incident override and absent for older incidents."
          },
          "incident_id": {
            "type": "string",
            "format": "uuid"
          },
          "rule_id": {
            "type": "string",
            "format": "uuid"
          },
          "rule_name": {
            "type": "string"
          },
          "rule_enabled": {
            "type": "boolean"
          },
          "mcp_readiness_scope": {
            "type": "string",
            "description": "Incident environment; omission covers every environment."
          },
          "opened_at": {
            "type": "string",
            "format": "date-time"
          },
          "resolved_at": {
            "type": "string",
            "format": "date-time"
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "state": {
            "type": "string",
            "enum": [
              "unacknowledged",
              "acknowledged",
              "expired",
              "resolved"
            ]
          },
          "acknowledgement": {
            "$ref": "#/components/schemas/MCPReadinessAcknowledgement"
          },
          "reminder_policy": {
            "$ref": "#/components/schemas/MCPReadinessReminderPolicy"
          },
          "reminders_created": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10
          },
          "next_reminder_at": {
            "type": "string",
            "format": "date-time",
            "description": "Earliest eligibility subject to fresh evidence and queue state."
          },
          "last_observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_unhealthy_at": {
            "type": "string",
            "format": "date-time",
            "description": "Latest matching unhealthy evidence; omitted after healthy or coverage-changed observations."
          },
          "last_action": {
            "$ref": "#/components/schemas/MCPReadinessAttentionReceipt"
          }
        }
      },
      "MCPReadinessAttentionPage": {
        "description": "Bounded page of readiness incident attention ordered by incident UUID ascending.",
        "type": "object",
        "required": [
          "incidents"
        ],
        "properties": {
          "incidents": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/MCPReadinessIncidentAttention"
            }
          },
          "next_after": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "MCPReadinessAttentionHistory": {
        "description": "Bounded immutable history of incident attention decisions.",
        "type": "object",
        "required": [
          "actions"
        ],
        "properties": {
          "actions": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/MCPReadinessAttentionReceipt"
            }
          },
          "next_before": {
            "type": "string"
          }
        }
      },
      "MCPReadinessNotificationAction": {
        "description": "Version-fenced decision against a receiver head or the oldest event using an app-scoped idempotency key.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "request_id",
          "event_id",
          "action",
          "expected_version",
          "reason"
        ],
        "properties": {
          "destination": {
            "type": "string",
            "enum": [
              "primary",
              "fallback"
            ],
            "description": "Selected receiver queue; omitted for an event-wide decision."
          },
          "request_id": {
            "type": "string",
            "format": "uuid",
            "description": "Reuse this UUID and the identical request body when retrying the same decision."
          },
          "event_id": {
            "type": "string",
            "format": "uuid"
          },
          "action": {
            "type": "string",
            "enum": [
              "retry",
              "abandon"
            ]
          },
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Current head delivery_version from queue inspection."
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "Nonblank operator explanation limited to 500 UTF-8 bytes."
          }
        }
      },
      "MCPReadinessNotificationReceipt": {
        "description": "Immutable recovery decision retained transactionally with the queue change.",
        "type": "object",
        "required": [
          "request_id",
          "event_id",
          "action",
          "reason",
          "created_at",
          "created_by",
          "delivery_version"
        ],
        "properties": {
          "destination": {
            "type": "string",
            "enum": [
              "primary",
              "fallback"
            ],
            "description": "Receiver selected by the retained decision; absent for a whole-event receipt."
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "event_id": {
            "type": "string",
            "format": "uuid"
          },
          "action": {
            "type": "string",
            "enum": [
              "retry",
              "abandon"
            ]
          },
          "reason": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_by": {
            "type": "string",
            "format": "uuid"
          },
          "delivery_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "MCPReadinessNotificationQueue": {
        "description": "One readiness webhook rule and its full outstanding queue independent of incident health.",
        "type": "object",
        "required": [
          "rule_id",
          "name",
          "enabled",
          "outstanding_count",
          "blocked_count",
          "oldest_age_seconds",
          "state",
          "can_retry",
          "can_abandon"
        ],
        "properties": {
          "destinations": {
            "type": "array",
            "maxItems": 2,
            "items": {
              "$ref": "#/components/schemas/MCPReadinessDestinationQueue"
            },
            "description": "Ordered receiver queues including fallback reservations awaiting the primary outcome."
          },
          "rule_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "mcp_readiness_scope": {
            "type": "string",
            "description": "Omitted for an all-environment rule."
          },
          "enabled": {
            "type": "boolean"
          },
          "outstanding_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "blocked_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Events newer than the oldest event; inspect destinations for actual receiver blocking."
          },
          "oldest_age_seconds": {
            "type": "number",
            "minimum": 0
          },
          "state": {
            "type": "string",
            "enum": [
              "idle",
              "ready",
              "delayed",
              "delivering",
              "paused",
              "maintenance"
            ]
          },
          "failure_kind": {
            "type": "string",
            "enum": [
              "http_4xx",
              "http_5xx",
              "http_other",
              "transport",
              "lease_expired"
            ],
            "description": "Safe failure classification without webhook URLs or remote response bodies."
          },
          "can_retry": {
            "type": "boolean",
            "description": "Snapshot hint; the action transaction rechecks current eligibility."
          },
          "can_abandon": {
            "type": "boolean",
            "description": "Whether the current snapshot permits permanent abandonment."
          },
          "head": {
            "$ref": "#/components/schemas/MCPReadinessIncidentEvent"
          }
        }
      },
      "MCPReadinessDestinationDelivery": {
        "description": "Safe persisted progress for one event receiver without ownership tokens or credentials.",
        "type": "object",
        "required": [
          "destination",
          "status",
          "attempt_count"
        ],
        "properties": {
          "provider": {
            "type": "string",
            "enum": [
              "webhook",
              "pagerduty"
            ],
            "description": "Transport for this receiver delivery; omission denotes a legacy webhook."
          },
          "provider_status": {
            "type": "string",
            "enum": [
              "pending",
              "delivering",
              "retrying",
              "accepted",
              "suppressed",
              "abandoned",
              "superseded"
            ],
            "description": "PagerDuty transport progress; accepted means a validated 202 acknowledgement rather than a confirmed page."
          },
          "destination": {
            "type": "string",
            "enum": [
              "primary",
              "fallback"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "failed",
              "delivering",
              "delivered",
              "suppressed",
              "abandoned",
              "superseded"
            ]
          },
          "attempt_count": {
            "type": "integer",
            "minimum": 0
          },
          "last_status_code": {
            "type": "integer"
          },
          "last_delivery_id": {
            "type": "string",
            "format": "uuid"
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "lease_until": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "MCPReadinessDestinationQueue": {
        "description": "One ordered receiver lane; waiting_primary reserves order until primary succeeds or fails over.",
        "type": "object",
        "required": [
          "destination",
          "outstanding_count",
          "blocked_count",
          "state",
          "can_retry",
          "can_abandon"
        ],
        "properties": {
          "provider": {
            "type": "string",
            "enum": [
              "webhook",
              "pagerduty"
            ],
            "description": "Native transport of this queue head; omitted for an idle receiver or legacy inspection."
          },
          "destination": {
            "type": "string",
            "enum": [
              "primary",
              "fallback"
            ]
          },
          "outstanding_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "blocked_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "state": {
            "type": "string",
            "enum": [
              "idle",
              "ready",
              "delayed",
              "delivering",
              "paused",
              "maintenance",
              "waiting_primary",
              "waiting_receiver"
            ]
          },
          "failure_kind": {
            "type": "string",
            "enum": [
              "http_4xx",
              "http_5xx",
              "http_other",
              "transport",
              "lease_expired"
            ]
          },
          "can_retry": {
            "type": "boolean"
          },
          "can_abandon": {
            "type": "boolean"
          },
          "head": {
            "$ref": "#/components/schemas/MCPReadinessIncidentEvent"
          }
        }
      },
      "MCPReadinessNotificationQueues": {
        "description": "Bounded notification queue page from a consistent database snapshot.",
        "type": "object",
        "required": [
          "observed_at",
          "queues"
        ],
        "properties": {
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "queues": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/MCPReadinessNotificationQueue"
            }
          },
          "next_after": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "SetMCPReadinessFallbackRequest": {
        "description": "Optimistically versioned fallback replacement. Webhook requires webhook_url and webhook_secret. PagerDuty requires provider=pagerduty and integration_key with optional region. Enabled policies require after_failures; disabling omits all destination fields.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version",
          "enabled"
        ],
        "properties": {
          "provider": {
            "type": "string",
            "enum": [
              "webhook",
              "pagerduty"
            ],
            "description": "Destination provider; omitted means webhook. Omit when disabling."
          },
          "region": {
            "type": "string",
            "enum": [
              "us",
              "eu"
            ],
            "description": "PagerDuty region; defaults to US. Omit for webhook or disabled policies."
          },
          "integration_key": {
            "type": "string",
            "minLength": 32,
            "maxLength": 32,
            "pattern": "^[A-Za-z0-9]{32}$",
            "writeOnly": true,
            "description": "PagerDuty fallback Events API key; omit webhook fields when selecting this provider."
          },
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9223372036854776000,
            "description": "Current fallback policy version; zero is valid for an unconfigured rule."
          },
          "enabled": {
            "type": "boolean",
            "description": "Whether unclaimed incidents should acquire a fallback destination."
          },
          "webhook_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048,
            "description": "Public webhook fallback receiver URL; required for webhook only and must differ from the primary webhook address."
          },
          "webhook_secret": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "writeOnly": true,
            "description": "Fallback HMAC signing material; required only when enabling or replacing a webhook policy."
          },
          "after_failures": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10,
            "description": "Completed unsuccessful primary dispatch claims before switching this incident to fallback."
          }
        }
      },
      "MCPReadinessFallbackPolicy": {
        "description": "Masked rule configuration for readiness incidents whose delivery has not yet been attempted.",
        "type": "object",
        "required": [
          "version",
          "enabled"
        ],
        "properties": {
          "provider": {
            "type": "string",
            "enum": [
              "webhook",
              "pagerduty"
            ],
            "description": "Configured fallback provider; omitted when disabled."
          },
          "region": {
            "type": "string",
            "enum": [
              "us",
              "eu"
            ],
            "description": "Configured PagerDuty fallback region."
          },
          "integration_key_masked": {
            "type": "string",
            "enum": [
              "***"
            ],
            "description": "Fixed mask for the PagerDuty fallback credential."
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Monotonic fallback configuration version."
          },
          "enabled": {
            "type": "boolean",
            "description": "Whether this configuration supplies a fallback to new delivery incidents."
          },
          "webhook_url": {
            "type": "string",
            "format": "uri",
            "description": "Configured public fallback address; omitted when disabled."
          },
          "webhook_secret_sealed_masked": {
            "type": "string",
            "description": "Constant mask for the stored fallback secret; omitted when disabled."
          },
          "after_failures": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10,
            "description": "Configured threshold of completed failed primary dispatches."
          }
        }
      },
      "MCPReadinessDeliveryRouting": {
        "description": "Credential-free destination progress for one immutable readiness event. A recovery can remain pending after fallback succeeds while the previously informed primary is still outstanding.",
        "type": "object",
        "required": [
          "policy_version",
          "primary_attempts",
          "fallback_attempts",
          "primary_failures",
          "primary_delivered",
          "fallback_delivered"
        ],
        "properties": {
          "pagerduty_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Native primary policy version pinned at first delivery; omitted for legacy webhook routing."
          },
          "policy_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Fallback configuration version captured when this incident first claimed delivery."
          },
          "last_destination": {
            "type": "string",
            "enum": [
              "primary",
              "fallback"
            ],
            "description": "Receiver role used for this event's most recent dispatch claim."
          },
          "failover_reason": {
            "type": "string",
            "enum": [
              "primary_failure_threshold",
              "incident_sticky_fallback",
              "recovery_to_primary",
              "primary_queue_blocked"
            ],
            "description": "Explanation for selecting a receiver after failover; omitted for ordinary primary delivery."
          },
          "primary_attempts": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of primary dispatch claims including expired leases."
          },
          "fallback_attempts": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of fallback dispatch claims for this logical event."
          },
          "primary_failures": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of fenced unsuccessful primary completions for this event."
          },
          "primary_delivered": {
            "type": "boolean",
            "description": "Whether primary accepted this event in a completed delivery claim."
          },
          "fallback_delivered": {
            "type": "boolean",
            "description": "Whether fallback accepted this event in a completed delivery claim."
          }
        }
      },
      "MCPReadinessIncidentEvent": {
        "description": "Readiness incident transition or continuation with current notification status.",
        "type": "object",
        "required": [
          "id",
          "incident_id",
          "event_id",
          "event",
          "rule_id",
          "scopes",
          "occurred_at",
          "incident_status",
          "delivery_status",
          "attempt_count",
          "subjects"
        ],
        "properties": {
          "destination_deliveries": {
            "type": "array",
            "maxItems": 2,
            "items": {
              "$ref": "#/components/schemas/MCPReadinessDestinationDelivery"
            },
            "description": "Materialized receiver progress with independent retry and lease times."
          },
          "delivery_routing": {
            "$ref": "#/components/schemas/MCPReadinessDeliveryRouting"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Logical event ID."
          },
          "incident_id": {
            "type": "string",
            "format": "uuid"
          },
          "event_id": {
            "type": "string",
            "format": "uuid",
            "description": "Stable across retries; also the signed webhook ID."
          },
          "event": {
            "type": "string",
            "enum": [
              "alert.fired",
              "alert.resolved"
            ]
          },
          "rule_id": {
            "type": "string",
            "format": "uuid"
          },
          "mcp_readiness_scope": {
            "type": "string",
            "description": "Empty or omitted selects all environments."
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time",
            "description": "Logical event time",
            "retained across retries.": null
          },
          "attempted_at": {
            "type": "string",
            "format": "date-time"
          },
          "incident_status": {
            "type": "string",
            "enum": [
              "open",
              "resolved"
            ],
            "description": "Current incident state independent of notification success."
          },
          "delivery_status": {
            "type": "string",
            "enum": [
              "pending",
              "delivering",
              "delivered",
              "failed",
              "suppressed",
              "abandoned"
            ]
          },
          "delivery_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Changes on claims, completions, suppression and operator decisions."
          },
          "last_operator_action": {
            "$ref": "#/components/schemas/MCPReadinessNotificationReceipt"
          },
          "attempt_count": {
            "type": "integer",
            "minimum": 0
          },
          "maintenance_window_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Windows responsible for suppressing this notification."
          },
          "suppression_reason": {
            "type": "string",
            "enum": [
              "maintenance",
              "maintenance_recovered",
              "acknowledged",
              "incident_resolved",
              "reminders_disabled",
              "reminder_obsolete"
            ]
          },
          "notification_reason": {
            "type": "string",
            "enum": [
              "maintenance_ended",
              "reminder"
            ]
          },
          "reminder_number": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10,
            "description": "Per-incident reminder creation number; omitted for ordinary notifications."
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time",
            "description": "Next eligible delivery time. Omitted for all terminal delivery states."
          },
          "last_delivery_id": {
            "type": "string",
            "format": "uuid"
          },
          "last_status_code": {
            "type": "integer"
          },
          "subjects": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/MCPReadinessMonitorStatus"
            }
          }
        }
      },
      "MCPReadinessMonitorStatus": {
        "description": "Current policy-bound monitoring state and recent probe history for a deployment role.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "scope": {
            "type": "string",
            "maxLength": 40,
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$",
            "description": "Readiness environment. Omission selects default."
          },
          "oauth_connection": {
            "$ref": "#/components/schemas/MCPReadinessOAuthConnection"
          },
          "recovery_action": {
            "type": "string",
            "enum": [
              "reconnect",
              "review_binding",
              "review_connection"
            ]
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "role": {
            "type": "string"
          },
          "policy_revision": {
            "type": "string",
            "format": "uuid"
          },
          "artifact_sha256": {
            "type": "string"
          },
          "next_probe_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_success_at": {
            "type": "string",
            "format": "date-time"
          },
          "consecutive_failures": {
            "type": "integer"
          },
          "failure_threshold": {
            "type": "integer"
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "healthy",
              "degraded",
              "firing",
              "stale"
            ]
          },
          "reason": {
            "type": "string"
          },
          "history": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/MCPReadinessMonitorObservation"
            }
          }
        },
        "required": [
          "deployment_id",
          "role",
          "policy_revision",
          "next_probe_at",
          "consecutive_failures",
          "failure_threshold",
          "state",
          "history"
        ]
      },
      "MCPReadinessRole": {
        "description": "Role-specific protocol, catalog and monitoring requirements in a readiness policy.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "monitor": {
            "$ref": "#/components/schemas/MCPReadinessMonitorConfig"
          },
          "name": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$"
          },
          "protocol_version": {
            "type": "string",
            "enum": [
              "2026-07-28",
              "2025-11-25"
            ]
          },
          "catalog_format": {
            "type": "integer",
            "enum": [
              1,
              2
            ]
          },
          "catalog_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        },
        "required": [
          "name",
          "protocol_version",
          "catalog_format",
          "catalog_sha256"
        ]
      },
      "MCPReadinessPolicyHistory": {
        "description": "Bounded page of saved environment readiness policy revisions.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "policies"
        ],
        "properties": {
          "policies": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MCPReadinessPolicy"
            }
          },
          "next_before_revision": {
            "type": "string",
            "description": "Use as before_revision for the next page; absent on the last page"
          }
        }
      },
      "RestoreMCPReadinessPolicyRequest": {
        "description": "Historical policy restore request guarded by the expected current revision and an audit reason.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_revision",
          "reason"
        ],
        "properties": {
          "scope": {
            "type": "string",
            "maxLength": 40,
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
          },
          "expected_revision": {
            "type": "string",
            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          }
        }
      },
      "MCPReadinessPolicyChange": {
        "description": "One field change between two readiness policy configurations.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "path",
          "before",
          "after"
        ],
        "properties": {
          "path": {
            "type": "string",
            "description": "JSON Pointer configuration field or role; role order and audit fields are ignored"
          },
          "before": {},
          "after": {}
        }
      },
      "MCPReadinessPolicyDiff": {
        "description": "Configuration differences between the selected readiness policy revisions.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "scope",
          "from_revision",
          "to_revision",
          "changes"
        ],
        "properties": {
          "scope": {
            "type": "string",
            "maxLength": 40,
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
          },
          "from_revision": {
            "type": "string"
          },
          "to_revision": {
            "type": "string"
          },
          "changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MCPReadinessPolicyChange"
            }
          }
        }
      },
      "MCPReadinessPolicy": {
        "description": "Saved environment readiness requirements with revision and audit context.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "restored_from": {
            "type": "string",
            "description": "Historical source revision for a restore; audit metadata is always newly recorded."
          },
          "scope": {
            "type": "string",
            "maxLength": 40,
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$",
            "description": "Environment to which this saved readiness policy applies. Omitted means default."
          },
          "revision": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "endpoint": {
            "type": "string",
            "maxLength": 256
          },
          "max_age_seconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 3600
          },
          "roles": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/MCPReadinessRole"
            }
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_by": {
            "type": "string"
          }
        },
        "required": [
          "revision",
          "enabled",
          "endpoint",
          "max_age_seconds",
          "roles",
          "updated_at"
        ]
      },
      "SetMCPReadinessPolicyRequest": {
        "description": "Replacement readiness configuration with expected-revision concurrency control.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "scope": {
            "type": "string",
            "maxLength": 40,
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$",
            "description": "Environment whose readiness policy is replaced by this request. Omit for default."
          },
          "expected_revision": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "endpoint": {
            "type": "string",
            "maxLength": 256
          },
          "max_age_seconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 3600
          },
          "roles": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/MCPReadinessRole"
            }
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          }
        },
        "required": [
          "expected_revision",
          "enabled",
          "endpoint",
          "max_age_seconds",
          "roles",
          "reason"
        ]
      },
      "MCPReadinessCheck": {
        "description": "Result of one protocol or catalog check in readiness evidence.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "passed",
              "failed"
            ]
          },
          "detail": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "status"
        ]
      },
      "MCPReadinessEvidence": {
        "description": "Platform-recorded readiness results bound to deployment configuration and probe policy.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "role": {
            "type": "string"
          },
          "policy_revision": {
            "type": "string",
            "format": "uuid"
          },
          "artifact_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "protocol_version": {
            "type": "string"
          },
          "catalog_format": {
            "type": "integer"
          },
          "catalog_sha256": {
            "type": "string"
          },
          "passed": {
            "type": "boolean"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "checks": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/MCPReadinessCheck"
            }
          }
        },
        "required": [
          "id",
          "deployment_id",
          "role",
          "policy_revision",
          "artifact_sha256",
          "protocol_version",
          "catalog_format",
          "passed",
          "observed_at",
          "checks"
        ]
      },
      "MCPReadinessOverride": {
        "description": "Retained audited readiness override for a deployment.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "policy_revision": {
            "type": "string",
            "format": "uuid"
          },
          "artifact_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "reason": {
            "type": "string"
          },
          "created_by": {
            "type": "string",
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "used_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "deployment_id",
          "policy_revision",
          "artifact_sha256",
          "reason",
          "created_by",
          "created_at",
          "expires_at"
        ]
      },
      "MCPReadinessSnapshot": {
        "description": "Environment readiness policy together with retained evidence and overrides.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "monitoring": {
            "type": "array",
            "maxItems": 1000,
            "items": {
              "$ref": "#/components/schemas/MCPReadinessMonitorStatus"
            }
          },
          "policy": {
            "$ref": "#/components/schemas/MCPReadinessPolicy"
          },
          "evidence": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/MCPReadinessEvidence"
            }
          },
          "overrides": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/MCPReadinessOverride"
            }
          }
        },
        "required": [
          "policy",
          "evidence",
          "overrides"
        ]
      },
      "MCPReadinessProbeRequest": {
        "description": "Role selection and options for a platform-executed deployment readiness probe.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "role": {
            "type": "string"
          }
        },
        "required": [
          "role"
        ]
      },
      "MCPReadinessOverrideRequest": {
        "description": "Request to record an audited readiness override for a deployment.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expected_revision": {
            "type": "string",
            "format": "uuid"
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          }
        },
        "required": [
          "expected_revision",
          "reason"
        ]
      },
      "MCPCatalogObserverOAuthConfig": {
        "description": "Explicit OAuth refresh grant for one app and role; credentials are app secret references in the connection environment.",
        "type": "object",
        "required": [
          "token_endpoint",
          "client_id"
        ],
        "properties": {
          "revocation_endpoint": {
            "type": "string",
            "format": "uri",
            "maxLength": 512,
            "description": "Explicit HTTPS RFC 7009 revocation endpoint; omission requires manual provider revocation"
          },
          "revocation_auth_method": {
            "type": "string",
            "enum": [
              "none",
              "client_secret_basic",
              "client_secret_post"
            ],
            "description": "Defaults to token authentication except Google none"
          },
          "token_endpoint": {
            "type": "string",
            "format": "uri",
            "maxLength": 512,
            "description": "Explicit public HTTPS token endpoint without query or fragment; redirects and private egress are refused"
          },
          "client_id": {
            "type": "string",
            "maxLength": 512
          },
          "refresh_token_secret_ref": {
            "type": "string",
            "description": "App secret containing the initial refresh token; rotation resets the connection"
          },
          "client_secret_ref": {
            "type": "string",
            "description": "Optional app secret for OAuth client_secret_basic authentication"
          },
          "guided": {
            "type": "boolean",
            "description": "Use browser authorization; mutually exclusive with an initial refresh secret"
          },
          "authorization_endpoint": {
            "type": "string",
            "format": "uri",
            "description": "Explicit HTTPS browser authorization endpoint required for guided connections"
          },
          "scopes": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "type": "string",
              "maxLength": 128
            }
          },
          "profile": {
            "type": "string",
            "enum": [
              "generic",
              "google",
              "oidc"
            ],
            "description": "Explicit provider behavior; Google requests offline consent and OIDC adds openid and offline_access"
          },
          "token_auth_method": {
            "type": "string",
            "enum": [
              "none",
              "client_secret_basic",
              "client_secret_post"
            ],
            "description": "Explicit token authentication; defaults to public none or confidential basic except Google confidential post"
          },
          "browser_redirect_uri": {
            "type": "string",
            "format": "uri",
            "maxLength": 512,
            "description": "Registered HTTPS console callback for guided browser authorization; omitted for loopback flows"
          },
          "callback_port": {
            "type": "integer",
            "minimum": 0,
            "maximum": 65535,
            "description": "Guided loopback callback port; 0 chooses a dynamic port"
          },
          "resource": {
            "type": "string",
            "format": "uri",
            "maxLength": 512,
            "description": "Reviewed HTTPS MCP resource indicator sent unchanged in authorization",
            "code exchange and renewal": null
          },
          "issuer": {
            "type": "string",
            "format": "uri",
            "maxLength": 512,
            "description": "Reviewed provider issuer paired with discovery_url"
          },
          "discovery_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 512,
            "description": "Explicit guarded metadata URL; endpoint mismatches and declared incompatibilities block new authorization"
          }
        }
      },
      "MCPCatalogMonitorConfig": {
        "description": "Server-issued revision and retained settings for a configured MCP catalog role.",
        "type": "object",
        "required": [
          "enabled",
          "revision",
          "baseline",
          "baseline_sha256",
          "freshness_seconds"
        ],
        "properties": {
          "scope": {
            "type": "string",
            "maxLength": 40,
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$",
            "description": "Environment watched by this configured MCP catalog monitor. Defaults to default."
          },
          "observer": {
            "$ref": "#/components/schemas/MCPCatalogObserverConfig"
          },
          "token_env": {
            "type": "string",
            "maxLength": 128,
            "description": "Token environment reference selected by observers; no secret value is retained"
          },
          "role": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_-]{0,31}$",
            "default": "default"
          },
          "enabled": {
            "type": "boolean"
          },
          "revision": {
            "type": "string",
            "format": "uuid"
          },
          "baseline": {
            "type": "object",
            "additionalProperties": true
          },
          "baseline_sha256": {
            "type": "string"
          },
          "freshness_seconds": {
            "type": "integer",
            "minimum": 15,
            "maximum": 3600
          }
        }
      },
      "MCPCatalogOAuthRenewal": {
        "description": "Renewal recovery metadata. Private operation fields and sealed results are omitted from public responses.",
        "type": "object",
        "required": [
          "state",
          "started_at"
        ],
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "response_recorded",
              "issuance_unknown"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "saved",
              "installed",
              "failed",
              "reauthorization_required"
            ]
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "private_id": {
            "type": "string",
            "format": "uuid",
            "readOnly": true
          },
          "private_source_sha256": {
            "type": "string",
            "readOnly": true
          },
          "private_lease_id": {
            "type": "string",
            "format": "uuid",
            "readOnly": true
          },
          "private_result": {
            "$ref": "#/components/schemas/MCPCatalogObserverOAuthStatus"
          }
        }
      },
      "MCPCatalogMonitorSummary": {
        "description": "App health and individual catalog views for every configured role.",
        "type": "object",
        "required": [
          "state",
          "roles",
          "signal"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "disabled",
              "healthy",
              "drift",
              "unavailable"
            ]
          },
          "roles": {
            "type": "object",
            "maxProperties": 16,
            "additionalProperties": {
              "$ref": "#/components/schemas/MCPCatalogMonitorSnapshot"
            }
          },
          "signal": {
            "$ref": "#/components/schemas/MCPCatalogMonitorSignal"
          }
        }
      },
      "MCPAdmissionHistoryResponse": {
        "description": "Account-owned admission receipts ordered by descending audit sequence with a continuation cursor.",
        "type": "object",
        "required": [
          "items",
          "limit"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MCPAdmissionEvidence"
            }
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 50
          },
          "next_cursor": {
            "type": "string"
          }
        }
      },
      "MCPConnectionHealthSnapshot": {
        "type": "object",
        "description": "Account-wide or app-filtered connection issues with complete counts independent of issue pagination. Incomplete inventory cannot prove alert recovery.",
        "required": [
          "observed_at",
          "complete",
          "counts",
          "total_issues",
          "items"
        ],
        "properties": {
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "complete": {
            "type": "boolean"
          },
          "counts": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "minimum": 0
            }
          },
          "total_issues": {
            "type": "integer",
            "minimum": 0
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MCPConnectionHealthIssue"
            }
          },
          "next_offset": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          }
        }
      },
      "MCPCatalogOAuthResponse": {
        "description": "Guided OAuth outcome; token and verifier values are never returned.",
        "type": "object",
        "required": [
          "revision",
          "state"
        ],
        "properties": {
          "revision": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "authorization_pending",
              "connected",
              "disconnected",
              "compatible",
              "unsupported",
              "unverified",
              "unavailable"
            ]
          },
          "authorization_url": {
            "type": "string",
            "format": "uri"
          },
          "callback_state": {
            "type": "string",
            "description": "One-time state to validate the local browser callback"
          },
          "provider_revocation": {
            "type": "string",
            "enum": [
              "not_required",
              "pending",
              "provider_acknowledged",
              "manual_required"
            ]
          },
          "checks": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/MCPCatalogOAuthCheck"
            }
          }
        }
      },
      "MCPCatalogMonitorSignal": {
        "description": "Freshness-aware catalog health and evidence links used in monitoring notifications.",
        "type": "object",
        "required": [
          "state",
          "changed_count"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "disabled",
              "healthy",
              "drift",
              "unavailable"
            ]
          },
          "role": {
            "type": "string"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "receipt_id": {
            "type": "string",
            "format": "uuid"
          },
          "evidence_path": {
            "type": "string"
          },
          "changed_count": {
            "type": "integer",
            "minimum": 0
          },
          "unavailable_roles": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "drifted_roles": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "roles": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/MCPCatalogMonitorSignal"
            }
          }
        }
      },
      "MCPCatalogReceipt": {
        "description": "Retained catalog transition with server-computed drift, hashes and capture time.",
        "type": "object",
        "required": [
          "id",
          "revision",
          "captured_at",
          "state",
          "baseline_sha256",
          "changed_count",
          "truncated"
        ],
        "properties": {
          "role": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_-]{0,31}$",
            "default": "default"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "string",
            "format": "uuid"
          },
          "captured_at": {
            "type": "string",
            "format": "date-time"
          },
          "state": {
            "type": "string",
            "enum": [
              "healthy",
              "drift",
              "unavailable"
            ]
          },
          "baseline_sha256": {
            "type": "string"
          },
          "observed_sha256": {
            "type": "string"
          },
          "changed_count": {
            "type": "integer",
            "minimum": 0
          },
          "diff": {
            "type": "object",
            "additionalProperties": true
          },
          "truncated": {
            "type": "boolean"
          }
        }
      },
      "MCPCatalogMonitorConfigRequest": {
        "description": "Reviewed baseline and observer settings for one independently monitored MCP role.",
        "type": "object",
        "required": [
          "enabled",
          "baseline",
          "freshness_seconds"
        ],
        "properties": {
          "scope": {
            "type": "string",
            "maxLength": 40,
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$",
            "description": "Environment selected when configuring catalog monitoring. Omit for default."
          },
          "observer": {
            "$ref": "#/components/schemas/MCPCatalogObserverConfig"
          },
          "token_env": {
            "type": "string",
            "maxLength": 128,
            "description": "Environment variable name only; credentials are never stored"
          },
          "role": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_-]{0,31}$",
            "default": "default"
          },
          "enabled": {
            "type": "boolean"
          },
          "baseline": {
            "type": "object",
            "additionalProperties": true,
            "description": "Reviewed format-2 MCP catalog contract"
          },
          "freshness_seconds": {
            "type": "integer",
            "minimum": 15,
            "maximum": 3600,
            "default": 90
          }
        }
      },
      "MCPPolicyConvergenceSnapshot": {
        "description": "Account-scoped live gateway replay observation for an active HTTP deployment. Snapshot metadata only; token enforcement is not attested. Correlates retained admission evidence when available.",
        "type": "object",
        "required": [
          "state",
          "captured_at",
          "desired_revision",
          "serving_gateways",
          "pending_gateways",
          "stale_gateways",
          "unconverged_gateways"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "active",
              "pending",
              "unverified",
              "paused",
              "unknown"
            ]
          },
          "captured_at": {
            "type": "string",
            "format": "date-time"
          },
          "desired_revision": {
            "type": "integer",
            "format": "int64"
          },
          "serving_gateways": {
            "type": "integer",
            "format": "int64"
          },
          "pending_gateways": {
            "type": "integer",
            "format": "int64"
          },
          "stale_gateways": {
            "type": "integer",
            "format": "int64"
          },
          "unconverged_gateways": {
            "type": "integer",
            "format": "int64",
            "description": "Distinct gateways with stale/missing/future reports or pending replay."
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "admission_id": {
            "type": "string",
            "format": "uuid"
          },
          "policy_status_path": {
            "type": "string"
          },
          "admission_history_path": {
            "type": "string"
          }
        }
      },
      "MCPCatalogOAuthRequest": {
        "description": "Account-authorized guided OAuth action bound to an exact role revision.",
        "type": "object",
        "required": [
          "action",
          "role",
          "revision"
        ],
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "begin",
              "complete",
              "disconnect",
              "check"
            ]
          },
          "role": {
            "type": "string"
          },
          "revision": {
            "type": "string",
            "format": "uuid"
          },
          "redirect_uri": {
            "type": "string",
            "description": "Begin only; HTTP IPv4 loopback callback with an explicit port and callback path"
          },
          "state": {
            "type": "string",
            "description": "Complete only; one-time authorization state"
          },
          "code": {
            "type": "string",
            "description": "Complete only; authorization code exchanged with sealed PKCE verifier"
          },
          "denied": {
            "type": "boolean",
            "description": "Consume a denied authorization callback without a token exchange"
          }
        }
      },
      "MCPCatalogOAuthRevocation": {
        "description": "Durable RFC 7009 progress; acknowledgement also covers tokens already invalid at the provider. Private fields are omitted from all public projections.",
        "type": "object",
        "required": [
          "id",
          "state",
          "attempts",
          "next_attempt_at",
          "refresh_acknowledged",
          "access_acknowledged"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "provider_acknowledged",
              "manual_required"
            ]
          },
          "attempts": {
            "type": "integer",
            "minimum": 0,
            "maximum": 8
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "failure_reason": {
            "type": "string",
            "enum": [
              "credential_unavailable",
              "provider_unavailable"
            ]
          },
          "acknowledged_at": {
            "type": "string",
            "format": "date-time"
          },
          "refresh_acknowledged": {
            "type": "boolean"
          },
          "access_acknowledged": {
            "type": "boolean"
          },
          "private_config": {
            "allOf": [
              {
                "$ref": "#/components/schemas/MCPCatalogObserverOAuthConfig"
              }
            ],
            "readOnly": true,
            "description": "Internal frozen binding omitted from responses"
          },
          "private_client_ciphertext": {
            "type": "string",
            "format": "byte",
            "readOnly": true,
            "description": "Internal sealed client credential captured at disconnect and omitted from responses"
          },
          "private_ciphertext": {
            "type": "string",
            "format": "byte",
            "readOnly": true,
            "description": "Internal sealed retired grant omitted from responses"
          },
          "private_lease_id": {
            "type": "string",
            "readOnly": true,
            "description": "Internal fence omitted from responses"
          },
          "private_lease_until": {
            "type": "string",
            "format": "date-time",
            "readOnly": true,
            "description": "Internal lease omitted from responses"
          }
        }
      },
      "MCPCatalogObserverConfig": {
        "description": "Opt-in platform observer intent for one MCP role using its canonical app origin and an optional sealed secret reference.",
        "type": "object",
        "required": [
          "enabled",
          "paused",
          "interval_seconds",
          "timeout_seconds",
          "endpoint"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "paused": {
            "type": "boolean"
          },
          "interval_seconds": {
            "type": "integer",
            "minimum": 30,
            "maximum": 3600,
            "default": 30
          },
          "timeout_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 30,
            "default": 10
          },
          "endpoint": {
            "type": "string",
            "maxLength": 512,
            "default": "/mcp"
          },
          "secret_ref": {
            "type": "string",
            "description": "App secret in the connection environment named secret:NAME; its current value is loaded for each check"
          },
          "oauth": {
            "$ref": "#/components/schemas/MCPCatalogObserverOAuthConfig"
          }
        }
      },
      "MCPOAuthRetirement": {
        "description": "Account-owned grant retirement metadata surviving app deletion; sealed data is omitted from public responses.",
        "type": "object",
        "required": [
          "id",
          "app_id",
          "app_slug",
          "role",
          "reason",
          "state",
          "created_at",
          "retain_until",
          "revocation",
          "allow_active_grant_revocation",
          "history"
        ],
        "properties": {
          "scope": {
            "type": "string",
            "maxLength": 40,
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$",
            "description": "Environment of the retired MCP OAuth connection. Empty means default."
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_slug": {
            "type": "string"
          },
          "role": {
            "type": "string"
          },
          "reason": {
            "type": "string",
            "description": "Retirement cause or unknown issuance outcome"
          },
          "state": {
            "type": "string",
            "enum": [
              "awaiting_issuance",
              "pending",
              "held",
              "installed",
              "manual_required",
              "provider_acknowledged",
              "manually_acknowledged",
              "expired"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "retain_until": {
            "type": "string",
            "format": "date-time",
            "description": "Seven-day maximum sealed credential retention deadline"
          },
          "revocation": {
            "$ref": "#/components/schemas/MCPCatalogOAuthRevocation"
          },
          "allow_active_grant_revocation": {
            "type": "boolean",
            "description": "Explicit operator authorization to retire a grant despite a matching active connection"
          },
          "history": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/MCPOAuthRetirementEvent"
            }
          }
        }
      },
      "MCPCatalogOAuthEvent": {
        "description": "OAuth lifecycle metadata without token values or provider response bodies.",
        "type": "object",
        "required": [
          "id",
          "at",
          "kind"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "kind": {
            "type": "string",
            "enum": [
              "connected",
              "renewed",
              "reauthorization_required",
              "disconnected",
              "revocation_acknowledged",
              "revocation_manual_required",
              "credentials_discarded"
            ]
          }
        }
      },
      "MCPOAuthRetirementEvent": {
        "description": "Bounded metadata-only retirement action history.",
        "type": "object",
        "required": [
          "at",
          "action"
        ],
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "action": {
            "type": "string",
            "maxLength": 64
          }
        }
      },
      "MCPOAuthRetirementsResponse": {
        "description": "Bounded administrator-only account retirement history.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/MCPOAuthRetirement"
            }
          },
          "next_offset": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          }
        }
      },
      "MCPAdmissionGateway": {
        "description": "Gateway replay metadata captured with a retained traffic admission decision.",
        "type": "object",
        "required": [
          "node_name",
          "boot_id",
          "revision",
          "observed_at"
        ],
        "properties": {
          "node_name": {
            "type": "string"
          },
          "boot_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "revision": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "observed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "MCPCatalogOAuthFlow": {
        "description": "Internal sealed one-time authorization state omitted from public monitor projections.",
        "type": "object",
        "required": [
          "state_sha256",
          "ciphertext",
          "expires_at",
          "consumed"
        ],
        "properties": {
          "browser_session_sha256": {
            "type": "string",
            "readOnly": true,
            "description": "Internal browser session binding hash; the entire flow is omitted from public projections"
          },
          "state_sha256": {
            "type": "string",
            "readOnly": true
          },
          "ciphertext": {
            "type": "string",
            "format": "byte",
            "readOnly": true
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "consumed": {
            "type": "boolean",
            "readOnly": true
          }
        }
      },
      "MCPCatalogMonitorSnapshot": {
        "description": "Configuration, latest observation and bounded transition history for a catalog monitor.",
        "type": "object",
        "required": [
          "config",
          "history",
          "state"
        ],
        "properties": {
          "oauth_lifecycle": {
            "$ref": "#/components/schemas/MCPCatalogOAuthLifecycle"
          },
          "observer_status": {
            "$ref": "#/components/schemas/MCPCatalogObserverStatus"
          },
          "roles": {
            "type": "object",
            "readOnly": true,
            "maxProperties": 16,
            "description": "Additional role views when included; role-scoped reads omit this field. Use all_roles for aggregate state.",
            "additionalProperties": {
              "$ref": "#/components/schemas/MCPCatalogMonitorSnapshot"
            }
          },
          "config": {
            "$ref": "#/components/schemas/MCPCatalogMonitorConfig"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "latest": {
            "$ref": "#/components/schemas/MCPCatalogReceipt"
          },
          "history": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/MCPCatalogReceipt"
            }
          },
          "state": {
            "type": "string",
            "enum": [
              "disabled",
              "healthy",
              "drift",
              "unavailable"
            ]
          }
        }
      },
      "MCPAdmissionEvidence": {
        "description": "Version 1 durable traffic admission snapshot in deployment audit data.mcp_admission. Accepted commits with traffic; rejected is saved after rollback. Existing deployment audit retention applies. This is historical admission evidence, not a lease or live authorization proof.",
        "type": "object",
        "required": [
          "version",
          "id",
          "deployment_id",
          "traffic_percent",
          "captured_at",
          "outcome",
          "expected_fingerprint",
          "gateways"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "traffic_percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "captured_at": {
            "type": "string",
            "format": "date-time"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "accepted",
              "rejected"
            ]
          },
          "reason": {
            "type": "string",
            "description": "Public rejection code, or traffic_update_failed for a later traffic failure. Raw errors are never stored."
          },
          "expected_fingerprint": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "observed_fingerprint": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "observed_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "gateways": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MCPAdmissionGateway"
            }
          }
        }
      },
      "MCPCatalogOAuthLifecycle": {
        "description": "Durable local connection state, provider revocation progress and bounded metadata audit history.",
        "type": "object",
        "required": [
          "local_state",
          "history"
        ],
        "properties": {
          "credential_state": {
            "type": "string",
            "enum": [
              "credential_changed",
              "retirement_held",
              "reconnect_required"
            ]
          },
          "local_state": {
            "type": "string",
            "enum": [
              "connected",
              "disconnected",
              "reauthorization_required"
            ]
          },
          "revocation": {
            "$ref": "#/components/schemas/MCPCatalogOAuthRevocation"
          },
          "history": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "$ref": "#/components/schemas/MCPCatalogOAuthEvent"
            }
          }
        }
      },
      "MCPCatalogObservationRequest": {
        "description": "Complete role catalog or an unavailable observation bound to its reviewed revision.",
        "type": "object",
        "required": [
          "revision",
          "unavailable"
        ],
        "properties": {
          "role": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_-]{0,31}$",
            "default": "default"
          },
          "revision": {
            "type": "string",
            "format": "uuid"
          },
          "unavailable": {
            "type": "boolean"
          },
          "observed": {
            "type": "object",
            "additionalProperties": true,
            "description": "Complete observed format-2 contract; omit when unavailable is true"
          }
        }
      },
      "MCPConnectionHealthIssue": {
        "type": "object",
        "description": "Actionable connection health metadata without sealed grants or provider responses.",
        "required": [
          "id",
          "app_id",
          "app_slug",
          "role",
          "kind",
          "state",
          "recovery_action",
          "recovery_path"
        ],
        "properties": {
          "scope": {
            "type": "string",
            "maxLength": 40,
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$",
            "description": "Environment containing the MCP connection with this health issue. Empty means default."
          },
          "id": {
            "type": "string"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_slug": {
            "type": "string"
          },
          "role": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "reauthorization_required",
              "renewal_failed",
              "retirement_expiring",
              "issuance_unknown"
            ]
          },
          "state": {
            "type": "string"
          },
          "app_deleted": {
            "type": "boolean"
          },
          "retirement_id": {
            "type": "string",
            "format": "uuid"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "recovery_action": {
            "type": "string"
          },
          "recovery_path": {
            "type": "string"
          }
        }
      },
      "MCPOAuthRetirementAction": {
        "description": "Explicit retirement recovery; allowing active grant revocation may invalidate a replacement connection.",
        "type": "object",
        "required": [
          "action"
        ],
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "retry",
              "acknowledge_manual"
            ]
          },
          "allow_active_grant_revocation": {
            "type": "boolean"
          }
        }
      },
      "MCPCatalogObserverStatus": {
        "description": "Managed observer scheduling and recovery metadata without credential values or raw source errors.",
        "type": "object",
        "required": [
          "state",
          "consecutive_failures"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "scheduled",
              "checking",
              "degraded",
              "overdue",
              "paused",
              "stopped"
            ]
          },
          "last_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_success_at": {
            "type": "string",
            "format": "date-time"
          },
          "next_check_at": {
            "type": "string",
            "format": "date-time"
          },
          "failure_reason": {
            "type": "string",
            "enum": [
              "credential_unavailable",
              "source_unavailable",
              "comparison_unavailable"
            ]
          },
          "consecutive_failures": {
            "type": "integer",
            "minimum": 0,
            "maximum": 16
          },
          "lease_id": {
            "type": "string",
            "format": "uuid",
            "readOnly": true,
            "description": "Internal fencing metadata omitted from public monitor projections"
          },
          "lease_until": {
            "type": "string",
            "format": "date-time"
          },
          "oauth": {
            "$ref": "#/components/schemas/MCPCatalogObserverOAuthStatus"
          },
          "oauth_renewal": {
            "$ref": "#/components/schemas/MCPCatalogOAuthRenewal"
          },
          "oauth_flow": {
            "$ref": "#/components/schemas/MCPCatalogOAuthFlow"
          }
        }
      },
      "MCPCatalogObserverOAuthStatus": {
        "description": "Public OAuth connection health; sealed credentials and source fingerprint are omitted from responses.",
        "type": "object",
        "required": [
          "state"
        ],
        "properties": {
          "retirement_id": {
            "type": "string",
            "format": "uuid",
            "readOnly": true,
            "description": "Internal issuance reservation identity omitted from public responses"
          },
          "state": {
            "type": "string",
            "enum": [
              "connected",
              "reauthorization_required"
            ]
          },
          "reauthorization_needed": {
            "type": "boolean",
            "readOnly": true,
            "description": "Reconnect is required or credentials failed within fifteen minutes of expiry"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_renewal_at": {
            "type": "string",
            "format": "date-time"
          },
          "ciphertext": {
            "type": "string",
            "format": "byte",
            "readOnly": true,
            "description": "Internal sealed storage omitted from public responses"
          },
          "source_sha256": {
            "type": "string",
            "readOnly": true,
            "description": "Internal source fingerprint omitted from public responses"
          },
          "granted_scopes": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "type": "string"
            }
          }
        }
      },
      "MCPCatalogOAuthCheck": {
        "description": "Public metadata compatibility result without source errors, provider response bodies or credentials.",
        "type": "object",
        "required": [
          "name",
          "state"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "passed",
              "failed",
              "unverified"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "metadata_not_configured",
              "metadata_unavailable",
              "reviewed_endpoint_mismatch",
              "capability_not_advertised",
              "required_capability_not_supported",
              "scope_not_advertised"
            ]
          }
        }
      },
      "RealtimePublisherCredentialRequest": {
        "type": "object",
        "required": [
          "name",
          "channels",
          "event_types"
        ],
        "properties": {
          "max_message_ttl_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400,
            "default": 0,
            "description": "Message TTL cap; zero is uncapped. Positive caps require a positive message TTL at or below the cap."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "channels": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "uniqueItems": true,
            "items": {
              "type": "string"
            }
          },
          "event_types": {
            "type": "array",
            "minItems": 1,
            "maxItems": 16,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          "publishes_per_minute": {
            "type": "integer",
            "minimum": 1,
            "maximum": 600,
            "default": 60
          },
          "max_payload_bytes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4096,
            "default": 4096
          },
          "ttl_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2592000,
            "default": 86400
          }
        },
        "description": "Realtime Publisher Credential Request."
      },
      "RealtimePublisherCredential": {
        "type": "object",
        "required": [
          "name",
          "channels",
          "event_types",
          "publishes_per_minute",
          "max_payload_bytes",
          "id",
          "endpoint_id",
          "generation",
          "issued_at",
          "expires_at",
          "revoked_at",
          "accepted_count",
          "replay_count",
          "last_used_at",
          "last_channel",
          "last_sequence"
        ],
        "properties": {
          "max_message_ttl_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400,
            "default": 0,
            "description": "Immutable message TTL cap; zero is uncapped. Rotation preserves this policy."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "channels": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "uniqueItems": true,
            "items": {
              "type": "string"
            }
          },
          "event_types": {
            "type": "array",
            "minItems": 1,
            "maxItems": 16,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          "publishes_per_minute": {
            "type": "integer",
            "minimum": 1,
            "maximum": 600,
            "default": 60
          },
          "max_payload_bytes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4096,
            "default": 4096
          },
          "id": {
            "type": "string"
          },
          "endpoint_id": {
            "type": "string"
          },
          "generation": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "issued_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "revoked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "accepted_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "replay_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "last_used_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_channel": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_sequence": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "description": "Realtime Publisher Credential."
      },
      "RealtimePublisherCredentialIssued": {
        "type": "object",
        "required": [
          "credential",
          "info"
        ],
        "properties": {
          "credential": {
            "type": "string",
            "description": "One-time plaintext grp_ credential; never log or cache."
          },
          "info": {
            "$ref": "#/components/schemas/RealtimePublisherCredential"
          }
        },
        "description": "Realtime Publisher Credential Issued."
      },
      "RealtimePublisherMessageRequest": {
        "type": "object",
        "required": [
          "event_type",
          "data_base64"
        ],
        "properties": {
          "ttl_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400,
            "default": 0,
            "description": "Message lifetime from retained publication; zero disables expiry. Positive credential caps forbid zero or omitted TTL."
          },
          "event_type": {
            "type": "string"
          },
          "data_base64": {
            "type": "string"
          },
          "binary": {
            "type": "boolean",
            "default": false
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "event_type is reserved; supplied value must match the top-level event_type."
          }
        },
        "description": "Realtime Publisher Message Request."
      },
      "RealtimePublisherPublishResponse": {
        "type": "object",
        "required": [
          "sequence",
          "durable",
          "replayed",
          "partial"
        ],
        "properties": {
          "sequence": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "durable": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "replayed": {
            "type": "boolean"
          },
          "partial": {
            "type": "boolean",
            "description": "Immediate live fanout may be incomplete; retained delivery is committed."
          }
        },
        "description": "Realtime Publisher Publish Response."
      },
      "RealtimeWorkerCredential": {
        "type": "object",
        "required": [
          "id",
          "group_id",
          "name",
          "permissions",
          "generation",
          "issued_at",
          "expires_at",
          "revoked_at",
          "last_used_at",
          "last_operation",
          "use_count"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "group_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "permissions": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "status",
                "claim",
                "renew",
                "complete",
                "retry",
                "dead_letters",
                "replay",
                "resync",
                "delete",
                "pause",
                "resume",
                "drain",
                "heartbeat",
                "release"
              ]
            }
          },
          "generation": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "issued_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "revoked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_used_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_operation": {
            "type": [
              "string",
              "null"
            ]
          },
          "use_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        },
        "description": "Realtime Worker Credential."
      },
      "RealtimeWorkerCredentialRequest": {
        "type": "object",
        "required": [
          "name",
          "permissions"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "permissions": {
            "type": "array",
            "minItems": 1,
            "maxItems": 14,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "status",
                "claim",
                "renew",
                "complete",
                "retry",
                "dead_letters",
                "replay",
                "resync",
                "delete",
                "pause",
                "resume",
                "drain",
                "heartbeat",
                "release"
              ]
            }
          },
          "ttl_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2592000,
            "default": 86400
          }
        },
        "description": "Realtime Worker Credential Request."
      },
      "RealtimeWorkerCredentialIssued": {
        "type": "object",
        "required": [
          "credential",
          "info"
        ],
        "properties": {
          "credential": {
            "type": "string",
            "description": "Plaintext grw_ credential, returned once; never log or cache."
          },
          "info": {
            "$ref": "#/components/schemas/RealtimeWorkerCredential"
          }
        },
        "description": "Realtime Worker Credential Issued."
      },
      "RealtimeWorkerCredentialRotationRequest": {
        "type": "object",
        "properties": {
          "ttl_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2592000,
            "default": 86400
          }
        },
        "description": "Realtime Worker Credential Rotation Request."
      },
      "RealtimeWorkerClaimRequest": {
        "type": "object",
        "properties": {
          "worker": {
            "type": "string",
            "description": "Optional; if provided, must match the name fixed by the credential."
          },
          "wait_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 20,
            "default": 0,
            "description": "Wait for available work, checking every 500 ms without holding a transaction. Returns promptly on pause/drain or blockers. At most 64 waiting requests per the API. Cancellation stops waiting; uncertain claims must not be retried automatically."
          }
        },
        "description": "Realtime Worker Claim Request."
      },
      "RealtimeConsumerGroupCreateRequest": {
        "type": "object",
        "required": [
          "name",
          "after_sequence"
        ],
        "properties": {
          "deduplication_metadata_key": {
            "type": "string",
            "maxLength": 64,
            "pattern": "^[a-z0-9_.-]*$",
            "default": "",
            "description": "Immutable opt-in exact metadata field such as event_id. Empty disables assignment-time deduplication. Missing or empty values process normally. Within the window, the first filter-matching assigned event ID wins even if its snapshot later fails or expires. Retries and explicit dead-letter replay reuse the original snapshot. Store hashes only, at most 4096 live IDs per group; live IDs are never evicted. New IDs wait for capacity while existing snapshots remain claimable."
          },
          "deduplication_window_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400,
            "default": 0,
            "description": "Immutable retention from first assignment. With a metadata key, omit or use zero for the 3600-second default; otherwise choose 60 to 86400. Without a key, must be zero. Duplicate hits do not extend expiry. After expiry, another copy can be assigned again."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "after_sequence": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "lease_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 300,
            "default": 30
          },
          "max_attempts": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10,
            "default": 5
          },
          "ordering_metadata_key": {
            "type": "string",
            "pattern": "^[a-z0-9_.-]*$",
            "maxLength": 64,
            "default": "",
            "description": "Immutable exact valid metadata field. Empty disables ordering. Missing/empty values share one ordered bucket."
          },
          "dead_letter_policy": {
            "type": "string",
            "enum": [
              "block",
              "skip"
            ],
            "default": "block",
            "description": "Immutable ordered-group policy. Block holds later events until replay/repair; skip lets later events proceed. Explicit replay can occur after later work completed."
          },
          "dead_letter_retention_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2592000,
            "default": 0,
            "description": "Zero keeps indefinitely; otherwise 3600 to 2592000 seconds. Ordered groups require skip policy. Cleanup includes a 300-second warning grace."
          },
          "priority_metadata_key": {
            "type": "string",
            "maxLength": 64,
            "pattern": "^[a-z0-9_.-]*$",
            "default": "",
            "description": "Immutable opt-in metadata field. Exact single digits 0 through 9 freeze on assignment; missing or invalid values use zero. Higher values claim first within the bounded 128-snapshot window. Every eighth successful claim uses oldest eligible sequence; entity ordering remains authoritative. Empty disables priority."
          },
          "deadline_metadata_key": {
            "type": "string",
            "maxLength": 64,
            "pattern": "^[a-z0-9_.-]*$",
            "default": "",
            "description": "Immutable opt-in metadata field containing an RFC3339 delivery deadline. Ordered groups require skip policy. Missing or empty values have no deadline. Malformed values become terminal invalid_delivery_deadline failures. Frozen on assignment; existing snapshots are unchanged. Deadlines prevent expired claims and cap leases."
          },
          "filter": {
            "$ref": "#/components/schemas/RealtimeConsumerGroupFilter"
          }
        },
        "description": "Realtime Consumer Group Create Request."
      },
      "RealtimeConsumerGroupPauseState": {
        "type": "object",
        "required": [
          "paused",
          "paused_at"
        ],
        "properties": {
          "paused": {
            "type": "boolean"
          },
          "paused_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "description": "Realtime Consumer Group Pause State."
      },
      "RealtimeConsumerGroupDrainState": {
        "type": "object",
        "required": [
          "draining",
          "drained",
          "active_leases",
          "paused_at"
        ],
        "properties": {
          "draining": {
            "type": "boolean"
          },
          "drained": {
            "type": "boolean"
          },
          "active_leases": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "paused_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "description": "Realtime Consumer Group Drain State."
      },
      "RealtimeDeadLetterPreviewRequest": {
        "type": "object",
        "properties": {
          "failure_codes": {
            "type": "array",
            "maxItems": 32,
            "uniqueItems": true,
            "description": "Empty selects all codes; otherwise exact case-sensitive matches.",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[ -~]+$"
            }
          },
          "after_sequence": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "default": "0",
            "description": "Exclusive lower bound within signed 64-bit sequence range."
          },
          "through_sequence": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "Optional inclusive upper bound greater than after_sequence."
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 32,
            "default": 32
          }
        },
        "description": "Realtime Dead Letter Preview Request."
      },
      "RealtimeDeadLetterReplaySelection": {
        "type": "object",
        "required": [
          "sequence",
          "dead_since"
        ],
        "properties": {
          "sequence": {
            "type": "string",
            "pattern": "^[1-9][0-9]*$"
          },
          "dead_since": {
            "type": "string",
            "format": "date-time",
            "description": "Exact preview timestamp; preserve precision, do not round it."
          }
        },
        "description": "Realtime Dead Letter Replay Selection."
      },
      "RealtimeDeadLetterPreviewItem": {
        "type": "object",
        "required": [
          "sequence",
          "dead_since",
          "attempts",
          "failure_code",
          "ordering_blocked",
          "expires_at"
        ],
        "properties": {
          "sequence": {
            "type": "string",
            "pattern": "^[1-9][0-9]*$"
          },
          "dead_since": {
            "type": "string",
            "format": "date-time"
          },
          "attempts": {
            "type": "integer",
            "minimum": 0
          },
          "failure_code": {
            "type": "string"
          },
          "ordering_blocked": {
            "type": "boolean",
            "description": "A current unexpired same-key lease blocks replay; observed only."
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Nominal retention expiry; warning grace may postpone actual cleanup."
          }
        },
        "description": "Realtime Dead Letter Preview Item."
      },
      "RealtimeDeadLetterPreview": {
        "type": "object",
        "required": [
          "group_id",
          "items",
          "has_more"
        ],
        "properties": {
          "group_id": {
            "type": "string",
            "format": "uuid"
          },
          "items": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/RealtimeDeadLetterPreviewItem"
            }
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "description": "Realtime Dead Letter Preview."
      },
      "RealtimeReplayJobWebhookPayload": {
        "type": "object",
        "description": "Payload of realtime.replay_job.completed, realtime.replay_job.cancelled and realtime.replay_job.processing_failed app webhooks. Use event_id to deduplicate delivery retries. Counts describe the committed transition; cancellation does not undo earlier replays.",
        "required": [
          "event_id",
          "app_id",
          "endpoint_id",
          "group_id",
          "job_id",
          "channel",
          "group",
          "state",
          "rate",
          "selected",
          "processed",
          "replayed",
          "skipped",
          "remaining",
          "error_count",
          "error_code",
          "error_threshold",
          "inspector_path",
          "occurred_at"
        ],
        "properties": {
          "event_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "endpoint_id": {
            "type": "string",
            "format": "uuid"
          },
          "group_id": {
            "type": "string",
            "format": "uuid"
          },
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "channel": {
            "type": "string"
          },
          "group": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "running",
              "completed",
              "cancelled"
            ]
          },
          "rate": {
            "type": "integer",
            "minimum": 1,
            "maximum": 32
          },
          "selected": {
            "type": "integer",
            "minimum": 0,
            "maximum": 128
          },
          "processed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 128
          },
          "replayed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 128
          },
          "skipped": {
            "type": "integer",
            "minimum": 0,
            "maximum": 128
          },
          "remaining": {
            "type": "integer",
            "minimum": 0,
            "maximum": 128
          },
          "error_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_code": {
            "type": "string",
            "description": "processing_failed on the warning event; empty for terminal events. Contains no raw database error."
          },
          "error_threshold": {
            "type": "integer",
            "minimum": 3,
            "maximum": 3,
            "description": "One warning per job when cumulative processing errors first reach this threshold."
          },
          "inspector_path": {
            "type": "string",
            "description": "Relative inspector link on the Gregale console origin. Recent job history may later be pruned."
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "RealtimeReplayJobRequest": {
        "type": "object",
        "required": [
          "rate"
        ],
        "properties": {
          "rate": {
            "type": "integer",
            "minimum": 1,
            "maximum": 32
          },
          "failure_codes": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "type": "string"
            }
          },
          "after_sequence": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "default": "0"
          },
          "through_sequence": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        },
        "description": "Realtime Replay Job Request."
      },
      "RealtimeReplayJob": {
        "type": "object",
        "required": [
          "id",
          "group_id",
          "state",
          "rate",
          "selected",
          "processed",
          "replayed",
          "skipped",
          "outcomes",
          "created_at",
          "updated_at",
          "error_count",
          "last_error",
          "dry_run",
          "eligible",
          "reviewed_job_id",
          "started_job_id"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "group_id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "running",
              "paused",
              "checking",
              "check_paused",
              "completed",
              "cancelled"
            ]
          },
          "rate": {
            "type": "integer",
            "minimum": 1,
            "maximum": 32
          },
          "selected": {
            "type": "integer",
            "minimum": 0,
            "maximum": 128
          },
          "processed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 128
          },
          "replayed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 128
          },
          "skipped": {
            "type": "integer",
            "minimum": 0,
            "maximum": 128
          },
          "outcomes": {
            "type": "array",
            "maxItems": 128,
            "items": {
              "$ref": "#/components/schemas/RealtimeReplayJobOutcome"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "error_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "last_error": {
            "type": "string",
            "description": "Empty until a processing failure; processing_failed is a safe diagnostic without database details."
          },
          "dry_run": {
            "type": "boolean"
          },
          "eligible": {
            "type": "integer",
            "minimum": 0,
            "maximum": 128,
            "description": "Eligible checks in a dry-run report; zero for a real replay."
          },
          "reviewed_job_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Source dry-run report for a reviewed replay. History reference may outlive the report."
          },
          "started_job_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Single real replay started from this report. History reference may outlive the replay."
          }
        },
        "description": "Realtime Replay Job."
      },
      "RealtimeReplayJobOutcome": {
        "type": "object",
        "required": [
          "sequence",
          "status"
        ],
        "properties": {
          "sequence": {
            "type": "string",
            "pattern": "^[1-9][0-9]*$"
          },
          "status": {
            "type": "string",
            "enum": [
              "eligible",
              "replayed",
              "ordering_blocked",
              "stale",
              "not_dead",
              "missing",
              "deadline_expired",
              "invalid_deadline"
            ]
          },
          "checked_at": {
            "type": "string",
            "format": "date-time",
            "description": "Per-item observation time; absent in older retained job outcomes."
          }
        },
        "description": "Realtime Replay Job Outcome."
      },
      "RealtimeDeadLetterBulkReplayRequest": {
        "type": "object",
        "required": [
          "group_id",
          "items"
        ],
        "properties": {
          "group_id": {
            "type": "string",
            "format": "uuid"
          },
          "items": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "description": "Unique sequences selected explicitly from a preview.",
            "items": {
              "$ref": "#/components/schemas/RealtimeDeadLetterReplaySelection"
            }
          }
        },
        "description": "Realtime Dead Letter Bulk Replay Request."
      },
      "RealtimeDeadLetterReplayOutcome": {
        "type": "object",
        "required": [
          "sequence",
          "status"
        ],
        "properties": {
          "sequence": {
            "type": "string",
            "pattern": "^[1-9][0-9]*$"
          },
          "status": {
            "type": "string",
            "enum": [
              "replayed",
              "ordering_blocked",
              "stale",
              "not_dead",
              "missing",
              "deadline_expired",
              "invalid_deadline"
            ]
          }
        },
        "description": "Realtime Dead Letter Replay Outcome."
      },
      "RealtimeDeadLetterBulkReplayResult": {
        "type": "object",
        "required": [
          "group_id",
          "replayed",
          "outcomes"
        ],
        "properties": {
          "group_id": {
            "type": "string",
            "format": "uuid"
          },
          "replayed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "outcomes": {
            "type": "array",
            "maxItems": 32,
            "description": "One outcome per selection, in request order.",
            "items": {
              "$ref": "#/components/schemas/RealtimeDeadLetterReplayOutcome"
            }
          }
        },
        "description": "Realtime Dead Letter Bulk Replay Result."
      },
      "RealtimeWorkerHeartbeatRequest": {
        "type": "object",
        "required": [
          "ready"
        ],
        "properties": {
          "worker": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "description": "Required on account route; optional for scoped workers and must match credential name if supplied. Sharing a credential aggregates processes."
          },
          "ready": {
            "type": "boolean"
          },
          "status_code": {
            "type": "string",
            "maxLength": 64,
            "pattern": "^[ -~]*$",
            "description": "Short diagnostic code only; never include secrets."
          }
        },
        "description": "Realtime Worker Heartbeat Request."
      },
      "RealtimeWorkerHeartbeat": {
        "type": "object",
        "required": [
          "id",
          "worker",
          "ready",
          "status_code",
          "last_seen_at",
          "lost",
          "live"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "worker": {
            "type": "string"
          },
          "ready": {
            "type": "boolean"
          },
          "status_code": {
            "type": "string"
          },
          "last_seen_at": {
            "type": "string",
            "format": "date-time"
          },
          "lost": {
            "type": "boolean",
            "description": "Persisted loss decision; sampled and may lag computed liveness."
          },
          "live": {
            "type": "boolean",
            "description": "Fresh heartbeat and currently eligible credential. Not proof of connectivity or ability to process work."
          }
        },
        "description": "Realtime Worker Heartbeat."
      },
      "RealtimeConsumerGroupBatchSettlementRequest": {
        "type": "object",
        "required": [
          "settlements"
        ],
        "properties": {
          "idempotency_key": {
            "type": "string",
            "format": "uuid",
            "minLength": 36,
            "maxLength": 36,
            "description": "Optional UUID. Retains the original successful result for 24 hours for this group and principal. Reuse requires identical normalized contents, including claim tokens and ordered batch items. At most 1024 receipts per group; full capacity returns 429 before settlement. Omit item-level keys in batches. Replays require current authorization and do not settle again. Renew receipts report the original lease expiry rather than extending it again."
          },
          "settlements": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/RealtimeConsumerGroupSettlement"
            }
          }
        },
        "description": "Realtime Consumer Group Batch Settlement Request."
      },
      "RealtimeConsumerGroupBatchSettlementResult": {
        "type": "object",
        "required": [
          "results"
        ],
        "properties": {
          "results": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/RealtimeConsumerGroupBatchSettlementItem"
            }
          }
        },
        "description": "Realtime Consumer Group Batch Settlement Result."
      },
      "RealtimeConsumerGroupBatchSettlementItem": {
        "type": "object",
        "required": [
          "sequence",
          "action",
          "status"
        ],
        "properties": {
          "sequence": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "action": {
            "type": "string",
            "enum": [
              "complete",
              "retry",
              "renew",
              "release"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "completed",
              "ready",
              "dead",
              "leased",
              "lease_lost"
            ]
          },
          "available_at": {
            "type": "string",
            "format": "date-time"
          },
          "lease_until": {
            "type": "string",
            "format": "date-time"
          }
        },
        "description": "Realtime Consumer Group Batch Settlement Item."
      },
      "RealtimeDeadLetterExportManifest": {
        "type": "object",
        "required": [
          "type",
          "format_version",
          "group_id",
          "group",
          "channel",
          "exported_at",
          "snapshot_at",
          "after_sequence",
          "through_sequence",
          "failure_codes",
          "count",
          "has_more",
          "next_after_sequence"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "manifest"
            ]
          },
          "format_version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "group_id": {
            "type": "string",
            "format": "uuid"
          },
          "group": {
            "type": "string"
          },
          "channel": {
            "type": "string"
          },
          "exported_at": {
            "type": "string",
            "format": "date-time"
          },
          "snapshot_at": {
            "type": "string",
            "format": "date-time"
          },
          "after_sequence": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "through_sequence": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "failure_codes": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          "count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 128
          },
          "has_more": {
            "type": "boolean"
          },
          "next_after_sequence": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        },
        "description": "Realtime Dead Letter Export Manifest."
      },
      "RealtimeDeadLetterExportRecord": {
        "type": "object",
        "required": [
          "type",
          "group_id",
          "sequence",
          "dead_since",
          "attempts",
          "failure_code",
          "fencing_token",
          "delivery_deadline",
          "deadline_invalid",
          "ordering_key",
          "priority",
          "expires_at",
          "message"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "dead_letter"
            ]
          },
          "group_id": {
            "type": "string",
            "format": "uuid"
          },
          "sequence": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "dead_since": {
            "type": "string",
            "format": "date-time"
          },
          "attempts": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10
          },
          "failure_code": {
            "type": "string",
            "maxLength": 64
          },
          "fencing_token": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[1-9][0-9]*$"
          },
          "delivery_deadline": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "deadline_invalid": {
            "type": "boolean"
          },
          "ordering_key": {
            "type": "string"
          },
          "priority": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Nominal dead-letter expiry; retained rows can survive until cleanup runs"
          },
          "message": {
            "$ref": "#/components/schemas/RealtimeConsumerGroupMessage"
          }
        },
        "description": "Realtime Dead Letter Export Record."
      },
      "RealtimeConsumerGroupDeliveryHistory": {
        "type": "object",
        "required": [
          "events",
          "has_more",
          "next_after_id",
          "group_pruned_events",
          "retention_seconds"
        ],
        "properties": {
          "events": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/RealtimeConsumerGroupDeliveryHistoryEvent"
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "next_after_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "group_pruned_events": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "retention_seconds": {
            "type": "integer",
            "enum": [
              86400
            ]
          }
        },
        "description": "Realtime Consumer Group Delivery History."
      },
      "RealtimeConsumerGroupDeliveryHistoryEvent": {
        "type": "object",
        "required": [
          "id",
          "sequence",
          "event",
          "attempt",
          "fencing_token",
          "failure_code",
          "recorded_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "sequence": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "event": {
            "type": "string",
            "enum": [
              "claimed",
              "released",
              "retried",
              "lease_expired",
              "dead_lettered",
              "deadline_expired",
              "invalid_deadline",
              "completed",
              "replayed"
            ]
          },
          "attempt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10
          },
          "fencing_token": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[0-9]+$"
          },
          "failure_code": {
            "type": "string",
            "maxLength": 64
          },
          "recorded_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "description": "Realtime Consumer Group Delivery History Event."
      },
      "RealtimeConsumerGroupCircuitPolicy": {
        "type": "object",
        "required": [
          "enabled",
          "failure_threshold",
          "cooldown_seconds"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "failure_threshold": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "cooldown_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3600
          }
        },
        "description": "Realtime Consumer Group Circuit Policy."
      },
      "RealtimeConsumerGroupCircuitStatus": {
        "type": "object",
        "required": [
          "enabled",
          "failure_threshold",
          "cooldown_seconds",
          "state",
          "reason",
          "consecutive_failures",
          "next_probe_at",
          "probe_sequence",
          "blocked",
          "retry_after_milliseconds"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "failure_threshold": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "cooldown_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3600
          },
          "state": {
            "type": "string",
            "enum": [
              "closed",
              "open",
              "half_open"
            ]
          },
          "reason": {
            "type": "string"
          },
          "consecutive_failures": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "next_probe_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "probe_sequence": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[0-9]+$"
          },
          "blocked": {
            "type": "boolean",
            "description": "Breaker admission gate only; manual pause and other eligibility checks are separate."
          },
          "retry_after_milliseconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        },
        "description": "Realtime Consumer Group Circuit Status."
      },
      "RealtimeConsumerGroupPriorityStatus": {
        "type": "object",
        "required": [
          "metadata_key",
          "fair_turns",
          "next_claim_oldest",
          "backlog"
        ],
        "properties": {
          "metadata_key": {
            "type": "string",
            "maxLength": 64
          },
          "fair_turns": {
            "type": "integer",
            "enum": [
              8
            ]
          },
          "next_claim_oldest": {
            "type": "boolean"
          },
          "backlog": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/RealtimeConsumerGroupPriorityBacklog"
            }
          }
        },
        "description": "Realtime Consumer Group Priority Status."
      },
      "RealtimeConsumerGroupPriorityBacklog": {
        "type": "object",
        "required": [
          "priority",
          "ready",
          "leased",
          "dead"
        ],
        "properties": {
          "priority": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9
          },
          "ready": {
            "type": "integer",
            "minimum": 0,
            "maximum": 128
          },
          "leased": {
            "type": "integer",
            "minimum": 0,
            "maximum": 128
          },
          "dead": {
            "type": "integer",
            "minimum": 0,
            "maximum": 128
          }
        },
        "description": "Realtime Consumer Group Priority Backlog."
      },
      "RealtimeConsumerGroupMetrics": {
        "type": "object",
        "required": [
          "bucket_seconds",
          "buckets"
        ],
        "properties": {
          "bucket_seconds": {
            "type": "integer",
            "enum": [
              60
            ]
          },
          "buckets": {
            "type": "array",
            "minItems": 60,
            "maxItems": 60,
            "items": {
              "$ref": "#/components/schemas/RealtimeConsumerGroupMetricBucket"
            }
          }
        },
        "description": "Realtime Consumer Group Metrics."
      },
      "RealtimeConsumerGroupMetricBucket": {
        "type": "object",
        "required": [
          "bucket_at",
          "first_claims",
          "completed",
          "retries",
          "dead_letters",
          "queue_wait_milliseconds",
          "processing_milliseconds"
        ],
        "properties": {
          "bucket_at": {
            "type": "string",
            "format": "date-time"
          },
          "first_claims": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "completed": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "Successful attempts with an observed processing start; legacy in-flight attempts are excluded."
          },
          "retries": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "dead_letters": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "queue_wait_milliseconds": {
            "type": "number",
            "format": "double",
            "minimum": 0
          },
          "processing_milliseconds": {
            "type": "number",
            "format": "double",
            "minimum": 0
          }
        },
        "description": "Realtime Consumer Group Metric Bucket."
      },
      "RealtimeWorkerHealth": {
        "type": "object",
        "required": [
          "workers",
          "live_workers",
          "ready_workers",
          "timeout_seconds"
        ],
        "properties": {
          "workers": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/RealtimeWorkerHeartbeat"
            }
          },
          "live_workers": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "ready_workers": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "timeout_seconds": {
            "type": "integer",
            "enum": [
              60
            ]
          }
        },
        "description": "Realtime Worker Health."
      },
      "RealtimeConsumerGroupFilter": {
        "type": "object",
        "description": "Immutable selection of retained events. Event types match metadata.event_type, not the created/updated/deleted lifecycle event. Nonempty event_types uses OR; every metadata predicate and the event-type condition must match. Empty selections match everything. Missing metadata never equals an expected empty value. Configuration is bounded to 8192 encoded JSON bytes.",
        "properties": {
          "event_types": {
            "type": "array",
            "maxItems": 32,
            "uniqueItems": true,
            "default": [],
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "description": "Exact event_type value, at most 128 bytes; nonempty and trimmed, with no NUL, CR or LF."
            }
          },
          "metadata": {
            "type": "object",
            "maxProperties": 8,
            "default": {},
            "description": "Exact case-sensitive string equality; valid metadata keys use lowercase letters, digits, underscore, hyphen or dot and are 1 to 64 bytes. Values are at most 128 bytes and cannot contain NUL, CR or LF. Encoded metadata is bounded to 4096 bytes.",
            "additionalProperties": {
              "type": "string",
              "maxLength": 128
            }
          }
        }
      },
      "RealtimeConsumerGroupClaimRatePolicy": {
        "type": "object",
        "required": [
          "rate_per_second",
          "burst"
        ],
        "properties": {
          "rate_per_second": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000,
            "description": "Zero disables claim throttling."
          },
          "burst": {
            "type": "integer",
            "minimum": 1,
            "maximum": 32
          }
        },
        "description": "Realtime Consumer Group Claim Rate Policy."
      },
      "RealtimeConsumerGroupClaimRateStatus": {
        "type": "object",
        "required": [
          "rate_per_second",
          "burst",
          "throttled_claim_requests",
          "retry_after_milliseconds"
        ],
        "properties": {
          "rate_per_second": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000
          },
          "burst": {
            "type": "integer",
            "minimum": 1,
            "maximum": 32
          },
          "throttled_claim_requests": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "Cumulative committed batch admission decisions stopped by rate, including partial batches. Counts polling attempts, not withheld messages."
          },
          "retry_after_milliseconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Current earliest rate allowance delay; zero when available or disabled."
          }
        },
        "description": "Realtime Consumer Group Claim Rate Status."
      },
      "RealtimeConsumerGroupRetryPolicyRequest": {
        "type": "object",
        "required": [
          "enabled",
          "base_delay_seconds",
          "max_delay_seconds",
          "jitter"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "base_delay_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 300
          },
          "max_delay_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 300,
            "description": "Must be at least base_delay_seconds."
          },
          "jitter": {
            "type": "boolean"
          },
          "permanent_failure_codes": {
            "type": "array",
            "maxItems": 32,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[ -~]+$"
            },
            "description": "Exact case-sensitive codes; unspecified codes remain retryable."
          }
        },
        "description": "Realtime Consumer Group Retry Policy Request."
      },
      "RealtimeConsumerGroupRetryStatus": {
        "type": "object",
        "required": [
          "enabled",
          "base_delay_seconds",
          "max_delay_seconds",
          "jitter",
          "permanent_failure_codes",
          "next_retry_at"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "base_delay_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 300
          },
          "max_delay_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 300
          },
          "jitter": {
            "type": "boolean"
          },
          "permanent_failure_codes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "next_retry_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Earliest future available_at among ready snapshots; null when none."
          }
        },
        "description": "Realtime Consumer Group Retry Status."
      },
      "RealtimeConsumerGroupRetentionRequest": {
        "type": "object",
        "required": [
          "retention_seconds"
        ],
        "properties": {
          "retention_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2592000,
            "description": "Zero disables cleanup; otherwise 3600 to 2592000. Ordered groups require skip."
          }
        },
        "description": "Realtime Consumer Group Retention Request."
      },
      "RealtimeConsumerGroupRetentionPolicy": {
        "type": "object",
        "required": [
          "retention_seconds",
          "warning_seconds",
          "expired_dead_letters"
        ],
        "properties": {
          "retention_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2592000
          },
          "warning_seconds": {
            "type": "integer",
            "enum": [
              300
            ]
          },
          "expired_dead_letters": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        },
        "description": "Realtime Consumer Group Retention Policy."
      },
      "RealtimeConsumerGroupLagAlertConfig": {
        "type": "object",
        "required": [
          "enabled"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "unassigned_threshold": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "default": "0",
            "description": "0 disables backlog threshold; maximum 1000000000."
          },
          "oldest_pending_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 604800,
            "default": 0
          },
          "dead_letter_threshold": {
            "type": "integer",
            "minimum": 0,
            "maximum": 128,
            "default": 0
          },
          "cooldown_seconds": {
            "type": "integer",
            "minimum": 30,
            "maximum": 86400,
            "default": 300
          }
        },
        "description": "Realtime Consumer Group Lag Alert Config."
      },
      "RealtimeConsumerGroupLagAlert": {
        "type": "object",
        "required": [
          "enabled",
          "unassigned_threshold",
          "oldest_pending_seconds",
          "dead_letter_threshold",
          "cooldown_seconds",
          "breached",
          "unassigned",
          "oldest_pending_age_seconds",
          "dead_letters",
          "observed_at",
          "last_event_at"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "unassigned_threshold": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "default": "0",
            "description": "this realtime operation. 0 disables backlog threshold; maximum 1000000000."
          },
          "oldest_pending_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 604800,
            "default": 0
          },
          "dead_letter_threshold": {
            "type": "integer",
            "minimum": 0,
            "maximum": 128,
            "default": 0
          },
          "cooldown_seconds": {
            "type": "integer",
            "minimum": 30,
            "maximum": 86400,
            "default": 300
          },
          "breached": {
            "type": "boolean"
          },
          "unassigned": {
            "type": [
              "string",
              "null"
            ]
          },
          "oldest_pending_age_seconds": {
            "type": [
              "integer",
              "null"
            ]
          },
          "dead_letters": {
            "type": [
              "integer",
              "null"
            ]
          },
          "observed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_event_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Last event decision, including when no recipient opted in."
          }
        },
        "description": "Realtime Consumer Group Lag Alert."
      },
      "RealtimeConsumerGroup": {
        "type": "object",
        "required": [
          "deduplication_metadata_key",
          "deduplication_window_seconds",
          "duplicate_messages",
          "deduplication_keys",
          "group_id",
          "name",
          "channel",
          "assigned_sequence",
          "latest_sequence",
          "oldest_sequence",
          "unassigned",
          "completed",
          "ready",
          "leased",
          "expired_leases",
          "dead",
          "active_workers",
          "history_unavailable",
          "capacity_blocked",
          "lease_seconds",
          "max_attempts",
          "created_at",
          "paused",
          "paused_at",
          "draining",
          "drained",
          "ordering_metadata_key",
          "dead_letter_policy",
          "ordering_blocked",
          "last_fencing_token",
          "dead_letter_retention_seconds",
          "expired_dead_letters",
          "deadline_metadata_key",
          "expired_deliveries",
          "filter",
          "filtered_messages"
        ],
        "properties": {
          "deduplication_metadata_key": {
            "type": "string",
            "maxLength": 64,
            "description": "Immutable event ID metadata field; empty disables deduplication."
          },
          "deduplication_window_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400,
            "description": "Retention from first assignment; zero when disabled."
          },
          "duplicate_messages": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "Cumulative source events skipped as duplicate IDs. Separate from filtering and completions; no snapshots, lease attempts, claim-rate credit or fencing tokens are allocated."
          },
          "deduplication_keys": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4096,
            "description": "Currently unexpired remembered event ID hashes. Idle expired rows are pruned on the next keyed assignment."
          },
          "group_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "channel": {
            "type": "string"
          },
          "assigned_sequence": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "latest_sequence": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "oldest_sequence": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "unassigned": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "completed": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "ready": {
            "type": "integer",
            "minimum": 0
          },
          "leased": {
            "type": "integer",
            "minimum": 0
          },
          "expired_leases": {
            "type": "integer",
            "minimum": 0
          },
          "dead": {
            "type": "integer",
            "minimum": 0
          },
          "active_workers": {
            "type": "integer",
            "minimum": 0
          },
          "history_unavailable": {
            "type": "boolean"
          },
          "capacity_blocked": {
            "type": "boolean"
          },
          "trigger_id": {
            "type": "string",
            "format": "uuid",
            "description": "Realtime trigger consuming this group. Absent when workers consume it directly."
          },
          "lease_seconds": {
            "type": "integer"
          },
          "max_attempts": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "paused": {
            "type": "boolean",
            "description": "New claims are paused; existing leases remain valid."
          },
          "paused_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "draining": {
            "type": "boolean"
          },
          "drained": {
            "type": "boolean",
            "description": "Drain mode is active and no unexpired leases remain; not a handler completion receipt."
          },
          "ordering_metadata_key": {
            "type": "string",
            "pattern": "^[a-z0-9_.-]*$",
            "maxLength": 64,
            "default": "",
            "description": "this realtime operation. Immutable exact valid metadata field. Empty disables ordering. Missing/empty values share one ordered bucket."
          },
          "dead_letter_policy": {
            "type": "string",
            "enum": [
              "block",
              "skip"
            ],
            "default": "block",
            "description": "this realtime operation. Immutable ordered-group policy. Block holds later events until replay/repair; skip lets later events proceed. Explicit replay can occur after later work completed."
          },
          "ordering_blocked": {
            "type": "integer",
            "minimum": 0,
            "maximum": 128,
            "description": "Ready snapshots held by ordering predecessors or leases; ready counts still include them."
          },
          "last_fencing_token": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "Latest committed fencing number for this group UUID; starts at zero."
          },
          "dead_letter_retention_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2592000,
            "default": 0,
            "description": "Realtime consumer group properties dead letter retention seconds. Zero keeps indefinitely; otherwise 3600 to 2592000 seconds. Ordered groups require skip policy. Cleanup includes a 300-second warning grace."
          },
          "expired_dead_letters": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "Cumulative snapshots removed by retention; not successful completions."
          },
          "deadline_metadata_key": {
            "type": "string",
            "maxLength": 64,
            "pattern": "^[a-z0-9_.-]*$",
            "default": "",
            "description": "this realtime operation. Immutable opt-in metadata field containing an RFC3339 delivery deadline. Ordered groups require skip policy. Missing or empty values have no deadline. Malformed values become terminal invalid_delivery_deadline failures. Frozen on assignment; existing snapshots are unchanged. Deadlines prevent expired claims and cap leases."
          },
          "expired_deliveries": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "Cumulative deadline-expired or malformed-deadline deliveries made terminal by claim/replay maintenance. Not successful completions."
          },
          "filter": {
            "$ref": "#/components/schemas/RealtimeConsumerGroupFilter"
          },
          "filtered_messages": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "Cumulative nonmatching retained events skipped during assignment; does not count completions or explicit retention-gap resynchronization."
          }
        },
        "description": "Realtime Consumer Group."
      },
      "RealtimeConsumerGroupMessage": {
        "type": "object",
        "required": [
          "sequence",
          "data_base64",
          "binary",
          "version",
          "event",
          "deleted",
          "created_at"
        ],
        "properties": {
          "sequence": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "data_base64": {
            "type": "string"
          },
          "binary": {
            "type": "boolean"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "target_message_id": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "format": "int64"
          },
          "event": {
            "type": "string"
          },
          "deleted": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "description": "Realtime Consumer Group Message."
      },
      "RealtimeConsumerGroupBatchRequest": {
        "type": "object",
        "required": [
          "worker",
          "limit"
        ],
        "properties": {
          "worker": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 16
          },
          "wait_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 20,
            "default": 0,
            "description": "Realtime consumer group batch request properties wait seconds. Wait for available work, checking every 500 ms without holding a transaction. Returns promptly on pause/drain or blockers. At most 64 waiting requests per the API. Cancellation stops waiting; uncertain claims must not be retried automatically."
          }
        },
        "description": "Realtime Consumer Group Batch Request."
      },
      "RealtimeWorkerBatchClaimRequest": {
        "type": "object",
        "required": [
          "limit"
        ],
        "properties": {
          "worker": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "description": "Optional; must match the credential identity if supplied."
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 16
          },
          "wait_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 20,
            "default": 0,
            "description": "Realtime worker batch claim request properties wait seconds. Wait for available work, checking every 500 ms without holding a transaction. Returns promptly on pause/drain or blockers. At most 64 waiting requests per the API. Cancellation stops waiting; uncertain claims must not be retried automatically."
          }
        },
        "description": "Realtime Worker Batch Claim Request."
      },
      "RealtimeConsumerGroupBatch": {
        "type": "object",
        "required": [
          "deduplication_blocked",
          "circuit_open",
          "claims",
          "history_unavailable",
          "capacity_blocked",
          "paused",
          "ordering_blocked",
          "rate_throttled",
          "retry_after_milliseconds",
          "filter_scan_limited"
        ],
        "properties": {
          "deduplication_blocked": {
            "type": "boolean",
            "description": "A new event ID encountered the 4096-key bound; its source cursor is unchanged. Partial claims may be present. Existing snapshots bypass deduplication and remain claimable. Wait using retry_after_milliseconds before assigning new IDs."
          },
          "circuit_open": {
            "type": "boolean",
            "description": "Circuit cooldown or an active probe stopped new claims; partial claims may be present."
          },
          "claims": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/RealtimeConsumerGroupClaim"
            }
          },
          "history_unavailable": {
            "type": "boolean"
          },
          "capacity_blocked": {
            "type": "boolean"
          },
          "paused": {
            "type": "boolean",
            "description": "this realtime operation. New claims are paused; existing leases remain valid."
          },
          "ordering_blocked": {
            "type": "boolean",
            "description": "Ready snapshots are blocked by same-key predecessors or leases. This is normal backpressure, not a fatal error."
          },
          "rate_throttled": {
            "type": "boolean",
            "description": "Shared group rate stopped admission, possibly after partial claims."
          },
          "retry_after_milliseconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Minimum observed rate or circuit delay or time until an event ID expires. Positive when rate_throttled, circuit_open or deduplication_blocked."
          },
          "filter_scan_limited": {
            "type": "boolean",
            "description": "Assignment reached the 128-event scan budget. Progress is committed; partial claims may be present. Poll again to continue; more work is not guaranteed."
          }
        },
        "description": "Realtime Consumer Group Batch."
      },
      "RealtimeConsumerGroupClaimRequest": {
        "type": "object",
        "required": [
          "worker"
        ],
        "properties": {
          "worker": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "wait_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 20,
            "default": 0,
            "description": "Realtime consumer group claim request properties wait seconds. Wait for available work, checking every 500 ms without holding a transaction. Returns promptly on pause/drain or blockers. At most 64 waiting requests per the API. Cancellation stops waiting; uncertain claims must not be retried automatically."
          }
        },
        "description": "Realtime Consumer Group Claim Request."
      },
      "RealtimeConsumerGroupClaim": {
        "type": "object",
        "required": [
          "message",
          "worker",
          "attempt",
          "claim_token",
          "lease_until",
          "group_id",
          "fencing_token",
          "delivery_deadline"
        ],
        "properties": {
          "message": {
            "$ref": "#/components/schemas/RealtimeConsumerGroupMessage"
          },
          "worker": {
            "type": "string"
          },
          "attempt": {
            "type": "integer",
            "minimum": 1
          },
          "claim_token": {
            "type": "string",
            "description": "Opaque lease credential. Never log or persist in generic response caches."
          },
          "lease_until": {
            "type": "string",
            "format": "date-time"
          },
          "group_id": {
            "type": "string",
            "format": "uuid",
            "description": "Immutable counter namespace. A recreated group has a different UUID."
          },
          "fencing_token": {
            "type": "string",
            "pattern": "^[1-9][0-9]*$",
            "description": "Monotonically increasing per-group signed-64-bit counter. Stable on renewal, new on every new lease including retry/replay. Compare with BigInt, within a group UUID and resource scope; downstream storage must enforce stale-write rejection."
          },
          "delivery_deadline": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Frozen deadline, or null. lease_until never extends beyond it. Handlers must stop cooperatively and guard external writes."
          }
        },
        "description": "Realtime Consumer Group Claim."
      },
      "RealtimeConsumerGroupSettlement": {
        "type": "object",
        "required": [
          "sequence",
          "claim_token",
          "action"
        ],
        "properties": {
          "idempotency_key": {
            "type": "string",
            "format": "uuid",
            "minLength": 36,
            "maxLength": 36,
            "description": "this realtime operation. Optional UUID. Retains the original successful result for 24 hours for this group and principal. Reuse requires identical normalized contents, including claim tokens and ordered batch items. At most 1024 receipts per group; full capacity returns 429 before settlement. Omit item-level keys in batches. Replays require current authorization and do not settle again. Renew receipts report the original lease expiry rather than extending it again."
          },
          "sequence": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "claim_token": {
            "type": "string"
          },
          "action": {
            "type": "string",
            "enum": [
              "complete",
              "retry",
              "renew",
              "release"
            ]
          },
          "retry_after_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 300,
            "description": "Omitted uses enabled group backoff; explicit zero retries immediately."
          },
          "failure_code": {
            "type": "string",
            "maxLength": 64,
            "description": "Optional printable ASCII diagnostic code; do not include secrets."
          }
        },
        "description": "Realtime Consumer Group Settlement."
      },
      "RealtimeConsumerGroupSettlementResult": {
        "type": "object",
        "required": [
          "status"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "completed",
              "ready",
              "dead",
              "leased"
            ]
          },
          "lease_until": {
            "type": "string",
            "format": "date-time"
          },
          "available_at": {
            "type": "string",
            "format": "date-time",
            "description": "Earliest eligibility timestamp returned only for ready retry results."
          }
        },
        "description": "Realtime Consumer Group Settlement Result."
      },
      "RealtimeConsumerGroupDeadLetter": {
        "type": "object",
        "required": [
          "message",
          "attempts",
          "failure_code",
          "retention_started_at",
          "expires_at",
          "warning_at",
          "cleanup_after"
        ],
        "properties": {
          "message": {
            "$ref": "#/components/schemas/RealtimeConsumerGroupMessage"
          },
          "attempts": {
            "type": "integer",
            "minimum": 0
          },
          "failure_code": {
            "type": "string"
          },
          "retention_started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "warning_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "cleanup_after": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "description": "Realtime Consumer Group Dead Letter."
      },
      "RealtimeConsumerGroupResyncRequest": {
        "type": "object",
        "required": [
          "expected_sequence",
          "after_sequence"
        ],
        "properties": {
          "expected_sequence": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "after_sequence": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        },
        "description": "Realtime Consumer Group Resync Request."
      },
      "RealtimeAcknowledgement": {
        "type": "object",
        "required": [
          "checkpoint_sequence",
          "acknowledged_sequence",
          "acknowledged_at",
          "updated_at"
        ],
        "properties": {
          "checkpoint_sequence": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "acknowledged_sequence": {
            "type": [
              "string",
              "null"
            ],
            "description": "Latest advancing ACK; null after initialization or reset"
          },
          "acknowledged_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "description": "Realtime Acknowledgement."
      },
      "RealtimeTicketRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "principal",
          "channels",
          "ttl_seconds"
        ],
        "properties": {
          "principal": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "channels": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          "ttl_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 300
          }
        },
        "description": "Realtime Ticket Request."
      },
      "RealtimeTicketResponse": {
        "type": "object",
        "required": [
          "ticket",
          "ticket_id",
          "expires_at"
        ],
        "properties": {
          "ticket": {
            "type": "string",
            "description": "Opaque bearer credential returned once; store only in client memory."
          },
          "ticket_id": {
            "type": "string",
            "format": "uuid",
            "description": "Identifies the ticket for revocation; safe to log and store."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "description": "Realtime Ticket Response."
      },
      "RealtimeUsageHour": {
        "type": "object",
        "required": [
          "hour",
          "peak_connections",
          "connection_seconds",
          "delivered_messages",
          "delivered_bytes",
          "received_messages",
          "received_bytes"
        ],
        "properties": {
          "hour": {
            "type": "string",
            "format": "date-time",
            "description": "Start of the UTC hour."
          },
          "peak_connections": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Most connections open at once in any minute of the hour."
          },
          "connection_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Connections held multiplied by seconds."
          },
          "delivered_messages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Messages sent to clients",
            "one per recipient.": null
          },
          "delivered_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Bytes of delivered messages."
          },
          "received_messages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Client messages forwarded to the app."
          },
          "received_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Bytes of received client messages."
          }
        },
        "description": "Realtime usage in one UTC hour."
      },
      "RealtimeEndpointUsageHour": {
        "allOf": [
          {
            "$ref": "#/components/schemas/RealtimeUsageHour"
          },
          {
            "type": "object",
            "required": [
              "endpoint_id",
              "app_id"
            ],
            "properties": {
              "endpoint_id": {
                "type": "string",
                "description": "Realtime endpoint."
              },
              "app_id": {
                "type": "string",
                "description": "App that owns the endpoint."
              }
            }
          }
        ],
        "description": "One endpoint's realtime usage in one UTC hour."
      },
      "RealtimeUsageResponse": {
        "type": "object",
        "required": [
          "plan",
          "connection_limit",
          "open_connections",
          "from",
          "to",
          "hours",
          "endpoints"
        ],
        "properties": {
          "plan": {
            "type": "string",
            "description": "The account's plan."
          },
          "connection_limit": {
            "type": "integer",
            "minimum": 0,
            "description": "Concurrent connections the plan allows per account; zero when the plan has no realtime."
          },
          "open_connections": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Connections open now on nodes that reported in the last 30 seconds."
          },
          "from": {
            "type": "string",
            "format": "date-time",
            "description": "Start of the first hour returned."
          },
          "to": {
            "type": "string",
            "format": "date-time",
            "description": "End of the last hour returned (exclusive)."
          },
          "hours": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RealtimeUsageHour"
            },
            "description": "Account usage per hour, oldest first."
          },
          "endpoints": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RealtimeEndpointUsageHour"
            },
            "description": "Usage per endpoint and hour, oldest first."
          }
        },
        "description": "An account's realtime usage against its fair-use limits."
      },
      "RealtimeTicketsRevokeResponse": {
        "type": "object",
        "required": [
          "revoked"
        ],
        "properties": {
          "revoked": {
            "type": "integer",
            "minimum": 0,
            "description": "Live tickets revoked."
          }
        },
        "description": "Result of revoking a principal's subscription tickets."
      },
      "RealtimeChannelWebhookFilter": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "endpoint_id",
          "channel"
        ],
        "properties": {
          "endpoint_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          },
          "channel": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "metadata": {
            "type": "object",
            "maxProperties": 8,
            "additionalProperties": {
              "type": "string",
              "maxLength": 128
            }
          }
        },
        "description": "Realtime Channel Webhook Filter."
      },
      "ManagedRealtimeAccessRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "action"
        ],
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "revoke_channel",
              "restore_channel",
              "revoke_sessions"
            ]
          },
          "channel": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Required for channel actions; omitted for revoke_sessions."
          }
        },
        "description": "Managed Realtime Access Request."
      },
      "ManagedRealtimeAccessResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "denied_channels",
          "revision",
          "updated_at"
        ],
        "properties": {
          "denied_channels": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          "sessions_revoked_before": {
            "type": "string",
            "format": "date-time"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "description": "Managed Realtime Access Response."
      },
      "ManagedRealtimePrincipalMessageRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "principal",
          "data_base64"
        ],
        "properties": {
          "ttl_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400,
            "default": 0,
            "description": "Delivery lifetime in seconds; positive values require retained inbox delivery. Zero disables expiry."
          },
          "principal": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "data_base64": {
            "type": "string",
            "maxLength": 5464,
            "description": "Standard base64; at most 4096 decoded bytes."
          },
          "binary": {
            "type": "boolean",
            "default": false
          },
          "delivery": {
            "type": "string",
            "enum": [
              "live",
              "retained"
            ],
            "default": "live"
          },
          "message_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "request_receipt": {
            "type": "boolean",
            "default": false
          },
          "fallback_after_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400,
            "default": 0,
            "description": "Requires retained delivery; zero disables fallback."
          },
          "notification_group_key": {
            "type": "string",
            "maxLength": 128,
            "description": "Stable conversation, job or project key; requires a fallback."
          },
          "notification_not_before": {
            "type": "string",
            "format": "date-time",
            "description": "Earliest built-in push delivery time; RFC3339 with timezone, at most 48 hours ahead. Requires fallback; explicit TTL must extend past this instant."
          },
          "notification_collapse_key": {
            "type": "string",
            "maxLength": 128,
            "description": "Requires fallback. Newer queued alerts supersede older alerts for the same recipient, device, category, priority and collapse key."
          },
          "notification_ttl_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 259200,
            "description": "Push lifetime in seconds from publication. Positive values require fallback and must exceed its deadline. Zero or omission keeps default expiration."
          },
          "notification_priority": {
            "type": "string",
            "enum": [
              "low",
              "normal",
              "urgent"
            ],
            "description": "Defaults to normal when omitted; requires retained fallback. Urgent bypass requires user opt-in."
          },
          "notification_group_label": {
            "type": "string",
            "maxLength": 128,
            "description": "Display name for summaries; requires a group key."
          },
          "notification_category": {
            "type": "string",
            "pattern": "^[a-z0-9_.-]{1,64}$",
            "description": "Requires a nonzero fallback deadline; omitted values use notifications for push preferences."
          }
        },
        "description": "Principal message payload with optional retained notification and push fallback settings."
      },
      "ManagedRealtimePrincipalSendResponse": {
        "type": "object",
        "properties": {
          "delivery_expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "Delivery deadline; independent of notification fallback and retention."
          },
          "message_id": {
            "type": "string"
          },
          "sequence": {
            "type": "integer",
            "format": "int64"
          },
          "durable": {
            "type": "boolean"
          },
          "fallback_deadline": {
            "type": "string",
            "format": "date-time"
          },
          "recipients": {
            "type": "integer"
          },
          "queued": {
            "type": "integer"
          },
          "unsupported": {
            "type": "integer"
          },
          "queue_full": {
            "type": "integer"
          },
          "failed": {
            "type": "integer"
          },
          "nodes_queried": {
            "type": "integer"
          },
          "nodes_unavailable": {
            "type": "integer"
          },
          "partial": {
            "type": "boolean"
          },
          "receipt_requested": {
            "type": "boolean"
          },
          "receipt_status": {
            "type": "string"
          },
          "acknowledged": {
            "type": "integer"
          },
          "pending": {
            "type": "integer"
          },
          "timed_out": {
            "type": "integer"
          }
        },
        "description": "Principal send outcome including fleet queueing and retained notification acceptance."
      },
      "ManagedRealtimeChannelBatchRequest": {
        "type": "object",
        "required": [
          "batch_id",
          "messages"
        ],
        "properties": {
          "ttl_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400,
            "default": 0,
            "description": "Default delivery lifetime for all batch messages; zero disables expiry."
          },
          "expected_sequence": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0,
            "description": "Precondition for the channel head before the whole batch."
          },
          "batch_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "messages": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/ManagedRealtimeBatchMessageRequest"
            }
          }
        },
        "description": "Atomic batch of retained channel messages with an optional sequence precondition."
      },
      "ManagedRealtimeChannelBatchResponse": {
        "type": "object",
        "required": [
          "batch_id",
          "durable",
          "partial",
          "messages"
        ],
        "properties": {
          "batch_id": {
            "type": "string"
          },
          "durable": {
            "type": "boolean",
            "const": true
          },
          "partial": {
            "type": "boolean"
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ManagedRealtimePublishResponse"
            }
          }
        },
        "description": "Committed retained batch and per-message live fanout outcomes."
      },
      "ManagedRealtimeChannelSnapshotRequest": {
        "type": "object",
        "required": [
          "sequence",
          "data_base64"
        ],
        "properties": {
          "sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "data_base64": {
            "type": "string",
            "maxLength": 87384
          },
          "binary": {
            "type": "boolean",
            "default": false
          }
        },
        "description": "Encoded channel state representing an explicit committed sequence."
      },
      "ManagedRealtimeReducerRequest": {
        "type": "object",
        "required": [
          "sequence",
          "entities"
        ],
        "properties": {
          "sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "entities": {
            "type": "object",
            "maxProperties": 128,
            "additionalProperties": {
              "type": "object"
            },
            "description": "Seed entities, at most 64 KiB encoded. Keys are 1..128 UTF-8 bytes."
          }
        },
        "description": "Initial entity state and sequence for the channel reducer."
      },
      "ManagedRealtimeEventSchemaRequest": {
        "type": "object",
        "required": [
          "schema"
        ],
        "properties": {
          "schema": {
            "type": [
              "object",
              "boolean"
            ],
            "description": "JSON Schema Draft 2020-12, at most 16384 encoded bytes; external resources are unsupported."
          }
        },
        "description": "JSON Schema document for one channel event type and version."
      },
      "ManagedRealtimeScheduleUpdate": {
        "type": "object",
        "required": [
          "deliver_at",
          "expected_version"
        ],
        "properties": {
          "deliver_at": {
            "type": "string",
            "format": "date-time"
          },
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        },
        "description": "Version-checked change to a scheduled channel publication time."
      },
      "ManagedRealtimeSchedulePauseRequest": {
        "type": "object",
        "required": [
          "expected_version"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        },
        "description": "Current schedule version required to pause or resume recurrence."
      },
      "ManagedRealtimeScheduleRetryRequest": {
        "type": "object",
        "required": [
          "expected_version"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "deliver_at": {
            "type": "string",
            "format": "date-time",
            "description": "Optional future retry time within 30 days; omit to retry on the next worker pass."
          }
        },
        "description": "Version-checked manual retry with an optional new delivery time."
      },
      "ManagedRealtimeSchedulesResponse": {
        "type": "object",
        "required": [
          "schedules",
          "totals"
        ],
        "properties": {
          "totals": {
            "$ref": "#/components/schemas/ManagedRealtimeScheduleTotals"
          },
          "schedules": {
            "type": "array",
            "maxItems": 256,
            "items": {
              "$ref": "#/components/schemas/ManagedRealtimeScheduleResponse"
            }
          }
        },
        "description": "Matching retained channel schedules and their aggregate lifecycle totals."
      },
      "ManagedRealtimeNotificationRescheduleRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "notification_not_before"
        ],
        "properties": {
          "notification_not_before": {
            "type": "string",
            "format": "date-time",
            "description": "RFC3339, up to 48 hours ahead; must precede expiration."
          }
        },
        "description": "Replacement not-before instant for pending notification delivery work."
      },
      "RealtimeQuietHours": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "timezone",
          "start",
          "end"
        ],
        "description": "Daily local-time interval during which push delivery is deferred.",
        "properties": {
          "timezone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "description": "Named timezone, for example Europe/Rome; Local is rejected."
          },
          "start": {
            "type": "string",
            "pattern": "^(?:[01][0-9]|2[0-3]):[0-5][0-9]$"
          },
          "end": {
            "type": "string",
            "pattern": "^(?:[01][0-9]|2[0-3]):[0-5][0-9]$"
          }
        }
      },
      "RealtimeNotificationRateLimit": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "max_notifications",
          "window_seconds"
        ],
        "description": "Shared provider-delivery quota for a principal across registered devices.",
        "properties": {
          "max_notifications": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "window_seconds": {
            "type": "integer",
            "enum": [
              60,
              300,
              3600
            ]
          },
          "allow_urgent_bypass": {
            "type": "boolean",
            "default": false,
            "description": "Allow urgent alerts to bypass only this quota."
          }
        }
      },
      "ManagedRealtimeInboxMessageResponse": {
        "type": "object",
        "description": "Retained principal inbox event with payload and mutation metadata.",
        "required": [
          "version",
          "event",
          "deleted",
          "message_id",
          "sequence",
          "data_base64",
          "binary",
          "created_at",
          "expires_at"
        ],
        "properties": {
          "expired": {
            "type": "boolean",
            "default": false,
            "description": "Delivery deadline passed; payload is suppressed but sequence remains ACKable."
          },
          "delivery_expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "Delivery deadline; expires_at remains the retention deadline."
          },
          "ttl_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400,
            "default": 0,
            "description": "Delivery lifetime; zero disables expiry."
          },
          "target_message_id": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "format": "int64"
          },
          "event": {
            "type": "string"
          },
          "deleted": {
            "type": "boolean"
          },
          "message_id": {
            "type": "string"
          },
          "sequence": {
            "type": "integer",
            "format": "int64"
          },
          "data_base64": {
            "type": "string"
          },
          "binary": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string"
          },
          "expires_at": {
            "type": "string"
          }
        }
      },
      "ManagedRealtimeInboxResponse": {
        "type": "object",
        "description": "Principal inbox page with retention bounds and consumer checkpoint.",
        "required": [
          "messages",
          "oldest_sequence",
          "latest_sequence",
          "history_unavailable",
          "has_more"
        ],
        "properties": {
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ManagedRealtimeInboxMessageResponse"
            }
          },
          "oldest_sequence": {
            "type": "integer",
            "format": "int64"
          },
          "latest_sequence": {
            "type": "integer",
            "format": "int64"
          },
          "history_unavailable": {
            "type": "boolean"
          },
          "has_more": {
            "type": "boolean"
          },
          "consumer": {
            "type": "string"
          },
          "acknowledged_sequence": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "ManagedRealtimePrincipalReceiptDelivery": {
        "type": "object",
        "description": "Per-connection receipt state for a principal message dispatch.",
        "required": [
          "connection_id",
          "status",
          "queue_status",
          "ack_supported",
          "created_at"
        ],
        "properties": {
          "connection_id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "queue_status": {
            "type": "string"
          },
          "ack_supported": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string"
          },
          "queued_at": {
            "type": "string"
          },
          "acknowledged_at": {
            "type": "string"
          }
        }
      },
      "ManagedRealtimePrincipalReceiptResponse": {
        "type": "object",
        "description": "Aggregate principal receipt and per-connection delivery states.",
        "required": [
          "endpoint_id",
          "message_id",
          "status",
          "dispatch_complete",
          "created_at",
          "expires_at",
          "recipients",
          "queued",
          "acknowledged",
          "pending",
          "timed_out",
          "unsupported",
          "queue_full",
          "failed",
          "nodes_queried",
          "nodes_unavailable",
          "partial",
          "deliveries"
        ],
        "properties": {
          "endpoint_id": {
            "type": "string"
          },
          "message_id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "dispatch_complete": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string"
          },
          "expires_at": {
            "type": "string"
          },
          "recipients": {
            "type": "integer",
            "format": "int64"
          },
          "queued": {
            "type": "integer",
            "format": "int64"
          },
          "acknowledged": {
            "type": "integer",
            "format": "int64"
          },
          "pending": {
            "type": "integer",
            "format": "int64"
          },
          "timed_out": {
            "type": "integer",
            "format": "int64"
          },
          "unsupported": {
            "type": "integer",
            "format": "int64"
          },
          "queue_full": {
            "type": "integer",
            "format": "int64"
          },
          "failed": {
            "type": "integer",
            "format": "int64"
          },
          "nodes_queried": {
            "type": "integer",
            "format": "int64"
          },
          "nodes_unavailable": {
            "type": "integer",
            "format": "int64"
          },
          "partial": {
            "type": "boolean"
          },
          "deliveries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ManagedRealtimePrincipalReceiptDelivery"
            }
          }
        }
      },
      "ManagedRealtimeMessageMutationRequest": {
        "type": "object",
        "description": "Expected message version and replacement payload for a retained event.",
        "required": [
          "expected_version"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "data_base64": {
            "type": "string",
            "format": "byte",
            "maxLength": 5464
          },
          "binary": {
            "type": "boolean"
          }
        }
      },
      "ManagedRealtimeMessageMutationResponse": {
        "type": "object",
        "description": "Committed retained message mutation and resulting stream sequence.",
        "required": [
          "message_id",
          "version",
          "sequence",
          "event",
          "deleted"
        ],
        "properties": {
          "message_id": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "format": "int64"
          },
          "sequence": {
            "type": "integer",
            "format": "int64"
          },
          "event": {
            "type": "string"
          },
          "deleted": {
            "type": "boolean"
          }
        }
      },
      "ManagedRealtimeReadProgressRequest": {
        "type": "object",
        "description": "Monotonic principal read position to advance within a retained stream.",
        "required": [
          "sequence"
        ],
        "properties": {
          "sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ManagedRealtimeReadProgressResponse": {
        "type": "object",
        "description": "Principal read position with unread count and current retention bounds.",
        "required": [
          "sequence",
          "unread",
          "oldest_sequence",
          "latest_sequence",
          "history_unavailable"
        ],
        "properties": {
          "sequence": {
            "type": "integer",
            "format": "int64"
          },
          "unread": {
            "type": "integer",
            "format": "int64"
          },
          "oldest_sequence": {
            "type": "integer",
            "format": "int64"
          },
          "latest_sequence": {
            "type": "integer",
            "format": "int64"
          },
          "history_unavailable": {
            "type": "boolean"
          },
          "updated_at": {
            "type": "string"
          }
        }
      },
      "OperationExecutionControlResponse": {
        "description": "Current HTTP attempt observation. Contains no input, result, owner or capability; grants no renewal.",
        "type": "object",
        "required": [
          "operation_id",
          "invocation_id",
          "attempt",
          "cancellation_requested",
          "deadline_at",
          "lease_expires_at",
          "observed_at",
          "poll_after_ms"
        ],
        "properties": {
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "invocation_id": {
            "type": "string",
            "format": "uuid"
          },
          "attempt": {
            "type": "integer",
            "minimum": 1
          },
          "cancellation_requested": {
            "type": "boolean"
          },
          "deadline_at": {
            "type": "string",
            "format": "date-time"
          },
          "lease_expires_at": {
            "description": "Current claim expiry, capped by deadline_at. Only the scheduler can renew it.",
            "type": "string",
            "format": "date-time"
          },
          "observed_at": {
            "description": "Server observation time. Derive a conservative local duration and subtract request latency.",
            "type": "string",
            "format": "date-time"
          },
          "poll_after_ms": {
            "description": "Recommended polling interval; clients also stop at the earlier lease or deadline bound.",
            "type": "integer",
            "minimum": 100,
            "maximum": 1000
          }
        }
      },
      "OperationArtifactUploadResponse": {
        "description": "Availability and metadata of one verified private HTTP invocation file receipt.",
        "type": "object",
        "required": [
          "available"
        ],
        "properties": {
          "available": {
            "type": "boolean",
            "description": "True only for a verified private copy bound to this invocation attempt. Does not confirm business success."
          },
          "artifact": {
            "$ref": "#/components/schemas/OperationResultArtifact"
          }
        }
      },
      "OperationJobArtifactResponse": {
        "description": "Availability and metadata of one verified private native Job file receipt.",
        "type": "object",
        "required": [
          "available"
        ],
        "properties": {
          "available": {
            "type": "boolean",
            "description": "True only for a verified private copy bound to this generation. Does not confirm business success."
          },
          "artifact": {
            "$ref": "#/components/schemas/OperationResultArtifact"
          }
        }
      },
      "OperationJobReportRequest": {
        "description": "Stable native task report carrying progress or typed private output.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "report_id"
        ],
        "properties": {
          "report_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "progress": {
            "$ref": "#/components/schemas/OperationReportRequest"
          },
          "result": {
            "description": "JSON result matching the immutable output schema."
          }
        }
      },
      "OperationJobControlResponse": {
        "description": "Scoped observation of customer ownership, cancellation and current native task timing.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "account_id",
          "app_id",
          "platform_tenant_id",
          "scope",
          "operation_id",
          "job_run_id",
          "generation",
          "attempt",
          "cancellation_requested",
          "deadline_at",
          "lease_expires_at",
          "observed_at",
          "poll_after_ms"
        ],
        "properties": {
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "job_run_id": {
            "type": "string",
            "format": "uuid"
          },
          "generation": {
            "type": "integer",
            "minimum": 1
          },
          "attempt": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1
          },
          "cancellation_requested": {
            "type": "boolean"
          },
          "deadline_at": {
            "type": "string",
            "format": "date-time"
          },
          "lease_expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "poll_after_ms": {
            "type": "integer",
            "minimum": 100,
            "maximum": 1000
          }
        }
      },
      "OperationWorkflowControlResponse": {
        "description": "Current native workflow attempt observation. Contains no input, result, owner or capability; grants no renewal.",
        "type": "object",
        "required": [
          "operation_id",
          "workflow_run_id",
          "workflow_step",
          "generation",
          "attempt",
          "cancellation_requested",
          "deadline_at",
          "lease_expires_at",
          "observed_at",
          "poll_after_ms"
        ],
        "properties": {
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "workflow_run_id": {
            "type": "string",
            "format": "uuid"
          },
          "workflow_step": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9_-]{1,128}$"
          },
          "generation": {
            "type": "integer",
            "minimum": 1
          },
          "attempt": {
            "type": "integer",
            "minimum": 1
          },
          "cancellation_requested": {
            "type": "boolean"
          },
          "deadline_at": {
            "type": "string",
            "format": "date-time"
          },
          "lease_expires_at": {
            "description": "Native run lease expiry, bounded by this attempt's fixed deadline. Only native scheduler ownership can extend the lease.",
            "type": "string",
            "format": "date-time"
          },
          "observed_at": {
            "description": "Native authority observation time; use relative durations and subtract the time spent fetching this observation.",
            "type": "string",
            "format": "date-time"
          },
          "poll_after_ms": {
            "description": "Suggested delay before observing this native attempt again. The local time budget expires independently.",
            "type": "integer",
            "minimum": 100,
            "maximum": 1000
          }
        }
      },
      "OperationReportRequest": {
        "description": "Idempotent fenced progress report.",
        "type": "object",
        "required": [
          "report_id",
          "stage",
          "completed",
          "total"
        ],
        "properties": {
          "report_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "stage": {
            "type": "string"
          },
          "completed": {
            "type": "integer",
            "minimum": 0
          },
          "total": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "OperationArtifactUploadRequest": {
        "description": "Direct private file declaration. Gregale derives its opaque operation reference and storage key.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "report_id",
          "name",
          "size_bytes",
          "sha256"
        ],
        "properties": {
          "report_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "size_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "sha256": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          }
        }
      },
      "OperationArtifactRequest": {
        "description": "Idempotent attachment of an existing managed object; bytes are checked before commit.",
        "type": "object",
        "required": [
          "report_id",
          "name",
          "uri",
          "size_bytes",
          "sha256"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 128
          },
          "uri": {
            "type": "string",
            "maxLength": 2048,
            "description": "Managed object to verify before attachment, formatted as obj://<app UUID>/<bucket UUID>/<opaque key>."
          },
          "size_bytes": {
            "type": "integer",
            "minimum": 0
          },
          "sha256": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "report_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      },
      "OperationWorkflowArtifactResponse": {
        "description": "A private verified workflow copy receipt; publication follows confirmed execution success.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "available"
        ],
        "properties": {
          "available": {
            "type": "boolean",
            "description": "False only after successful authorization with no matching verified copy."
          },
          "artifact": {
            "$ref": "#/components/schemas/OperationResultArtifact"
          }
        }
      },
      "OperationRecoveryInspection": {
        "description": "Account-only durable recovery evidence with execution secrets and payloads omitted.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "operation_id",
          "generation",
          "state",
          "cancellation_requested",
          "execution_kind",
          "execution_state",
          "attempt",
          "deployment_id",
          "steps",
          "artifacts",
          "retry_blockers",
          "inspection_revision",
          "observed_at"
        ],
        "properties": {
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "generation": {
            "type": "integer",
            "minimum": 1
          },
          "state": {
            "type": "string",
            "enum": [
              "accepted",
              "running",
              "waiting",
              "succeeded",
              "failed",
              "cancelled",
              "requires_reconciliation"
            ]
          },
          "failure_code": {
            "type": "string"
          },
          "cancellation_requested": {
            "type": "boolean"
          },
          "execution_kind": {
            "type": "string",
            "enum": [
              "http",
              "workflow",
              "job"
            ]
          },
          "execution_state": {
            "type": "string"
          },
          "invocation_id": {
            "type": "string",
            "format": "uuid"
          },
          "job_run_id": {
            "type": "string",
            "format": "uuid"
          },
          "workflow_run_id": {
            "type": "string",
            "format": "uuid"
          },
          "attempt": {
            "type": "integer",
            "minimum": 0
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "release_id": {
            "type": "string",
            "format": "uuid"
          },
          "steps": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OperationRecoveryStep"
            }
          },
          "artifacts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OperationRecoveryArtifact"
            }
          },
          "retry_blockers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "inspection_revision": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$",
            "description": "Digest of durable execution evidence and file bindings; excludes observation time and independent notification state."
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperationRecoveryStep": {
        "description": "Ordered native step summary from the captured workflow contract and durable step state.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "state",
          "attempt",
          "confirmed",
          "outcome_unknown"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "attempt": {
            "type": "integer",
            "minimum": 0
          },
          "confirmed": {
            "type": "boolean"
          },
          "outcome_unknown": {
            "type": "boolean",
            "description": "A dispatched action lacks confirmed success; operator reconciliation must establish its external effects."
          }
        }
      },
      "OperationRecoveryArtifact": {
        "description": "Metadata for a prepared private copy or attached result reference, without download authority.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "name",
          "generation",
          "attempt",
          "state",
          "retained",
          "size_bytes",
          "sha256",
          "expires_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "workflow_step": {
            "type": "string"
          },
          "generation": {
            "type": "integer",
            "minimum": 1
          },
          "attempt": {
            "type": "integer",
            "minimum": 0
          },
          "state": {
            "type": "string",
            "enum": [
              "prepared",
              "attached"
            ]
          },
          "retained": {
            "type": "boolean",
            "description": "An owned retained storage receipt matches this reference at observation time; bytes are not fetched by inspection."
          },
          "size_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "sha256": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperationRecoveryPreviewRequest": {
        "description": "Proposed recovery resolution without a durable decision identity or reconciliation evidence.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_generation",
          "resolution"
        ],
        "properties": {
          "expected_generation": {
            "type": "integer",
            "minimum": 1
          },
          "resolution": {
            "type": "string",
            "enum": [
              "succeeded",
              "failed",
              "cancelled",
              "safe_to_retry"
            ]
          },
          "result": {
            "description": "Proposed pinned-schema output required only for a succeeded preview."
          }
        }
      },
      "OperationRecoveryPreview": {
        "description": "Structural platform eligibility and planned reuse; no evidence that external effects can safely repeat.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "inspection",
          "resolution",
          "eligible",
          "evidence_required",
          "blockers",
          "reused_steps",
          "reopened_steps",
          "reusable_artifact_ids",
          "publish_artifact_ids",
          "starts_new_execution",
          "clears_artifact_references"
        ],
        "properties": {
          "inspection": {
            "$ref": "#/components/schemas/OperationRecoveryInspection"
          },
          "resolution": {
            "type": "string",
            "enum": [
              "succeeded",
              "failed",
              "cancelled",
              "safe_to_retry"
            ]
          },
          "eligible": {
            "type": "boolean"
          },
          "evidence_required": {
            "type": "boolean",
            "const": true
          },
          "blockers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "reused_steps": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "reopened_steps": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "reusable_artifact_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "publish_artifact_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "starts_new_execution": {
            "type": "boolean"
          },
          "clears_artifact_references": {
            "type": "boolean"
          }
        }
      },
      "OperationRecoveryDecision": {
        "description": "Immutable historical recovery acknowledgement; excludes raw evidence, result and credentials.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "operation_id",
          "recovery_id",
          "request_fingerprint",
          "expected_generation",
          "generation",
          "resolution",
          "state",
          "recorded_at",
          "expires_at"
        ],
        "properties": {
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "recovery_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "request_fingerprint": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "expected_generation": {
            "type": "integer",
            "minimum": 1
          },
          "generation": {
            "type": "integer",
            "minimum": 1
          },
          "expected_inspection_revision": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "resolution": {
            "type": "string",
            "enum": [
              "succeeded",
              "failed",
              "cancelled",
              "safe_to_retry"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "accepted",
              "succeeded",
              "failed",
              "cancelled"
            ]
          },
          "invocation_id": {
            "type": "string",
            "format": "uuid"
          },
          "job_run_id": {
            "type": "string",
            "format": "uuid"
          },
          "workflow_run_id": {
            "type": "string",
            "format": "uuid"
          },
          "recorded_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperationRecoveryRequest": {
        "description": "Explicit recovery decision with retained evidence and idempotent recovery identity.",
        "type": "object",
        "required": [
          "recovery_id",
          "expected_generation",
          "resolution",
          "evidence"
        ],
        "additionalProperties": false,
        "properties": {
          "expected_inspection_revision": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$",
            "description": "Optional durable recovery inspection fence, rechecked before a new decision and ignored for an identical accepted receipt replay."
          },
          "recovery_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "expected_generation": {
            "type": "integer",
            "minimum": 1
          },
          "resolution": {
            "type": "string",
            "enum": [
              "succeeded",
              "failed",
              "cancelled",
              "safe_to_retry"
            ]
          },
          "evidence": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4096
          },
          "result": {
            "description": "Required typed output for succeeded."
          }
        }
      },
      "OperationWorkflowPolicyRequirement": {
        "description": "Exact policy rule identity, version, and decision code required as fresh transition evidence.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "milestone",
          "rule_id",
          "rule_version",
          "code"
        ],
        "properties": {
          "milestone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "rule_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "rule_version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          }
        }
      },
      "OperationWorkflowPlannedDecision": {
        "description": "Proposed typed policy decision attached to a milestone in the current evidence plan.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "milestone",
          "decision"
        ],
        "properties": {
          "milestone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "decision": {
            "$ref": "#/components/schemas/OperationBusinessDecision"
          }
        }
      },
      "OperationWorkflowReconciliation": {
        "description": "Application comparison of authoritative business state and revision against the retained workflow projection.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "workflow",
          "instance_id",
          "authoritative_state",
          "source_revision",
          "expected_report_revision",
          "contract_version",
          "observed_report_revision",
          "observed_contract_version",
          "status"
        ],
        "properties": {
          "workflow": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "instance_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "authoritative_state": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "source_revision": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "description": "Opaque application business revision; distinct from the SDK report counter. UTF-8 byte bound."
          },
          "expected_report_revision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "contract_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000
          },
          "observed_state": {
            "type": "string",
            "maxLength": 64
          },
          "observed_report_revision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "observed_contract_version": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          },
          "status": {
            "type": "string",
            "enum": [
              "in_sync",
              "report_missing",
              "report_behind",
              "report_ahead",
              "state_mismatch",
              "contract_version_mismatch"
            ]
          }
        }
      },
      "OperationWorkflowReconciliationPayload": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "kind",
          "reconciliation"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "gregale.workflow-reconciliation.v1"
            ]
          },
          "reconciliation": {
            "$ref": "#/components/schemas/OperationWorkflowReconciliation"
          }
        },
        "description": "Application-reported discrepancy recorded as a declared milestone using the existing transaction, ownership, and retention boundaries."
      },
      "OperationWorkflowInvariantRequirement": {
        "description": "Exact invariant code and version that must pass in a milestone committed with the transition.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "milestone",
          "code",
          "version"
        ],
        "properties": {
          "milestone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 54,
            "pattern": "^[a-z][a-z0-9-]{0,53}$"
          },
          "version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          }
        }
      },
      "OperationWorkflowPlannedInvariant": {
        "description": "Proposed application invariant result and the milestone that will carry it.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "milestone",
          "invariant"
        ],
        "properties": {
          "milestone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "invariant": {
            "$ref": "#/components/schemas/OperationBusinessInvariant"
          }
        }
      },
      "OperationWorkflowUnmetInvariant": {
        "description": "An invariant requirement that the proposed evidence cannot satisfy, with its failure reason.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requirement",
          "reason"
        ],
        "properties": {
          "requirement": {
            "$ref": "#/components/schemas/OperationWorkflowInvariantRequirement"
          },
          "reason": {
            "type": "string",
            "enum": [
              "missing",
              "mismatched",
              "failed",
              "unknown"
            ]
          }
        }
      },
      "OperationBusinessEffectReference": {
        "description": "Pair of retained Operation and milestone identifiers identifying a confirmed business effect.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "operation_id",
          "milestone_id"
        ],
        "properties": {
          "operation_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
            "description": "Canonical nonzero UUID of the retained confirmed effect."
          },
          "milestone_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
            "description": "Canonical nonzero UUID of the milestone that recorded the retained confirmed effect."
          }
        }
      },
      "OperationBusinessCompensation": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "workflow",
          "instance_id",
          "state",
          "operation",
          "code",
          "version",
          "description",
          "status",
          "source_effect"
        ],
        "properties": {
          "workflow": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "instance_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "state": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "operation": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "status": {
            "type": "string",
            "enum": [
              "required",
              "pending",
              "failed",
              "confirmed"
            ]
          },
          "reference": {
            "type": "string",
            "maxLength": 256
          },
          "source_effect": {
            "$ref": "#/components/schemas/OperationBusinessEffectReference"
          }
        },
        "description": "Application-reported compensation workflow observation. Confirmed status requires a nonempty reference. Text bounds are UTF-8 bytes without control characters. Source must be a retained confirmed effect in the same account, app, customer, and environment."
      },
      "OperationBusinessCompensationPayload": {
        "description": "Typed milestone envelope for an application-reported compensation linked to its original effect.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "kind",
          "compensation"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "gregale.business-compensation.v1"
            ]
          },
          "compensation": {
            "$ref": "#/components/schemas/OperationBusinessCompensation"
          }
        }
      },
      "OperationBusinessEffect": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "workflow",
          "instance_id",
          "state",
          "operation",
          "code",
          "version",
          "description",
          "status"
        ],
        "properties": {
          "workflow": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "instance_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "state": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "operation": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "failed",
              "confirmed"
            ]
          },
          "reference": {
            "type": "string",
            "maxLength": 256
          },
          "amount_minor": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          }
        },
        "description": "Application-reported effect. Text bounds are UTF-8 bytes; confirmed status requires a nonempty reference. Amount/currency are supplied together in minor units."
      },
      "OperationBusinessEffectPayload": {
        "description": "Typed milestone envelope recording an application-reported business effect.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "kind",
          "effect"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "gregale.business-effect.v1"
            ]
          },
          "effect": {
            "$ref": "#/components/schemas/OperationBusinessEffect"
          }
        }
      },
      "OperationWorkflowEffectRequirement": {
        "description": "Exact effect code and version that must be confirmed by fresh transition evidence.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "milestone",
          "code",
          "version"
        ],
        "properties": {
          "milestone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          }
        }
      },
      "OperationWorkflowPlannedEffect": {
        "description": "Proposed business effect confirmation associated with a milestone in the evidence plan.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "milestone",
          "effect"
        ],
        "properties": {
          "milestone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "effect": {
            "$ref": "#/components/schemas/OperationBusinessEffect"
          }
        }
      },
      "OperationWorkflowUnmetEffect": {
        "description": "A required effect confirmation that is absent or incompatible with the planned evidence.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requirement",
          "reason"
        ],
        "properties": {
          "requirement": {
            "$ref": "#/components/schemas/OperationWorkflowEffectRequirement"
          },
          "reason": {
            "type": "string",
            "enum": [
              "missing",
              "mismatched",
              "pending",
              "failed"
            ]
          }
        }
      },
      "OperationBusinessInvariant": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "workflow",
          "instance_id",
          "state",
          "code",
          "version",
          "status",
          "description",
          "operations"
        ],
        "properties": {
          "workflow": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "instance_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "state": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 54,
            "pattern": "^[a-z][a-z0-9-]{0,53}$"
          },
          "version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "status": {
            "type": "string",
            "enum": [
              "passed",
              "failed",
              "unknown"
            ]
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "operations": {
            "type": "array",
            "minItems": 1,
            "maxItems": 16,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          }
        },
        "description": "Application-evaluated business condition. String limits are UTF-8 bytes; instance, version, and description must be nonempty without control characters."
      },
      "OperationBusinessInvariantPayload": {
        "description": "Typed milestone envelope containing an application check of a business invariant.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "kind",
          "invariant"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "gregale.business-invariant.v1"
            ]
          },
          "invariant": {
            "$ref": "#/components/schemas/OperationBusinessInvariant"
          }
        }
      },
      "OperationWorkflowChangeReason": {
        "type": "object",
        "additionalProperties": false,
        "description": "Optional application-reported explanation tied to a business decision fact in the same transaction and Operation and workflow instance and pinned version. It describes application reasoning and grants no authority.",
        "required": [
          "milestone_id",
          "decision"
        ],
        "properties": {
          "milestone_id": {
            "type": "string",
            "format": "uuid"
          },
          "decision": {
            "$ref": "#/components/schemas/OperationBusinessDecision"
          }
        }
      },
      "OperationBusinessConditionDefinition": {
        "description": "Public condition vocabulary declared on a pinned workflow milestone step. A definition does not evaluate a predicate.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "description"
        ],
        "properties": {
          "expected_states": {
            "type": "array",
            "maxItems": 32,
            "uniqueItems": true,
            "description": "Optional states where this workflow step is expected to report the condition. Names must belong to its declared workflow states. Omission declares no expectation; this never gates transitions or evaluates business truth.",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          "refresh_owner": {
            "type": "string",
            "maxLength": 128,
            "description": "Optional public team or actor responsible for refreshing this condition report. UTF-8 byte bound; no controls or surrounding whitespace. Omission is unassigned."
          },
          "refresh_instructions": {
            "type": "string",
            "maxLength": 1024,
            "description": "Optional public application-declared refresh instructions. UTF-8 byte bound; no controls or surrounding whitespace. Displayed as text and never executed."
          },
          "evidence_max_age_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 315360000,
            "description": "Optional pinned maximum condition report age in seconds. Zero or omission disables the budget; this measures reporting freshness without changing the application result."
          },
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "description": "Public UTF-8 explanation without control characters; byte bound."
          }
        }
      },
      "OperationBusinessConditionResult": {
        "description": "Application-reported condition result matching the pinned milestone declaration. Omitted conditions remain unreported; unknown is explicit. No execution authority or causal inference.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "description",
          "result"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "description": "Exact public description from the pinned milestone declaration; UTF-8 byte bound."
          },
          "result": {
            "type": "string",
            "enum": [
              "pass",
              "fail",
              "unknown"
            ]
          }
        }
      },
      "OperationBusinessDecision": {
        "description": "Application-reported business decision with a public explanation and optional exact policy rule identity.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "workflow",
          "instance_id",
          "code",
          "description",
          "rule_id",
          "rule_version"
        ],
        "properties": {
          "conditions": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationBusinessConditionResult"
            },
            "description": "Optional unique condition IDs declared by the pinned milestone step. Canonical order is by ID; existing decisions omit this field."
          },
          "workflow": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "instance_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "UTF-8 byte limit; nonempty text without control characters."
          },
          "code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "description": "Public decision explanation; UTF-8 byte limit; nonempty text without control characters."
          },
          "rule_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "rule_version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "description": "Exact policy rule version; UTF-8 byte limit; nonempty text without control characters."
          }
        }
      },
      "OperationBusinessDecisionPayload": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "kind",
          "decision"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "gregale.business-decision.v1"
            ]
          },
          "decision": {
            "$ref": "#/components/schemas/OperationBusinessDecision"
          }
        },
        "description": "Versioned application decision evidence carried in a declared milestone payload. Must match its declared workflow step and instance. Uses existing milestone transaction, publication, ownership, and retention boundaries."
      },
      "OperationMilestoneRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "name",
          "payload",
          "occurred_at"
        ],
        "description": "Public application fact with a stable UUID reused across retries and recovery. Payloads are validated against the immutable definition; publication does not change business outcome.",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "payload": {
            "description": "Declared JSON payload, bounded to 8192 UTF-8 bytes before and after canonicalization. The application chooses customer-visible data."
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time",
            "description": "Application-recorded time. Normalized to UTC microsecond precision; independent of platform receipt time."
          }
        }
      },
      "OperationMilestoneValidationRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "milestones"
        ],
        "description": "Bounded read-only precommit validation; does not reserve capacity, extend the claim, or publish facts. Maximum request size 65536 bytes.",
        "properties": {
          "milestones": {
            "type": "array",
            "minItems": 1,
            "maxItems": 64,
            "items": {
              "$ref": "#/components/schemas/OperationMilestoneRequest"
            }
          }
        }
      },
      "OperationMilestoneValidationResponse": {
        "description": "Confirmation that all candidate facts passed validation under the current execution claim.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "valid"
        ],
        "properties": {
          "valid": {
            "type": "boolean",
            "description": "True when the batch satisfies the current execution fence and immutable schemas."
          }
        }
      },
      "OperationMilestone": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "operation_id",
          "name",
          "payload",
          "occurred_at",
          "created_at",
          "sequence"
        ],
        "description": "Retained public business fact. Deduplicated by Operation and milestone ID across execution generations, retained with the Operation, and attributed to its immutable business reference.",
        "properties": {
          "workflow_steps": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowStep"
            },
            "description": "App-declared workflow labels matched to this retained milestone; only observed steps are included."
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid",
            "description": "Only account operator feeds include this customer identity."
          },
          "subject": {
            "$ref": "#/components/schemas/OperationSubject"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "payload": {
            "description": "Retained, schema-validated public JSON fact. Read through the existing customer or account ownership boundary."
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "First platform publication time; determines descending timeline order."
          },
          "sequence": {
            "type": "integer",
            "minimum": 1,
            "description": "Corresponding Operation event sequence. The general event stream contains a notice; this ledger retains the payload."
          }
        }
      },
      "OperationWorkflowStep": {
        "description": "App-declared read-only workflow step represented by an observed milestone. New declarations select the instance ID from the validated public milestone payload using the pinned JSON Pointer.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "workflow",
          "title",
          "step",
          "label",
          "milestone",
          "position"
        ],
        "properties": {
          "playbooks": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPlaybook"
            },
            "description": "OperationWorkflowStep.playbooks. Optional advisory playbooks pinned to this workflow contract and immutable reporting definition; never execution commands."
          },
          "blocker_escalations": {
            "type": "object",
            "maxProperties": 32,
            "propertyNames": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/OperationWorkflowBlockerEscalationPolicy"
            },
            "description": "Versioned policies by blocker code. All steps in one workflow definition must agree. Policies only recommend escalation for active workflows with known blocker age."
          },
          "decision_conditions": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationBusinessConditionDefinition"
            },
            "description": "Optional unique condition definitions for decisions reported on this milestone step. Definitions are pinned by workflow contract version; reporting all conditions is optional."
          },
          "allow_reconciliation": {
            "type": "boolean",
            "description": "Explicit permission for evidence-backed state reconciliation snapshots."
          },
          "workflow": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000,
            "description": "Explicit workflow contract version. Legacy definitions that omit it have effective version 1."
          },
          "states": {
            "type": "array",
            "maxItems": 32,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            },
            "description": "App-declared business state vocabulary pinned with this workflow mapping."
          },
          "terminal_states": {
            "type": "array",
            "maxItems": 32,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            },
            "description": "App-declared terminal states, which must be in states and cannot have outgoing transitions."
          },
          "state_sla_warning_percent": {
            "type": "object",
            "maxProperties": 32,
            "propertyNames": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            },
            "additionalProperties": {
              "type": "integer",
              "format": "int64",
              "minimum": 1,
              "maximum": 99
            },
            "description": "Optional whole-percent warning thresholds for states with SLA budgets. At the threshold a known current visit becomes at_risk until its budget is breached. Omitted states have no early warning. All steps must agree; publish a new workflow contract version when changing thresholds."
          },
          "state_sla_budget_seconds": {
            "type": "object",
            "maxProperties": 32,
            "propertyNames": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            },
            "additionalProperties": {
              "type": "integer",
              "format": "int64",
              "minimum": 1,
              "maximum": 315360000
            },
            "description": "Optional observed state visit budgets. Keys must be declared nonterminal states. All workflow steps in one definition must agree; publish a new workflow contract version for budget changes. Metadata updates do not reset a visit clock. Unknown retained entry times do not imply a breach."
          },
          "state_stale_after_seconds": {
            "type": "object",
            "maxProperties": 32,
            "propertyNames": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            },
            "additionalProperties": {
              "type": "integer",
              "minimum": 1,
              "maximum": 315360000
            },
            "description": "App-declared age thresholds in seconds for active states. Keys must be states and cannot be terminal states."
          },
          "transitions": {
            "type": "array",
            "maxItems": 128,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowTransition"
            },
            "description": "App-declared allowed state edges pinned with this workflow mapping."
          },
          "transitions_declared": {
            "type": "boolean",
            "description": "True when the workflow declares transitions, including when this Operation has no scoped edges."
          },
          "step": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "milestone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "instance_id_from": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048,
            "description": "JSON Pointer to a stable workflow-run ID in this milestone's payload; omitted by older pinned definitions."
          },
          "instance_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "App-provided workflow-run ID selected from this observed milestone."
          },
          "position": {
            "type": "integer",
            "minimum": 1,
            "maximum": 32
          }
        }
      },
      "OperationWorkflowTransition": {
        "description": "Allowed state edge declared by a pinned application workflow definition.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "from",
          "to"
        ],
        "properties": {
          "retained_milestone_groups": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowRetainedMilestoneGroup"
            }
          },
          "retained_milestone_freshness": {
            "type": "array",
            "maxItems": 16,
            "uniqueItems": true,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowRetainedMilestoneFreshnessRule"
            },
            "description": "Maximum evidence ages pinned to this workflow edge."
          },
          "retained_milestone_invalidations": {
            "type": "array",
            "maxItems": 16,
            "uniqueItems": true,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowRetainedMilestoneInvalidationRule"
            },
            "description": "Pinned edge rules linking retained prerequisites to invalidating facts from declared workflow steps. Business occurrence time determines order; an invalidating fact wins equal timestamps."
          },
          "required_retained_milestones": {
            "type": "array",
            "maxItems": 16,
            "uniqueItems": true,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowRetainedMilestoneRequirement"
            },
            "description": "Previously reported transaction-backed workflow facts required within the same ownership, subject, instance, and contract version; proposed evidence does not satisfy these prerequisites."
          },
          "required_effects": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowEffectRequirement"
            }
          },
          "required_invariants": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowInvariantRequirement"
            }
          },
          "required_dependency_workflows": {
            "type": "array",
            "maxItems": 16,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 63,
              "pattern": "^[a-z][a-z0-9-]{0,62}$"
            },
            "description": "Omitted means all reported dependencies; an empty array means none. Named workflows require at least one reported link and every matching link must meet its outcome requirement."
          },
          "required_policies": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPolicyRequirement"
            }
          },
          "from": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "to": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "required_milestones": {
            "type": "array",
            "maxItems": 16,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            },
            "description": "Milestone names that must be committed in the same application transaction as this transition."
          }
        }
      },
      "OperationWorkflowPathSelection": {
        "description": "Application-reported choice of one named path in a compound prerequisite group of the selected pinned transition. Each group may appear once. Choices do not authorize or execute actions.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "group_id",
          "path_id"
        ],
        "properties": {
          "decision_conditions": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationBusinessConditionResult"
            },
            "description": "Optional application condition snapshot; requires a decision fact reference and exact equality with that fact. Omitted for legacy decisions."
          },
          "group_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "path_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "decision_milestone_id": {
            "type": "string",
            "format": "uuid",
            "description": "Optional business decision milestone in this report evidence list and application transaction. When present all decision fields are required and must match its payload."
          },
          "decision_code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "decision_description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          },
          "decision_rule_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "decision_rule_version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      },
      "OperationWorkflowRetainedMilestoneGroup": {
        "description": "Named alternatives in a pinned workflow edge. Declare either a nonempty any_of list or nonempty named paths. Any verified fact satisfies a flat group; every fact in one complete path satisfies a path group. All groups and mandatory prerequisites must pass. Across named paths a group permits at most 16 fact occurrences including repeated selectors. Changes require a new contract version.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "any_of": {
            "type": "array",
            "minItems": 2,
            "maxItems": 16,
            "uniqueItems": true,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowRetainedMilestoneRequirement"
            }
          },
          "paths": {
            "type": "array",
            "minItems": 2,
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowRetainedMilestonePath"
            }
          }
        }
      },
      "OperationWorkflowPathDecisionResult": {
        "description": "Comparison of a pinned path decision requirement with planned application evidence. This is an observation and grants no execution authority.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requirement",
          "satisfied"
        ],
        "properties": {
          "requirement": {
            "$ref": "#/components/schemas/OperationWorkflowPolicyRequirement"
          },
          "reported": {
            "$ref": "#/components/schemas/OperationBusinessDecision"
          },
          "satisfied": {
            "type": "boolean"
          }
        }
      },
      "OperationWorkflowRetainedMilestonePath": {
        "description": "One uniquely named business path within an alternative group. Every declared retained fact must be verified together at the evaluation time; selectors are canonicalized and unique within the path.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "all_of"
        ],
        "properties": {
          "decision": {
            "$ref": "#/components/schemas/OperationWorkflowPolicyRequirement"
          },
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "all_of": {
            "type": "array",
            "minItems": 1,
            "maxItems": 16,
            "uniqueItems": true,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowRetainedMilestoneRequirement"
            }
          }
        }
      },
      "OperationWorkflowRetainedMilestoneGroupResult": {
        "description": "Evaluation of one retained alternative group. Flat groups return alternatives; compound groups return paths. Every fact includes freshness and invalidation and recovery diagnostics. A satisfied group requires at least one verified alternative or fully satisfied path.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "satisfied"
        ],
        "properties": {
          "selected_path_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$",
            "description": "When supplied by the application readiness request only this path determines group satisfaction; other paths remain diagnostic."
          },
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "satisfied": {
            "type": "boolean"
          },
          "alternatives": {
            "type": "array",
            "minItems": 2,
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowRetainedMilestone"
            }
          },
          "paths": {
            "type": "array",
            "minItems": 2,
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowRetainedMilestonePathResult"
            }
          }
        }
      },
      "OperationWorkflowRetainedMilestonePathResult": {
        "description": "Complete evidence findings for one named alternative path. Satisfied means every requirement is verified at the shared evaluation time; passing facts from separate paths cannot combine to satisfy a group.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "satisfied",
          "requirements"
        ],
        "properties": {
          "decision": {
            "$ref": "#/components/schemas/OperationWorkflowPathDecisionResult"
          },
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "satisfied": {
            "type": "boolean"
          },
          "requirements": {
            "type": "array",
            "minItems": 1,
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowRetainedMilestone"
            }
          }
        }
      },
      "OperationWorkflowRetainedMilestoneRequirement": {
        "description": "Source operation and milestone bound to a declared transaction-backed step of the selected workflow contract.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "operation",
          "milestone"
        ],
        "properties": {
          "operation": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "milestone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          }
        }
      },
      "OperationWorkflowRetainedMilestone": {
        "description": "Verification of a retained app-reported prerequisite fact within the selected ownership boundary, subject, workflow instance, and contract version. Verified does not attest to an external provider or authorize business writes. Invalidated means an applicable retained fact occurred at or after the prerequisite. Expired means the declared maximum evidence age has been reached at evaluation time. Invalidation takes precedence over expiry. Awaiting verification means no matching eligible fact is currently retained and does not prove it never occurred.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requirement",
          "status"
        ],
        "properties": {
          "recovery": {
            "$ref": "#/components/schemas/OperationWorkflowPrerequisiteRecovery"
          },
          "freshness": {
            "$ref": "#/components/schemas/OperationWorkflowRetainedMilestoneFreshness"
          },
          "invalidation": {
            "$ref": "#/components/schemas/OperationWorkflowRetainedMilestoneInvalidation",
            "description": "Source and evidence identity of the latest applicable invalidating fact. Present only for invalidated prerequisites."
          },
          "requirement": {
            "$ref": "#/components/schemas/OperationWorkflowRetainedMilestoneRequirement"
          },
          "status": {
            "type": "string",
            "enum": [
              "verified",
              "awaiting_verification",
              "invalidated",
              "expired"
            ]
          },
          "evidence": {
            "$ref": "#/components/schemas/OperationWorkflowInstanceMilestoneRef",
            "description": "Matching retained prerequisite fact; present for verified, invalidated, and expired results. Edges with invalidation or freshness policies select the latest occurrence at or before evaluation time, with publication and identities breaking ties; other edges retain publication order."
          }
        }
      },
      "OperationWorkflowPrerequisiteRecovery": {
        "description": "Application-owned steps to restore a missing or unusable retained prerequisite. Derived from the pinned selector; absent for verified evidence. This is guidance and does not establish that the producer operation is currently executable. Steps are ordered perform_operation then publish_milestone then recheck_readiness. Publication must use the same ownership boundary and workflow instance and contract version. Freshness limits still apply.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "reason",
          "operation",
          "milestone",
          "steps"
        ],
        "properties": {
          "reason": {
            "type": "string",
            "enum": [
              "awaiting_verification",
              "expired",
              "invalidated"
            ]
          },
          "operation": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "milestone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "after_occurred_at": {
            "type": "string",
            "format": "date-time",
            "description": "Exclusive occurrence threshold from the invalidating fact or expired prerequisite. Never fabricate an occurrence time to satisfy this threshold."
          },
          "steps": {
            "type": "array",
            "minItems": 3,
            "maxItems": 3,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "perform_operation",
                "publish_milestone",
                "recheck_readiness"
              ]
            }
          }
        }
      },
      "OperationWorkflowRetainedMilestoneFreshnessRule": {
        "description": "Versioned maximum age for one declared mandatory or alternative retained prerequisite; measured from business occurrence time.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "prerequisite",
          "max_age_seconds"
        ],
        "properties": {
          "prerequisite": {
            "$ref": "#/components/schemas/OperationWorkflowRetainedMilestoneRequirement"
          },
          "max_age_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 315360000
          }
        }
      },
      "OperationWorkflowRetainedMilestoneFreshness": {
        "description": "Evidence age evaluated at the shared server timestamp. Expiry is inclusive; missing evidence omits expiry and age fields. Remaining seconds round up while eligible and are zero after expiry.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "max_age_seconds",
          "evaluated_at"
        ],
        "properties": {
          "max_age_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 315360000
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "age_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "remaining_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 315360000
          }
        }
      },
      "OperationWorkflowRetainedMilestoneInvalidationRule": {
        "description": "Versioned link between a declared retained prerequisite and a distinct invalidating source bound to a transaction-backed workflow step. Sources must share ownership, subject, workflow instance, and contract version.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "prerequisite",
          "invalidated_by"
        ],
        "properties": {
          "prerequisite": {
            "$ref": "#/components/schemas/OperationWorkflowRetainedMilestoneRequirement"
          },
          "invalidated_by": {
            "$ref": "#/components/schemas/OperationWorkflowRetainedMilestoneRequirement"
          }
        }
      },
      "OperationWorkflowRetainedMilestoneInvalidation": {
        "description": "Identity of the retained fact that invalidated a prerequisite by business occurrence time. Equal occurrence timestamps invalidate conservatively; a later prerequisite fact can satisfy the requirement again. Normal retention applies to both sources.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "source",
          "evidence"
        ],
        "properties": {
          "source": {
            "$ref": "#/components/schemas/OperationWorkflowRetainedMilestoneRequirement"
          },
          "evidence": {
            "$ref": "#/components/schemas/OperationWorkflowInstanceMilestoneRef"
          }
        }
      },
      "OperationWorkflowEvidenceMilestone": {
        "description": "Reference to a retained milestone fact committed in the same application transaction as a workflow transition.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "name"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          }
        }
      },
      "OperationMilestonesResponse": {
        "description": "Page of retained public milestone facts in the selected ownership and business-reference boundary.",
        "type": "object",
        "required": [
          "milestones"
        ],
        "properties": {
          "milestones": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OperationMilestone"
            }
          },
          "workflow_states": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowState"
            },
            "description": "Latest explicitly reported states for recent workflow instances under this business reference. With stale_only=true, this list contains only states past their app-declared age threshold. Milestone facts and state history are unaffected. This list is empty on Operation-specific feeds."
          },
          "workflow_state_history": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowStateHistoryEntry"
            },
            "description": "Retained app-reported changes for the exact workflow run when paired workflow selectors are supplied, ordered by app-assigned revision."
          },
          "workflow_instance": {
            "$ref": "#/components/schemas/OperationWorkflowInstanceSnapshot"
          },
          "next_cursor": {
            "type": "string",
            "description": "Opaque continuation bound to the same account, customer, app, environment, reference or Operation, and feed role."
          },
          "next_workflow_state_cursor": {
            "type": "string",
            "description": "Independent continuation for workflow_state_history, bound to the same run and ownership filters."
          }
        }
      },
      "OperationWorkflowOutcomeEntry": {
        "description": "One retained terminal workflow instance with its explicitly reported business result and ownership context.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "app_id",
          "scope",
          "subject",
          "operation_id",
          "state"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid",
            "description": "Present only in account-operator responses."
          },
          "subject": {
            "$ref": "#/components/schemas/OperationSubject"
          },
          "operation_id": {
            "type": "string",
            "format": "uuid",
            "description": "Operation that published the current state report."
          },
          "state": {
            "$ref": "#/components/schemas/OperationWorkflowState"
          }
        }
      },
      "OperationWorkflowOutcomesResponse": {
        "description": "Paginated collection of matching terminal workflow outcomes evaluated at a shared time.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "items",
          "evaluated_at"
        ],
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowOutcomeEntry"
            }
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time"
          },
          "next_cursor": {
            "type": "string",
            "maxLength": 512
          }
        }
      },
      "OperationWorkflowOutcomeGroup": {
        "description": "Count of terminal workflow instances matching one outcome aggregation value.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "value",
          "workflow_count"
        ],
        "properties": {
          "value": {
            "type": "string"
          },
          "workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "OperationWorkflowOutcomeSummary": {
        "description": "Total matching terminal instances and a bounded page of outcome aggregation groups.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "group_by",
          "evaluated_at",
          "workflow_count",
          "groups"
        ],
        "properties": {
          "group_by": {
            "type": "string",
            "enum": [
              "outcome",
              "workflow",
              "customer"
            ]
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time"
          },
          "workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "groups": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowOutcomeGroup"
            }
          },
          "next_cursor": {
            "type": "string",
            "maxLength": 512
          }
        }
      },
      "OperationWorkflowBlockerEscalationPolicy": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "after_seconds",
          "owner"
        ],
        "description": "Application-declared recommendation to escalate a blocker once its known age reaches a threshold. Does not assign work or execute actions.",
        "properties": {
          "after_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 315360000,
            "description": "Whole seconds from first_observed_at, bounded to ten years."
          },
          "owner": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "description": "Public recommended escalation team or person identifier, limited to 128 UTF-8 bytes without control characters."
          }
        }
      },
      "OperationWorkflowBlockerEscalation": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "code",
          "operation",
          "owner",
          "after_seconds",
          "escalated_at"
        ],
        "description": "Read-only threshold finding evaluated at the attention cursor time against the current retained report and its pinned definition. Owner is the recommended escalation recipient, not the blocker assignee.",
        "properties": {
          "code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "operation": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "owner": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "after_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 315360000
          },
          "escalated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time when the reported blocker first reached its declared threshold."
          }
        }
      },
      "OperationWorkflowAttentionEntry": {
        "description": "One active workflow instance requiring attention, including its reasons and unresolved prerequisites.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "app_id",
          "scope",
          "subject",
          "operation_id",
          "state",
          "reasons"
        ],
        "properties": {
          "resolution_verifications": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowResolutionVerification"
            },
            "description": "Bounded preview with pending obligations first. Exact counts cover all retained distinct obligations."
          },
          "awaiting_verification_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "resolution_verification_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "escalations": {
            "type": "array",
            "maxItems": 16,
            "description": "Passed blocker escalation thresholds; missing observation times do not produce findings.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowBlockerEscalation"
            }
          },
          "dependency_attention": {
            "type": "array",
            "maxItems": 16,
            "description": "Unresolved direct references on an active source. These entries carry dependency and status; target state is available in the workflow instance detail.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowRelatedInstance"
            }
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid",
            "description": "For this attention entry, present only in account-operator responses."
          },
          "subject": {
            "$ref": "#/components/schemas/OperationSubject"
          },
          "operation_id": {
            "type": "string",
            "format": "uuid",
            "description": "For this attention entry, operation that published the current state report."
          },
          "state": {
            "$ref": "#/components/schemas/OperationWorkflowState"
          },
          "reasons": {
            "type": "array",
            "minItems": 1,
            "maxItems": 10,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "blocked",
                "stale",
                "overdue",
                "dependency",
                "escalated",
                "unacknowledged",
                "follow_up_overdue",
                "awaiting_verification",
                "sla_breached",
                "sla_at_risk"
              ]
            }
          }
        }
      },
      "OperationWorkflowAttentionStats": {
        "description": "Aggregate counts and age measurements for workflows, blockers, deadlines, and unresolved dependencies.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "sla_at_risk_workflow_count",
          "sla_breached_workflow_count",
          "sla_unknown_workflow_count",
          "awaiting_verification_workflow_count",
          "awaiting_verification_resolution_count",
          "low_blocker_count",
          "normal_blocker_count",
          "high_blocker_count",
          "urgent_blocker_count",
          "unacknowledged_blocker_count",
          "follow_up_overdue_blocker_count",
          "escalated_workflow_count",
          "escalated_blocker_count",
          "dependency_workflow_count",
          "dependency_count",
          "overdue_workflow_count",
          "workflow_count",
          "blocked_workflow_count",
          "stale_workflow_count",
          "blocker_count",
          "unknown_age_blockers"
        ],
        "properties": {
          "sla_at_risk_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "sla_breached_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "sla_unknown_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "escalated_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "awaiting_verification_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "awaiting_verification_resolution_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "low_blocker_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "normal_blocker_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "high_blocker_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "urgent_blocker_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unacknowledged_blocker_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "follow_up_overdue_blocker_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "escalated_blocker_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "dependency_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "dependency_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "overdue_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "earliest_overdue_deadline_at": {
            "type": "string",
            "format": "date-time"
          },
          "longest_overdue_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "blocked_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "stale_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "blocker_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unknown_age_blockers": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "oldest_blocker_at": {
            "type": "string",
            "format": "date-time"
          },
          "oldest_blocker_age_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "OperationWorkflowAttentionGroup": {
        "description": "Attention statistics for one value of the selected grouping dimension. Owner grouping uses an empty value for unassigned blockers; owner counts and ages cover that owner only.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "value",
          "stats"
        ],
        "properties": {
          "value": {
            "type": "string"
          },
          "stats": {
            "$ref": "#/components/schemas/OperationWorkflowAttentionStats"
          }
        }
      },
      "OperationWorkflowAttentionSummary": {
        "description": "Attention totals across all matches and a paginated collection of grouped statistics.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "group_by",
          "evaluated_at",
          "totals",
          "groups"
        ],
        "properties": {
          "group_by": {
            "type": "string",
            "enum": [
              "owner",
              "workflow",
              "blocker_code",
              "target_operation",
              "customer",
              "dependency_status",
              "required_outcome_code"
            ]
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time"
          },
          "totals": {
            "$ref": "#/components/schemas/OperationWorkflowAttentionStats"
          },
          "groups": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowAttentionGroup"
            }
          },
          "next_cursor": {
            "type": "string",
            "maxLength": 512
          }
        }
      },
      "OperationWorkflowAttentionResponse": {
        "description": "Bounded attention queue with a stable evaluation time and filter-bound continuation.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "items",
          "evaluated_at"
        ],
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowAttentionEntry"
            }
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Staleness evaluation time retained across cursor pages."
          },
          "next_cursor": {
            "type": "string",
            "description": "Opaque continuation bound to account/customer role and every queue filter."
          }
        }
      },
      "OperationWorkflowDecisionOutcomeEvidence": {
        "type": "object",
        "additionalProperties": false,
        "description": "Retained report classifying this contributor. Completed outcome groups use the earliest qualifying fact; active condition groups use the latest matching fact among current decision contexts. The optional business decision snapshot references its fact within operation_id. A path without a decision is evidenced by the report itself. These are application-reported facts and do not establish causation.",
        "required": [
          "report_id",
          "operation_id",
          "revision",
          "state",
          "occurred_at"
        ],
        "properties": {
          "condition_freshness": {
            "$ref": "#/components/schemas/OperationWorkflowConditionFreshness"
          },
          "evidence_age_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Age of the selected active condition fact at evaluated_at; not a condition expiry or assertion of current truth."
          },
          "condition": {
            "$ref": "#/components/schemas/OperationBusinessConditionResult"
          },
          "observed_condition_results": {
            "type": "array",
            "maxItems": 3,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "pass",
                "fail",
                "unknown"
              ]
            },
            "description": "All results reported before or at the first terminal report for the selected exact contract and decision and rule and condition ID/description identity. Present on condition contributors; multiple results explain overlapping group membership."
          },
          "condition_comparison": {
            "$ref": "#/components/schemas/OperationWorkflowConditionComparison"
          },
          "report_id": {
            "type": "string",
            "format": "uuid"
          },
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "from_state": {
            "type": "string",
            "maxLength": 64
          },
          "state": {
            "type": "string",
            "maxLength": 64
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "milestone_id": {
            "type": "string",
            "format": "uuid"
          },
          "decision": {
            "$ref": "#/components/schemas/OperationBusinessDecision"
          }
        }
      },
      "OperationWorkflowPerformanceGroup": {
        "description": "Exact duration dimension and optional contract, state, blocker or owner selectors for contributor reads.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "dimension"
        ],
        "properties": {
          "gap_status": {
            "type": "string",
            "enum": [
              "report_lost",
              "new_expectation",
              "still_missing",
              "expectation_changed",
              "contract_changed"
            ]
          },
          "condition_evidence_status": {
            "type": "string",
            "enum": [
              "within_budget",
              "overdue",
              "no_budget"
            ],
            "description": "Optional active-condition contributor filter; other dimensions reject this selector."
          },
          "condition_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "condition_description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "description": "Exact public condition description in the returned group; UTF-8 byte bound without controls."
          },
          "condition_result": {
            "type": "string",
            "enum": [
              "pass",
              "fail",
              "unknown"
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "decision",
              "path"
            ]
          },
          "decision_code": {
            "type": "string",
            "maxLength": 64
          },
          "rule_id": {
            "type": "string",
            "maxLength": 64
          },
          "rule_version": {
            "type": "string",
            "maxLength": 128
          },
          "group_id": {
            "type": "string",
            "maxLength": 64
          },
          "path_id": {
            "type": "string",
            "maxLength": 64
          },
          "outcome_code": {
            "type": "string",
            "maxLength": 64
          },
          "dimension": {
            "type": "string",
            "enum": [
              "state_time",
              "blocked_time",
              "verification_wait",
              "state",
              "blocker",
              "verification_owner",
              "decision_completion",
              "decision_blocked",
              "condition_completion",
              "condition_blocked",
              "active_condition_elapsed",
              "active_condition_blocked",
              "condition_refresh_owner",
              "condition_refresh_age",
              "condition_refresh_blocked",
              "condition_missing_owner",
              "condition_gap_owner",
              "condition_gap_queue"
            ]
          },
          "contract_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000
          },
          "state": {
            "type": "string",
            "maxLength": 64
          },
          "operation": {
            "type": "string",
            "maxLength": 64
          },
          "code": {
            "type": "string",
            "maxLength": 64
          },
          "owner": {
            "type": "string",
            "maxLength": 128
          },
          "unassigned": {
            "type": "boolean"
          }
        }
      },
      "OperationWorkflowPerformanceInstance": {
        "type": "object",
        "additionalProperties": false,
        "description": "Current state and verification findings for one complete-history contributor. Customer responses omit tenant identifiers. Observed seconds measure the selected historical group rather than current ownership alone.",
        "required": [
          "subject",
          "operation_id",
          "state",
          "observed_seconds",
          "resolution_verifications",
          "awaiting_verification_count",
          "resolution_verification_count"
        ],
        "properties": {
          "gap_queue_priority": {
            "$ref": "#/components/schemas/OperationWorkflowGapQueuePriority"
          },
          "gap_progress": {
            "$ref": "#/components/schemas/OperationWorkflowNewMissingConditionProgressInstance"
          },
          "missing_condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Exact missing condition count for the selected current state and refresh owner before preview limits."
          },
          "missing_conditions_truncated": {
            "type": "boolean"
          },
          "missing_conditions": {
            "type": "array",
            "maxItems": 16,
            "description": "First matching missing conditions ordered by workflow step then condition ID with latest reporting Operation pinned expectations and public guidance. No qualifying report exists in current contexts, so evidence is absent.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowConditionCoverageEntry"
            }
          },
          "refresh_priority": {
            "$ref": "#/components/schemas/OperationWorkflowConditionRefreshPriority"
          },
          "refresh_evidence_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Exact number of selected overdue conditions for this contributor. Owner dimensions restrict the count to that owner; workflow priority dimensions count all overdue conditions across owners."
          },
          "refresh_evidence_truncated": {
            "type": "boolean"
          },
          "refresh_evidence": {
            "type": "array",
            "maxItems": 16,
            "description": "First 16 matching overdue condition facts in canonical identity order with pinned refresh guidance and token-bound deadlines. More conditions may qualify; refresh_evidence_count remains exact.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowDecisionOutcomeEvidence"
            }
          },
          "decision_evidence": {
            "$ref": "#/components/schemas/OperationWorkflowDecisionOutcomeEvidence"
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "subject": {
            "$ref": "#/components/schemas/OperationSubject"
          },
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "$ref": "#/components/schemas/OperationWorkflowState"
          },
          "observed_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "resolution_verifications": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowResolutionVerification"
            }
          },
          "awaiting_verification_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "resolution_verification_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "OperationWorkflowPerformanceInstancesResponse": {
        "type": "object",
        "additionalProperties": false,
        "description": "Coverage counts cover the selected cohort before dimension selection. Duration statistics and ranked items include only complete-history instances contributing to the exact dimension. Overall dimensions include eligible zero values. The token binds both sampled cohorts and evidence at evaluated_at; it does not store a database snapshot.",
        "required": [
          "evaluated_at",
          "cohort_token",
          "workflow",
          "cohort",
          "group",
          "matching_workflow_count",
          "sampled_workflow_count",
          "complete_history_workflow_count",
          "excluded_incomplete_workflow_count",
          "cohort_truncated",
          "exclusions",
          "duration",
          "items"
        ],
        "properties": {
          "new_missing_progress": {
            "$ref": "#/components/schemas/OperationWorkflowNewMissingConditionProgress"
          },
          "condition_coverage": {
            "$ref": "#/components/schemas/OperationWorkflowConditionCoverage"
          },
          "active_conditions": {
            "$ref": "#/components/schemas/OperationWorkflowActiveConditionSummary"
          },
          "condition_outcomes": {
            "$ref": "#/components/schemas/OperationWorkflowConditionOutcomeSummary"
          },
          "decision_outcomes": {
            "$ref": "#/components/schemas/OperationWorkflowDecisionOutcomeSummary"
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time"
          },
          "cohort_token": {
            "type": "string",
            "maxLength": 512
          },
          "workflow": {
            "type": "string",
            "maxLength": 63
          },
          "cohort": {
            "type": "string",
            "enum": [
              "completed",
              "ongoing"
            ]
          },
          "group": {
            "$ref": "#/components/schemas/OperationWorkflowPerformanceGroup"
          },
          "matching_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "sampled_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "complete_history_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "excluded_incomplete_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cohort_truncated": {
            "type": "boolean"
          },
          "exclusions": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPerformanceCoverageReason"
            }
          },
          "duration": {
            "$ref": "#/components/schemas/OperationWorkflowDurationDistribution"
          },
          "items": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPerformanceInstance"
            }
          }
        }
      },
      "OperationWorkflowPerformanceSummary": {
        "description": "Completed and ongoing workflow cohorts with bounded sampling, history coverage and duration distributions.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "cohort_token",
          "evaluated_at",
          "workflow",
          "cohort_limit",
          "completed",
          "ongoing"
        ],
        "properties": {
          "new_missing_progress": {
            "$ref": "#/components/schemas/OperationWorkflowNewMissingConditionProgress"
          },
          "missing_progress": {
            "$ref": "#/components/schemas/OperationWorkflowMissingConditionProgress"
          },
          "condition_coverage": {
            "$ref": "#/components/schemas/OperationWorkflowConditionCoverage"
          },
          "refresh_progress": {
            "$ref": "#/components/schemas/OperationWorkflowConditionRefreshProgress"
          },
          "active_conditions": {
            "$ref": "#/components/schemas/OperationWorkflowActiveConditionSummary"
          },
          "condition_outcomes": {
            "$ref": "#/components/schemas/OperationWorkflowConditionOutcomeSummary"
          },
          "decision_outcomes": {
            "$ref": "#/components/schemas/OperationWorkflowDecisionOutcomeSummary"
          },
          "cohort_token": {
            "type": "string",
            "maxLength": 512,
            "description": "Opaque selector-bound token for opening consistent contributor views."
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time"
          },
          "workflow": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "cohort_limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "completed": {
            "$ref": "#/components/schemas/OperationWorkflowPerformanceCohort"
          },
          "ongoing": {
            "$ref": "#/components/schemas/OperationWorkflowPerformanceCohort"
          }
        }
      },
      "OperationWorkflowConditionRefreshProgress": {
        "type": "object",
        "additionalProperties": false,
        "description": "Report freshness progress reconstructed at baseline_token evaluation time using publication visibility in current retained completed and ongoing cohorts. This is not a stored baseline cohort, a total historical backlog, or business verification. Only continuous retained report history qualifies; contract boundaries are permitted for explicit contract_changed classification without relaxing existing duration or active-summary eligibility. Unknown history and conflicting or over-limit evidence are excluded. Status totals include all baseline overdue identities before per-workflow preview limits. Completed workflows remain visible as terminal reports without implying cleared verification.",
        "required": [
          "baseline_at",
          "evaluated_at",
          "sampled_workflow_count",
          "compared_workflow_count",
          "no_baseline_workflow_count",
          "no_overdue_baseline_workflow_count",
          "excluded_incomplete_workflow_count",
          "excluded_ambiguous_workflow_count",
          "excluded_condition_evidence_workflow_count",
          "newer_report_condition_count",
          "statuses",
          "items"
        ],
        "properties": {
          "baseline_at": {
            "type": "string",
            "format": "date-time"
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time"
          },
          "sampled_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "compared_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "no_baseline_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "no_overdue_baseline_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "excluded_incomplete_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "excluded_ambiguous_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "excluded_condition_evidence_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "newer_report_condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "statuses": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowConditionRefreshProgressCount"
            }
          },
          "items": {
            "type": "array",
            "maxItems": 200,
            "description": "Compared workflows in stable workflow identity order from current samples of up to 100 completed and 100 ongoing runs. Missing original baseline members are not classified as cleared.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowConditionRefreshProgressInstance"
            }
          }
        }
      },
      "OperationWorkflowConditionRefreshProgressCount": {
        "type": "object",
        "additionalProperties": false,
        "description": "Exact condition count for one reporting progress status, computed before preview truncation. Refreshed means a newer report within its pinned age budget; still_overdue includes newer reports already overdue. Unreported denotes an absent exact condition and decision/rule identity, not proof of a cleared business condition. Contract changes are not compared across definitions. Budget removal is not a refresh.",
        "required": [
          "status",
          "condition_count"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "refreshed",
              "still_overdue",
              "unreported",
              "contract_changed",
              "budget_removed"
            ]
          },
          "condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "OperationWorkflowConditionRefreshProgressInstance": {
        "type": "object",
        "additionalProperties": false,
        "description": "One currently sampled workflow with overdue reporting evidence at the reconstructed baseline. Subject, current state and optional operator tenant context support workflow links. Customer projections omit tenant identifiers. Current terminal state does not imply reporting freshness or business verification success.",
        "required": [
          "subject",
          "state",
          "baseline_overdue_condition_count",
          "newer_report_condition_count",
          "statuses",
          "changes_truncated",
          "changes"
        ],
        "properties": {
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "subject": {
            "$ref": "#/components/schemas/OperationSubject"
          },
          "state": {
            "$ref": "#/components/schemas/OperationWorkflowState"
          },
          "baseline_overdue_condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "newer_report_condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "statuses": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowConditionRefreshProgressCount"
            }
          },
          "changes_truncated": {
            "type": "boolean"
          },
          "changes": {
            "type": "array",
            "maxItems": 16,
            "description": "First 16 overdue baseline identities in canonical order with before and optional exact-identity after evidence; status counts remain exact.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowConditionRefreshProgressChange"
            }
          }
        }
      },
      "OperationWorkflowConditionRefreshProgressChange": {
        "type": "object",
        "additionalProperties": false,
        "description": "Before and optional after reports for one baseline overdue condition. Results may change while matching exact contract and decision/rule/version and condition ID/description. Newer report is independent of current freshness. Removed identities and budgets are not evidence of refreshed verification. Contract changes have no comparable after fact.",
        "required": [
          "status",
          "newer_report",
          "before",
          "explanation"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "refreshed",
              "still_overdue",
              "unreported",
              "contract_changed",
              "budget_removed"
            ]
          },
          "newer_report": {
            "type": "boolean"
          },
          "before": {
            "$ref": "#/components/schemas/OperationWorkflowDecisionOutcomeEvidence"
          },
          "after": {
            "$ref": "#/components/schemas/OperationWorkflowDecisionOutcomeEvidence"
          },
          "explanation": {
            "type": "string"
          }
        }
      },
      "OperationWorkflowConditionFreshness": {
        "type": "object",
        "additionalProperties": false,
        "description": "Report-age status using the selected fact reporting Operation's immutable condition definition and the summary evaluation time. A positive budget yields a refresh deadline from occurred_at; overdue begins at the deadline. Missing or zero budgets remain no_budget. This does not expire facts, change reported results, or authorize execution. Republishing an explicit snapshot updates reporting freshness; it does not prove renewed business verification.",
        "required": [
          "status"
        ],
        "properties": {
          "refresh_owner": {
            "type": "string",
            "maxLength": 128,
            "description": "Public refresh owner copied from the selected fact milestone on its reporting Operation pinned definition. UTF-8 byte bound; no controls or surrounding whitespace. Omission is unassigned."
          },
          "refresh_instructions": {
            "type": "string",
            "maxLength": 1024,
            "description": "Application-declared refresh instructions copied from the selected fact pinned condition definition. UTF-8 byte bound; no controls or surrounding whitespace. Displayed as text and never executed."
          },
          "status": {
            "type": "string",
            "enum": [
              "within_budget",
              "overdue",
              "no_budget"
            ]
          },
          "evidence_max_age_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 315360000
          },
          "refresh_due_at": {
            "type": "string",
            "format": "date-time"
          },
          "overdue_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "OperationWorkflowConditionRefreshPriority": {
        "type": "object",
        "additionalProperties": false,
        "description": "Evidence and explanation for one ongoing workflow with overdue condition reports. Rankings use the same token-bound sample, complete-history eligibility and pinned definitions as active condition coverage. Owner lists and unassigned condition counts include all qualifying identities before the 16-fact preview cap. The oldest evidence has the earliest selected overdue report timestamp with canonical identity breaking ties, and is included independently of the preview. This is observational prioritization without business severity or execution authority.",
        "required": [
          "oldest_evidence",
          "oldest_evidence_age_seconds",
          "blocked_seconds",
          "refresh_owners",
          "unassigned_condition_count",
          "explanation"
        ],
        "properties": {
          "oldest_evidence": {
            "$ref": "#/components/schemas/OperationWorkflowDecisionOutcomeEvidence"
          },
          "oldest_evidence_age_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Age of the oldest selected overdue report at evaluated_at. This is report age rather than seconds past its refresh deadline."
          },
          "blocked_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Full observed workflow blocked duration through evaluated_at; not time attributed to these conditions."
          },
          "refresh_owners": {
            "type": "array",
            "maxItems": 256,
            "uniqueItems": true,
            "description": "All distinct assigned refresh owners across qualifying overdue conditions, sorted lexically. Independent of owner-group display and evidence preview limits.",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          "unassigned_condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Number of qualifying overdue conditions without a pinned refresh owner; independent of preview limits."
          },
          "explanation": {
            "type": "string",
            "description": "Explains the selected age or blocked-duration ranking using observed evidence without assigning causation or severity."
          }
        }
      },
      "OperationWorkflowConditionRefreshOwnerGroup": {
        "type": "object",
        "additionalProperties": false,
        "description": "Eligible ongoing workflows with overdue condition reports assigned to one pinned refresh owner. Missing owners are unassigned. Each workflow counts once per owner even with multiple overdue conditions, and can appear under several owners. Durations cover the entire observed workflow, not time under the owner. Guidance never authorizes verification or execution.",
        "required": [
          "unassigned",
          "overdue_condition_count",
          "elapsed_time",
          "blocked_time"
        ],
        "properties": {
          "owner": {
            "type": "string",
            "maxLength": 128
          },
          "unassigned": {
            "type": "boolean"
          },
          "overdue_condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "elapsed_time": {
            "$ref": "#/components/schemas/OperationWorkflowDurationDistribution"
          },
          "blocked_time": {
            "$ref": "#/components/schemas/OperationWorkflowDurationDistribution"
          }
        }
      },
      "OperationWorkflowActiveConditionSummary": {
        "type": "object",
        "additionalProperties": false,
        "description": "Latest explicit condition snapshots in the ongoing sample with complete retained history. The latest reason and latest nonempty selected-path snapshot provide independent contexts; a path without a fact clears that path context. Metadata-only reports preserve evidence. Explicit decision omission removes older conditions. Contract changes reset contexts. Conflicting results for an exact identity exclude the workflow. Missing conditions remain unreported. At most 256 contexts and 256 final condition identities per workflow qualify. Groups overlap; no present business truth or causation is inferred.",
        "required": [
          "overdue_workflow_count",
          "overdue_condition_count",
          "refresh_owners_truncated",
          "refresh_owners",
          "matching_workflow_count",
          "sampled_workflow_count",
          "linked_workflow_count",
          "excluded_incomplete_workflow_count",
          "excluded_ambiguous_workflow_count",
          "excluded_condition_evidence_workflow_count",
          "unclassified_workflow_count",
          "cohort_truncated",
          "groups_truncated",
          "groups"
        ],
        "properties": {
          "overdue_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Eligible sampled workflows with at least one overdue selected condition report; counted once before owner display limits."
          },
          "overdue_condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Exact selected overdue condition identities across eligible sampled workflows before owner display limits."
          },
          "refresh_owners_truncated": {
            "type": "boolean"
          },
          "refresh_owners": {
            "type": "array",
            "maxItems": 64,
            "description": "First 64 owner strings in lexical order; unassigned sorts first. Counts for returned owners are exact. Workflows may overlap across owners.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowConditionRefreshOwnerGroup"
            }
          },
          "matching_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "sampled_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "linked_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "excluded_incomplete_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "excluded_ambiguous_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "excluded_condition_evidence_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unclassified_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cohort_truncated": {
            "type": "boolean"
          },
          "groups_truncated": {
            "type": "boolean"
          },
          "groups": {
            "type": "array",
            "maxItems": 64,
            "description": "First 64 contract/decision/rule/version/condition ID/description/result identities in lexical order with exact counts for returned groups.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowActiveConditionGroup"
            }
          }
        }
      },
      "OperationWorkflowActiveConditionGroup": {
        "type": "object",
        "additionalProperties": false,
        "description": "One latest explicitly reported result per exact condition identity and workflow. Elapsed and blocked durations cover the entire observed workflow to evaluated_at, not time under the condition. Evidence age is measured at the same time. Workflow state staleness follows its declared threshold and does not expire the condition.",
        "required": [
          "within_budget_workflow_count",
          "overdue_workflow_count",
          "no_budget_workflow_count",
          "contract_version",
          "decision_code",
          "rule_id",
          "rule_version",
          "condition_id",
          "condition_description",
          "condition_result",
          "stale_workflow_count",
          "elapsed_time",
          "blocked_time",
          "evidence_age"
        ],
        "properties": {
          "within_budget_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "overdue_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "no_budget_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "contract_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000
          },
          "decision_code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "rule_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "rule_version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "condition_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "condition_description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          },
          "condition_result": {
            "type": "string",
            "enum": [
              "pass",
              "fail",
              "unknown"
            ]
          },
          "stale_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "elapsed_time": {
            "$ref": "#/components/schemas/OperationWorkflowDurationDistribution"
          },
          "blocked_time": {
            "$ref": "#/components/schemas/OperationWorkflowDurationDistribution"
          },
          "evidence_age": {
            "$ref": "#/components/schemas/OperationWorkflowDurationDistribution"
          }
        }
      },
      "OperationWorkflowConditionOutcomeSummary": {
        "type": "object",
        "additionalProperties": false,
        "description": "Observed condition/result associations with latest reported outcomes in the completed performance sample. Only complete histories with a reported outcome and at most 256 exact condition identities qualify. Reasons and selected-path decision facts at or before the first terminal report supply explicit results. Missing conditions are unreported; unknown is explicit. Groups overlap and do not establish causation.",
        "required": [
          "matching_workflow_count",
          "sampled_workflow_count",
          "linked_workflow_count",
          "changing_result_workflow_count",
          "excluded_incomplete_workflow_count",
          "missing_outcome_workflow_count",
          "unclassified_workflow_count",
          "excluded_condition_evidence_workflow_count",
          "cohort_truncated",
          "groups_truncated",
          "groups"
        ],
        "properties": {
          "matching_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "All completed matching workflows before bounded sampling."
          },
          "sampled_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "linked_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Eligible sampled workflows with reported condition evidence; includes workflows whose groups are omitted by the display cap."
          },
          "changing_result_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Eligible linked workflows reporting multiple results for at least one exact condition and rule identity; counted once per workflow."
          },
          "excluded_incomplete_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "missing_outcome_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unclassified_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Complete sampled workflows with an outcome but no reported conditions; omission is not unknown."
          },
          "excluded_condition_evidence_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Complete workflows with an outcome exceeding 256 exact condition identities; excluded entirely before group display limits."
          },
          "cohort_truncated": {
            "type": "boolean"
          },
          "groups_truncated": {
            "type": "boolean"
          },
          "groups": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowConditionOutcomeGroup"
            },
            "description": "First 64 identities in contract/decision/rule/version/condition ID/description/result/outcome lexical order. Counts of overlapping groups must not be summed."
          }
        }
      },
      "OperationWorkflowConditionOutcomeGroup": {
        "type": "object",
        "additionalProperties": false,
        "description": "A workflow counts once per exact contract and decision and rule/version and condition ID/description and observed result and outcome. Different descriptions remain separate. Multiple observed results cause overlapping memberships. Durations cover the full completed workflow rather than time under this condition; no causal claim.",
        "required": [
          "contract_version",
          "decision_code",
          "rule_id",
          "rule_version",
          "condition_id",
          "condition_description",
          "condition_result",
          "outcome_code",
          "changing_result_workflow_count",
          "completion_time",
          "blocked_time"
        ],
        "properties": {
          "contract_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000
          },
          "decision_code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "rule_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "rule_version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "condition_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "condition_description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "description": "Public condition vocabulary included in the exact grouping identity; UTF-8 byte bound without controls."
          },
          "condition_result": {
            "type": "string",
            "enum": [
              "pass",
              "fail",
              "unknown"
            ]
          },
          "outcome_code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "changing_result_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Contributors reporting more than one result for this exact condition identity before or at the first terminal report."
          },
          "completion_time": {
            "$ref": "#/components/schemas/OperationWorkflowDurationDistribution"
          },
          "blocked_time": {
            "$ref": "#/components/schemas/OperationWorkflowDurationDistribution"
          }
        }
      },
      "OperationWorkflowDecisionOutcomeSummary": {
        "type": "object",
        "additionalProperties": false,
        "description": "Observed decision and path associations with latest reported outcomes in the completed performance cohort. Only complete histories with a reported outcome qualify. Repeated decision or path identities count once per workflow and group. Groups overlap; their counts must not be summed. Classification uses reasons and selections reported at or before the first terminal report. Sequence does not establish causation. Groups retain the first 64 canonical identities in ascending order.",
        "required": [
          "matching_workflow_count",
          "sampled_workflow_count",
          "linked_workflow_count",
          "excluded_incomplete_workflow_count",
          "missing_outcome_workflow_count",
          "unclassified_workflow_count",
          "cohort_truncated",
          "groups_truncated",
          "groups"
        ],
        "properties": {
          "rule_comparisons": {
            "$ref": "#/components/schemas/OperationWorkflowRuleComparisonSummary"
          },
          "matching_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "All matching completed workflows before bounded sampling."
          },
          "sampled_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "linked_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Sampled complete workflows with a reported outcome and at least one decision or path identity. Includes workflows whose groups are omitted by the group limit."
          },
          "excluded_incomplete_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "missing_outcome_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Complete completed workflows without a latest reported outcome code."
          },
          "unclassified_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Complete completed workflows with an outcome but no qualifying decision or path."
          },
          "cohort_truncated": {
            "type": "boolean"
          },
          "groups_truncated": {
            "type": "boolean"
          },
          "groups": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowDecisionOutcomeGroup"
            }
          }
        }
      },
      "OperationWorkflowRuleComparisonSummary": {
        "type": "object",
        "additionalProperties": false,
        "description": "Side-by-side rule version statistics from the same bounded completed workflow sample. Observed identities are scoped to contract, decision code and rule ID. Version names are opaque and sorted lexically, not chronologically. Workflows may report several versions and contribute to several columns; comparisons do not establish causation or statistical significance. Coverage of unobserved versions cannot be inferred from missing history.",
        "required": [
          "sampled_workflow_count",
          "unattributed_workflow_count",
          "comparisons_truncated",
          "comparisons"
        ],
        "properties": {
          "sampled_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unattributed_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Sampled workflows without an observed decision identity in the retained window. Includes missing history and paths without decisions; absence does not prove a rule was unused."
          },
          "comparisons_truncated": {
            "type": "boolean"
          },
          "comparisons": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowRuleComparison"
            }
          }
        }
      },
      "OperationWorkflowRuleComparison": {
        "type": "object",
        "additionalProperties": false,
        "description": "One pinned contract, decision code and rule ID with side-by-side version columns. Compared status means at least two returned versions have eligible observations; it is not a significance test or a claim of improvement. At most 16 canonical identities and 16 lexical versions per identity are retained.",
        "required": [
          "single_version_status",
          "multi_version_workflow_count",
          "eligible_multi_version_workflow_count",
          "examples_truncated",
          "multi_version_examples",
          "contract_version",
          "decision_code",
          "rule_id",
          "status",
          "versions_truncated",
          "versions"
        ],
        "properties": {
          "single_version_status": {
            "type": "string",
            "enum": [
              "compared",
              "insufficient_data"
            ],
            "description": "At least two returned versions need eligible single-version workflows to compare this subset."
          },
          "multi_version_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Distinct sampled workflows reporting multiple versions for this comparison identity, including incomplete histories and versions omitted by limits."
          },
          "eligible_multi_version_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "examples_truncated": {
            "type": "boolean"
          },
          "multi_version_examples": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowRuleVersionOverlap"
            }
          },
          "contract_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000
          },
          "decision_code": {
            "type": "string",
            "maxLength": 64
          },
          "rule_id": {
            "type": "string",
            "maxLength": 64
          },
          "status": {
            "type": "string",
            "enum": [
              "compared",
              "insufficient_data"
            ]
          },
          "versions_truncated": {
            "type": "boolean"
          },
          "versions": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowRuleVersionStatistics"
            }
          }
        }
      },
      "OperationWorkflowRuleVersionStatistics": {
        "type": "object",
        "additionalProperties": false,
        "description": "Each sampled workflow counts once per observed contract/decision/rule/version identity. Observed membership uses retained reports up to the first retained terminal report; incomplete histories supply coverage counts only. Eligible workflows require complete history and a latest reported outcome. Duration distributions cover the full completed workflow. Outcome proportions use all eligible workflows for this version as denominator, including omitted outcome groups.",
        "required": [
          "rule_version",
          "observed_workflow_count",
          "eligible_workflow_count",
          "excluded_incomplete_workflow_count",
          "missing_outcome_workflow_count",
          "completion_time",
          "blocked_time",
          "outcomes_truncated",
          "outcomes"
        ],
        "properties": {
          "single_version": {
            "$ref": "#/components/schemas/OperationWorkflowRuleVersionCohort"
          },
          "rule_version": {
            "type": "string",
            "maxLength": 128
          },
          "observed_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "eligible_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "excluded_incomplete_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "missing_outcome_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "completion_time": {
            "$ref": "#/components/schemas/OperationWorkflowDurationDistribution"
          },
          "blocked_time": {
            "$ref": "#/components/schemas/OperationWorkflowDurationDistribution"
          },
          "outcomes_truncated": {
            "type": "boolean"
          },
          "outcomes": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowRuleVersionOutcome"
            }
          }
        }
      },
      "OperationWorkflowRuleVersionCohort": {
        "type": "object",
        "additionalProperties": false,
        "description": "Complete completed workflows with a latest reported outcome and exactly one observed version for the same contract/decision/rule identity before the first terminal report. Detection occurs before version truncation. Incomplete histories never qualify. Statistics exclude overlapping workflows and are still observational rather than causal.",
        "required": [
          "eligible_workflow_count",
          "completion_time",
          "blocked_time",
          "outcomes_truncated",
          "outcomes"
        ],
        "properties": {
          "eligible_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "completion_time": {
            "$ref": "#/components/schemas/OperationWorkflowDurationDistribution"
          },
          "blocked_time": {
            "$ref": "#/components/schemas/OperationWorkflowDurationDistribution"
          },
          "outcomes_truncated": {
            "type": "boolean"
          },
          "outcomes": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowRuleVersionOutcome"
            }
          }
        }
      },
      "OperationWorkflowRuleVersionOverlap": {
        "type": "object",
        "additionalProperties": false,
        "description": "Bounded observed multi-version example in stable workflow identity order. Up to 16 earliest-per-version decision reports appear in revision order; ties do not imply business ordering. Missing history may hide other versions or earlier terminal reports. Evidence links explain observed membership and do not establish that a policy was replaced.",
        "required": [
          "subject",
          "instance_id",
          "operation_id",
          "history_complete",
          "eligible",
          "evidence_truncated",
          "evidence"
        ],
        "properties": {
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "subject": {
            "$ref": "#/components/schemas/OperationSubject"
          },
          "instance_id": {
            "type": "string",
            "maxLength": 256
          },
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "history_complete": {
            "type": "boolean"
          },
          "eligible": {
            "type": "boolean"
          },
          "evidence_truncated": {
            "type": "boolean"
          },
          "evidence": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowDecisionOutcomeEvidence"
            }
          }
        }
      },
      "OperationWorkflowRuleVersionOutcome": {
        "type": "object",
        "additionalProperties": false,
        "description": "One latest application-reported outcome among eligible workflows associated with this rule version. Up to 16 outcomes are returned in code order. Basis points are rounded down, so displayed proportions may sum below 10000 even without truncation.",
        "required": [
          "outcome_code",
          "workflow_count",
          "proportion_basis_points"
        ],
        "properties": {
          "outcome_code": {
            "type": "string",
            "maxLength": 64
          },
          "workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "proportion_basis_points": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 10000
          }
        }
      },
      "OperationWorkflowDecisionOutcomeGroup": {
        "type": "object",
        "additionalProperties": false,
        "description": "One exact contract, decision or path, rule version and reported outcome identity. Each contributing workflow counts once. Durations cover the full completed workflow and use the existing performance history rules; they do not measure rule causation or decision execution time. Overlapping blockers count once in each workflow's blocked duration.",
        "required": [
          "kind",
          "contract_version",
          "outcome_code",
          "completion_time",
          "blocked_time"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "decision",
              "path"
            ]
          },
          "contract_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000
          },
          "decision_code": {
            "type": "string",
            "maxLength": 64
          },
          "rule_id": {
            "type": "string",
            "maxLength": 64
          },
          "rule_version": {
            "type": "string",
            "maxLength": 128
          },
          "group_id": {
            "type": "string",
            "maxLength": 64
          },
          "path_id": {
            "type": "string",
            "maxLength": 64
          },
          "outcome_code": {
            "type": "string",
            "maxLength": 64
          },
          "completion_time": {
            "$ref": "#/components/schemas/OperationWorkflowDurationDistribution"
          },
          "blocked_time": {
            "$ref": "#/components/schemas/OperationWorkflowDurationDistribution"
          }
        }
      },
      "OperationWorkflowDurationDistribution": {
        "type": "object",
        "additionalProperties": false,
        "description": "One accumulated duration per eligible workflow. Nearest-rank percentiles are zero when workflow_count is zero.",
        "required": [
          "workflow_count",
          "total_seconds",
          "p50_seconds",
          "p95_seconds"
        ],
        "properties": {
          "workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "p50_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "p95_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "OperationWorkflowPerformanceCoverageReason": {
        "description": "Count of sampled workflows excluded for one retained-history coverage reason.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "reason",
          "workflow_count"
        ],
        "properties": {
          "reason": {
            "type": "string",
            "enum": [
              "missing_start",
              "missing_latest",
              "revision_gap",
              "duplicate_revision",
              "out_of_order_time",
              "future_observation",
              "contract_changed",
              "state_discontinuity",
              "history_window_truncated",
              "verification_start_missing"
            ]
          },
          "workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "OperationWorkflowPerformanceCohort": {
        "type": "object",
        "additionalProperties": false,
        "description": "Counts distinguish all matches from the latest retained sample and complete eligible histories. Every duration excludes incomplete histories. Groups are ranked by total duration descending with stable identity ties. Overall distributions include eligible zero-duration instances; group distributions include only instances that reported that group. Overlapping blockers and verification waits are counted separately in their groups.",
        "required": [
          "sla_configured_workflow_count",
          "sla_evaluated_workflow_count",
          "sla_breached_workflow_count",
          "sla_unknown_workflow_count",
          "matching_workflow_count",
          "sampled_workflow_count",
          "complete_history_workflow_count",
          "excluded_incomplete_workflow_count",
          "cohort_truncated",
          "exclusions",
          "state_time",
          "blocked_time",
          "verification_wait",
          "states",
          "blockers",
          "verification_owners",
          "states_truncated",
          "blockers_truncated",
          "verification_owners_truncated"
        ],
        "properties": {
          "sla_configured_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "sla_evaluated_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "sla_breached_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "sla_unknown_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "matching_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "sampled_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "complete_history_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "excluded_incomplete_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cohort_truncated": {
            "type": "boolean"
          },
          "exclusions": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPerformanceCoverageReason"
            }
          },
          "state_time": {
            "$ref": "#/components/schemas/OperationWorkflowDurationDistribution"
          },
          "blocked_time": {
            "$ref": "#/components/schemas/OperationWorkflowDurationDistribution"
          },
          "verification_wait": {
            "$ref": "#/components/schemas/OperationWorkflowDurationDistribution"
          },
          "states": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowStatePerformance"
            }
          },
          "blockers": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowBlockerPerformance"
            }
          },
          "verification_owners": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowVerificationPerformance"
            }
          },
          "states_truncated": {
            "type": "boolean"
          },
          "blockers_truncated": {
            "type": "boolean"
          },
          "verification_owners_truncated": {
            "type": "boolean"
          }
        }
      },
      "OperationWorkflowStatePerformance": {
        "description": "Cohort duration distribution and evaluated SLA visits for one state and contract version.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "sla_evaluated_visit_count",
          "sla_breached_visit_count",
          "contract_version",
          "state",
          "duration"
        ],
        "properties": {
          "sla_evaluated_visit_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "sla_breached_visit_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "contract_version": {
            "type": "integer",
            "minimum": 1
          },
          "state": {
            "type": "string",
            "maxLength": 64
          },
          "duration": {
            "$ref": "#/components/schemas/OperationWorkflowDurationDistribution"
          }
        }
      },
      "OperationWorkflowBlockerPerformance": {
        "description": "Cohort duration distribution for one blocker target, code, contract version and observed owner.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "contract_version",
          "operation",
          "code",
          "owner",
          "duration"
        ],
        "properties": {
          "contract_version": {
            "type": "integer",
            "minimum": 1
          },
          "operation": {
            "type": "string",
            "maxLength": 64
          },
          "code": {
            "type": "string",
            "maxLength": 64
          },
          "owner": {
            "type": "string",
            "maxLength": 128,
            "description": "Application-reported blocker owner for this cohort group; empty means unassigned."
          },
          "duration": {
            "$ref": "#/components/schemas/OperationWorkflowDurationDistribution"
          }
        }
      },
      "OperationWorkflowVerificationPerformance": {
        "description": "Cohort verification-wait distribution and pending obligations for one verification owner.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "owner",
          "pending_resolution_count",
          "duration"
        ],
        "properties": {
          "owner": {
            "type": "string",
            "maxLength": 128,
            "description": "Verification recipient for this cohort group; empty means unassigned."
          },
          "pending_resolution_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "duration": {
            "$ref": "#/components/schemas/OperationWorkflowDurationDistribution"
          }
        }
      },
      "OperationWorkflowStateSLA": {
        "type": "object",
        "additionalProperties": false,
        "description": "Observational SLA for the current nonterminal state visit under its pinned contract. Consecutive same-state metadata reports preserve entry time. Known history establishes the current visit from revision 1 or a contiguous prior different state. Gaps or inconsistent times/versions/budgets yield unknown status and omit inferred timestamps/durations. Breached at due_at or later. Terminal states have no current SLA.",
        "required": [
          "evaluated_at",
          "budget_seconds",
          "status",
          "history_complete"
        ],
        "properties": {
          "warning_percent": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 99,
            "description": "Pinned warning percentage when configured."
          },
          "warning_at": {
            "type": "string",
            "format": "date-time",
            "description": "Warning time for a known state visit with a configured threshold."
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time"
          },
          "budget_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 315360000
          },
          "status": {
            "type": "string",
            "enum": [
              "within_budget",
              "at_risk",
              "breached",
              "unknown"
            ]
          },
          "history_complete": {
            "type": "boolean",
            "description": "Retained evidence establishes the current state visit entry. Earlier workflow history can still be incomplete."
          },
          "entered_at": {
            "type": "string",
            "format": "date-time"
          },
          "due_at": {
            "type": "string",
            "format": "date-time"
          },
          "elapsed_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "remaining_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Ceiling of remaining elapsed time. Zero at or after the due time."
          },
          "breached_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Whole seconds elapsed beyond the budget."
          }
        }
      },
      "OperationWorkflowBottlenecks": {
        "type": "object",
        "additionalProperties": false,
        "description": "Observed durations for one retained workflow instance. State/blocker intervals use application occurrence time. Verification waits use platform publication time. Gaps are excluded and incomplete histories are marked. Groups are sorted by observed duration and bounded independently of exact window totals.",
        "required": [
          "evaluated_at",
          "history_complete",
          "incomplete_reasons",
          "reports_in_window",
          "history_truncated",
          "ongoing",
          "state_seconds",
          "blocked_seconds",
          "verification_unknown_start_count",
          "verification_wait_seconds",
          "states",
          "blockers",
          "verification_owners",
          "states_truncated",
          "blockers_truncated",
          "verification_owners_truncated"
        ],
        "properties": {
          "evaluated_at": {
            "type": "string",
            "format": "date-time"
          },
          "history_complete": {
            "type": "boolean",
            "description": "True only when the retained window starts at revision 1 and reaches the current report without gaps or invalid interval boundaries."
          },
          "incomplete_reasons": {
            "type": "array",
            "maxItems": 10,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "missing_start",
                "missing_latest",
                "revision_gap",
                "duplicate_revision",
                "out_of_order_time",
                "future_observation",
                "contract_changed",
                "state_discontinuity",
                "history_window_truncated",
                "verification_start_missing"
              ]
            }
          },
          "observed_from": {
            "type": "string",
            "format": "date-time"
          },
          "observed_through": {
            "type": "string",
            "format": "date-time"
          },
          "reports_in_window": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1024
          },
          "history_truncated": {
            "type": "boolean"
          },
          "ongoing": {
            "type": "boolean",
            "description": "Current workflow state is nonterminal. Ongoing duration is evaluated as of evaluated_at."
          },
          "state_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "blocked_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Union of measured intervals with at least one active blocker. Overlapping blocker groups can sum to more than this total."
          },
          "verification_unknown_start_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "verification_wait_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Sum of whole observed wait seconds across obligations with known publication starts in the history window. Overlapping waits are counted separately."
          },
          "states": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowStateDuration"
            }
          },
          "blockers": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowBlockerDuration"
            }
          },
          "verification_owners": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowVerificationDuration"
            }
          },
          "states_truncated": {
            "type": "boolean"
          },
          "blockers_truncated": {
            "type": "boolean"
          },
          "verification_owners_truncated": {
            "type": "boolean"
          }
        }
      },
      "OperationWorkflowStateDuration": {
        "description": "Observed time and interval count for one state and contract version within a selected workflow instance.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "contract_version",
          "state",
          "observed_seconds",
          "observation_count",
          "ongoing"
        ],
        "properties": {
          "contract_version": {
            "type": "integer",
            "minimum": 1
          },
          "state": {
            "type": "string",
            "maxLength": 64
          },
          "observed_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "observation_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "ongoing": {
            "type": "boolean"
          }
        }
      },
      "OperationWorkflowBlockerDuration": {
        "description": "Observed blocked time and interval count for one target, code, contract version and owner within an instance.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "contract_version",
          "operation",
          "code",
          "owner",
          "observed_seconds",
          "observation_count",
          "ongoing"
        ],
        "properties": {
          "contract_version": {
            "type": "integer",
            "minimum": 1
          },
          "operation": {
            "type": "string",
            "maxLength": 64
          },
          "code": {
            "type": "string",
            "maxLength": 64
          },
          "owner": {
            "type": "string",
            "maxLength": 128,
            "description": "Blocker owner observed in this instance interval; empty means unassigned."
          },
          "observed_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "observation_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "ongoing": {
            "type": "boolean"
          }
        }
      },
      "OperationWorkflowVerificationDuration": {
        "description": "Publication-based proof waiting time and coverage counts for one verification owner within an instance.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "owner",
          "observed_seconds",
          "resolution_count",
          "pending_count",
          "unknown_start_count"
        ],
        "properties": {
          "owner": {
            "type": "string",
            "maxLength": 128,
            "description": "Application-assigned verification owner. Empty means unassigned."
          },
          "observed_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "resolution_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "pending_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unknown_start_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Retained obligations whose start report is outside the history window. No wait duration is inferred for these obligations."
          }
        }
      },
      "OperationWorkflowResolutionVerification": {
        "description": "Retained resolution claim and its exact proof-verification status under the original scoped workflow contract.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "resolution",
          "resolution_operation_id",
          "resolution_report_id",
          "resolution_revision",
          "status"
        ],
        "properties": {
          "resolution": {
            "$ref": "#/components/schemas/OperationWorkflowBlockerResolution"
          },
          "resolution_operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "resolution_report_id": {
            "type": "string",
            "format": "uuid"
          },
          "resolution_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "awaiting_verification",
              "verified"
            ]
          },
          "verified_at": {
            "type": "string",
            "format": "date-time",
            "description": "Retained proof publication time."
          }
        }
      },
      "OperationWorkflowBlockerResolution": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "code",
          "operation",
          "description",
          "blocker_operation_id",
          "blocker_report_id",
          "blocker_revision"
        ],
        "description": "Explicit application explanation for clearing one prior blocker occurrence. The source must be a retained report in the same owner/business-reference/workflow-instance/contract-version boundary and must contain this target/code. The containing state report supplies the resolution identity and timestamps. A cleared list alone does not imply a resolution fact.",
        "properties": {
          "verification_milestone_id": {
            "type": "string",
            "format": "uuid",
            "description": "Exact expected milestone ID paired with verification_milestone_name. Missing retained evidence leaves verification pending."
          },
          "verification_milestone_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$",
            "description": "Expected milestone name paired with its exact ID."
          },
          "verification_operation_id": {
            "type": "string",
            "format": "uuid",
            "description": "Optional evidence Operation ID. Defaults to the Operation containing this resolution. Evidence must match the same account/customer/app/scope/subject/workflow-instance/contract boundary."
          },
          "verification_owner": {
            "type": "string",
            "maxLength": 128,
            "description": "Public application-assigned verification owner limited to 128 UTF-8 bytes without control characters. Requires a verification milestone. Omitted means unassigned."
          },
          "resolved_by": {
            "type": "string",
            "maxLength": 128,
            "description": "Optional public application-reported resolver identifier or team, limited to 128 UTF-8 bytes without control characters. This is not verified platform identity."
          },
          "code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "operation": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512,
            "description": "Public UTF-8 explanation limited to 512 bytes without control characters."
          },
          "blocker_operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "blocker_report_id": {
            "type": "string",
            "format": "uuid"
          },
          "blocker_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "Source revision must precede the resolution report revision."
          }
        }
      },
      "OperationWorkflowBlocker": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "code",
          "description",
          "operation"
        ],
        "description": "Public application-reported reason a named target Operation must wait. Reports replace the entire prior blocker list at their state revision; these observations do not grant or enforce execution authority.",
        "properties": {
          "priority": {
            "type": "string",
            "enum": [
              "low",
              "normal",
              "high",
              "urgent"
            ],
            "description": "Application-assigned urgency. Omitted means normal for queue filtering and counts."
          },
          "business_impact": {
            "type": "string",
            "maxLength": 512,
            "description": "Public application-reported impact limited to 512 UTF-8 bytes without control characters."
          },
          "acknowledged_at": {
            "type": "string",
            "format": "date-time",
            "description": "Application acknowledgement time paired with acknowledged_by. Must be at or after known first observation and at or before report time."
          },
          "acknowledged_by": {
            "type": "string",
            "maxLength": 128,
            "description": "Public application actor identifier paired with acknowledged_at. Limited to 128 UTF-8 bytes without control characters."
          },
          "follow_up_at": {
            "type": "string",
            "format": "date-time",
            "description": "Optional follow-up deadline at or after acknowledgement. Does not resolve the blocker or reset its age."
          },
          "owner": {
            "type": "string",
            "maxLength": 128,
            "description": "Optional public application-assigned person or team identifier, limited to 128 UTF-8 bytes without control characters. Empty or omitted means unassigned; this grants no execution authority."
          },
          "next_action": {
            "type": "string",
            "maxLength": 512,
            "description": "Optional public application-suggested resolution step, limited to 512 UTF-8 bytes without control characters. This is guidance rather than an executable command."
          },
          "first_observed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Optional application observation time at or before the containing report. Upgraded transactional SDKs preserve it across repeats of the same target/code until cleared. Omitted means unknown."
          },
          "code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512,
            "description": "Public UTF-8 text limited to 512 bytes without control characters."
          },
          "operation": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$",
            "description": "Target Operation name."
          }
        }
      },
      "OperationWorkflowDependency": {
        "type": "object",
        "additionalProperties": false,
        "description": "Direct prerequisite in the same application/customer/environment. References may have no retained state. Self references and duplicate targets are rejected.",
        "required": [
          "subject_type",
          "subject_id",
          "workflow",
          "instance_id"
        ],
        "properties": {
          "subject_type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "subject_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "workflow": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "instance_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "required_outcome_code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          }
        }
      },
      "OperationWorkflowRelatedInstance": {
        "type": "object",
        "additionalProperties": false,
        "description": "One-hop retained state resolution. Terminal without a required outcome does not establish business success.",
        "required": [
          "dependency",
          "status"
        ],
        "properties": {
          "dependency": {
            "$ref": "#/components/schemas/OperationWorkflowDependency"
          },
          "status": {
            "type": "string",
            "enum": [
              "unknown",
              "waiting",
              "terminal",
              "satisfied",
              "outcome_mismatch"
            ]
          },
          "state": {
            "$ref": "#/components/schemas/OperationWorkflowState"
          }
        }
      },
      "OperationWorkflowDecision": {
        "type": "object",
        "additionalProperties": false,
        "description": "Observational explanation from the selected contract and latest reported state, independent of fact pagination. These options are not execution authorization. Required milestones must be committed with the next transition; retained historical facts do not satisfy them.",
        "required": [
          "reason",
          "explanation",
          "needs_attention",
          "next_actions"
        ],
        "properties": {
          "blockers": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowBlocker"
            }
          },
          "reason": {
            "type": "string",
            "enum": [
              "state_unknown",
              "terminal",
              "no_declared_transition",
              "transitions_available",
              "state_stale",
              "application_blocked",
              "deadline_overdue",
              "dependency_waiting"
            ]
          },
          "explanation": {
            "type": "string"
          },
          "needs_attention": {
            "type": "boolean",
            "description": "True when state is unknown, stale, overdue, has application-reported blockers, or has unresolved direct dependencies."
          },
          "state_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "next_actions": {
            "type": "array",
            "maxItems": 4096,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowInstanceTransition"
            }
          }
        }
      },
      "OperationWorkflowDependentInstance": {
        "type": "object",
        "additionalProperties": false,
        "description": "Current retained source pointing at the selected prerequisite. Status describes that prerequisite against this source's required outcome. Needs attention is true only for an active source with an unmet prerequisite.",
        "required": [
          "subject",
          "state",
          "dependency_status",
          "needs_attention"
        ],
        "properties": {
          "subject": {
            "$ref": "#/components/schemas/OperationSubject"
          },
          "state": {
            "$ref": "#/components/schemas/OperationWorkflowState"
          },
          "required_outcome_code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "dependency_status": {
            "type": "string",
            "enum": [
              "unknown",
              "waiting",
              "terminal",
              "satisfied",
              "outcome_mismatch"
            ]
          },
          "needs_attention": {
            "type": "boolean"
          }
        }
      },
      "OperationWorkflowDependencyImpact": {
        "type": "object",
        "additionalProperties": false,
        "description": "One-hop reverse dependency impact within the selected customer/application/environment. Counts cover all current retained sources; items are capped at 100 with affected sources first. Omitted when no customer can be identified for an unknown account-side prerequisite. Independent of milestone and history pagination.",
        "required": [
          "items",
          "workflow_count",
          "impacted_workflow_count",
          "has_more"
        ],
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowDependentInstance"
            }
          },
          "workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "impacted_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "has_more": {
            "type": "boolean",
            "description": "True when the full retained relationship count exceeds the displayed 100 items."
          }
        }
      },
      "OperationWorkflowDependencyFinding": {
        "type": "object",
        "additionalProperties": false,
        "description": "Observed prerequisite-chain finding with a representative path starting at the selected workflow. Shared workflows are expanded once; this is not an exhaustive enumeration of every route or execution authorization.",
        "required": [
          "kind",
          "path",
          "explanation"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "reported_blockers",
              "state_unknown",
              "outcome_unknown",
              "outcome_mismatch",
              "awaiting_application",
              "state_stale",
              "deadline_overdue",
              "cycle",
              "trace_limit"
            ]
          },
          "path": {
            "type": "array",
            "minItems": 1,
            "maxItems": 9,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowDependency"
            }
          },
          "explanation": {
            "type": "string"
          },
          "state": {
            "$ref": "#/components/schemas/OperationWorkflowState"
          },
          "limit": {
            "type": "string",
            "enum": [
              "depth",
              "workflows",
              "findings",
              "dependencies"
            ]
          }
        }
      },
      "OperationWorkflowDependencyTrace": {
        "type": "object",
        "additionalProperties": false,
        "description": "Bounded deterministic depth-first traversal of unmet reported prerequisites within one customer/application/environment. Unknown retained state and traversal limits are distinct. Terminal sources and satisfied requirements stop traversal. Current reports may change while reading.",
        "required": [
          "findings",
          "visited_workflow_count",
          "examined_dependency_count",
          "depth_limit",
          "workflow_limit",
          "finding_limit",
          "dependency_limit",
          "truncated"
        ],
        "properties": {
          "findings": {
            "type": "array",
            "maxItems": 128,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowDependencyFinding"
            }
          },
          "visited_workflow_count": {
            "type": "integer",
            "minimum": 1,
            "maximum": 64,
            "description": "Distinct inspected workflow references including the selected source and cached lookups of unknown or satisfied prerequisites."
          },
          "examined_dependency_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 256
          },
          "depth_limit": {
            "type": "integer",
            "enum": [
              8
            ]
          },
          "workflow_limit": {
            "type": "integer",
            "enum": [
              64
            ]
          },
          "finding_limit": {
            "type": "integer",
            "enum": [
              128
            ]
          },
          "dependency_limit": {
            "type": "integer",
            "enum": [
              256
            ]
          },
          "truncated": {
            "type": "boolean"
          },
          "limits_reached": {
            "type": "array",
            "maxItems": 4,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "depth",
                "workflows",
                "findings",
                "dependencies"
              ]
            }
          }
        }
      },
      "OperationWorkflowActionPreviewRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "scope",
          "subject",
          "workflow",
          "instance_id"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid",
            "description": "Required in customer-self mode only."
          },
          "tenant_id": {
            "type": "string",
            "format": "uuid",
            "description": "Required in account mode only."
          },
          "scope": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40,
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
          },
          "subject": {
            "$ref": "#/components/schemas/OperationSubject"
          },
          "workflow": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "instance_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "operation": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "state_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "Optional expected retained source revision."
          },
          "contract_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000,
            "description": "Optional expected selected contract version."
          }
        },
        "description": "Explicit workflow instance selection. Self requires app_id and omits tenant_id; account requires tenant_id and omits app_id. Operation optionally filters candidate edges. Revision/version expectations are evaluated per candidate."
      },
      "OperationWorkflowActionPreviewResponse": {
        "description": "Observed current-state action candidates and their readiness without planned transaction evidence.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "subject",
          "workflow",
          "instance_id",
          "evaluated_at",
          "contract_version",
          "reason",
          "actions",
          "action_count",
          "has_more"
        ],
        "properties": {
          "subject": {
            "$ref": "#/components/schemas/OperationSubject"
          },
          "workflow": {
            "type": "string"
          },
          "instance_id": {
            "type": "string"
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time"
          },
          "state": {
            "$ref": "#/components/schemas/OperationWorkflowState"
          },
          "state_revision": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "contract_version": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          },
          "reason": {
            "type": "string",
            "enum": [
              "state_unknown",
              "terminal",
              "no_declared_transition",
              "actions_available"
            ]
          },
          "actions": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowTransitionReadiness"
            },
            "description": "Declared candidates evaluated with no planned milestones or decisions. Availability does not mean readiness or authorization."
          },
          "action_count": {
            "type": "integer",
            "minimum": 0
          },
          "has_more": {
            "type": "boolean",
            "description": "The 100-action cap was reached. Filter by operation to narrow the preview; this endpoint has no cursor."
          }
        }
      },
      "OperationWorkflowReadinessRequest": {
        "description": "Proposed workflow edge and evidence plan to evaluate against retained reports without executing it.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "scope",
          "subject",
          "workflow",
          "instance_id",
          "operation",
          "from_state",
          "to_state"
        ],
        "properties": {
          "selected_paths": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPathSelection"
            }
          },
          "effects": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPlannedEffect"
            }
          },
          "invariants": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPlannedInvariant"
            }
          },
          "decisions": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPlannedDecision"
            }
          },
          "app_id": {
            "type": "string",
            "format": "uuid",
            "description": "For this proposed transition, required in customer-self mode only."
          },
          "tenant_id": {
            "type": "string",
            "format": "uuid",
            "description": "For this proposed transition, required in account mode only."
          },
          "scope": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40,
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
          },
          "subject": {
            "$ref": "#/components/schemas/OperationSubject"
          },
          "workflow": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "instance_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "operation": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "from_state": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "to_state": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "milestones": {
            "type": "array",
            "maxItems": 16,
            "uniqueItems": true,
            "description": "Planned milestone names for this transition; retained historical facts are not evidence for the new transaction.",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          },
          "state_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "For this proposed transition, optional expected retained source revision."
          },
          "contract_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000,
            "description": "For this proposed transition, optional expected selected contract version."
          }
        }
      },
      "OperationWorkflowTransitionReadiness": {
        "type": "object",
        "additionalProperties": false,
        "description": "Ready means declared requirements match retained reports and the proposed milestone plan. It does not authorize or commit a transition or validate milestone payloads. All reported workflow prerequisites apply; only blockers targeting this Operation apply. Staleness, overdue deadlines, current-state reporting context and pending resolution proofs are advisories rather than undeclared guards. Reporting context uses current pinned expected_states, not invented required transition conditions. Planned reports do not replace this retained context.",
        "required": [
          "pending_verification_count",
          "pending_verifications_truncated",
          "transition",
          "declared",
          "ready",
          "reasons",
          "advisories",
          "contract_version",
          "blockers",
          "unmet_dependencies",
          "missing_milestones"
        ],
        "properties": {
          "reporting": {
            "$ref": "#/components/schemas/OperationWorkflowTransitionReporting"
          },
          "pending_verification_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Exact retained pending resolution proof count targeting the transition Operation before previews, across retained workflow reports. Advisory rather than a new transition guard."
          },
          "pending_verifications_truncated": {
            "type": "boolean"
          },
          "pending_verifications": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowResolutionVerification"
            },
            "description": "Canonical first matching pending proofs with declared owners and milestone references. Verified proofs and other target Operations are excluded."
          },
          "retained_milestone_groups": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowRetainedMilestoneGroupResult"
            }
          },
          "retained_milestones": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowRetainedMilestone"
            },
            "description": "Status and latest retained evidence for each prerequisite declared on this edge. Absent facts remain awaiting verification; invalidating facts mark prerequisites invalidated. Both statuses prevent readiness."
          },
          "unmet_effects": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowUnmetEffect"
            }
          },
          "unmet_invariants": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowUnmetInvariant"
            }
          },
          "invariant_blockers": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowBlocker"
            },
            "description": "Subset of matching blockers using the invariant- namespace. Failed or unknown application checks deny readiness through application_blocked."
          },
          "missing_dependency_workflows": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "type": "string"
            },
            "description": "Required workflow selectors without a reported prerequisite link."
          },
          "missing_policies": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPolicyRequirement"
            }
          },
          "transition": {
            "$ref": "#/components/schemas/OperationWorkflowInstanceTransition"
          },
          "declared": {
            "type": "boolean"
          },
          "ready": {
            "type": "boolean"
          },
          "reasons": {
            "type": "array",
            "maxItems": 18,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "state_unknown",
                "terminal",
                "transition_undeclared",
                "from_state_mismatch",
                "revision_mismatch",
                "contract_version_mismatch",
                "application_blocked",
                "dependency_unmet",
                "milestone_required",
                "policy_evidence_required",
                "dependency_required",
                "invariant_evidence_required",
                "effect_evidence_required",
                "retained_milestone_required",
                "retained_milestone_invalidated",
                "retained_milestone_expired",
                "retained_milestone_group_unmet",
                "path_selection_invalid"
              ]
            }
          },
          "advisories": {
            "type": "array",
            "maxItems": 6,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "state_stale",
                "deadline_overdue",
                "condition_reports_missing",
                "condition_reports_overdue",
                "condition_reporting_unknown",
                "verification_pending"
              ]
            }
          },
          "state_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "contract_version": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          },
          "blockers": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowBlocker"
            }
          },
          "unmet_dependencies": {
            "type": "array",
            "maxItems": 16,
            "description": "Unmet reference/status pairs; inspect full related states through the workflow detail.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowRelatedInstance"
            }
          },
          "missing_milestones": {
            "type": "array",
            "maxItems": 16,
            "uniqueItems": true,
            "items": {
              "type": "string"
            }
          }
        }
      },
      "OperationWorkflowReadinessResponse": {
        "description": "Readiness evaluation for the selected business subject and workflow instance at the reported time.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "subject",
          "workflow",
          "instance_id",
          "evaluated_at",
          "readiness"
        ],
        "properties": {
          "subject": {
            "$ref": "#/components/schemas/OperationSubject"
          },
          "workflow": {
            "type": "string"
          },
          "instance_id": {
            "type": "string"
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time"
          },
          "readiness": {
            "$ref": "#/components/schemas/OperationWorkflowTransitionReadiness"
          }
        }
      },
      "OperationWorkflowReadinessOverview": {
        "type": "object",
        "additionalProperties": false,
        "description": "At most 100 current-state declared edges evaluated without planned milestones. Counts cover all declared current-state edges; history cursors do not paginate this overview.",
        "required": [
          "items",
          "transition_count",
          "has_more"
        ],
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowTransitionReadiness"
            }
          },
          "transition_count": {
            "type": "integer",
            "minimum": 0
          },
          "has_more": {
            "type": "boolean"
          }
        }
      },
      "OperationWorkflowInstanceSnapshot": {
        "description": "Grouped view of the selected contract's declared steps and allowed transitions, current explicit state, and transition-history page for one workflow instance. Allowed transitions are contract edges by target Operation; the application still checks its business row and authorization before using one. Page-scoped facts follow the milestone cursor; retention-wide step summaries cover all matching facts still retained under the normal Operation retention rules.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "workflow",
          "instance_id",
          "contract_version",
          "steps",
          "transitions",
          "has_more"
        ],
        "properties": {
          "bottlenecks": {
            "$ref": "#/components/schemas/OperationWorkflowBottlenecks"
          },
          "resolution_verifications": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowResolutionVerification"
            },
            "description": "Selected instance proof preview with pending obligations first; exact counts include all distinct retained claims."
          },
          "awaiting_verification_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "resolution_verification_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "readiness": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessOverview"
          },
          "dependency_trace": {
            "$ref": "#/components/schemas/OperationWorkflowDependencyTrace"
          },
          "dependency_impact": {
            "$ref": "#/components/schemas/OperationWorkflowDependencyImpact"
          },
          "related_workflows": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowRelatedInstance"
            }
          },
          "decision": {
            "$ref": "#/components/schemas/OperationWorkflowDecision"
          },
          "workflow": {
            "type": "string"
          },
          "instance_id": {
            "type": "string"
          },
          "contract_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000
          },
          "state": {
            "$ref": "#/components/schemas/OperationWorkflowState"
          },
          "steps": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowInstanceStep"
            }
          },
          "allowed_transitions": {
            "type": "array",
            "maxItems": 4096,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowInstanceTransition"
            }
          },
          "transitions": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowStateHistoryEntry"
            }
          },
          "has_more": {
            "type": "boolean",
            "description": "True when either milestone or transition-history cursor has more pages."
          },
          "next_milestone_cursor": {
            "type": "string"
          },
          "next_transition_cursor": {
            "type": "string"
          }
        }
      },
      "OperationWorkflowInstanceTransition": {
        "description": "One allowed state edge from the selected contract version, bound to the Operation that can report it. Required milestones must be committed with the transition in the same application transaction. This declaration does not establish that the edge is currently valid for the application's business row or authorized for the caller.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "from",
          "to",
          "operation"
        ],
        "properties": {
          "retained_milestone_groups": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowRetainedMilestoneGroup"
            }
          },
          "retained_milestone_freshness": {
            "type": "array",
            "maxItems": 16,
            "uniqueItems": true,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowRetainedMilestoneFreshnessRule"
            },
            "description": "Freshness limits required for this selected transition."
          },
          "retained_milestone_invalidations": {
            "type": "array",
            "maxItems": 16,
            "uniqueItems": true,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowRetainedMilestoneInvalidationRule"
            },
            "description": "Rules for this selected edge linking retained prerequisites to invalidating facts from declared workflow steps. Business occurrence time determines order; an invalidating fact wins equal timestamps."
          },
          "required_retained_milestones": {
            "type": "array",
            "maxItems": 16,
            "uniqueItems": true,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowRetainedMilestoneRequirement"
            },
            "description": "For this selected edge, previously reported transaction-backed workflow facts required within the same ownership, subject, instance, and contract version; proposed evidence does not satisfy these prerequisites."
          },
          "required_effects": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowEffectRequirement"
            }
          },
          "required_invariants": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowInvariantRequirement"
            }
          },
          "required_dependency_workflows": {
            "type": "array",
            "maxItems": 16,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 63,
              "pattern": "^[a-z][a-z0-9-]{0,62}$"
            },
            "description": "For this selected contract edge, omitted means all reported dependencies; an empty array means none. Named workflows require at least one reported link and every matching link must meet its outcome requirement."
          },
          "required_policies": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPolicyRequirement"
            }
          },
          "from": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "to": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "operation": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z][a-z0-9-]*$",
            "description": "Manifest operation name that may report this transition."
          },
          "required_milestones": {
            "type": "array",
            "maxItems": 16,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            },
            "description": "For this selected contract edge, milestone names that must be committed in the same application transaction as this transition."
          }
        }
      },
      "OperationWorkflowInstanceStep": {
        "description": "One declared step with both current-page facts and a retention-wide summary for the selected contract version. Retention fields include all matching facts still retained under the normal Operation retention rules.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "step",
          "label",
          "milestone",
          "position",
          "observed",
          "milestones_in_page",
          "observed_in_retention",
          "milestones_in_retention"
        ],
        "properties": {
          "step": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "operation": {
            "type": "string"
          },
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "milestone": {
            "type": "string"
          },
          "position": {
            "type": "integer",
            "minimum": 1,
            "maximum": 32
          },
          "observed": {
            "type": "boolean",
            "description": "True when a matching fact is visible on the current milestone page."
          },
          "milestones_in_page": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Number of matching facts on the current milestone page."
          },
          "latest_milestone": {
            "$ref": "#/components/schemas/OperationWorkflowInstanceMilestoneRef",
            "description": "Latest matching fact on the current milestone page."
          },
          "observed_in_retention": {
            "type": "boolean",
            "description": "True when at least one matching fact for the selected contract version remains under normal Operation retention. False means no matching fact is currently retained and does not prove it never occurred."
          },
          "milestones_in_retention": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Number of matching facts for the selected contract version that remain under normal Operation retention."
          },
          "latest_retained_milestone": {
            "$ref": "#/components/schemas/OperationWorkflowInstanceMilestoneRef",
            "description": "Latest matching fact for the selected contract version by platform publication time across all currently retained facts."
          }
        }
      },
      "OperationWorkflowInstanceMilestoneRef": {
        "description": "Identity and occurrence and publication times of a milestone observed for a declared workflow step.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "operation_id",
          "occurred_at",
          "published_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "published_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperationWorkflowStateReport": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "workflow",
          "instance_id",
          "state",
          "revision",
          "occurred_at"
        ],
        "description": "Idempotent app-reported state update already committed with the business write. Revision is assigned transactionally by the application SDK. Contract version is filled from the pinned definition when omitted.",
        "properties": {
          "change_reason": {
            "$ref": "#/components/schemas/OperationWorkflowChangeReason"
          },
          "selected_paths": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPathSelection"
            }
          },
          "depends_on": {
            "type": "array",
            "maxItems": 16,
            "description": "Full replacement snapshot of direct prerequisite references.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowDependency"
            }
          },
          "dependencies_only": {
            "type": "boolean",
            "description": "Same-state metadata update mutually exclusive with other metadata-only flags."
          },
          "outcome_code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$",
            "description": "Explicit application-defined business result for a declared terminal state."
          },
          "outcome_description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512,
            "description": "Public UTF-8 description limited to 512 bytes without control characters. Required when outcome_code is supplied."
          },
          "outcome_only": {
            "type": "boolean",
            "description": "Same-state terminal outcome report. Requires from_state equal to state and no milestone evidence. Mutually exclusive with deadline_only and blockers_only. SDKs preserve current blockers and deadline."
          },
          "deadline_at": {
            "oneOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "string",
                "enum": [
                  ""
                ]
              }
            ],
            "description": "Optional application-reported due time. Omitted or empty in a report clears the deadline. Transactional SDKs inherit it from their counter unless explicitly updated."
          },
          "deadline_only": {
            "type": "boolean",
            "description": "Same-state deadline snapshot update. Requires from_state equal to state and no milestone evidence. Mutually exclusive with blockers_only. SDKs preserve current blockers."
          },
          "blocker_resolutions": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowBlockerResolution"
            }
          },
          "blockers": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowBlocker"
            }
          },
          "blockers_only": {
            "type": "boolean",
            "description": "Same-state blocker replacement. Requires from_state equal to state and no milestone evidence; not a business transition."
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "workflow": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "instance_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "^[^\\\\x00-\\\\x1f\\\\x7f]+$"
          },
          "from_state": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$",
            "description": "Current app database state before the requested declared transition. Required when the pinned workflow declares transitions."
          },
          "state": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "contract_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000,
            "description": "Optional version precondition; the server fills this from the immutable Operation definition."
          },
          "evidence_milestones": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowEvidenceMilestone"
            },
            "description": "Facts committed in the same application transaction as this transition."
          }
        }
      },
      "OperationWorkflowStateValidationRequest": {
        "description": "Batch of application-reported workflow updates to validate before their transaction commits.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "workflow_states"
        ],
        "properties": {
          "workflow_states": {
            "type": "array",
            "minItems": 1,
            "maxItems": 64,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowStateReport"
            }
          },
          "milestones": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "$ref": "#/components/schemas/OperationMilestoneRequest"
            },
            "description": "Facts from the same application transaction, used to verify transition evidence before commit."
          }
        }
      },
      "OperationWorkflowStateValidationResponse": {
        "description": "Validation outcome for an app-reported workflow-state batch.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "valid"
        ],
        "properties": {
          "valid": {
            "type": "boolean"
          }
        }
      },
      "OperationWorkflowStateReportResponse": {
        "description": "Acknowledgement returned after the platform records an app-reported workflow-state update.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "operation_id",
          "workflow",
          "instance_id",
          "state",
          "revision",
          "contract_version"
        ],
        "properties": {
          "change_reason": {
            "$ref": "#/components/schemas/OperationWorkflowChangeReason"
          },
          "selected_paths": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPathSelection"
            }
          },
          "depends_on": {
            "type": "array",
            "maxItems": 16,
            "description": "In the accepted report acknowledgement, full replacement snapshot of direct prerequisite references.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowDependency"
            }
          },
          "dependencies_only": {
            "type": "boolean",
            "description": "In the accepted report acknowledgement, same-state metadata update mutually exclusive with other metadata-only flags."
          },
          "outcome_code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$",
            "description": "In the accepted report acknowledgement, explicit application-defined business result for a declared terminal state."
          },
          "outcome_description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512,
            "description": "In the accepted report acknowledgement, public UTF-8 description limited to 512 bytes without control characters. Required when outcome_code is supplied."
          },
          "outcome_only": {
            "type": "boolean",
            "description": "In the accepted report acknowledgement, same-state terminal outcome report. Requires from_state equal to state and no milestone evidence. Mutually exclusive with deadline_only and blockers_only. SDKs preserve current blockers and deadline."
          },
          "deadline_at": {
            "type": "string",
            "format": "date-time",
            "description": "In the accepted report acknowledgement, optional application-reported due time. Omitted or empty in a report clears the deadline. Transactional SDKs inherit it from their counter unless explicitly updated."
          },
          "deadline_only": {
            "type": "boolean",
            "description": "In the accepted report acknowledgement, same-state deadline snapshot update. Requires from_state equal to state and no milestone evidence. Mutually exclusive with blockers_only. SDKs preserve current blockers."
          },
          "blocker_resolutions": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowBlockerResolution"
            }
          },
          "blockers": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowBlocker"
            }
          },
          "blockers_only": {
            "type": "boolean",
            "description": "In the accepted report acknowledgement, same-state blocker replacement. Requires from_state equal to state and no milestone evidence; not a business transition."
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "workflow": {
            "type": "string"
          },
          "instance_id": {
            "type": "string"
          },
          "from_state": {
            "type": "string",
            "description": "Previous app state when a declared transition was reported."
          },
          "state": {
            "type": "string"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "contract_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000
          },
          "evidence_milestones": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowEvidenceMilestone"
            }
          }
        }
      },
      "OperationWorkflowState": {
        "description": "Latest app-reported state for one declared workflow instance, including terminal and staleness indicators.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "workflow",
          "instance_id",
          "state",
          "terminal",
          "stale",
          "overdue",
          "occurred_at",
          "revision",
          "contract_version",
          "updated_at"
        ],
        "properties": {
          "change_reason": {
            "$ref": "#/components/schemas/OperationWorkflowChangeReason"
          },
          "selected_paths": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPathSelection"
            }
          },
          "sla": {
            "$ref": "#/components/schemas/OperationWorkflowStateSLA"
          },
          "depends_on": {
            "type": "array",
            "maxItems": 16,
            "description": "In the latest retained state, full replacement snapshot of direct prerequisite references.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowDependency"
            }
          },
          "dependencies_only": {
            "type": "boolean",
            "description": "In the latest retained state, same-state metadata update mutually exclusive with other metadata-only flags."
          },
          "outcome_code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$",
            "description": "In the latest retained state, explicit application-defined business result for a declared terminal state."
          },
          "outcome_description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512,
            "description": "In the latest retained state, public UTF-8 description limited to 512 bytes without control characters. Required when outcome_code is supplied."
          },
          "outcome_only": {
            "type": "boolean",
            "description": "In the latest retained state, same-state terminal outcome report. Requires from_state equal to state and no milestone evidence. Mutually exclusive with deadline_only and blockers_only. SDKs preserve current blockers and deadline."
          },
          "overdue": {
            "type": "boolean",
            "description": "True for an active workflow at or after its application-reported deadline."
          },
          "overdue_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Whole elapsed seconds since the missed due time."
          },
          "deadline_at": {
            "type": "string",
            "format": "date-time",
            "description": "In the latest retained state, optional application-reported due time. Omitted or empty in a report clears the deadline. Transactional SDKs inherit it from their counter unless explicitly updated."
          },
          "deadline_only": {
            "type": "boolean",
            "description": "In the latest retained state, same-state deadline snapshot update. Requires from_state equal to state and no milestone evidence. Mutually exclusive with blockers_only. SDKs preserve current blockers."
          },
          "blocker_resolutions": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowBlockerResolution"
            }
          },
          "report_id": {
            "type": "string",
            "format": "uuid",
            "description": "Identity of the latest reported snapshot."
          },
          "operation_id": {
            "type": "string",
            "format": "uuid",
            "description": "Operation that published the latest snapshot."
          },
          "blockers": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowBlocker"
            }
          },
          "blockers_only": {
            "type": "boolean",
            "description": "In the latest retained state, same-state blocker replacement. Requires from_state equal to state and no milestone evidence; not a business transition."
          },
          "workflow": {
            "type": "string"
          },
          "instance_id": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "terminal": {
            "type": "boolean",
            "description": "True when the state is listed in terminal_states on the pinned workflow definition that reported it."
          },
          "stale": {
            "type": "boolean",
            "description": "True when the app-reported occurrence time plus the pinned state_stale_after threshold is at or before the read time."
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time",
            "description": "App-reported time when the current state became true; used for stale-state age."
          },
          "stale_after_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 315360000,
            "description": "App-declared age threshold for the current state when one is configured."
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "contract_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000
          },
          "evidence_milestones": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowEvidenceMilestone"
            }
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid",
            "description": "Included only for account operator feeds."
          }
        }
      },
      "OperationWorkflowOutcomeLink": {
        "description": "Observed report-to-outcome path on the same retained history page. Links reported sequence without establishing business causation; durations are meaningful only for linked status.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "status",
          "summary",
          "elapsed_seconds",
          "blocked_seconds"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "linked",
              "outcome_unavailable",
              "history_incomplete",
              "timing_inconsistent"
            ]
          },
          "summary": {
            "type": "string",
            "maxLength": 512
          },
          "outcome_report_id": {
            "type": "string",
            "format": "uuid"
          },
          "outcome_operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "outcome_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "outcome_code": {
            "type": "string",
            "maxLength": 64
          },
          "elapsed_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Observed duration from this report to the linked outcome. Meaningful only when status is linked."
          },
          "blocked_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Observed intervals with at least one reported blocker. Overlapping blockers count once. Meaningful only when status is linked."
          }
        }
      },
      "OperationWorkflowConditionComparison": {
        "type": "object",
        "additionalProperties": false,
        "description": "Condition changes in explicit decision snapshots between consecutive retained revisions in the same tenant and workflow run and pinned contract. Shares history comparison statuses; missing decisions on metadata reports do not clear conditions. No causal inference.",
        "required": [
          "status",
          "changes",
          "truncated"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "compared",
              "baseline_unavailable",
              "revision_gap",
              "contract_changed",
              "ambiguous_revision"
            ]
          },
          "changes": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowConditionChange"
            },
            "description": "Reason conditions first then path groups then condition IDs in lexical order. Unchanged conditions are omitted. Contributor evidence carries changes for the entire qualifying report."
          },
          "truncated": {
            "type": "boolean",
            "description": "More condition changes exist than the 64 retained entries."
          }
        }
      },
      "OperationWorkflowConditionChange": {
        "type": "object",
        "additionalProperties": false,
        "description": "Application condition snapshots matched by ID within the reason or selected path group on one pinned contract. Changed includes a changed result or description. Unreported means absent from an explicit current decision and does not prove resolution.",
        "required": [
          "source",
          "condition_id",
          "status",
          "current_evidence",
          "explanation"
        ],
        "properties": {
          "source": {
            "type": "string",
            "enum": [
              "reason",
              "path"
            ]
          },
          "group_id": {
            "type": "string",
            "maxLength": 64,
            "description": "Selected path group for path comparisons; omitted for reasons."
          },
          "condition_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "changed",
              "newly_reported",
              "unreported"
            ]
          },
          "before": {
            "$ref": "#/components/schemas/OperationBusinessConditionResult"
          },
          "after": {
            "$ref": "#/components/schemas/OperationBusinessConditionResult"
          },
          "previous_evidence": {
            "$ref": "#/components/schemas/OperationWorkflowConditionEvidence"
          },
          "current_evidence": {
            "$ref": "#/components/schemas/OperationWorkflowConditionEvidence"
          },
          "explanation": {
            "type": "string",
            "maxLength": 512
          }
        }
      },
      "OperationWorkflowConditionEvidence": {
        "type": "object",
        "additionalProperties": false,
        "description": "Exact retained report and decision fact reference with reported rule identity. Previous evidence is absent when the baseline did not report a decision in this context. Links refer to the current retained Operation view.",
        "required": [
          "report_id",
          "operation_id",
          "revision",
          "milestone_id",
          "decision_code",
          "rule_id",
          "rule_version"
        ],
        "properties": {
          "report_id": {
            "type": "string",
            "format": "uuid"
          },
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "milestone_id": {
            "type": "string",
            "format": "uuid"
          },
          "decision_code": {
            "type": "string",
            "maxLength": 64
          },
          "rule_id": {
            "type": "string",
            "maxLength": 64
          },
          "rule_version": {
            "type": "string",
            "maxLength": 128
          },
          "path_id": {
            "type": "string",
            "maxLength": 64,
            "description": "Selected path when the decision was reported for a path group."
          }
        }
      },
      "OperationWorkflowRevisionComparison": {
        "type": "object",
        "additionalProperties": false,
        "description": "Derived comparison with the preceding retained report on this history page in the same workflow run and tenant. Gaps and unavailable baselines prevent inferred changes or causal claims.",
        "required": [
          "status",
          "summary",
          "changes",
          "evidence"
        ],
        "properties": {
          "condition_comparison": {
            "$ref": "#/components/schemas/OperationWorkflowConditionComparison"
          },
          "change_reason": {
            "$ref": "#/components/schemas/OperationWorkflowChangeReason"
          },
          "status": {
            "type": "string",
            "enum": [
              "compared",
              "baseline_unavailable",
              "revision_gap",
              "contract_changed",
              "ambiguous_revision"
            ]
          },
          "summary": {
            "type": "string",
            "maxLength": 512
          },
          "previous_report_id": {
            "type": "string",
            "format": "uuid"
          },
          "previous_operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "previous_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "changes": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowRevisionChange"
            }
          },
          "evidence": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowRevisionEvidence"
            }
          }
        }
      },
      "OperationWorkflowRevisionChange": {
        "type": "object",
        "additionalProperties": false,
        "description": "Deterministic reported state or blocker or path or decision change. Before and after contain bounded public snapshot text; removal of a blocker does not prove business resolution.",
        "required": [
          "kind",
          "key",
          "explanation"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "state_changed",
              "blocker_added",
              "blocker_removed",
              "blocker_updated",
              "path_selected",
              "path_changed",
              "decision_changed",
              "contract_changed"
            ]
          },
          "key": {
            "type": "string",
            "maxLength": 256
          },
          "before": {
            "type": "string",
            "maxLength": 8192
          },
          "after": {
            "type": "string",
            "maxLength": 8192
          },
          "explanation": {
            "type": "string",
            "maxLength": 512
          }
        }
      },
      "OperationWorkflowRevisionEvidence": {
        "type": "object",
        "additionalProperties": false,
        "description": "Links to reported decision or milestone facts and explicitly unverified expected verification facts. These references do not establish a cause for the revision.",
        "required": [
          "kind",
          "operation_id",
          "milestone_id"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "milestone",
              "decision",
              "verification_expected"
            ]
          },
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "milestone_id": {
            "type": "string",
            "format": "uuid"
          },
          "milestone": {
            "type": "string",
            "maxLength": 64
          }
        }
      },
      "OperationWorkflowStateHistoryEntry": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "operation_id",
          "workflow",
          "instance_id",
          "state",
          "revision",
          "contract_version",
          "occurred_at",
          "published_at"
        ],
        "description": "One retained app-reported state update. Pages are ordered by revision, then stable publication and report identifiers.",
        "properties": {
          "outcome_link": {
            "$ref": "#/components/schemas/OperationWorkflowOutcomeLink"
          },
          "change_reason": {
            "$ref": "#/components/schemas/OperationWorkflowChangeReason"
          },
          "comparison": {
            "$ref": "#/components/schemas/OperationWorkflowRevisionComparison"
          },
          "selected_paths": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPathSelection"
            }
          },
          "resolution_verifications": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowResolutionVerification"
            },
            "description": "Current retained-evidence status for verification obligations in this history report."
          },
          "depends_on": {
            "type": "array",
            "maxItems": 16,
            "description": "At this retained historical revision, full replacement snapshot of direct prerequisite references.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowDependency"
            }
          },
          "dependencies_only": {
            "type": "boolean",
            "description": "At this retained historical revision, same-state metadata update mutually exclusive with other metadata-only flags."
          },
          "outcome_code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$",
            "description": "At this retained historical revision, explicit application-defined business result for a declared terminal state."
          },
          "outcome_description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512,
            "description": "At this retained historical revision, public UTF-8 description limited to 512 bytes without control characters. Required when outcome_code is supplied."
          },
          "outcome_only": {
            "type": "boolean",
            "description": "At this retained historical revision, same-state terminal outcome report. Requires from_state equal to state and no milestone evidence. Mutually exclusive with deadline_only and blockers_only. SDKs preserve current blockers and deadline."
          },
          "deadline_at": {
            "type": "string",
            "format": "date-time",
            "description": "At this retained historical revision, optional application-reported due time. Omitted or empty in a report clears the deadline. Transactional SDKs inherit it from their counter unless explicitly updated."
          },
          "deadline_only": {
            "type": "boolean",
            "description": "At this retained historical revision, same-state deadline snapshot update. Requires from_state equal to state and no milestone evidence. Mutually exclusive with blockers_only. SDKs preserve current blockers."
          },
          "blocker_resolutions": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowBlockerResolution"
            }
          },
          "blockers": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowBlocker"
            }
          },
          "blockers_only": {
            "type": "boolean",
            "description": "At this retained historical revision, same-state blocker replacement. Requires from_state equal to state and no milestone evidence; not a business transition."
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "workflow": {
            "type": "string"
          },
          "instance_id": {
            "type": "string"
          },
          "from_state": {
            "type": "string",
            "description": "App state immediately before this retained revision, when the transition was declared."
          },
          "state": {
            "type": "string"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "contract_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000
          },
          "evidence_milestones": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowEvidenceMilestone"
            }
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "published_at": {
            "type": "string",
            "format": "date-time"
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid",
            "description": "Account-owner tenant identifier attached to this report in operator feeds."
          }
        }
      },
      "OperationSubjectSpec": {
        "description": "Optional public business reference extracted once from validated input on new admission. This metadata does not authorize access to the business entity.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type",
          "id_from"
        ],
        "properties": {
          "type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "id_from": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048,
            "pattern": "^/([^~\\x00-\\x1f\\x7f]|~[01])*$",
            "description": "JSON Pointer into input. The selected value must be a nonempty string; array indices use canonical decimal notation. Maximum 2048 UTF-8 bytes; ASCII controls are rejected."
          }
        }
      },
      "OperationSubject": {
        "description": "Immutable public business correlation metadata. Captured at admission and preserved through recovery and redeploy. Never an ownership or authorization claim.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type",
          "id"
        ],
        "properties": {
          "type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "^[^\\x00-\\x1f\\x7f]+$",
            "description": "Opaque application identifier, compared exactly. Maximum 256 UTF-8 bytes; ASCII controls are rejected. Use a public stable ID appropriate for customer-visible history."
          }
        }
      },
      "OperationDefinitionSpec": {
        "description": "Resolved immutable contract for an HTTP handler or a named linear workflow from the same deployment. Workflow definitions require POST ingress, reconciliation recovery and stages matching the steps; steps are HTTP actions, fixed timers or declared approvals, ending with an HTTP action. Ownership comes from verified authentication. Production admission remains disabled pending qualification.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "method",
          "path",
          "owner",
          "input_schema",
          "output_schema",
          "progress_stages"
        ],
        "properties": {
          "approvals": {
            "type": "array",
            "maxItems": 64,
            "description": "Approvals for a workflow definition. Every wait_for_callback step must be listed and decided by the named approver.",
            "items": {
              "$ref": "#/components/schemas/OperationApprovalSpec"
            }
          },
          "limits": {
            "$ref": "#/components/schemas/OperationLimits"
          },
          "milestones": {
            "type": "object",
            "maxProperties": 16,
            "additionalProperties": {},
            "description": "Declared public milestone names mapped to bundled JSON Schemas. Requires http_transaction_version 1. At most 16 names, with an aggregate 16384 schema bytes."
          },
          "workflow_steps": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowStep"
            },
            "description": "Materialized workflow step mappings included in this compact definition view."
          },
          "subject": {
            "$ref": "#/components/schemas/OperationSubjectSpec"
          },
          "name": {
            "type": "string",
            "maxLength": 64
          },
          "job": {
            "type": "string",
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$",
            "description": "Optional account-owned active batch Job. POST ingress and reconciliation recovery only; one task per generation. Input, image, command, environment and execution policy are frozen at admission. Mutually exclusive with workflow and transaction_receipt."
          },
          "workflow": {
            "description": "Optional named workflow captured from this immutable deployment; path becomes its submission route.",
            "type": "string",
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "transaction_receipt": {
            "description": "Explicit HTTP/PostgreSQL receipt adapter; requires reconciliation recovery. Business writes and the saved result commit in the customer database. Approved recovery replays a committed result without calling business code. This does not certify external effects or platform completion.",
            "type": "string",
            "enum": [
              "postgres_v1"
            ]
          },
          "method": {
            "type": "string",
            "enum": [
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ]
          },
          "path": {
            "type": "string",
            "maxLength": 2048
          },
          "owner": {
            "type": "string",
            "enum": [
              "platform_tenant"
            ]
          },
          "input_schema": {
            "description": "Bundled JSON Schema 2020-12; only local document references are supported."
          },
          "output_schema": {
            "description": "Bundled schema for the business result selected by the execution target."
          },
          "progress_stages": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 64
          },
          "completion_webhook_id": {
            "type": "string",
            "format": "uuid"
          },
          "recovery": {
            "type": "string",
            "enum": [
              "reconcile_on_unknown",
              "safe_retry"
            ],
            "default": "reconcile_on_unknown"
          },
          "http_transaction_version": {
            "description": "Opt into the internal customer Operation PostgreSQL receipt protocol. Version 1 saves and replays the full JSON business result; it does not negotiate managed operation envelopes or named effects.",
            "type": "integer",
            "enum": [
              1
            ]
          }
        }
      },
      "OperationDefinitionResponse": {
        "description": "Definition identity, content revision and deployment pins.",
        "type": "object",
        "required": [
          "id",
          "app_id",
          "scope",
          "revision",
          "deployment_id",
          "spec",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "revision": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "release_id": {
            "type": "string",
            "format": "uuid"
          },
          "spec": {
            "$ref": "#/components/schemas/OperationDefinitionSpec"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperationDefinitionSummary": {
        "description": "Immutable definition metadata without bundled schema documents.",
        "type": "object",
        "required": [
          "id",
          "app_id",
          "scope",
          "revision",
          "deployment_id",
          "name",
          "method",
          "path",
          "owner",
          "recovery",
          "progress_stages",
          "created_at"
        ],
        "properties": {
          "milestones": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "type": "string",
              "maxLength": 64
            },
            "description": "Declared milestone names; schema documents are available on the full definition."
          },
          "workflow_steps": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowStep"
            },
            "description": "Resolved app-declared read-only workflow steps mapped to this definition's transaction-backed milestones."
          },
          "subject": {
            "$ref": "#/components/schemas/OperationSubjectSpec"
          },
          "http_transaction_version": {
            "type": "integer",
            "enum": [
              1
            ],
            "description": "Opt-in customer-owned HTTP transaction protocol. Absence means ordinary HTTP execution."
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "revision": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "release_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "maxLength": 64
          },
          "job": {
            "type": "string",
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$",
            "description": "Discovered account-owned single-task batch Job; accepted work retains its execution snapshot."
          },
          "workflow": {
            "description": "Workflow execution selected by this discoverable Operations definition.",
            "type": "string",
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "transaction_receipt": {
            "description": "Discovered customer transaction receipt contract for atomic HTTP completion.",
            "type": "string",
            "enum": [
              "postgres_v1"
            ]
          },
          "method": {
            "type": "string",
            "enum": [
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ]
          },
          "path": {
            "type": "string",
            "maxLength": 2048
          },
          "owner": {
            "type": "string",
            "enum": [
              "platform_tenant"
            ]
          },
          "completion_webhook_id": {
            "type": "string",
            "format": "uuid"
          },
          "recovery": {
            "type": "string",
            "enum": [
              "reconcile_on_unknown",
              "safe_retry"
            ]
          },
          "progress_stages": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 64
            },
            "maxItems": 64
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperationDeliveryInspection": {
        "description": "Sanitized completion transport snapshot; business state remains independently authoritative.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "operation_id",
          "business_state",
          "operation_expires_at",
          "observed_at",
          "state",
          "attempts",
          "last_response_code"
        ],
        "properties": {
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "business_state": {
            "type": "string",
            "enum": [
              "accepted",
              "running",
              "waiting",
              "succeeded",
              "failed",
              "cancelled",
              "requires_reconciliation"
            ]
          },
          "operation_expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "state": {
            "type": "string"
          },
          "delivery_id": {
            "type": "string",
            "format": "uuid"
          },
          "webhook_id": {
            "type": "string",
            "format": "uuid"
          },
          "replay_generation": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "attempts": {
            "type": "integer",
            "minimum": 0
          },
          "last_response_code": {
            "type": "integer"
          },
          "error_code": {
            "type": "string"
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "delivered_at": {
            "type": "string",
            "format": "date-time"
          },
          "receiver_state": {
            "type": "string"
          },
          "receiver_cooldown_until": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperationDeliveryAttempt": {
        "description": "One retained notification attempt without receiver payload, URL or raw transport errors.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "replay_generation",
          "attempt_number",
          "outcome",
          "response_code",
          "started_at",
          "finished_at"
        ],
        "properties": {
          "replay_generation": {
            "type": "integer",
            "minimum": 0
          },
          "attempt_number": {
            "type": "integer",
            "minimum": 1,
            "maximum": 8
          },
          "outcome": {
            "type": "string",
            "enum": [
              "succeeded",
              "retrying",
              "dead"
            ]
          },
          "response_code": {
            "type": "integer"
          },
          "error_code": {
            "type": "string"
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": "string",
            "format": "date-time"
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperationDeliveryAttemptsResponse": {
        "description": "Newest-first attempt page with an operation-bound continuation cursor.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "operation_id",
          "delivery_id",
          "attempts"
        ],
        "properties": {
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "delivery_id": {
            "type": "string",
            "format": "uuid"
          },
          "attempts": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OperationDeliveryAttempt"
            }
          },
          "next_cursor": {
            "type": "string",
            "maxLength": 512
          }
        }
      },
      "OperationTimelineResponse": {
        "description": "Chronological page merged from operation events, attempts and completion deliveries.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "operation_id",
          "state",
          "generation",
          "entries"
        ],
        "properties": {
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "accepted",
              "running",
              "succeeded",
              "failed",
              "cancelled",
              "requires_reconciliation"
            ]
          },
          "generation": {
            "type": "integer",
            "minimum": 1
          },
          "entries": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OperationTimelineEntry"
            }
          },
          "events_expired": {
            "description": "Event history was pruned before the operation; attempts and deliveries remain.",
            "type": "boolean"
          },
          "next_cursor": {
            "type": "string",
            "maxLength": 512
          }
        }
      },
      "OperationTimelineEntry": {
        "description": "One timeline record; kind selects which of event, attempt or delivery is present.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "at",
          "kind"
        ],
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "kind": {
            "type": "string",
            "enum": [
              "event",
              "attempt",
              "step_attempt",
              "delivery_attempt"
            ]
          },
          "event": {
            "$ref": "#/components/schemas/OperationEvent"
          },
          "attempt": {
            "$ref": "#/components/schemas/OperationTimelineAttempt"
          },
          "delivery": {
            "$ref": "#/components/schemas/OperationDeliveryAttempt"
          }
        }
      },
      "OperationTimelineAttempt": {
        "description": "One HTTP execution or workflow step attempt as read; a running attempt is not re-emitted when it ends.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "execution_id",
          "attempt",
          "outcome",
          "started_at"
        ],
        "properties": {
          "generation": {
            "description": "Execution generation of an HTTP attempt. Step attempts omit it because recovery resumes the same workflow run.",
            "type": "integer",
            "minimum": 1
          },
          "execution_id": {
            "type": "string",
            "format": "uuid"
          },
          "step": {
            "type": "string",
            "maxLength": 63
          },
          "attempt": {
            "type": "integer",
            "minimum": 1
          },
          "outcome": {
            "type": "string",
            "enum": [
              "running",
              "succeeded",
              "retry",
              "failed",
              "dead_letter",
              "cancelled",
              "unknown"
            ]
          },
          "http_status": {
            "type": "integer"
          },
          "error": {
            "type": "string"
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": "string",
            "format": "date-time"
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "logs": {
            "$ref": "#/components/schemas/OperationAttemptLogs"
          }
        }
      },
      "OperationAttemptLogs": {
        "description": "Instance log window of an HTTP attempt. Lines other requests wrote on the same instance during the window interleave.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "instance_id",
          "since",
          "archive_dates",
          "correlation"
        ],
        "properties": {
          "instance_id": {
            "type": "string",
            "format": "uuid"
          },
          "since": {
            "type": "string",
            "format": "date-time"
          },
          "until": {
            "type": "string",
            "format": "date-time"
          },
          "archive_dates": {
            "type": "array",
            "maxItems": 7,
            "items": {
              "type": "string",
              "format": "date"
            }
          },
          "correlation": {
            "type": "string",
            "enum": [
              "instance_window"
            ]
          }
        }
      },
      "OperationDeliveryRetryRequest": {
        "description": "Stable retry identity and the observed dead delivery generation; explicit generation zero is valid.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "retry_id",
          "delivery_id",
          "expected_replay_generation"
        ],
        "properties": {
          "retry_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "delivery_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_replay_generation": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483646
          }
        }
      },
      "OperationDeliveryRetryResponse": {
        "description": "Immutable notification reset decision retained with its parent operation; queued is not delivery success.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "operation_id",
          "retry_id",
          "delivery_id",
          "expected_replay_generation",
          "replay_generation",
          "state",
          "queued_at",
          "expires_at"
        ],
        "properties": {
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "retry_id": {
            "type": "string"
          },
          "delivery_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_replay_generation": {
            "type": "integer",
            "minimum": 0
          },
          "replay_generation": {
            "type": "integer",
            "minimum": 1
          },
          "state": {
            "type": "string",
            "enum": [
              "queued"
            ]
          },
          "queued_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperationDoctorResponse": {
        "description": "Read-only prerequisite observations for an owned deployment and tenant on one API node.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "app_id",
          "scope",
          "deployment_id",
          "platform_tenant_id",
          "plan",
          "observed_at",
          "observation_scope",
          "submission_state",
          "checks"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "hobby",
              "pro",
              "scale"
            ]
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "observation_scope": {
            "type": "string",
            "enum": [
              "responding_api_node"
            ]
          },
          "submission_state": {
            "type": "string",
            "enum": [
              "eligible",
              "blocked",
              "unknown"
            ],
            "description": "Submission prerequisites only. Delivery warnings and unverified qualification do not determine this observation."
          },
          "checks": {
            "type": "array",
            "maxItems": 1024,
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/OperationDoctorCheck"
            }
          }
        }
      },
      "OperationDoctorCheck": {
        "description": "One sanitized prerequisite, delivery configuration or unverified qualification observation.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "check",
          "status",
          "impact",
          "code",
          "message"
        ],
        "properties": {
          "check": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "observed",
              "configured",
              "blocked",
              "warning",
              "unknown",
              "not_requested"
            ]
          },
          "impact": {
            "type": "string",
            "enum": [
              "submission",
              "delivery",
              "qualification"
            ]
          },
          "code": {
            "type": "string",
            "description": "Stable non-secret reason code; filesystem paths and infrastructure errors are not exposed."
          },
          "message": {
            "type": "string"
          },
          "remediation": {
            "type": "string"
          },
          "definition_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "revision": {
            "type": "string"
          },
          "release_id": {
            "type": "string",
            "format": "uuid"
          },
          "execution_kind": {
            "type": "string",
            "enum": [
              "http",
              "workflow",
              "job"
            ],
            "description": "Immutable execution family for a definition-specific preview admission observation. Omitted for common prerequisites or an ambiguous contract."
          },
          "limit": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "observed": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "OperationDefinitionsResponse": {
        "description": "Contract metadata for one owned deployment; schemas are read individually.",
        "type": "object",
        "required": [
          "definitions"
        ],
        "properties": {
          "definitions": {
            "type": "array",
            "maxItems": 200,
            "items": {
              "$ref": "#/components/schemas/OperationDefinitionSummary"
            }
          }
        }
      },
      "OperationTenantIdentity": {
        "description": "Tenant credential identity used to bind a private local submission receipt; optional submission fence returns 409 operation_identity_conflict if the principal changes.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "account_id",
          "platform_tenant_id"
        ],
        "properties": {
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "OperationProgress": {
        "description": "Current bounded progress from the active execution attempt.",
        "type": "object",
        "required": [
          "stage",
          "completed",
          "total",
          "attempt",
          "updated_at"
        ],
        "properties": {
          "stage": {
            "type": "string"
          },
          "completed": {
            "type": "integer",
            "minimum": 0
          },
          "total": {
            "type": "integer",
            "minimum": 0
          },
          "attempt": {
            "type": "integer",
            "minimum": 1
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperationResultArtifact": {
        "description": "Verified private result reference, from a managed object or direct Job upload.",
        "type": "object",
        "required": [
          "id",
          "name",
          "uri",
          "size_bytes",
          "sha256"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "maxLength": 128
          },
          "uri": {
            "type": "string",
            "maxLength": 2048,
            "description": "Managed obj:// source or opaque operation://<operation UUID>/artifacts/<artifact UUID> direct-upload reference; never a signed URL or physical storage key."
          },
          "size_bytes": {
            "type": "integer",
            "minimum": 0
          },
          "sha256": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperationDeliveryResponse": {
        "description": "Independent completion notification projection from the webhook outbox.",
        "type": "object",
        "required": [
          "state",
          "attempts"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "not_requested",
              "awaiting_outcome",
              "configuration_failed",
              "pending",
              "in_flight",
              "succeeded",
              "failed",
              "dead",
              "delivery_expired"
            ]
          },
          "delivery_id": {
            "type": "string",
            "format": "uuid"
          },
          "attempts": {
            "type": "integer",
            "minimum": 0
          },
          "last_error": {
            "type": "string"
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperationApprovalSpec": {
        "description": "Declares a workflow callback step as an approval decided by the account or the operation's customer.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "step",
          "approver"
        ],
        "properties": {
          "step": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "approver": {
            "type": "string",
            "enum": [
              "account",
              "customer"
            ]
          }
        }
      },
      "OperationWaitingState": {
        "description": "Why a waiting operation holds no execution. until is the timer's wake time or the approval deadline.",
        "type": "object",
        "required": [
          "kind",
          "step",
          "since"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "timer",
              "approval",
              "event"
            ]
          },
          "step": {
            "type": "string"
          },
          "since": {
            "type": "string",
            "format": "date-time"
          },
          "until": {
            "type": "string",
            "format": "date-time"
          },
          "approver": {
            "type": "string",
            "enum": [
              "account",
              "customer"
            ]
          },
          "event": {
            "type": "string",
            "maxLength": 63,
            "description": "The event an event wait expects."
          }
        }
      },
      "OperationSignalRequest": {
        "description": "One named event for an operation.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "signal_id",
          "event"
        ],
        "properties": {
          "signal_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "description": "Idempotency key for this delivery",
            "per operation.": null
          },
          "event": {
            "type": "string",
            "maxLength": 63,
            "pattern": "^[a-z][a-z0-9_.-]*$"
          },
          "payload": {
            "description": "JSON delivered as the wait step's output; at most 64 KiB."
          }
        }
      },
      "OperationSubjectSignalRequest": {
        "description": "One named event for every active operation of a definition about one business subject.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "scope",
          "operation",
          "subject",
          "signal_id",
          "event"
        ],
        "properties": {
          "scope": {
            "type": "string"
          },
          "operation": {
            "type": "string",
            "maxLength": 64
          },
          "subject": {
            "$ref": "#/components/schemas/OperationSubject"
          },
          "signal_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "event": {
            "type": "string",
            "maxLength": 63,
            "pattern": "^[a-z][a-z0-9_.-]*$"
          },
          "payload": {
            "description": "JSON each reached operation's wait step receives as its output; at most 64 KiB."
          }
        }
      },
      "PlatformTenantSubjectSignalRequest": {
        "description": "One named event for the authenticated customer's own active operations of a definition about one business subject.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "definition_id",
          "subject",
          "signal_id",
          "event"
        ],
        "properties": {
          "definition_id": {
            "type": "string",
            "format": "uuid",
            "description": "Operation definition whose app",
            "environment and name select the operations.": null
          },
          "subject": {
            "$ref": "#/components/schemas/OperationSubject"
          },
          "signal_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "event": {
            "type": "string",
            "maxLength": 63,
            "pattern": "^[a-z][a-z0-9_.-]*$"
          },
          "payload": {
            "description": "JSON each of the customer's reached operations receives as its wait step output; at most 64 KiB."
          }
        }
      },
      "OperationSignalReceipt": {
        "description": "One signal delivery. waiting reports whether the operation was waiting for this event; otherwise the run holds it for a later wait.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "operation_id",
          "signal_id",
          "event",
          "duplicate",
          "waiting"
        ],
        "properties": {
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "signal_id": {
            "type": "string"
          },
          "event": {
            "type": "string"
          },
          "duplicate": {
            "type": "boolean"
          },
          "waiting": {
            "type": "boolean"
          }
        }
      },
      "OperationSubjectSignalResponse": {
        "description": "Receipts for the operations a subject signal reached.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "delivered"
        ],
        "properties": {
          "delivered": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationSignalReceipt"
            }
          }
        }
      },
      "OperationApprovalRequest": {
        "description": "One approval decision for the operation's current generation.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_generation",
          "decision"
        ],
        "properties": {
          "expected_generation": {
            "type": "integer",
            "minimum": 1
          },
          "decision": {
            "type": "string",
            "enum": [
              "approved",
              "rejected"
            ]
          },
          "comment": {
            "type": "string",
            "maxLength": 1024,
            "description": "Recorded with the decision in the operation history."
          }
        }
      },
      "OperationLimits": {
        "description": "Bounds fixed onto each accepted Operation. Every field is optional and bounded by the plan; workflow definitions take a deadline and an execution budget, and job definitions take none.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "deadline_seconds": {
            "description": "Wall clock from acceptance, including waits, retries and recovery.",
            "type": "integer",
            "minimum": 1,
            "maximum": 2592000
          },
          "max_attempts": {
            "description": "Automatic attempts of one HTTP execution.",
            "type": "integer",
            "minimum": 1,
            "maximum": 25
          },
          "max_execution_seconds": {
            "description": "Runtime of HTTP attempts, or of a workflow's HTTP step attempts, summed across generations; waits do not count.",
            "type": "integer",
            "minimum": 1,
            "maximum": 604800
          }
        }
      },
      "OperationUsage": {
        "description": "What an Operation with limits has consumed. A running attempt is added when it ends.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "execution_ms",
          "attempts"
        ],
        "properties": {
          "execution_ms": {
            "type": "integer",
            "minimum": 0
          },
          "attempts": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "OperationResponse": {
        "description": "Customer business work; execution recovery and delivery retain independent semantics.",
        "type": "object",
        "required": [
          "id",
          "name",
          "generation",
          "state",
          "completion_delivery",
          "cancellation_requested",
          "latest_sequence",
          "created_at",
          "updated_at",
          "expires_at"
        ],
        "properties": {
          "subject": {
            "$ref": "#/components/schemas/OperationSubject"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "generation": {
            "type": "integer",
            "minimum": 1
          },
          "state": {
            "type": "string",
            "enum": [
              "accepted",
              "running",
              "waiting",
              "succeeded",
              "failed",
              "cancelled",
              "requires_reconciliation"
            ]
          },
          "progress": {
            "$ref": "#/components/schemas/OperationProgress"
          },
          "result": {
            "description": "Pinned-schema-validated business result, when confirmed successful."
          },
          "artifacts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OperationResultArtifact"
            }
          },
          "completion_delivery": {
            "$ref": "#/components/schemas/OperationDeliveryResponse"
          },
          "cancellation_requested": {
            "type": "boolean"
          },
          "failure_code": {
            "type": "string",
            "description": "Stable failure reason. deadline_exceeded and budget_exhausted mean the operation's own limits settled it."
          },
          "waiting": {
            "$ref": "#/components/schemas/OperationWaitingState"
          },
          "data_repair": {
            "$ref": "#/components/schemas/OperationDataRepair"
          },
          "limits": {
            "$ref": "#/components/schemas/OperationLimits"
          },
          "deadline_at": {
            "type": "string",
            "format": "date-time",
            "description": "Absolute deadline fixed at acceptance; waits, retries and recovery count against it."
          },
          "usage": {
            "$ref": "#/components/schemas/OperationUsage"
          },
          "latest_sequence": {
            "type": "integer",
            "minimum": 0
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperationSummary": {
        "description": "Bounded discovery metadata; omits result bytes, artifact locations and execution authority.",
        "type": "object",
        "required": [
          "id",
          "name",
          "generation",
          "state",
          "completion_delivery",
          "cancellation_requested",
          "latest_sequence",
          "created_at",
          "updated_at",
          "expires_at"
        ],
        "properties": {
          "subject": {
            "$ref": "#/components/schemas/OperationSubject"
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid",
            "description": "Present only on account operator listings; absent from tenant-self summaries."
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "generation": {
            "type": "integer",
            "minimum": 1
          },
          "state": {
            "type": "string",
            "enum": [
              "accepted",
              "running",
              "waiting",
              "succeeded",
              "failed",
              "cancelled",
              "requires_reconciliation"
            ]
          },
          "progress": {
            "$ref": "#/components/schemas/OperationProgress"
          },
          "completion_delivery": {
            "$ref": "#/components/schemas/OperationDeliverySummary"
          },
          "cancellation_requested": {
            "type": "boolean"
          },
          "latest_sequence": {
            "type": "integer",
            "minimum": 0
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperationDeliverySummary": {
        "description": "Independent notification status without delivery identifiers or errors.",
        "type": "object",
        "required": [
          "state",
          "attempts"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "not_requested",
              "awaiting_outcome",
              "configuration_failed",
              "pending",
              "in_flight",
              "succeeded",
              "failed",
              "dead",
              "delivery_expired"
            ]
          },
          "attempts": {
            "type": "integer",
            "minimum": 0
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperationListResponse": {
        "description": "Bounded live discovery page of operation summaries, scoped to a verified customer or account operator.",
        "type": "object",
        "required": [
          "operations"
        ],
        "properties": {
          "operations": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OperationSummary"
            }
          },
          "next_cursor": {
            "type": "string",
            "maxLength": 512
          }
        }
      },
      "OperationExecution": {
        "description": "Retained execution generation. Exactly one HTTP, workflow, job or data repair backend identity is present. Workflow attempts counts retained HTTP step attempts at that generation.",
        "type": "object",
        "required": [
          "generation",
          "state",
          "attempts",
          "created_at"
        ],
        "properties": {
          "generation": {
            "type": "integer",
            "minimum": 1
          },
          "invocation_id": {
            "type": "string",
            "format": "uuid"
          },
          "job_run_id": {
            "type": "string",
            "format": "uuid"
          },
          "workflow_run_id": {
            "type": "string",
            "format": "uuid"
          },
          "data_repair_id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string"
          },
          "attempts": {
            "type": "integer",
            "minimum": 0
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperationExecutionsResponse": {
        "description": "Ascending bounded page of retained execution generations.",
        "type": "object",
        "required": [
          "executions"
        ],
        "properties": {
          "executions": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OperationExecution"
            }
          },
          "next_generation": {
            "type": "integer",
            "minimum": 1
          }
        }
      },
      "OperationAcceptedResponse": {
        "description": "Durable stable operation identity and customer-scoped read routes.",
        "type": "object",
        "required": [
          "id",
          "status_url",
          "events_url"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "status_url": {
            "type": "string"
          },
          "events_url": {
            "type": "string"
          }
        }
      },
      "OperationEvent": {
        "description": "Ordered retained event; execution identity may change under the same logical operation.",
        "type": "object",
        "required": [
          "operation_id",
          "sequence",
          "type",
          "data",
          "created_at"
        ],
        "properties": {
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "sequence": {
            "type": "integer",
            "minimum": 1
          },
          "type": {
            "type": "string",
            "enum": [
              "accepted",
              "running",
              "progress",
              "result_prepared",
              "artifact_prepared",
              "artifact_attached",
              "succeeded",
              "failed",
              "cancelled",
              "reconciliation_required",
              "recovery_requested",
              "cancellation_requested",
              "delivery_changed"
            ]
          },
          "execution_id": {
            "type": "string",
            "format": "uuid"
          },
          "attempt": {
            "type": "integer",
            "minimum": 0
          },
          "data": {
            "description": "Event-specific customer projection."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperationEventsResponse": {
        "description": "One bounded event page, or instruction to read a fresh status snapshot.",
        "type": "object",
        "required": [
          "events",
          "latest_sequence",
          "resync_required"
        ],
        "properties": {
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OperationEvent"
            },
            "maxItems": 100
          },
          "latest_sequence": {
            "type": "integer",
            "minimum": 0
          },
          "resync_required": {
            "type": "boolean"
          }
        }
      },
      "OperationSubmissionScope": {
        "description": "Optional immutable-definition fence for a browser feature.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "app_id",
          "scope",
          "name"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
          },
          "name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          }
        }
      },
      "OperationSubmissionLookupRequest": {
        "description": "Selectors for an authenticated customer's retained idempotency identity; bounded to 4096 bytes.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "app_id",
          "scope",
          "name",
          "idempotency_key"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
          },
          "name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "idempotency_key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "expected_identity": {
            "$ref": "#/components/schemas/OperationTenantIdentity"
          }
        }
      },
      "OperationSubmissionLookupResponse": {
        "description": "Read-only observation; accepted includes receipt and accepted_at. unresolved never proves rejection.",
        "type": "object",
        "required": [
          "state"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "accepted",
              "unresolved",
              "expired"
            ]
          },
          "receipt": {
            "$ref": "#/components/schemas/OperationAcceptedResponse"
          },
          "accepted_at": {
            "type": "string",
            "format": "date-time"
          },
          "idempotency_expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperationStartRequest": {
        "description": "Submission owned by the authenticated platform tenant.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "definition_id",
          "input"
        ],
        "properties": {
          "definition_id": {
            "type": "string",
            "format": "uuid"
          },
          "input": {
            "description": "JSON input matching the pinned definition."
          },
          "expected_identity": {
            "$ref": "#/components/schemas/OperationTenantIdentity"
          },
          "expected_scope": {
            "$ref": "#/components/schemas/OperationSubmissionScope"
          }
        }
      },
      "OperationCancellationRequest": {
        "description": "Compare-and-set cancellation intent for this generation.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_generation"
        ],
        "properties": {
          "expected_generation": {
            "type": "integer",
            "minimum": 1
          }
        }
      },
      "RuntimeReleaseResponse": {
        "type": "object",
        "description": "Exact published runtime base bytes; host kernel and function runner are separate components.",
        "additionalProperties": false,
        "required": [
          "id",
          "runtime",
          "architecture",
          "source_digest",
          "guest_init_digest",
          "base_digest",
          "layout_version",
          "published_at",
          "qualification"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "runtime": {
            "type": "string",
            "enum": [
              "node22",
              "node24",
              "python312",
              "python313",
              "go124",
              "go124-alpine"
            ]
          },
          "architecture": {
            "type": "string",
            "enum": [
              "amd64",
              "arm64"
            ]
          },
          "source_digest": {
            "type": "string",
            "description": "Immutable OCI source manifest digest."
          },
          "guest_init_digest": {
            "type": "string",
            "description": "SHA-256 of the PID 1 binary injected into this base."
          },
          "base_digest": {
            "type": "string",
            "description": "SHA-256 of the exact published ext4 bytes."
          },
          "layout_version": {
            "type": "string"
          },
          "published_at": {
            "type": "string",
            "format": "date-time"
          },
          "qualification": {
            "type": "string",
            "enum": [
              "not_evaluated"
            ],
            "description": "Publication alone establishes no upgrade compatibility verdict."
          }
        }
      },
      "DeploymentRuntimeResponse": {
        "description": "Recorded deployment runtime binding and published same-family base candidates.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "deployment_id",
          "status",
          "reason",
          "current",
          "releases"
        ],
        "properties": {
          "deployment_id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pinned",
              "unknown",
              "unsupported"
            ]
          },
          "reason": {
            "type": "string"
          },
          "current": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RuntimeReleaseResponse"
              },
              {
                "type": "null"
              }
            ]
          },
          "releases": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/RuntimeReleaseResponse"
            }
          }
        }
      },
      "RuntimeUpgradePreviewResponse": {
        "description": "Component comparison and qualification requirements for a read-only runtime update plan.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "deployment_id",
          "current",
          "target",
          "disposition",
          "changes",
          "blockers",
          "required_steps",
          "rebuild_required",
          "cold_start_required",
          "execution_available"
        ],
        "properties": {
          "deployment_id": {
            "type": "string"
          },
          "current": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RuntimeReleaseResponse"
              },
              {
                "type": "null"
              }
            ]
          },
          "target": {
            "$ref": "#/components/schemas/RuntimeReleaseResponse"
          },
          "disposition": {
            "type": "string",
            "enum": [
              "blocked",
              "no_change",
              "review_required"
            ]
          },
          "changes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "runtime_source",
                "guest_init",
                "base_layout",
                "base_bytes"
              ]
            }
          },
          "blockers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "required_steps": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "rebuild_required": {
            "type": "boolean"
          },
          "cold_start_required": {
            "type": "boolean"
          },
          "execution_available": {
            "type": "boolean",
            "enum": [
              false
            ],
            "description": "Preview only; no runtime update operation is implemented."
          }
        }
      },
      "DetachEnvironmentGitSourceRequest": {
        "type": "object",
        "description": "Release this binding's Git ownership at the supplied generation while retaining its history.",
        "additionalProperties": false,
        "required": [
          "expected_generation"
        ],
        "properties": {
          "expected_generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "RebindEnvironmentGitSourceRequest": {
        "type": "object",
        "description": "Replace a Git binding with a fresh report-only source that requires a new approval.",
        "additionalProperties": false,
        "required": [
          "expected_generation",
          "manifest_path"
        ],
        "properties": {
          "expected_generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "ref": {
            "type": "string"
          },
          "manifest_path": {
            "type": "string"
          },
          "approval_policy": {
            "type": "string",
            "enum": [
              "manual",
              "protected_branch"
            ]
          }
        }
      },
      "EnvironmentFieldOwnershipRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "environment",
          "paths",
          "manager"
        ],
        "description": "Specify exactly one of app or project. App fields use variables/KEY or source; project fields use configuration/KEY. Terraform must claim before writes and release after deletion. Claims contain no values.",
        "properties": {
          "app": {
            "type": "string"
          },
          "project": {
            "type": "string"
          },
          "environment": {
            "type": "string"
          },
          "paths": {
            "type": "array",
            "minItems": 1,
            "maxItems": 1024,
            "items": {
              "type": "string"
            }
          },
          "manager": {
            "type": "string",
            "enum": [
              "terraform"
            ]
          }
        }
      },
      "EnvironmentFieldOwnershipResponse": {
        "type": "object",
        "description": "Result of claiming or releasing Terraform ownership of environment fields.",
        "required": [
          "status"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "claimed",
              "released",
              "unscoped"
            ]
          }
        }
      },
      "CreateEnvironmentGitSourceRequest": {
        "type": "object",
        "description": "Select a Git definition. GitHub uses the project's bound repository; GitLab.com requires an account OAuth connection, a repository path and an explicit ref. Repository identity is verified by the server. Both providers support manual or verified protected-branch approval. Production enforcement remains unavailable in this preview.",
        "properties": {
          "provider": {
            "type": "string",
            "enum": [
              "github",
              "gitlab"
            ],
            "default": "github"
          },
          "repository": {
            "type": "string",
            "description": "Canonical GitLab.com group/project path, including subgroups when present."
          },
          "ref": {
            "type": "string",
            "description": "Git ref selecting candidates; GitHub defaults to the project production branch."
          },
          "manifest_path": {
            "type": "string",
            "minLength": 1
          },
          "mode": {
            "type": "string",
            "enum": [
              "report"
            ],
            "default": "report"
          },
          "approval_policy": {
            "type": "string",
            "enum": [
              "manual",
              "protected_branch"
            ],
            "default": "manual"
          },
          "prune": {
            "type": "boolean",
            "default": false
          }
        },
        "required": [
          "manifest_path"
        ],
        "additionalProperties": false
      },
      "PreviewEnvironmentGitRevisionRequest": {
        "type": "object",
        "description": "An exact Git commit to fetch and review.",
        "properties": {
          "commit_sha": {
            "type": "string",
            "pattern": "^[a-f0-9]{40}$"
          }
        },
        "required": [
          "commit_sha"
        ],
        "additionalProperties": false
      },
      "EnvironmentGitOpsChangedWebhookPayload": {
        "type": "object",
        "description": "Value-free account webhook for independent drift, source and rollout axes. Rollout serving and failure outcomes are assessed from current exact-commit graph evidence when a current report completes; approval and control transactions supersede pending rollouts. Each terminal outcome is delivered once per approval generation. Pending observations stay silent. Existing drift/source transition rules and explicit environment.gitops.changed subscriptions apply. Delivery is signed and at least once; deduplicate retries by transition_id.",
        "required": [
          "version",
          "transition_id",
          "source_id",
          "project",
          "environment",
          "axis",
          "previous_status",
          "status",
          "generation",
          "observed_version",
          "observed_at",
          "dashboard_path",
          "changes",
          "blocking_reasons",
          "details_truncated"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "transition_id": {
            "type": "string",
            "format": "uuid"
          },
          "source_id": {
            "type": "string",
            "format": "uuid"
          },
          "project": {
            "type": "string"
          },
          "environment": {
            "type": "string"
          },
          "axis": {
            "type": "string",
            "enum": [
              "drift",
              "source",
              "rollout"
            ]
          },
          "previous_status": {
            "type": "string",
            "enum": [
              "unknown",
              "in_sync",
              "drifted",
              "blocked",
              "unavailable",
              "verified",
              "progressing",
              "serving",
              "failed"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "in_sync",
              "drifted",
              "blocked",
              "unavailable",
              "verified",
              "serving",
              "failed",
              "superseded"
            ]
          },
          "generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "observed_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "approved_revision_id": {
            "type": "string",
            "format": "uuid"
          },
          "commit_sha": {
            "type": "string",
            "pattern": "^[a-f0-9]{40}$"
          },
          "definition_digest": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "graph_id": {
            "type": "string",
            "format": "uuid"
          },
          "plan_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "diagnostics": {
            "type": "array",
            "maxItems": 100,
            "description": "Safe mapped blocker codes and guidance, optionally scoped to a workload. Never includes upstream error text, logs, values or secret-reference targets.",
            "items": {
              "$ref": "#/components/schemas/EnvironmentGitOpsDiagnostic"
            }
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "error_code": {
            "type": "string"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "dashboard_path": {
            "type": "string"
          },
          "changes": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/EnvironmentGitOpsChange"
            }
          },
          "blocking_reasons": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "string"
            }
          },
          "details_truncated": {
            "type": "boolean"
          }
        }
      },
      "PreviewEnvironmentGitPromotionRequest": {
        "type": "object",
        "description": "Read-only environment promotion observation. A saved hash is not approval.",
        "additionalProperties": false,
        "required": [
          "from_environment",
          "target_commit_sha"
        ],
        "properties": {
          "from_environment": {
            "type": "string",
            "description": "Distinct source environment slug."
          },
          "target_commit_sha": {
            "type": "string",
            "description": "Verified commit containing the target environment manifest.",
            "pattern": "^[a-f0-9]{40}$"
          },
          "expected_plan_hash": {
            "type": "string",
            "description": "Previously reviewed hash; changed source, release, artifact or target observations return 409.",
            "pattern": "^[a-f0-9]{64}$"
          }
        }
      },
      "ListEnvironmentGitReleasesRequest": {
        "type": "object",
        "description": "Validated query inputs for an immutable-target recovery catalog read.",
        "required": [
          "target_commit_sha"
        ],
        "properties": {
          "target_commit_sha": {
            "type": "string",
            "pattern": "^[a-f0-9]{40}$",
            "description": "Exact target-manifest revision against which recovery eligibility is assessed."
          },
          "before": {
            "type": "string",
            "format": "uuid",
            "description": "Scoped anchor release from an earlier catalog response; omitted for the newest page."
          }
        }
      },
      "EnvironmentGitRecoveryRelease": {
        "type": "object",
        "description": "One retained serving release assessed against the selected current target manifest.",
        "required": [
          "release_set_id",
          "active",
          "created_at",
          "retention_status",
          "commit_sha",
          "eligibility",
          "blocking_reasons",
          "artifacts"
        ],
        "properties": {
          "protection_status": {
            "type": "string",
            "enum": [
              "disabled",
              "expired",
              "outside_policy",
              "budget_exceeded",
              "protected"
            ],
            "description": "Current artifact policy selection, independent of rollback eligibility and routing retention."
          },
          "artifacts_protected_until": {
            "type": "string",
            "format": "date-time",
            "description": "Age deadline of current protection; a newer release or explicit policy change may displace it earlier."
          },
          "retained_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Per-release charged layer bytes when currently protected; shared keys are charged once within each release."
          },
          "release_set_id": {
            "type": "string",
            "format": "uuid",
            "description": "Immutable release UUID within the current Git binding history."
          },
          "active": {
            "type": "boolean",
            "description": "Whether this release is the environment's current active selection."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Creation time used with release UUID for stable descending recovery pagination."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "Routing compatibility deadline for this release; does not guarantee artifact retention."
          },
          "retention_status": {
            "type": "string",
            "enum": [
              "active",
              "unknown",
              "compatibility_window",
              "compatibility_window_elapsed"
            ],
            "description": "Current selection or compatibility window status, separate from rollback eligibility."
          },
          "commit_sha": {
            "type": "string",
            "description": "Original manifest commit verified by historical serving evidence, or empty when unproven."
          },
          "served_at": {
            "type": "string",
            "format": "date-time",
            "description": "Completion time of the selected release's historical serving receipt."
          },
          "eligibility": {
            "type": "string",
            "enum": [
              "eligible",
              "blocked"
            ],
            "description": "Whether the reused rollback planner reports no blockers at observation time."
          },
          "blocking_reasons": {
            "type": "array",
            "description": "Value-redacted rollback planner blockers for this retained release.",
            "items": {
              "type": "string"
            }
          },
          "artifacts": {
            "type": "array",
            "description": "Public immutable image and signed build identities checked for this recovery selection.",
            "items": {
              "$ref": "#/components/schemas/EnvironmentGitPromotionArtifact"
            }
          },
          "plan_hash": {
            "type": "string",
            "description": "Individual rollback observation hash; obtain a fresh plan and revalidate before export."
          }
        }
      },
      "ListEnvironmentGitReleasesResponse": {
        "type": "object",
        "description": "Read-only page of recovery eligibility observations for one verified target manifest commit.",
        "required": [
          "project",
          "environment",
          "source_id",
          "target_commit_sha",
          "observed_at",
          "read_only",
          "values_redacted",
          "requires_target_qualification",
          "releases"
        ],
        "properties": {
          "recovery_retention": {
            "$ref": "#/components/schemas/EnvironmentRecoveryRetention"
          },
          "retention_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Current charged bytes across all protected releases of this source, including releases outside this page."
          },
          "project": {
            "type": "string",
            "description": "Registered project slug for this recovery page."
          },
          "environment": {
            "type": "string",
            "description": "Registered environment slug for the retained recovery history."
          },
          "source_id": {
            "type": "string",
            "format": "uuid",
            "description": "Current Git binding identity restricting all releases and the page cursor."
          },
          "target_commit_sha": {
            "type": "string",
            "pattern": "^[a-f0-9]{40}$",
            "description": "Provider-verified immutable target manifest commit for every release assessment in the page."
          },
          "observed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time of this page's recovery observation; eligibility is not a future guarantee."
          },
          "read_only": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Confirms that listing recovery history caused no retention or execution mutation."
          },
          "values_redacted": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Confirms that recovery results omit configuration values, secret references and storage paths."
          },
          "requires_target_qualification": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Recovery proposals must still pass new qualification for the target environment."
          },
          "releases": {
            "type": "array",
            "maxItems": 10,
            "description": "Newest retained completed serving releases from this Git source, including expired windows.",
            "items": {
              "$ref": "#/components/schemas/EnvironmentGitRecoveryRelease"
            }
          },
          "next_before": {
            "type": "string",
            "format": "uuid",
            "description": "Last release UUID in this page when additional older recovery history exists."
          }
        }
      },
      "PreviewEnvironmentGitRollbackRequest": {
        "type": "object",
        "description": "Read-only environment rollback observation. A saved hash is not approval.",
        "additionalProperties": false,
        "required": [
          "release_set_id",
          "target_commit_sha"
        ],
        "properties": {
          "release_set_id": {
            "type": "string",
            "format": "uuid",
            "description": "Retained GitOps serving release UUID in this environment."
          },
          "target_commit_sha": {
            "type": "string",
            "description": "Immutable commit whose current manifest will receive the rollback source changes.",
            "pattern": "^[a-f0-9]{40}$"
          },
          "expected_plan_hash": {
            "type": "string",
            "description": "Previously reviewed rollback hash; changed historical evidence or target intent returns 409.",
            "pattern": "^[a-f0-9]{64}$"
          }
        }
      },
      "EnvironmentGitPromotionOrigin": {
        "type": "object",
        "description": "Scoped identity of the approved source release; graph and release IDs are empty if unproven.",
        "additionalProperties": false,
        "required": [
          "source_id",
          "revision_id",
          "commit_sha",
          "definition_digest",
          "generation",
          "intent_version",
          "graph_id",
          "release_set_id",
          "provider",
          "repository_id"
        ],
        "properties": {
          "source_id": {
            "type": "string",
            "description": "Source binding identity."
          },
          "revision_id": {
            "type": "string",
            "description": "Current approved revision identity."
          },
          "commit_sha": {
            "type": "string",
            "description": "Approved immutable source commit.",
            "pattern": "^([a-f0-9]{40}|[a-f0-9]{64})$"
          },
          "definition_digest": {
            "type": "string",
            "description": "Approved source definition digest.",
            "pattern": "^[a-f0-9]{64}$"
          },
          "generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Source approval generation."
          },
          "intent_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Observed source intent version."
          },
          "graph_id": {
            "type": "string",
            "description": "Current qualified graph identity, if present."
          },
          "release_set_id": {
            "type": "string",
            "description": "Active source release identity, if present."
          },
          "provider": {
            "type": "string",
            "description": "Bound provider.",
            "enum": [
              "github",
              "gitlab"
            ]
          },
          "repository_id": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Immutable provider repository identity."
          }
        }
      },
      "EnvironmentGitPromotionTarget": {
        "type": "object",
        "description": "Target binding and manifest observation; no target values are returned.",
        "additionalProperties": false,
        "required": [
          "source_id",
          "generation",
          "intent_version",
          "commit_sha",
          "definition_digest",
          "proposed_digest",
          "manifest_path"
        ],
        "properties": {
          "source_id": {
            "type": "string",
            "description": "Target source binding identity."
          },
          "generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Target source generation."
          },
          "intent_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Observed target intent version."
          },
          "commit_sha": {
            "type": "string",
            "description": "Immutable target manifest commit.",
            "pattern": "^[a-f0-9]{40}$"
          },
          "definition_digest": {
            "type": "string",
            "description": "Required local base definition digest.",
            "pattern": "^[a-f0-9]{64}$"
          },
          "proposed_digest": {
            "type": "string",
            "description": "Digest after replacing only proposed image source contracts.",
            "pattern": "^[a-f0-9]{64}$"
          },
          "manifest_path": {
            "type": "string",
            "description": "Bound target manifest path in Git."
          }
        }
      },
      "EnvironmentGitPromotionArtifact": {
        "type": "object",
        "description": "Selected active source deployment identity, without host paths or storage keys.",
        "additionalProperties": false,
        "required": [
          "resource",
          "deployment_id",
          "kind"
        ],
        "properties": {
          "resource": {
            "type": "string",
            "description": "Logical workload resource."
          },
          "deployment_id": {
            "type": "string",
            "description": "Exact selected live deployment."
          },
          "build_id": {
            "type": "string",
            "description": "Associated build identity, if present."
          },
          "kind": {
            "type": "string",
            "description": "Recorded deployment kind."
          },
          "image_digest": {
            "type": "string",
            "description": "Recorded immutable image identity, if present."
          },
          "build_artifact_id": {
            "type": "string",
            "format": "uuid",
            "description": "Existing signed source-build producer identity."
          },
          "build_artifact_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Immutable producer input hash."
          },
          "artifact_digest": {
            "type": "string",
            "pattern": "^sha256:[a-f0-9]{64}$",
            "description": "Exact built application-layer byte digest."
          },
          "build_commit_sha": {
            "type": "string",
            "pattern": "^([a-f0-9]{40}|[a-f0-9]{64})$",
            "description": "Original code commit, distinct from the target manifest commit."
          }
        }
      },
      "EnvironmentGitPromotionChange": {
        "type": "object",
        "description": "Only a workload source contract changes; target configuration and identity are preserved.",
        "additionalProperties": false,
        "required": [
          "resource",
          "before",
          "after"
        ],
        "properties": {
          "resource": {
            "type": "string",
            "description": "Target workload resource whose source contract is proposed to change."
          },
          "before": {
            "$ref": "#/components/schemas/EnvironmentWorkloadSource"
          },
          "after": {
            "$ref": "#/components/schemas/EnvironmentWorkloadSource"
          }
        }
      },
      "PreviewEnvironmentGitPromotionResponse": {
        "type": "object",
        "description": "Read-only, value-redacted promotion proposal. It neither activates a release nor proves target readiness.",
        "additionalProperties": false,
        "required": [
          "project",
          "from_environment",
          "to_environment",
          "observed_at",
          "read_only",
          "values_redacted",
          "requires_target_qualification",
          "origin",
          "target",
          "artifacts",
          "changes",
          "target_plan",
          "blocking_reasons",
          "plan_hash"
        ],
        "properties": {
          "project": {
            "type": "string",
            "description": "Project slug."
          },
          "from_environment": {
            "type": "string",
            "description": "Source environment slug."
          },
          "to_environment": {
            "type": "string",
            "description": "Target environment slug."
          },
          "observed_at": {
            "type": "string",
            "description": "Observation time.",
            "format": "date-time"
          },
          "read_only": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Always true; no writes or leases are issued."
          },
          "values_redacted": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Configuration values and secret-reference targets are omitted."
          },
          "requires_target_qualification": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Source evidence cannot authorize target activation."
          },
          "origin": {
            "$ref": "#/components/schemas/EnvironmentGitPromotionOrigin"
          },
          "target": {
            "$ref": "#/components/schemas/EnvironmentGitPromotionTarget"
          },
          "artifacts": {
            "type": "array",
            "description": "Selected source deployment identities.",
            "items": {
              "$ref": "#/components/schemas/EnvironmentGitPromotionArtifact"
            }
          },
          "changes": {
            "type": "array",
            "description": "Image-only source contract proposals.",
            "items": {
              "$ref": "#/components/schemas/EnvironmentGitPromotionChange"
            }
          },
          "target_plan": {
            "$ref": "#/components/schemas/EnvironmentGitOpsPlan"
          },
          "blocking_reasons": {
            "type": "array",
            "description": "Reasons patch or manifest export is unavailable.",
            "items": {
              "type": "string"
            }
          },
          "plan_hash": {
            "type": "string",
            "description": "Domain-separated hash of source release, artifacts and target observation; never an execution token.",
            "pattern": "^[a-f0-9]{64}$"
          }
        }
      },
      "PreviewEnvironmentGitRollbackResponse": {
        "type": "object",
        "description": "Read-only, value-redacted rollback proposal. It neither activates a release nor proves target readiness.",
        "additionalProperties": false,
        "required": [
          "project",
          "environment",
          "observed_at",
          "read_only",
          "values_redacted",
          "requires_target_qualification",
          "current_release_set_id",
          "origin",
          "target",
          "artifacts",
          "changes",
          "target_plan",
          "blocking_reasons",
          "plan_hash"
        ],
        "properties": {
          "project": {
            "type": "string",
            "description": "Project containing the selected historical release."
          },
          "environment": {
            "type": "string",
            "description": "Environment whose workload code would be restored."
          },
          "observed_at": {
            "type": "string",
            "description": "Time at which rollback selection and current target intent were observed.",
            "format": "date-time"
          },
          "read_only": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "True because rollback planning does not change pins, intent or deployment status."
          },
          "values_redacted": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Rollback output excludes variable values and secret-reference destinations."
          },
          "requires_target_qualification": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Historical serving evidence selects code; the new target still needs fresh qualification."
          },
          "current_release_set_id": {
            "type": "string",
            "description": "Current active release identity, or empty when no release is active."
          },
          "origin_served_at": {
            "type": "string",
            "format": "date-time",
            "description": "Historical serving completion time; missing proof blocks export."
          },
          "origin": {
            "$ref": "#/components/schemas/EnvironmentGitPromotionOrigin"
          },
          "target": {
            "$ref": "#/components/schemas/EnvironmentGitPromotionTarget"
          },
          "artifacts": {
            "type": "array",
            "description": "Retained deployment and exact code artifact identities selected for rollback.",
            "items": {
              "$ref": "#/components/schemas/EnvironmentGitPromotionArtifact"
            }
          },
          "changes": {
            "type": "array",
            "description": "Code-only source contract proposals.",
            "items": {
              "$ref": "#/components/schemas/EnvironmentGitPromotionChange"
            }
          },
          "target_plan": {
            "$ref": "#/components/schemas/EnvironmentGitOpsPlan"
          },
          "blocking_reasons": {
            "type": "array",
            "description": "Historical evidence, artifact or target conflicts that prevent rollback export.",
            "items": {
              "type": "string"
            }
          },
          "plan_hash": {
            "type": "string",
            "description": "Rollback-specific SHA256 of historical serving evidence, selected code and current target intent; never deployment authority.",
            "pattern": "^[a-f0-9]{64}$"
          }
        }
      },
      "PreviewEnvironmentGitPlanResponse": {
        "type": "object",
        "description": "Read-only candidate plan pinned to a source generation and observed intent version. Values are omitted. The plan cannot authorize approval, adoption, deployment or runtime readiness. Re-run after source or environment changes.",
        "required": [
          "source_id",
          "provider",
          "project",
          "environment",
          "observed_at",
          "read_only",
          "values_redacted",
          "plan"
        ],
        "properties": {
          "source_id": {
            "type": "string",
            "format": "uuid"
          },
          "provider": {
            "type": "string",
            "enum": [
              "github",
              "gitlab"
            ]
          },
          "project": {
            "type": "string"
          },
          "environment": {
            "type": "string"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "read_only": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "values_redacted": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "plan": {
            "$ref": "#/components/schemas/EnvironmentGitOpsPlan"
          }
        }
      },
      "PreviewEnvironmentGitRevisionResponse": {
        "type": "object",
        "description": "Verified Git bytes with the digest and source generation needed for approval.",
        "properties": {
          "commit_sha": {
            "type": "string",
            "pattern": "^[a-f0-9]{40}$"
          },
          "definition_digest": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "definition": {
            "$ref": "#/components/schemas/EnvironmentDefinition"
          },
          "generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        },
        "required": [
          "commit_sha",
          "definition_digest",
          "definition",
          "generation"
        ]
      },
      "ApproveEnvironmentGitRevisionRequest": {
        "type": "object",
        "description": "Approve the reviewed digest for an immutable commit using the current source generation.",
        "properties": {
          "commit_sha": {
            "type": "string",
            "pattern": "^[a-f0-9]{40}$"
          },
          "definition_digest": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "expected_generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        },
        "required": [
          "commit_sha",
          "definition_digest",
          "expected_generation"
        ],
        "additionalProperties": false
      },
      "ApproveEnvironmentGitRevisionResponse": {
        "type": "object",
        "description": "Durable approved revision and the updated management source.",
        "properties": {
          "source": {
            "$ref": "#/components/schemas/EnvironmentGitSource"
          },
          "revision": {
            "$ref": "#/components/schemas/EnvironmentDesiredRevision"
          }
        },
        "required": [
          "source",
          "revision"
        ]
      },
      "EnvironmentGitOpsExplanation": {
        "type": "object",
        "description": "Read-only assessment of recorded source, graph and workload facts. Unknown or historical evidence never grants readiness or execution authority.",
        "properties": {
          "read_only": {
            "type": "boolean"
          },
          "assessed_at": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": [
              "unknown",
              "blocked",
              "progressing",
              "reporting",
              "serving",
              "degraded"
            ]
          },
          "summary": {
            "type": "string"
          },
          "source_id": {
            "type": "string"
          },
          "generation": {
            "type": "integer",
            "format": "int64"
          },
          "intent_version": {
            "type": "integer",
            "format": "int64"
          },
          "source_freshness": {
            "type": "string",
            "enum": [
              "unknown",
              "stale",
              "fresh"
            ]
          },
          "report_id": {
            "type": "string",
            "description": "Latest completed report matching the current revision, generation and intent version."
          },
          "report_status": {
            "type": "string",
            "enum": [
              "blocked",
              "partial",
              "failed",
              "drifted",
              "overridden",
              "converged"
            ]
          },
          "report_freshness": {
            "type": "string",
            "enum": [
              "unknown",
              "stale",
              "fresh"
            ]
          },
          "report_observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "observed_commit_sha": {
            "type": "string"
          },
          "approved_revision_id": {
            "type": "string"
          },
          "applied_revision_id": {
            "type": "string"
          },
          "serving_revision_id": {
            "type": "string"
          },
          "issues": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EnvironmentGitOpsDiagnostic"
            }
          },
          "workloads": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EnvironmentWorkloadProgress"
            }
          }
        },
        "required": [
          "read_only",
          "assessed_at",
          "status",
          "summary",
          "source_id",
          "generation",
          "intent_version",
          "source_freshness",
          "issues",
          "workloads"
        ]
      },
      "EnvironmentGitOpsDiagnostic": {
        "type": "object",
        "description": "A recognized blocker with a responsible actor and a safe next action. Unrecognized upstream errors are redacted.",
        "properties": {
          "resource": {
            "type": "string"
          },
          "stage": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "actor": {
            "type": "string",
            "enum": [
              "customer",
              "operator",
              "controller"
            ]
          },
          "action": {
            "type": "string"
          }
        },
        "required": [
          "stage",
          "code",
          "message",
          "actor",
          "action"
        ]
      },
      "EnvironmentWorkloadProgress": {
        "type": "object",
        "description": "Read-only progress for one exact reviewed graph member. Serving remains unknown without current whole-graph convergence proof.",
        "properties": {
          "resource": {
            "type": "string"
          },
          "app_id": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string"
          },
          "job_id": {
            "type": "string"
          },
          "execution_mode": {
            "type": "string"
          },
          "build_status": {
            "type": "string"
          },
          "build_cache_status": {
            "type": "string",
            "enum": [
              "hit",
              "miss",
              "invalidated"
            ],
            "description": "Recorded builder cache decision; does not grant qualification, activation or serving authority."
          },
          "build_cache_key_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "preparation": {
            "type": "string",
            "enum": [
              "complete",
              "pending",
              "failed",
              "unknown"
            ]
          },
          "qualification": {
            "type": "string",
            "enum": [
              "complete",
              "pending",
              "failed",
              "unknown"
            ]
          },
          "activation": {
            "type": "string",
            "enum": [
              "complete",
              "pending",
              "failed",
              "unknown"
            ]
          },
          "serving": {
            "type": "string",
            "enum": [
              "complete",
              "pending",
              "failed",
              "unknown"
            ]
          },
          "blocking_reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "resource",
          "app_id",
          "execution_mode",
          "preparation",
          "qualification",
          "activation",
          "serving",
          "blocking_reasons"
        ]
      },
      "EnvironmentGitOpsStatusResponse": {
        "type": "object",
        "description": "Source authority, current workload qualification evidence, and the twenty most recent durable reconciliation attempts.",
        "properties": {
          "explanation": {
            "$ref": "#/components/schemas/EnvironmentGitOpsExplanation"
          },
          "approval": {
            "$ref": "#/components/schemas/EnvironmentGitRevisionApproval"
          },
          "workload_retirements": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EnvironmentWorkloadRetirement"
            }
          },
          "workload_evidence": {
            "$ref": "#/components/schemas/EnvironmentWorkloadActivationEvidence"
          },
          "source": {
            "$ref": "#/components/schemas/EnvironmentGitSource"
          },
          "runs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EnvironmentGitOpsRun"
            }
          }
        },
        "required": [
          "source",
          "runs"
        ]
      },
      "EnvironmentWorkloadRetirementImpact": {
        "description": "Review-time snapshot of the scoped routes, consumers, schedule and accepted work affected by retained workload removal.",
        "type": "object",
        "properties": {
          "resource": {
            "type": "string"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "routes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeclaredRoute"
            }
          },
          "job_id": {
            "type": "string"
          },
          "queue_binding_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "consumer_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "pending_invocations": {
            "type": "integer",
            "format": "int64"
          },
          "in_flight_invocations": {
            "type": "integer",
            "format": "int64"
          },
          "queued_tasks": {
            "type": "integer",
            "format": "int64"
          },
          "in_flight_tasks": {
            "type": "integer",
            "format": "int64"
          }
        },
        "required": [
          "resource",
          "app_id",
          "pending_invocations",
          "in_flight_invocations",
          "queued_tasks",
          "in_flight_tasks"
        ]
      },
      "EnvironmentWorkloadRetirement": {
        "type": "object",
        "description": "Retained workload identity and durable route withdrawal and scheduler drain progress. Historical evidence does not grant execution authority.",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "environment_id": {
            "type": "string",
            "format": "uuid"
          },
          "source_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "revision_id": {
            "type": "string",
            "format": "uuid"
          },
          "resource": {
            "type": "string"
          },
          "plan_hash": {
            "type": "string"
          },
          "job_id": {
            "type": "string"
          },
          "route_deployment_id": {
            "type": "string"
          },
          "recovery_revision_id": {
            "type": "string"
          },
          "phase": {
            "type": "string",
            "enum": [
              "planned",
              "retiring",
              "retired",
              "recovering",
              "recovered",
              "cancelled"
            ]
          },
          "generation": {
            "type": "integer",
            "format": "int64"
          },
          "route_generation": {
            "type": "integer",
            "format": "int64"
          },
          "recovery_generation": {
            "type": "integer",
            "format": "int64"
          },
          "deployment_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "queue_binding_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "expected_gateways": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "acknowledged_gateways": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "requested_at": {
            "type": "string",
            "format": "date-time"
          },
          "retired_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "recovered_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "source_id",
          "resource",
          "app_id",
          "environment_id",
          "revision_id",
          "generation",
          "phase",
          "requested_at"
        ]
      },
      "EnvironmentWorkloadActivationEvidence": {
        "type": "object",
        "description": "Evidence summary for the exact current reviewed workload graph; retained workloads count only when their exact live deployment remains in the active release set. This evidence does not authorize candidate activation or serving.",
        "properties": {
          "commit_sha": {
            "type": "string",
            "pattern": "^([a-f0-9]{40}|[a-f0-9]{64})$",
            "description": "Approved revision commit verified in the same current graph snapshot. Independent source-ref observations never supply this identity. Older servers may omit this field."
          },
          "workloads": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EnvironmentWorkloadProgress"
            }
          },
          "graph_id": {
            "type": "string",
            "format": "uuid"
          },
          "source_id": {
            "type": "string",
            "format": "uuid"
          },
          "environment_id": {
            "type": "string",
            "format": "uuid"
          },
          "revision_id": {
            "type": "string",
            "format": "uuid"
          },
          "definition_digest": {
            "type": "string"
          },
          "generation": {
            "type": "integer",
            "format": "int64"
          },
          "intent_version": {
            "type": "integer",
            "format": "int64"
          },
          "plan_hash": {
            "type": "string"
          },
          "graph_phase": {
            "type": "string"
          },
          "graph_error_code": {
            "type": "string"
          },
          "artifacts_prepared": {
            "type": "boolean"
          },
          "candidates": {
            "type": "integer"
          },
          "retained_workloads_recorded": {
            "type": "integer",
            "description": "Unchanged graph members verified against their exact live active release-set deployments."
          },
          "captures_recorded": {
            "type": "integer"
          },
          "guest_config_acknowledgements_recorded": {
            "type": "integer"
          },
          "restores_recorded": {
            "type": "integer"
          },
          "smokes_recorded": {
            "type": "integer"
          },
          "job_smokes_recorded": {
            "type": "integer"
          },
          "framework_ready_acknowledgements_recorded": {
            "type": "integer"
          },
          "qualified": {
            "type": "boolean"
          },
          "activated": {
            "type": "boolean"
          },
          "serving": {
            "type": "boolean"
          },
          "blocking_reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "graph_id",
          "source_id",
          "environment_id",
          "revision_id",
          "definition_digest",
          "generation",
          "intent_version",
          "plan_hash",
          "graph_phase",
          "artifacts_prepared",
          "candidates",
          "retained_workloads_recorded",
          "captures_recorded",
          "guest_config_acknowledgements_recorded",
          "restores_recorded",
          "smokes_recorded",
          "job_smokes_recorded",
          "framework_ready_acknowledgements_recorded",
          "qualified",
          "activated",
          "serving",
          "blocking_reasons"
        ]
      },
      "EnvironmentGitRevisionApproval": {
        "type": "object",
        "description": "Immutable reviewed-merge evidence bound to the approved definition and source generation.",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "source_id": {
            "type": "string",
            "format": "uuid"
          },
          "revision_id": {
            "type": "string",
            "format": "uuid"
          },
          "generation": {
            "type": "integer",
            "format": "int64"
          },
          "definition_digest": {
            "type": "string"
          },
          "evidence": {
            "$ref": "#/components/schemas/EnvironmentGitReviewedMergeEvidence"
          },
          "recorded_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "source_id",
          "revision_id",
          "generation",
          "definition_digest",
          "evidence",
          "recorded_at"
        ]
      },
      "EnvironmentGitReviewedMergeEvidence": {
        "type": "object",
        "description": "Reviews of the final GitHub PR or GitLab MR head before merge. Permissions and protection describe the check time, not historical policy.",
        "properties": {
          "reviewed_definition_digest": {
            "type": "string"
          },
          "qualified": {
            "type": "boolean"
          },
          "reason": {
            "type": "string",
            "description": "Qualification failure reason; absent from persisted approval evidence."
          },
          "profile": {
            "type": "string"
          },
          "policy": {
            "$ref": "#/components/schemas/EnvironmentGitProtectedBranchEvidence"
          },
          "pull_request_id": {
            "type": "integer",
            "format": "int64"
          },
          "pull_request_number": {
            "type": "integer",
            "format": "int64"
          },
          "author_id": {
            "type": "integer",
            "format": "int64"
          },
          "head_sha": {
            "type": "string"
          },
          "merged_at": {
            "type": "string",
            "format": "date-time"
          },
          "reviews": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EnvironmentGitReviewEvidence"
            }
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "reviewed_definition_digest",
          "qualified",
          "profile",
          "policy",
          "pull_request_id",
          "pull_request_number",
          "author_id",
          "head_sha",
          "merged_at",
          "reviews",
          "checked_at"
        ]
      },
      "EnvironmentGitProtectedBranchEvidence": {
        "description": "Protected branch policy and approval checks bound to the exact environment definition commit.",
        "type": "object",
        "properties": {
          "qualified": {
            "type": "boolean"
          },
          "reason": {
            "type": "string",
            "description": "Protected branch check failure reason; excluded from durable approval evidence."
          },
          "profile": {
            "type": "string"
          },
          "installation_id": {
            "type": "integer",
            "format": "int64",
            "description": "GitHub App installation ID; omitted for GitLab OAuth sources."
          },
          "repository_id": {
            "type": "integer",
            "format": "int64"
          },
          "repository": {
            "type": "string"
          },
          "branch": {
            "type": "string"
          },
          "commit_sha": {
            "type": "string"
          },
          "policy_digest": {
            "type": "string"
          },
          "required_review_count": {
            "type": "integer"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "qualified",
          "profile",
          "repository_id",
          "repository",
          "branch",
          "commit_sha",
          "policy_digest",
          "required_review_count",
          "checked_at"
        ]
      },
      "EnvironmentGitReviewEvidence": {
        "description": "One reviewer decision for the proposed environment definition at an exact commit.",
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "reviewer_id": {
            "type": "integer",
            "format": "int64"
          },
          "reviewer": {
            "type": "string"
          },
          "head_sha": {
            "type": "string"
          },
          "submitted_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "reviewer_id",
          "reviewer",
          "head_sha",
          "submitted_at"
        ]
      },
      "AdoptEnvironmentGitOpsRequest": {
        "type": "object",
        "description": "Hash of the reviewed adoption plan; stale observations are rejected.",
        "properties": {
          "plan_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        },
        "required": [
          "plan_hash"
        ],
        "additionalProperties": false
      },
      "AdoptEnvironmentGitOpsResponse": {
        "type": "object",
        "description": "Ownership transfer result; adoption itself preserves resource values.",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "adopted"
            ]
          }
        },
        "required": [
          "status"
        ]
      },
      "RemoveEnvironmentGitOpsOverrideRequest": {
        "type": "object",
        "description": "Owned field whose temporary override should be revoked.",
        "properties": {
          "resource": {
            "type": "string"
          },
          "path": {
            "type": "string"
          }
        },
        "required": [
          "resource",
          "path"
        ],
        "additionalProperties": false
      },
      "EnvironmentGitSourceSpec": {
        "type": "object",
        "description": "Pinned repository identity and source-of-truth controls for one environment.",
        "properties": {
          "provider": {
            "type": "string",
            "enum": [
              "github",
              "gitlab"
            ]
          },
          "repository_id": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "installation_id": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "repository": {
            "type": "string"
          },
          "ref": {
            "type": "string"
          },
          "manifest_path": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "report",
              "enforce"
            ]
          },
          "approval_policy": {
            "type": "string",
            "enum": [
              "manual",
              "protected_branch"
            ]
          },
          "prune": {
            "type": "boolean"
          }
        },
        "required": [
          "provider",
          "repository_id",
          "installation_id",
          "repository",
          "ref",
          "manifest_path",
          "mode",
          "approval_policy",
          "prune"
        ]
      },
      "EnvironmentGitSource": {
        "type": "object",
        "description": "Durable environment authority with separate approved and fully applied revision pointers.",
        "properties": {
          "id": {
            "type": "string"
          },
          "account_id": {
            "type": "string"
          },
          "project_id": {
            "type": "string"
          },
          "environment_id": {
            "type": "string"
          },
          "environment": {
            "type": "string"
          },
          "source": {
            "$ref": "#/components/schemas/EnvironmentGitSourceSpec"
          },
          "detached": {
            "type": "boolean",
            "description": "Retired binding; excluded from current source lookup and controllers."
          },
          "suspended": {
            "type": "boolean"
          },
          "generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "intent_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "approved_revision_id": {
            "type": "string"
          },
          "applied_revision_id": {
            "type": "string"
          },
          "source_checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "source_error_code": {
            "type": "string"
          },
          "source_commit_sha": {
            "type": "string",
            "description": "Last verified candidate at the bound ref; discovery does not grant approval.",
            "pattern": "^([a-f0-9]{40}|[a-f0-9]{64})$"
          },
          "source_definition_digest": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "source_verified_at": {
            "type": "string",
            "format": "date-time",
            "description": "Last successful candidate verification, preserved when a later poll fails."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "account_id",
          "project_id",
          "environment_id",
          "environment",
          "source",
          "suspended",
          "generation",
          "intent_version",
          "created_at",
          "updated_at"
        ]
      },
      "EnvironmentDesiredRevision": {
        "type": "object",
        "description": "Immutable approved definition retained for reconciliation during Git outages.",
        "properties": {
          "id": {
            "type": "string"
          },
          "source_id": {
            "type": "string"
          },
          "commit_sha": {
            "type": "string",
            "pattern": "^[a-f0-9]{40}$"
          },
          "definition_digest": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "definition": {
            "$ref": "#/components/schemas/EnvironmentDefinition"
          },
          "approved_by": {
            "type": "string"
          },
          "approved_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "source_id",
          "commit_sha",
          "definition_digest",
          "definition",
          "approved_by",
          "approved_at"
        ]
      },
      "EnvironmentGitOpsRun": {
        "type": "object",
        "description": "Fenced reconciliation attempt with its observed plan and resource-step journal.",
        "properties": {
          "id": {
            "type": "string"
          },
          "source_id": {
            "type": "string"
          },
          "revision_id": {
            "type": "string"
          },
          "generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "status": {
            "type": "string",
            "enum": [
              "running",
              "converged",
              "drifted",
              "overridden",
              "blocked",
              "partial",
              "failed",
              "superseded"
            ]
          },
          "plan": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/EnvironmentGitOpsPlan"
              },
              {
                "type": "null"
              }
            ]
          },
          "steps": {
            "oneOf": [
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "error_code": {
            "type": "string"
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "source_id",
          "revision_id",
          "generation",
          "status",
          "plan",
          "steps",
          "started_at"
        ]
      },
      "EnvironmentGitSourceUpdate": {
        "type": "object",
        "description": "Change controls with a generation fence; suspended sources keep ownership.",
        "properties": {
          "expected_generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "mode": {
            "type": "string",
            "enum": [
              "report"
            ]
          },
          "prune": {
            "type": "boolean"
          },
          "suspended": {
            "type": "boolean"
          }
        },
        "required": [
          "expected_generation"
        ],
        "additionalProperties": false
      },
      "EnvironmentGitOpsOverrideRequest": {
        "type": "object",
        "description": "Temporary permission to edit one Git-owned field, bounded to twenty-four hours.",
        "properties": {
          "resource": {
            "type": "string",
            "minLength": 1
          },
          "path": {
            "type": "string",
            "minLength": 1
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "resource",
          "path",
          "reason",
          "expires_at"
        ],
        "additionalProperties": false
      },
      "EnvironmentGitOpsChange": {
        "type": "object",
        "description": "One ownership or intent difference in the deterministic plan.",
        "properties": {
          "resource": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "action": {
            "type": "string"
          },
          "before": {},
          "after": {},
          "reason": {
            "type": "string"
          }
        },
        "required": [
          "resource",
          "path",
          "action"
        ]
      },
      "EnvironmentGitOpsPlan": {
        "type": "object",
        "description": "Observation-bound plan; blocking reasons prevent mutation and overrides prevent convergence.",
        "properties": {
          "retirement_impacts": {
            "type": "array",
            "description": "Informational review-time work counts; counts do not authorize deletion or prevent busy workloads from retiring. Original identities and configuration remain protected by the plan hash.",
            "items": {
              "$ref": "#/components/schemas/EnvironmentWorkloadRetirementImpact"
            }
          },
          "manager": {
            "type": "string"
          },
          "revision": {
            "type": "string"
          },
          "commit_sha": {
            "type": "string",
            "pattern": "^[a-f0-9]{40}$"
          },
          "generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "desired_digest": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "observed_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "plan_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EnvironmentGitOpsChange"
            }
          },
          "blocking_reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "manager",
          "revision",
          "generation",
          "desired_digest",
          "observed_version",
          "plan_hash",
          "changes",
          "blocking_reasons"
        ]
      },
      "EnvironmentRecoveryRetention": {
        "type": "object",
        "additionalProperties": false,
        "description": "Explicit artifact retention; count, age and byte limits apply together. Removing the policy or detaching releases its protection. No snapshot or trust transfer.",
        "required": [
          "releases",
          "seconds",
          "max_bytes"
        ],
        "properties": {
          "releases": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5,
            "description": "Maximum newest completed serving releases, including the active release when served."
          },
          "seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 604800,
            "description": "Maximum age measured from original serving completion; observations never renew it."
          },
          "max_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 1073741824,
            "description": "Conservative per-release unique layer bytes budget; account policy reservations are limited to 2147483648 bytes."
          }
        }
      },
      "EnvironmentDefinition": {
        "type": "object",
        "description": "Versioned Git intent; omitted settings are unmanaged and removal requires explicit pruning. The workloads map is required; an explicit empty map represents an empty environment.",
        "properties": {
          "recovery_retention": {
            "$ref": "#/components/schemas/EnvironmentRecoveryRetention"
          },
          "api_version": {
            "type": "string",
            "enum": [
              "gregale.dev/environment/v1"
            ]
          },
          "project": {
            "type": "string"
          },
          "environment": {
            "type": "string"
          },
          "workload_pruning_policy": {
            "type": "string",
            "enum": [
              "retain"
            ],
            "description": "Reviewed whole-workload retirement when source pruning is enabled. Withdraws this environment after replacement qualification, retains configuration and accepted work, and requires original app identity and fresh qualification for recovery."
          },
          "workload_recoveries": {
            "type": "object",
            "description": "Reviewed recovery keyed by declared logical workload name, with its original retained app UUID. Queue recovery continues to require original binding UUIDs separately.",
            "additionalProperties": {
              "type": "string",
              "format": "uuid"
            }
          },
          "queue_pruning_policy": {
            "type": "string",
            "enum": [
              "retain"
            ],
            "description": "Explicit reviewed disposition for removed owned queues when pruning is enabled. Retires admission and dispatch while preserving binding IDs, accepted work and delivery receipts. Omit to block queue pruning."
          },
          "configuration": {
            "type": "object",
            "additionalProperties": {}
          },
          "workloads": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/EnvironmentWorkload"
            }
          }
        },
        "required": [
          "api_version",
          "project",
          "environment",
          "workloads"
        ],
        "additionalProperties": false
      },
      "EnvironmentWorkload": {
        "type": "object",
        "description": "Logical workload intent; unsupported adapters are reported as blocking reasons.",
        "properties": {
          "app": {
            "type": "string"
          },
          "source": {
            "$ref": "#/components/schemas/EnvironmentWorkloadSource"
          },
          "runtime": {
            "$ref": "#/components/schemas/AppManifest"
          },
          "variables": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "secret_refs": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "routes": {
            "$ref": "#/components/schemas/EnvironmentRouteContract"
          },
          "policies": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EnvironmentPolicy"
            }
          },
          "queue_bindings": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/EnvironmentQueueBinding"
            }
          },
          "queue_smoke": {
            "type": "object",
            "description": "Reviewed synthetic JSON input for each enabled push worker queue binding. Qualification sends it directly to the private candidate VM and never enqueues a customer message.",
            "additionalProperties": {
              "$ref": "#/components/schemas/EnvironmentQueueSmoke"
            }
          },
          "job_smoke": {
            "$ref": "#/components/schemas/EnvironmentJobSmoke"
          },
          "schedule": {
            "$ref": "#/components/schemas/EnvironmentJobSchedule"
          },
          "queue_recoveries": {
            "type": "object",
            "description": "Explicit recovery of retained queues, keyed by a declared binding name and pinned to its original scoped binding UUID. Requires reviewed adoption before reconciliation can resume retained work; adoption itself preserves the retirement hold.",
            "additionalProperties": {
              "type": "string",
              "format": "uuid"
            }
          },
          "service_bindings": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/EnvironmentServiceBinding"
            }
          }
        },
        "additionalProperties": false
      },
      "EnvironmentWorkloadSource": {
        "type": "object",
        "description": "Build source within the approved Git tree, a function runner, or an immutable OCI digest. Function sources require runtime and exclude dockerfile. An immutable image may explicitly opt into full-rootfs dispatch. The gated internal executor reserves new private workloads when app is omitted. Preparation does not grant serving authority.",
        "properties": {
          "reuse_unchanged_build": {
            "type": "boolean",
            "default": false,
            "description": "Opt into isolated canonical Git context and same-app signed build reuse. A fresh target candidate and qualification are always required. An explicit build_artifact_id takes precedence. Link entries in the context are unsupported."
          },
          "build_context": {
            "type": "string",
            "description": "Repository-relative context directory; defaults to the entire repository when reuse is enabled. Must contain source.directory and all shared build inputs. Files outside this directory are not delivered to the builder. Requires reuse_unchanged_build."
          },
          "kind": {
            "type": "string",
            "enum": [
              "source",
              "dockerfile",
              "image",
              "function"
            ]
          },
          "build_artifact_id": {
            "type": "string",
            "format": "uuid",
            "description": "Existing signed source-build producer. Requires build_artifact_hash; same mapped app only. Unsupported for images and scheduled Jobs."
          },
          "build_artifact_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Exact immutable producer input hash. Retention does not grant qualification or activation authority."
          },
          "runtime": {
            "type": "string",
            "description": "Supported runner; required only when kind is function.",
            "enum": [
              "node22",
              "python312",
              "go124",
              "go124-alpine",
              "node24",
              "python313"
            ]
          },
          "directory": {
            "type": "string"
          },
          "dockerfile": {
            "type": "string"
          },
          "image": {
            "type": "string"
          },
          "full_rootfs": {
            "type": "boolean",
            "description": "Explicit full-rootfs dispatch for an immutable image source; unsupported for other source kinds."
          }
        },
        "required": [
          "kind"
        ],
        "additionalProperties": false
      },
      "EnvironmentRouteContract": {
        "type": "object",
        "description": "Atomic environment-scoped declared-route collection.",
        "properties": {
          "only_allow_declared_routes": {
            "type": "boolean"
          },
          "declared_routes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeclaredRoute"
            },
            "maxItems": 50
          }
        },
        "required": [
          "only_allow_declared_routes",
          "declared_routes"
        ],
        "additionalProperties": false
      },
      "EnvironmentPolicy": {
        "type": "object",
        "description": "Named environment-scoped headers or CORS rule.",
        "properties": {
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "headers",
              "cors"
            ]
          },
          "match_path": {
            "type": "string"
          },
          "match_methods": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "match_headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "priority": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          },
          "enabled": {
            "type": "boolean"
          },
          "action": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/EdgeRuleHeadersAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleCORSAction"
              }
            ]
          }
        },
        "required": [
          "name",
          "kind",
          "match_path",
          "priority",
          "action"
        ],
        "additionalProperties": false
      },
      "EnvironmentQueueBinding": {
        "type": "object",
        "description": "Atomic queue binding intent in the named environment. Reviewed adoption preserves the original binding and consumer IDs and delivery history. Queue pruning and retired identity recovery require a separate reviewed disposition.",
        "properties": {
          "queue_name": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "pull",
              "push"
            ]
          },
          "workload_class": {
            "type": "string",
            "description": "worker or job, or http for push-only bindings on function workloads"
          },
          "enabled": {
            "type": "boolean"
          },
          "max_concurrency": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000
          },
          "retry_policy": {
            "$ref": "#/components/schemas/RetryPolicyDTO"
          }
        },
        "required": [
          "queue_name",
          "workload_class"
        ],
        "additionalProperties": false
      },
      "EnvironmentQueueSmoke": {
        "type": "object",
        "description": "Bounded customer-authored JSON payload used only for isolated push/pull-worker or HTTP-function qualification. Do not include secrets.",
        "properties": {
          "payload": {
            "description": "One JSON value, limited to 64 KiB, delivered to the candidate through its frozen queue invocation contract.",
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": true
              },
              {
                "type": "array",
                "items": {}
              },
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "payload"
        ],
        "additionalProperties": false
      },
      "EnvironmentJobSmoke": {
        "type": "object",
        "description": "Reviewed argv-only command and short timeout for a job qualification attempt. The contract is frozen with the candidate; isolated execution and exit evidence are not yet available.",
        "properties": {
          "command": {
            "type": "array",
            "minItems": 1,
            "maxItems": 64,
            "items": {
              "type": "string",
              "maxLength": 4096
            },
            "description": "Executable and arguments passed directly without a shell."
          },
          "timeout_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 300,
            "description": "Explicit qualification wall-clock limit."
          }
        },
        "required": [
          "command",
          "timeout_seconds"
        ],
        "additionalProperties": false
      },
      "EnvironmentJobSchedule": {
        "type": "object",
        "description": "Reviewed recurring schedule for a job workload. Cron and timezone map to Gregale's durable Job schedule; production dispatch remains gated until the managed Job adapter is available.",
        "properties": {
          "cron": {
            "type": "string",
            "description": "Five-field cron expression evaluated in timezone.",
            "example": "0 3 * * *"
          },
          "timezone": {
            "type": "string",
            "description": "IANA timezone. Empty or omitted uses UTC.",
            "default": "UTC",
            "example": "Europe/Istanbul"
          },
          "schedule_policy": {
            "$ref": "#/components/schemas/SchedulePolicy"
          },
          "failure_rules": {
            "$ref": "#/components/schemas/FailureRules"
          }
        },
        "required": [
          "cron"
        ],
        "additionalProperties": false
      },
      "EnvironmentServiceBinding": {
        "type": "object",
        "description": "Reference to another logical workload in the same environment.",
        "properties": {
          "workload": {
            "type": "string"
          },
          "env_key": {
            "type": "string"
          }
        },
        "required": [
          "workload",
          "env_key"
        ],
        "additionalProperties": false
      },
      "ObjectDeletionRequest": {
        "type": "object",
        "description": "One durable mutation; reuse the ID for retries of the same key and selector.",
        "required": [
          "id",
          "key"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          },
          "version_id": {
            "type": "string",
            "pattern": "^(null|[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$",
            "description": "Omit for ordinary deletion; use null or an owned public version UUID for permanent deletion."
          }
        }
      },
      "ObjectDeletion": {
        "type": "object",
        "description": "Durable deletion receipt; uncertain attempts retain their bucket fence.",
        "required": [
          "id",
          "bucket_id",
          "key",
          "selector",
          "state",
          "delete_marker",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bucket_id": {
            "type": "string",
            "format": "uuid"
          },
          "key": {
            "type": "string"
          },
          "selector": {
            "type": "string",
            "description": "Empty for ordinary deletion; null or the selected owned public version UUID otherwise."
          },
          "state": {
            "type": "string",
            "enum": [
              "prepared",
              "dispatched",
              "completed",
              "failed"
            ]
          },
          "version_id": {
            "type": "string",
            "description": "Selected public version UUID or new public marker UUID or null when acknowledged; private provider IDs are never exposed."
          },
          "delete_marker": {
            "type": "boolean"
          },
          "last_error_code": {
            "type": "string",
            "enum": [
              "provider_uncertain",
              "configuration",
              "preparation_failed",
              "preparation_expired",
              "provider_rejected",
              "object_protected"
            ],
            "description": "object_protected defers a lifecycle target under retention or a hold until a later scan."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ObjectTaggingRequest": {
        "type": "object",
        "description": "Complete replacement object tag set, including an empty set to clear all tags.",
        "additionalProperties": false,
        "required": [
          "tags"
        ],
        "properties": {
          "tags": {
            "type": "object",
            "description": "Complete replacement set. Empty removes all tags. Keys and values use the portable UTF-8 byte limits.",
            "maxProperties": 10,
            "propertyNames": {
              "minLength": 1,
              "maxLength": 128
            },
            "additionalProperties": {
              "type": "string",
              "maxLength": 256
            }
          }
        }
      },
      "ObjectTaggingResult": {
        "type": "object",
        "description": "Acknowledged object tags and optional owned public version identity.",
        "additionalProperties": false,
        "required": [
          "tags"
        ],
        "properties": {
          "version_id": {
            "type": "string",
            "description": "Public version UUID or null. Omitted for unversioned or legacy current-object providers."
          },
          "tags": {
            "type": "object",
            "description": "Acknowledged complete tag set; native provider IDs and private completion metadata are never exposed.",
            "maxProperties": 10,
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      },
      "ObjectVersionDeleteResult": {
        "type": "object",
        "description": "Selected immutable public version and the acknowledged marker flag after permanent deletion.",
        "required": [
          "version_id",
          "delete_marker"
        ],
        "properties": {
          "version_id": {
            "type": "string",
            "description": "Public immutable version UUID or null."
          },
          "delete_marker": {
            "type": "boolean",
            "description": "True when the acknowledged removal deleted a marker. A retry after removal can return false."
          }
        }
      },
      "RouteRequirementsConfig": {
        "type": "object",
        "description": "Version 1 requires 1..500 concrete routes. Version 2 assigns every captured operation to groups, concrete routes, or public exceptions; overlapping groups are conjunctive.",
        "additionalProperties": false,
        "required": [
          "version"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1,
              2
            ]
          },
          "routes": {
            "type": "array",
            "maxItems": 500,
            "items": {
              "$ref": "#/components/schemas/RouteRequirement"
            }
          },
          "groups": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/RouteGroup"
            }
          },
          "public": {
            "type": "array",
            "maxItems": 500,
            "items": {
              "$ref": "#/components/schemas/RoutePublicException"
            }
          }
        }
      },
      "RouteGroup": {
        "type": "object",
        "description": "Named policy requirements for explicit methods below a canonical literal prefix ending in slash.",
        "additionalProperties": false,
        "required": [
          "name",
          "path_prefix",
          "methods",
          "require"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "path_prefix": {
            "type": "string",
            "maxLength": 2048
          },
          "methods": {
            "type": "array",
            "minItems": 1,
            "maxItems": 7,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "GET",
                "HEAD",
                "POST",
                "PUT",
                "PATCH",
                "DELETE",
                "OPTIONS"
              ]
            }
          },
          "require": {
            "$ref": "#/components/schemas/RouteChecks"
          }
        }
      },
      "RoutePublicException": {
        "type": "object",
        "description": "Exact captured operation exempt from group checks. Rationale is replaced with declared_public_exception in normalized plans; exceptions do not change runtime access.",
        "additionalProperties": false,
        "required": [
          "method",
          "path",
          "reason"
        ],
        "properties": {
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "HEAD",
              "POST",
              "PUT",
              "PATCH",
              "DELETE",
              "OPTIONS"
            ]
          },
          "path": {
            "type": "string",
            "maxLength": 2048
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          }
        }
      },
      "RouteRequirement": {
        "type": "object",
        "description": "Named request shape and required configured authentication, throttle, or execution budget.",
        "additionalProperties": false,
        "required": [
          "method",
          "path",
          "require"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 128
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "HEAD",
              "POST",
              "PUT",
              "PATCH",
              "DELETE",
              "OPTIONS"
            ]
          },
          "path": {
            "type": "string",
            "maxLength": 2048,
            "description": "Concrete decoded platform-host path without templates or globs."
          },
          "require": {
            "$ref": "#/components/schemas/RouteChecks"
          }
        }
      },
      "RouteChecks": {
        "type": "object",
        "description": "At least one policy requirement; application authorization remains outside configuration verification.",
        "additionalProperties": false,
        "properties": {
          "authentication": {
            "type": "string",
            "enum": [
              "consumer",
              "jwt",
              "application"
            ]
          },
          "throttle": {
            "$ref": "#/components/schemas/RouteThrottleRequirement"
          },
          "budget": {
            "$ref": "#/components/schemas/RouteBudgetRequirement"
          }
        }
      },
      "RouteThrottleRequirement": {
        "type": "object",
        "description": "Desired throttle key dimension, optional rate ceiling, and missing-identity behavior.",
        "additionalProperties": false,
        "required": [
          "key_by"
        ],
        "properties": {
          "key_by": {
            "type": "string",
            "enum": [
              "none",
              "api_key",
              "consumer_id",
              "jwt_subject",
              "country",
              "ip"
            ]
          },
          "max_rps": {
            "type": "number",
            "exclusiveMinimum": 0
          },
          "missing_key_policy": {
            "type": "string",
            "enum": [
              "shared",
              "reject"
            ]
          }
        }
      },
      "RouteBudgetRequirement": {
        "type": "object",
        "description": "Optional execution-budget ceiling or requirement for an explicit budget rule.",
        "additionalProperties": false,
        "properties": {
          "max_ms": {
            "type": "integer",
            "minimum": 1
          },
          "explicit": {
            "type": "boolean"
          }
        }
      },
      "RouteRequirementsReport": {
        "type": "object",
        "description": "Configuration evidence for concrete requests or every captured operation with group assignments and bounded policy scope.",
        "required": [
          "version",
          "sha256",
          "policy_scope",
          "status",
          "scope",
          "routes"
        ],
        "properties": {
          "version": {
            "type": "integer"
          },
          "sha256": {
            "type": "string"
          },
          "host": {
            "type": "string"
          },
          "policy_scope": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          },
          "routes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteRequirementsResult"
            }
          },
          "coverage": {
            "$ref": "#/components/schemas/RouteCoverageInventory"
          },
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteGroupResult"
            }
          },
          "assignments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteAssignment"
            }
          }
        }
      },
      "RouteCoverageInventory": {
        "type": "object",
        "description": "Provenance and completeness of the selected captured contract; raw contract content is excluded.",
        "required": [
          "status",
          "source",
          "route_count"
        ],
        "properties": {
          "status": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "deployment": {
            "type": "string"
          },
          "sha256": {
            "type": "string"
          },
          "route_count": {
            "type": "integer"
          }
        }
      },
      "RouteGroupResult": {
        "type": "object",
        "description": "Group coverage status and captured operation counts.",
        "required": [
          "name",
          "status",
          "matched_routes",
          "exempt_routes"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "matched_routes": {
            "type": "integer"
          },
          "exempt_routes": {
            "type": "integer"
          },
          "code": {
            "type": "string"
          }
        }
      },
      "RouteAssignment": {
        "type": "object",
        "description": "Captured operation assignment and group provenance for checks in the same report row.",
        "required": [
          "method",
          "path",
          "scope"
        ],
        "properties": {
          "method": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          },
          "groups": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "checks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteAssignedCheck"
            }
          }
        }
      },
      "RouteAssignedCheck": {
        "type": "object",
        "description": "Group name and index into the operation checks array.",
        "required": [
          "group",
          "check_index"
        ],
        "properties": {
          "group": {
            "type": "string"
          },
          "check_index": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "RouteRequirementsResult": {
        "type": "object",
        "description": "Per-request requirement evaluation including satisfied, violated, or unknown findings.",
        "required": [
          "method",
          "path",
          "status",
          "checks"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "checks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteRequirementsFinding"
            }
          }
        }
      },
      "RouteRequirementsFinding": {
        "type": "object",
        "description": "Allowlisted configuration summary without raw credential material or unrelated rule actions.",
        "required": [
          "requirement",
          "status",
          "code",
          "expected",
          "reason"
        ],
        "properties": {
          "requirement": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "expected": {
            "type": "string"
          },
          "actual": {
            "type": "string"
          },
          "rule_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "reason": {
            "type": "string"
          },
          "next_action": {
            "type": "string"
          }
        }
      },
      "RouteRemovalPolicy": {
        "type": "object",
        "description": "App route retirement policy and its current observation baseline.",
        "required": [
          "app_id",
          "mode",
          "revision",
          "grace_period",
          "max_approval_age"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "mode": {
            "type": "string",
            "enum": [
              "report",
              "enforce"
            ]
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 2147483647
          },
          "grace_period": {
            "type": "string",
            "description": "Go duration; default 720h."
          },
          "max_approval_age": {
            "type": "string",
            "description": "Go duration; default 1h."
          },
          "baseline_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SetRouteRemovalPolicyRequest": {
        "type": "object",
        "description": "Replacement route retirement policy with an optimistic revision check.",
        "additionalProperties": false,
        "required": [
          "expected_revision",
          "mode"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 2147483646
          },
          "mode": {
            "type": "string",
            "enum": [
              "report",
              "enforce"
            ]
          },
          "grace_period": {
            "type": "string",
            "description": "Go duration between 1h and 2160h; default 720h."
          },
          "max_approval_age": {
            "type": "string",
            "description": "Go duration between 1m and 72h; default 1h."
          }
        }
      },
      "RouteRemovalMapping": {
        "type": "object",
        "description": "Removed operation and its optional successor operation.",
        "additionalProperties": false,
        "required": [
          "method",
          "path"
        ],
        "properties": {
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "PUT",
              "POST",
              "DELETE",
              "OPTIONS",
              "HEAD",
              "PATCH",
              "TRACE"
            ]
          },
          "path": {
            "type": "string",
            "maxLength": 4096
          },
          "successor_method": {
            "type": "string",
            "enum": [
              "GET",
              "PUT",
              "POST",
              "DELETE",
              "OPTIONS",
              "HEAD",
              "PATCH",
              "TRACE"
            ]
          },
          "successor_path": {
            "type": "string",
            "maxLength": 4096
          }
        }
      },
      "ApproveRouteRemovalRequest": {
        "type": "object",
        "description": "Pinned route retirement evidence and explicit acknowledgement of telemetry limits.",
        "additionalProperties": false,
        "required": [
          "expected_policy_revision",
          "baseline_deployment_id",
          "candidate_deployment_id",
          "baseline_contract_sha256",
          "candidate_contract_sha256",
          "mappings",
          "acknowledge_observed_only"
        ],
        "properties": {
          "expected_policy_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "baseline_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "candidate_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "baseline_contract_sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Authoritative doc_sha256 capture metadata, not a reserialized document digest."
          },
          "candidate_contract_sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "mappings": {
            "type": "array",
            "minItems": 1,
            "maxItems": 2000,
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/RouteRemovalMapping"
                },
                {
                  "type": "object",
                  "required": [
                    "successor_method",
                    "successor_path"
                  ]
                }
              ]
            }
          },
          "acknowledge_observed_only": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Explicit owner acknowledgement that telemetry is sampled and asynchronous and cannot establish absence of every client."
          }
        }
      },
      "RouteLifecycleMapping": {
        "type": "object",
        "description": "Retiring operation mapped to a verified captured successor.",
        "additionalProperties": false,
        "required": [
          "method",
          "path",
          "successor_url",
          "successor_method",
          "successor_path"
        ],
        "properties": {
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "PUT",
              "POST",
              "DELETE",
              "OPTIONS",
              "HEAD",
              "PATCH",
              "TRACE"
            ]
          },
          "path": {
            "type": "string",
            "maxLength": 4096
          },
          "successor_url": {
            "type": "string",
            "format": "uri",
            "description": "Exact candidate x-gregale-successor HTTPS URL on the successor app's canonical host or verified application-wide custom domain, with no port, query or fragment. Ambiguous routing and tenant surfaces require further review."
          },
          "successor_method": {
            "type": "string",
            "enum": [
              "GET",
              "PUT",
              "POST",
              "DELETE",
              "OPTIONS",
              "HEAD",
              "PATCH",
              "TRACE"
            ]
          },
          "successor_path": {
            "type": "string",
            "maxLength": 4096
          },
          "successor_app_id": {
            "type": "string",
            "format": "uuid",
            "description": "Same-account destination app. Supply together with successor_deployment_id and successor_contract_sha256; omit all three for the source app candidate."
          },
          "successor_deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Destination deployment. Legacy apps require one production destination at 100 percent. Project apps require one live active production graph member with frozen settings. Source-app successors must use the candidate."
          },
          "successor_contract_sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Authoritative destination doc_sha256 capture metadata."
          }
        }
      },
      "ApproveRouteLifecycleRequest": {
        "type": "object",
        "description": "Pinned policy, contract and successor evidence for a lifecycle approval.",
        "additionalProperties": false,
        "required": [
          "expected_gate_revision",
          "expected_requirements_revision",
          "expected_removal_policy_revision",
          "configuration_sha256",
          "baseline_deployment_id",
          "candidate_deployment_id",
          "baseline_contract_sha256",
          "candidate_contract_sha256",
          "mappings"
        ],
        "properties": {
          "expected_gate_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "expected_requirements_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "expected_removal_policy_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "configuration_sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Configuration digest from the server's saved route requirements check."
          },
          "baseline_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "candidate_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "baseline_contract_sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Authoritative doc_sha256 capture metadata; normalized document hashes are not accepted."
          },
          "candidate_contract_sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "mappings": {
            "type": "array",
            "minItems": 1,
            "maxItems": 2000,
            "items": {
              "$ref": "#/components/schemas/RouteLifecycleMapping"
            }
          }
        }
      },
      "RouteLifecycleHistoryCapture": {
        "type": "object",
        "description": "Deployment contract digest recorded at production review time.",
        "required": [
          "deployment_id",
          "sha256"
        ],
        "properties": {
          "deployment_id": {
            "type": "string"
          },
          "sha256": {
            "type": "string"
          }
        }
      },
      "RouteLifecycleHistoryApproval": {
        "type": "object",
        "description": "Historical approval binding with its current validity status.",
        "required": [
          "id",
          "used",
          "status",
          "status_reason",
          "baseline_deployment_id",
          "candidate_deployment_id",
          "baseline_contract_sha256",
          "candidate_contract_sha256",
          "configuration_sha256",
          "valid_until",
          "graph_ids"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "used": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "enum": [
              "valid",
              "expired",
              "invalidated",
              "unavailable"
            ]
          },
          "status_reason": {
            "type": "string"
          },
          "baseline_deployment_id": {
            "type": "string"
          },
          "candidate_deployment_id": {
            "type": "string"
          },
          "baseline_contract_sha256": {
            "type": "string"
          },
          "candidate_contract_sha256": {
            "type": "string"
          },
          "configuration_sha256": {
            "type": "string"
          },
          "valid_until": {
            "type": "string",
            "format": "date-time"
          },
          "invalidated_at": {
            "type": "string",
            "format": "date-time"
          },
          "graph_ids": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "type": "string"
            }
          }
        }
      },
      "RouteLifecycleHistoryEntry": {
        "type": "object",
        "description": "Retained production review outcome and bounded historical evidence.",
        "required": [
          "id",
          "app_id",
          "deployment_id",
          "reviewed_at",
          "scope",
          "outcome",
          "recovery",
          "decision",
          "evidence_available",
          "truncated",
          "captures",
          "graph_ids",
          "approvals"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[1-9][0-9]*$"
          },
          "app_id": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string"
          },
          "reviewed_at": {
            "type": "string",
            "format": "date-time"
          },
          "scope": {
            "type": "string"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "applied",
              "blocked"
            ]
          },
          "recovery": {
            "type": "boolean"
          },
          "decision": {
            "$ref": "#/components/schemas/RouteGateDecision"
          },
          "evidence_available": {
            "type": "boolean"
          },
          "truncated": {
            "type": "boolean"
          },
          "captures": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "$ref": "#/components/schemas/RouteLifecycleHistoryCapture"
            }
          },
          "graph_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "approvals": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/RouteLifecycleHistoryApproval"
            }
          }
        }
      },
      "RouteLifecycleHistoryPage": {
        "type": "object",
        "description": "Newest retained lifecycle reviews with an optional continuation cursor.",
        "required": [
          "app_id",
          "entries"
        ],
        "properties": {
          "app_id": {
            "type": "string"
          },
          "entries": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/RouteLifecycleHistoryEntry"
            }
          },
          "next_cursor": {
            "type": "string"
          }
        }
      },
      "RouteLifecycleApproval": {
        "type": "object",
        "description": "Time-limited lifecycle receipt bound to configuration and captured successors.",
        "required": [
          "id",
          "app_id",
          "gate_revision",
          "requirements_revision",
          "removal_policy_revision",
          "configuration_sha256",
          "baseline_deployment_id",
          "candidate_deployment_id",
          "baseline_contract_sha256",
          "candidate_contract_sha256",
          "mapping_sha256",
          "mappings",
          "compatibility",
          "checker_version",
          "approved_by",
          "approved_at",
          "valid_until"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "gate_revision": {
            "type": "integer",
            "format": "int64"
          },
          "requirements_revision": {
            "type": "integer",
            "format": "int64"
          },
          "removal_policy_revision": {
            "type": "integer",
            "format": "int64"
          },
          "configuration_sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "baseline_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "candidate_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "baseline_contract_sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "candidate_contract_sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "mapping_sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "mappings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteLifecycleMapping"
            }
          },
          "compatibility": {
            "type": "string",
            "enum": [
              "no_supported_breaks"
            ],
            "description": "Server comparison found no supported declared request, response, method, path parameter or security breaks. This is not proof of runtime equivalence."
          },
          "checker_version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "approved_by": {
            "type": "string",
            "description": "Authenticated owner/admin account and key or session identity."
          },
          "approved_at": {
            "type": "string",
            "format": "date-time"
          },
          "valid_until": {
            "type": "string",
            "format": "date-time"
          },
          "invalidated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Permanently invalidated by capture replacement or deletion; old bytes cannot revive the receipt."
          }
        }
      },
      "RouteRemovalApproval": {
        "type": "object",
        "description": "Time-limited retirement receipt bound to captures and observed route usage.",
        "required": [
          "id",
          "app_id",
          "policy_revision",
          "baseline_deployment_id",
          "candidate_deployment_id",
          "baseline_contract_sha256",
          "candidate_contract_sha256",
          "mapping_sha256",
          "mappings",
          "approved_by",
          "approved_at",
          "valid_until",
          "observation_from",
          "observation_until",
          "coverage"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "policy_revision": {
            "type": "integer",
            "format": "int64"
          },
          "baseline_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "candidate_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "baseline_contract_sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "candidate_contract_sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "mapping_sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Digest of server-normalized mapping entries."
          },
          "mappings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteRemovalMapping"
            }
          },
          "approved_by": {
            "type": "string",
            "description": "Authenticated account and key or session identity."
          },
          "approved_at": {
            "type": "string",
            "format": "date-time"
          },
          "valid_until": {
            "type": "string",
            "format": "date-time"
          },
          "observation_from": {
            "type": "string",
            "format": "date-time"
          },
          "observation_until": {
            "type": "string",
            "format": "date-time"
          },
          "coverage": {
            "type": "string",
            "enum": [
              "observed_only"
            ]
          }
        }
      },
      "RouteRemovalCheck": {
        "type": "object",
        "description": "Current retirement evaluation with blockers and recovery guidance.",
        "required": [
          "policy",
          "candidate_deployment_id",
          "status",
          "removed",
          "blockers"
        ],
        "properties": {
          "earliest_approval_at": {
            "type": "string",
            "format": "date-time",
            "description": "Earliest approval time for the current observed baseline and capture."
          },
          "approval_valid_until": {
            "type": "string",
            "format": "date-time",
            "description": "Expiry of the currently valid matching approval."
          },
          "next_actions": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Recovery guidance for the current check."
          },
          "baseline_contract_sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Authoritative baseline capture digest to pin in an approval request."
          },
          "candidate_contract_sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Authoritative candidate capture digest to pin in an approval request."
          },
          "policy": {
            "$ref": "#/components/schemas/RouteRemovalPolicy"
          },
          "candidate_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "not_configured",
              "not_required",
              "passed",
              "blocked"
            ]
          },
          "removed": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteRemovalMapping"
            }
          },
          "blockers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "approval_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "SavedRouteRequirements": {
        "type": "object",
        "description": "Current version 2 route intent. Revision increments only when normalized intent changes. Original public rationale is never stored or returned.",
        "required": [
          "app_id",
          "revision",
          "sha256",
          "requirements",
          "updated_at"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "requirements": {
            "$ref": "#/components/schemas/RouteRequirementsConfig"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SaveRouteRequirementsRequest": {
        "type": "object",
        "description": "Replacement version 2 route requirements with an optimistic revision check.",
        "additionalProperties": false,
        "required": [
          "expected_revision",
          "requirements"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Current revision; 0 creates the first saved record."
          },
          "requirements": {
            "$ref": "#/components/schemas/RouteRequirementsConfig"
          }
        }
      },
      "CheckRouteRequirementsRequest": {
        "type": "object",
        "description": "App-owned deployment capture to evaluate against saved route intent, with an optional intent revision pin.",
        "additionalProperties": false,
        "required": [
          "deployment_id"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "Optional saved revision pin; a changed revision returns 409."
          }
        }
      },
      "RouteRequirementsCheck": {
        "type": "object",
        "description": "Read-only coverage against one captured deployment and current configuration with saved intent provenance. Does not persist history or prove runtime behavior.",
        "required": [
          "version",
          "app",
          "app_id",
          "deployment_id",
          "requirements_revision",
          "requirements_sha256",
          "configuration_sha256",
          "report"
        ],
        "properties": {
          "version": {
            "type": "integer"
          },
          "app": {
            "type": "string"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "requirements_revision": {
            "type": "integer",
            "format": "int64"
          },
          "requirements_sha256": {
            "type": "string"
          },
          "configuration_sha256": {
            "type": "string"
          },
          "report": {
            "$ref": "#/components/schemas/RouteRequirementsReport"
          }
        }
      },
      "WorkerRolloutObservation": {
        "description": "Passive deployment-attributed observations of the selected worker generation.",
        "type": "object",
        "required": [
          "app_id",
          "deployment_id",
          "scope",
          "checked_at",
          "basis",
          "running",
          "starting",
          "draining",
          "other_residents",
          "retired_residents",
          "generation_converged",
          "queue_processing_confirmed"
        ],
        "properties": {
          "app_id": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          },
          "project_id": {
            "type": "string"
          },
          "environment_id": {
            "type": "string"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "basis": {
            "type": "string",
            "enum": [
              "resident_generation_snapshot"
            ]
          },
          "selected_deployment_id": {
            "type": "string"
          },
          "running": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "starting": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "draining": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "other_residents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "retired_residents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "generation_converged": {
            "type": "boolean"
          },
          "queue_processing_confirmed": {
            "type": "boolean",
            "enum": [
              false
            ]
          }
        }
      },
      "AppOperationalSummary": {
        "type": "object",
        "description": "Read-only current production route health, open incident metadata and pending recovery work, shared by inspect and the app dashboard.",
        "required": [
          "version",
          "app_id",
          "checked_at",
          "monitoring",
          "recovery",
          "recommendations"
        ],
        "properties": {
          "scope": {
            "type": "string"
          },
          "project_id": {
            "type": "string"
          },
          "environment_id": {
            "type": "string"
          },
          "health": {
            "$ref": "#/components/schemas/AppHealthResponse"
          },
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "app_id": {
            "type": "string"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "monitoring": {
            "$ref": "#/components/schemas/AppOperationalMonitoring"
          },
          "recovery": {
            "$ref": "#/components/schemas/AppOperationalRecovery"
          },
          "recommendations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppOperationalRecommendation"
            }
          }
        }
      },
      "EnvironmentRouteBudgets": {
        "description": "Effective advisory route budgets for one immutable app environment.",
        "type": "object",
        "required": [
          "app_id",
          "scope",
          "budget_source",
          "revision",
          "app_revision",
          "config"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "environment_id": {
            "type": "string",
            "format": "uuid"
          },
          "budget_source": {
            "type": "string",
            "enum": [
              "app_policy",
              "environment_policy"
            ]
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "app_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "config": {
            "$ref": "#/components/schemas/RouteMonitorConfig"
          }
        }
      },
      "EnvironmentRouteBudgetReceipt": {
        "description": "Original durable policy-intent receipt. Request fingerprints bind exact bodies but grant no write authority. No configuration values are exposed.",
        "type": "object",
        "required": [
          "request_id",
          "request_hash",
          "app_id",
          "scope",
          "revision",
          "app_revision",
          "budget_source"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "request_hash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "environment_id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "app_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "budget_source": {
            "type": "string",
            "enum": [
              "app_policy",
              "environment_policy"
            ]
          }
        }
      },
      "SetEnvironmentRouteBudgetsRequest": {
        "description": "Compare-and-swap update of the selected environment route-budget override.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "app_id",
          "request_id",
          "expected_revision",
          "expected_app_revision",
          "inherit",
          "enabled",
          "routes"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "environment_id": {
            "type": "string",
            "format": "uuid"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "expected_app_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "inherit": {
            "type": "boolean",
            "description": "Requires enabled=false and empty routes; restores current app thresholds."
          },
          "enabled": {
            "type": "boolean"
          },
          "routes": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/RouteMonitorRoute"
            }
          }
        }
      },
      "ScopedRouteBudgetReport": {
        "type": "object",
        "description": "Read-only evaluation of inherited or overridden budgets against one selected environment serving release. Completed current windows only; no pooled history, customer cohorts, scoped incidents or automatic rollback.",
        "required": [
          "scope",
          "budget_source",
          "report"
        ],
        "properties": {
          "scope": {
            "type": "string"
          },
          "project_id": {
            "type": "string"
          },
          "environment_id": {
            "type": "string"
          },
          "budget_source": {
            "type": "string",
            "enum": [
              "app_policy",
              "environment_policy"
            ]
          },
          "budget_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "app_budget_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "report": {
            "$ref": "#/components/schemas/RouteMonitorReport"
          }
        }
      },
      "AppOperationalMonitoring": {
        "type": "object",
        "description": "Recent default-scope or explicitly scoped route-monitor evaluation with observed-only coverage. Unknown or unavailable health is independent of deployment smoke verification.",
        "required": [
          "available",
          "status",
          "reason",
          "coverage",
          "incidents_available"
        ],
        "properties": {
          "route_budgets": {
            "$ref": "#/components/schemas/ScopedRouteBudgetReport"
          },
          "available": {
            "type": "boolean"
          },
          "status": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "coverage": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "window_end": {
            "type": "string",
            "format": "date-time"
          },
          "incidents_available": {
            "type": "boolean"
          },
          "incident": {
            "$ref": "#/components/schemas/AppOperationalIncident"
          }
        }
      },
      "AppOperationalIncident": {
        "type": "object",
        "description": "Metadata for the app's open production-route incident. Reading this summary never closes the incident or includes saved request evidence.",
        "required": [
          "id",
          "deployment_id",
          "opened_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string"
          },
          "opened_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AppOperationalRecovery": {
        "type": "object",
        "description": "Bounded app-scoped pending rollbacks and pending or failed restart handoffs. Availability and truncation are explicit; accepted work does not establish completed recovery.",
        "required": [
          "rollbacks_available",
          "restarts_available",
          "rollbacks_truncated",
          "restarts_truncated",
          "rollbacks",
          "restarts"
        ],
        "properties": {
          "workers": {
            "$ref": "#/components/schemas/AppWorkerRecovery"
          },
          "coverage": {
            "type": "string",
            "description": "Explicit scoped summaries include only attributable operations; app-wide restarts are excluded."
          },
          "rollbacks_available": {
            "type": "boolean"
          },
          "restarts_available": {
            "type": "boolean"
          },
          "rollbacks_truncated": {
            "type": "boolean"
          },
          "restarts_truncated": {
            "type": "boolean"
          },
          "rollbacks": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/AppOperationalRollback"
            }
          },
          "restarts": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/RuntimeConfigRestartStatusResponse"
            }
          }
        }
      },
      "AppWorkerRecovery": {
        "type": "object",
        "description": "Read-only app-wide worker retry status and last scheduler pool observations. Environment selection filters pools; retry status remains app-wide. Missing evidence never establishes health.",
        "required": [
          "available",
          "eligible",
          "scope",
          "status",
          "failures",
          "pools"
        ],
        "properties": {
          "available": {
            "type": "boolean"
          },
          "eligible": {
            "type": "boolean",
            "description": "Whether the app and account permit automatic recovery."
          },
          "scope": {
            "type": "string",
            "enum": [
              "app"
            ]
          },
          "status": {
            "type": "string",
            "description": "Last app-wide recovery outcome; unknown and not_observed indicate missing evidence."
          },
          "reason": {
            "type": "string"
          },
          "failures": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "lease_until": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "pools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppWorkerPoolObservation"
            }
          }
        }
      },
      "AppWorkerPoolObservation": {
        "type": "object",
        "description": "Last scheduler target after environment scaling and cooldowns, before account or physical capacity admission. Counts describe that observation time; stale after fifteen minutes. Running counts only the target generation; predecessor and stopping residents count as draining.",
        "required": [
          "scope",
          "observed_at",
          "stale",
          "desired",
          "running",
          "starting",
          "draining"
        ],
        "properties": {
          "scope": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "stale": {
            "type": "boolean"
          },
          "desired": {
            "type": "integer",
            "minimum": 0
          },
          "running": {
            "type": "integer",
            "minimum": 0
          },
          "starting": {
            "type": "integer",
            "minimum": 0
          },
          "draining": {
            "type": "integer",
            "minimum": 0
          },
          "blockers": {
            "type": "array",
            "maxItems": 16,
            "description": "Last actual admission refusals for this pool. Absent evidence is unknown. A cooldown can retain earlier refusals with their original timestamps; these are not a fresh capacity forecast. Cleared when target slots are satisfied.",
            "items": {
              "$ref": "#/components/schemas/WorkerAdmissionBlocker"
            }
          }
        }
      },
      "WorkerAdmissionBlocker": {
        "type": "object",
        "description": "Scheduler-owned admission evidence. Codes currently include account_worker_limit, concurrency_limit, node_ram, node_vcpu, node_cpu, no_admitting_nodes, node_ports, placement_changed, spend_cap, retry_cooldown, admission_refused and deployment_unavailable. Node constraints omit host identities and fleet usage. Values for account and concurrency budgets describe the actual decision, including residents still draining.",
        "required": [
          "code",
          "observed_at"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "stale": {
            "type": "boolean",
            "description": "Whether this refusal observation is older than fifteen minutes, independently of the pool counts."
          },
          "resource": {
            "type": "string",
            "description": "Units for numeric evidence, such as replicas, ram_mb, vcpu, cpu_millicores or cents."
          },
          "requested": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "used": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "limit": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "retry_at": {
            "type": "string",
            "format": "date-time",
            "description": "App-wide admission cooldown deadline when code is retry_cooldown."
          }
        }
      },
      "AppOperationalRollback": {
        "type": "object",
        "description": "Pending checked rollback progress with stable codes and target selection; free-form reasons and blocker diagnostics are omitted.",
        "required": [
          "id",
          "scope",
          "status",
          "target_deployment_id",
          "current_deployment_id",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "target_deployment_id": {
            "type": "string"
          },
          "current_deployment_id": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AppOperationalRecommendation": {
        "type": "object",
        "description": "An actionable explanation of current operational evidence and an existing command or status endpoint for investigation.",
        "required": [
          "code",
          "severity",
          "message",
          "next"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "severity": {
            "type": "string",
            "enum": [
              "info",
              "warning",
              "error"
            ]
          },
          "message": {
            "type": "string"
          },
          "next": {
            "type": "string"
          }
        }
      },
      "RouteMonitorRoute": {
        "type": "object",
        "description": "Exact normalized production telemetry label with absolute budgets. Omitted max_5xx_rate_bps disables errors; zero is a selected zero-error budget. Zero or omitted max_p95_ms disables latency. At least one budget is required.",
        "additionalProperties": false,
        "required": [
          "method",
          "path"
        ],
        "properties": {
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE",
              "HEAD",
              "OPTIONS"
            ]
          },
          "path": {
            "type": "string",
            "minLength": 1,
            "maxLength": 240
          },
          "max_5xx_rate_bps": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 10000
          },
          "max_p95_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 86400000
          }
        }
      },
      "RouteMonitorConfig": {
        "type": "object",
        "description": "Advisory production monitor intent, independent of the canary guard.",
        "required": [
          "app_id",
          "enabled",
          "revision",
          "routes"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "enabled": {
            "type": "boolean"
          },
          "customer_group_by": {
            "type": "string",
            "enum": [
              "tenant",
              "consumer"
            ],
            "description": "Saved request-time identity dimension used for per-cohort budget evaluation."
          },
          "on_violation": {
            "type": "string",
            "enum": [
              "rollback"
            ],
            "description": "Present only when a confirmed error-budget incident that opens within 30 minutes of the deployment serving all traffic requests a checked rollback to the incident's healthy baseline. Omitted for the default report-only action."
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "routes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteMonitorRoute"
            },
            "maxItems": 20
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 20,
            "description": "Returned by a save of an enabled monitor: selectors no request matched within the plan's telemetry lookback (at most 7 days). Selectors match the route label exactly."
          }
        }
      },
      "SetRouteMonitorRequest": {
        "type": "object",
        "description": "Replacement production monitor intent, with a mandatory revision check.",
        "additionalProperties": false,
        "required": [
          "enabled",
          "expected_revision",
          "routes"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "customer_group_by": {
            "type": "string",
            "enum": [
              "tenant",
              "consumer"
            ],
            "description": "Optional request-time identity dimension. Omission disables per-cohort evaluation."
          },
          "on_violation": {
            "type": "string",
            "enum": [
              "report",
              "rollback"
            ],
            "description": "report (default) only records incidents. rollback requests one checked rollback per early error-budget incident and requires at least one route with max_5xx_rate_bps."
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "routes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteMonitorRoute"
            },
            "maxItems": 20
          }
        }
      },
      "PreviewRouteMonitorRequest": {
        "type": "object",
        "description": "Proposed route monitor intent evaluated against recent production observations without being saved.",
        "additionalProperties": false,
        "required": [
          "routes"
        ],
        "properties": {
          "customer_group_by": {
            "type": "string",
            "enum": [
              "tenant",
              "consumer"
            ],
            "description": "Optional request-time identity dimension for per-cohort evaluation."
          },
          "routes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteMonitorRoute"
            },
            "minItems": 1,
            "maxItems": 20
          }
        }
      },
      "RouteMonitorWindow": {
        "type": "object",
        "description": "Observed weighted counts and independently evaluated absolute budgets in a closed window.",
        "required": [
          "start",
          "end",
          "observed",
          "error_status",
          "error_reason",
          "latency_status",
          "latency_reason"
        ],
        "properties": {
          "start": {
            "type": "string",
            "format": "date-time"
          },
          "end": {
            "type": "string",
            "format": "date-time"
          },
          "observed": {
            "$ref": "#/components/schemas/RouteHealthCounts"
          },
          "error_status": {
            "type": "string",
            "enum": [
              "healthy",
              "violated",
              "unknown",
              "disabled"
            ]
          },
          "error_reason": {
            "type": "string"
          },
          "latency_status": {
            "type": "string",
            "enum": [
              "healthy",
              "violated",
              "unknown",
              "disabled"
            ]
          },
          "latency_reason": {
            "type": "string"
          }
        }
      },
      "RouteMonitorFinding": {
        "type": "object",
        "description": "One production route and two windows with independently confirmed error and latency verdicts.",
        "required": [
          "route",
          "status",
          "reason",
          "error_status",
          "latency_status",
          "windows"
        ],
        "properties": {
          "route": {
            "$ref": "#/components/schemas/RouteMonitorRoute"
          },
          "status": {
            "type": "string",
            "enum": [
              "healthy",
              "violated",
              "unknown",
              "disabled"
            ]
          },
          "reason": {
            "type": "string"
          },
          "error_status": {
            "type": "string",
            "enum": [
              "healthy",
              "violated",
              "unknown",
              "disabled"
            ]
          },
          "latency_status": {
            "type": "string",
            "enum": [
              "healthy",
              "violated",
              "unknown",
              "disabled"
            ]
          },
          "windows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteMonitorWindow"
            },
            "minItems": 2,
            "maxItems": 2
          },
          "evidence_window": {
            "type": "string",
            "enum": [
              "pooled"
            ],
            "description": "Present when the verdict comes from pooled_windows because the one-minute windows lacked requests. Budgets are unchanged."
          },
          "pooled_windows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteMonitorWindow"
            },
            "minItems": 2,
            "maxItems": 2,
            "description": "Two consecutive halves of up to the newest 30 minutes since the observation anchor, read only for routes whose one-minute windows were sparse."
          }
        }
      },
      "RouteAwakeResponse": {
        "type": "object",
        "description": "How long the app was awake in the window and which routes kept it awake. Seconds are instance-seconds of billed running time.",
        "required": [
          "slug",
          "from",
          "until",
          "idle_timeout_seconds",
          "window_seconds",
          "awake_seconds",
          "awake_share",
          "mb_seconds",
          "gb_hours",
          "wakes",
          "unattributed_seconds",
          "sources",
          "min_instances",
          "other_routes_seconds",
          "routes_limit",
          "routes"
        ],
        "properties": {
          "slug": {
            "type": "string"
          },
          "from": {
            "type": "string",
            "format": "date-time"
          },
          "until": {
            "type": "string",
            "format": "date-time"
          },
          "window_clamped": {
            "type": "boolean"
          },
          "idle_timeout_seconds": {
            "type": "integer",
            "description": "The app's effective idle timeout: how long it stays awake after its last successful request."
          },
          "wait_until_timeout_seconds": {
            "type": "integer",
            "description": "The plan's waitUntil task timeout when the plan enables waitUntil. An instance parks no earlier than the later of the idle timeout and its last waitUntil task, so a request keeps the app awake for the longer of the two."
          },
          "window_seconds": {
            "type": "integer",
            "format": "int64"
          },
          "awake_seconds": {
            "type": "integer",
            "format": "int64"
          },
          "awake_share": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "Share of the window's minutes with at least one instance running."
          },
          "mb_seconds": {
            "type": "integer",
            "format": "int64",
            "description": "Billed MB-seconds in the window."
          },
          "gb_hours": {
            "type": "number"
          },
          "wakes": {
            "type": "integer",
            "format": "int64",
            "description": "Cold boots in the window."
          },
          "unattributed_seconds": {
            "type": "integer",
            "format": "int64",
            "description": "Awake time no recorded request, probe, prewarm or delivery explains: minimum instances, probes older than a day, deliveries already pruned by result retention, or telemetry the plan's rate cap dropped."
          },
          "sources": {
            "type": "array",
            "description": "Awake time credited to causes other than customer requests, for minutes no request explains: route probes and prewarms, and cron, queue and other deliveries the scheduler made to the app, per cron job and per queue.",
            "items": {
              "$ref": "#/components/schemas/RouteAwakeSource"
            }
          },
          "min_instances": {
            "type": "integer",
            "description": "The app's current minimum instance count; above zero the app never parks, so unattributed time is expected."
          },
          "other_routes_seconds": {
            "type": "integer",
            "format": "int64",
            "description": "Awake time attributed to routes outside the busiest routes_limit."
          },
          "routes_limit": {
            "type": "integer"
          },
          "routes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteAwakeRoute"
            }
          }
        }
      },
      "RouteAwakeSource": {
        "type": "object",
        "description": "Awake time one non-request cause explains.",
        "required": [
          "source",
          "events",
          "awake_seconds",
          "awake_share",
          "gb_hours"
        ],
        "properties": {
          "source": {
            "type": "string",
            "enum": [
              "route_probe",
              "prewarm",
              "cron",
              "queue",
              "delayed_task",
              "async_invoke",
              "inbound_webhook",
              "replay",
              "esm"
            ],
            "description": "route_probe: synthetic canary probes the app answered (kept for a day). prewarm: instances a scheduled prewarm admitted. The others are deliveries the scheduler made to the app, by invocation source; a delivery counts from when it reached the instance until it completed, at most 60 minutes."
          },
          "name": {
            "type": "string",
            "description": "One cron job (the path or command it runs and its schedule) or one queue; absent for other sources."
          },
          "events": {
            "type": "integer",
            "format": "int64",
            "description": "Probe requests answered without a 5xx or an auth rejection, prewarmed instances, or deliveries that started in the window."
          },
          "awake_seconds": {
            "type": "integer",
            "format": "int64"
          },
          "awake_share": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "gb_hours": {
            "type": "number"
          },
          "pattern": {
            "type": "string",
            "enum": [
              "periodic",
              "irregular"
            ],
            "description": "Set for cron jobs: periodic when the job fires at a steady interval."
          },
          "interval_seconds": {
            "type": "integer",
            "description": "Approximate interval between the cron job's firings when pattern is periodic."
          },
          "suggestion": {
            "$ref": "#/components/schemas/RouteAwakeSuggestion"
          }
        }
      },
      "RouteAwakeRoute": {
        "type": "object",
        "description": "One route's share of the app's awake time and what removing its requests would change.",
        "required": [
          "method",
          "route",
          "requests",
          "wakes",
          "awake_seconds",
          "awake_share",
          "gb_hours",
          "pattern",
          "if_removed"
        ],
        "properties": {
          "method": {
            "type": "string"
          },
          "route": {
            "type": "string",
            "description": "Route template, for example /orders/{id}."
          },
          "requests": {
            "type": "integer",
            "format": "int64",
            "description": "Requests that restarted the idle timer."
          },
          "wakes": {
            "type": "integer",
            "format": "int64",
            "description": "Cold boots this route's requests triggered."
          },
          "awake_seconds": {
            "type": "integer",
            "format": "int64"
          },
          "awake_share": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "gb_hours": {
            "type": "number"
          },
          "pattern": {
            "type": "string",
            "enum": [
              "periodic",
              "irregular"
            ]
          },
          "interval_seconds": {
            "type": "integer",
            "description": "Approximate interval when pattern is periodic."
          },
          "if_removed": {
            "$ref": "#/components/schemas/RouteAwakeWhatIf"
          },
          "suggestion": {
            "$ref": "#/components/schemas/RouteAwakeSuggestion"
          }
        }
      },
      "RouteAwakeWhatIf": {
        "type": "object",
        "description": "Estimated change had this route's requests never reached the app, with every other request unchanged.",
        "required": [
          "awake_seconds_saved",
          "gb_hours_saved",
          "wakes_change"
        ],
        "properties": {
          "awake_seconds_saved": {
            "type": "integer",
            "format": "int64"
          },
          "gb_hours_saved": {
            "type": "number"
          },
          "wakes_change": {
            "type": "integer",
            "format": "int64",
            "description": "Change in cold wakes; positive when other routes would find the app parked more often."
          }
        }
      },
      "RouteAwakeSuggestion": {
        "type": "object",
        "description": "A change that would let the app park.",
        "required": [
          "kind",
          "message"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "edge_cache",
              "call_less_often",
              "run_less_often"
            ]
          },
          "message": {
            "type": "string"
          }
        }
      },
      "RouteInsightsResponse": {
        "type": "object",
        "description": "An app's active route insights, then those resolved in the last seven days.",
        "required": [
          "slug",
          "insights"
        ],
        "properties": {
          "slug": {
            "type": "string"
          },
          "insights": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/RouteInsight"
            }
          }
        }
      },
      "RouteInsight": {
        "type": "object",
        "description": "One finding for a route; also the payload of the routes.insight.detected and routes.insight.resolved webhooks.",
        "required": [
          "id",
          "kind",
          "method",
          "route",
          "state",
          "message",
          "evidence",
          "first_detected_at",
          "last_detected_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "kept_awake",
              "cacheable",
              "cache_stale",
              "cache_too_short"
            ]
          },
          "method": {
            "type": "string"
          },
          "route": {
            "type": "string",
            "description": "Route template, for example /catalog."
          },
          "state": {
            "type": "string",
            "enum": [
              "active",
              "resolved"
            ]
          },
          "message": {
            "type": "string",
            "description": "What was observed and what to change."
          },
          "evidence": {
            "type": "object",
            "additionalProperties": true,
            "description": "Measured figures behind the insight: awake share, interval and savings for kept_awake; safe max-age and repeat counts for cacheable; the rule's max-age, refills, stale refills and measured safe max-age for cache_stale and cache_too_short."
          },
          "first_detected_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_detected_at": {
            "type": "string",
            "format": "date-time"
          },
          "resolved_at": {
            "type": "string",
            "format": "date-time"
          },
          "fixed_at": {
            "type": "string",
            "format": "date-time",
            "description": "When an applied fix resolved the insight."
          },
          "fix_action": {
            "type": "string",
            "enum": [
              "create_cache_rule",
              "set_cache_max_age",
              "add_cache_override",
              "disable_cache_rule"
            ],
            "description": "The fix that resolved the insight."
          },
          "fix": {
            "$ref": "#/components/schemas/RouteInsightFix"
          }
        }
      },
      "RouteInsightFix": {
        "type": "object",
        "description": "The edge-rule change applying an active insight would make now, planned from its evidence and the app's current rules. Absent when the platform has no fix; never in webhook payloads.",
        "required": [
          "id",
          "action"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Covers every value the fix would write; send it back to apply exactly this fix."
          },
          "action": {
            "type": "string",
            "enum": [
              "create_cache_rule",
              "set_cache_max_age",
              "add_cache_override",
              "disable_cache_rule"
            ]
          },
          "summary": {
            "type": "string"
          },
          "max_age_seconds": {
            "type": "integer",
            "minimum": 1
          },
          "rule_id": {
            "type": "string",
            "description": "The cache rule the fix changes or overrides."
          },
          "purge_cache": {
            "type": "boolean",
            "description": "The fix also purges the route's cached responses."
          }
        }
      },
      "RouteInsightFixRequest": {
        "type": "object",
        "description": "Applies the fix an insight listed; refused when the fix changed since.",
        "required": [
          "fix_id"
        ],
        "properties": {
          "fix_id": {
            "type": "string",
            "description": "The fix.id the insight lists now."
          }
        }
      },
      "RouteInsightFixResponse": {
        "type": "object",
        "description": "An applied fix: the insight after it, the fix, the edge rule created or changed, the cache purge outcome, and how many of the route's insights it resolved.",
        "required": [
          "insight",
          "fix",
          "rule",
          "resolved"
        ],
        "properties": {
          "insight": {
            "$ref": "#/components/schemas/RouteInsight"
          },
          "fix": {
            "$ref": "#/components/schemas/RouteInsightFix"
          },
          "rule": {
            "$ref": "#/components/schemas/EdgeRuleResponse"
          },
          "cache_purge": {
            "type": "string",
            "enum": [
              "requested",
              "failed"
            ]
          },
          "resolved": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "RouteAdviceResponse": {
        "type": "object",
        "description": "Route advisor suggestions derived from retained request telemetry. Nothing is applied.",
        "required": [
          "slug",
          "from",
          "until",
          "cache_max_age_seconds",
          "routes_analyzed",
          "suggestions"
        ],
        "properties": {
          "slug": {
            "type": "string"
          },
          "from": {
            "type": "string",
            "format": "date-time"
          },
          "until": {
            "type": "string",
            "format": "date-time"
          },
          "window_clamped": {
            "type": "boolean",
            "description": "The requested window was shortened to plan retention."
          },
          "cache_max_age_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3600
          },
          "routes_analyzed": {
            "type": "integer",
            "minimum": 0
          },
          "suggestions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteAdviceSuggestion"
            }
          }
        }
      },
      "RouteAdviceSuggestion": {
        "type": "object",
        "description": "One proposed edge rule for one observed route, with evidence, a what-if estimate and disabled rule bodies (one per hostname). Kinds wake_ahead and priority are app-level settings: method and route are empty, rules is empty and setting carries the proposal.",
        "required": [
          "id",
          "kind",
          "method",
          "route",
          "title",
          "rationale",
          "evidence",
          "impact",
          "rules"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Stable for the same kind, method and route."
          },
          "kind": {
            "type": "string",
            "enum": [
              "cache",
              "async",
              "throttle",
              "wake_ahead",
              "priority"
            ]
          },
          "method": {
            "type": "string"
          },
          "route": {
            "type": "string",
            "description": "Observed route template, for example /users/{id}."
          },
          "title": {
            "type": "string"
          },
          "rationale": {
            "type": "string"
          },
          "evidence": {
            "$ref": "#/components/schemas/RouteAdviceEvidence"
          },
          "impact": {
            "$ref": "#/components/schemas/RouteAdviceImpact"
          },
          "cautions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateEdgeRuleRequest"
            }
          },
          "setting": {
            "$ref": "#/components/schemas/RouteAdviceSetting"
          }
        }
      },
      "RouteAdviceSetting": {
        "type": "object",
        "description": "The app setting a wake_ahead or priority suggestion proposes; apply it through PUT /v1/apps/{slug}/service-wake-ahead or PUT /v1/apps/{slug}/route-priorities.",
        "properties": {
          "wake_ahead": {
            "type": "boolean",
            "description": "Turn service wake-ahead on."
          },
          "route_priorities": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/RoutePriorityRule"
            }
          }
        }
      },
      "RouteAdviceEvidence": {
        "type": "object",
        "description": "Observed traffic for the route over the window. Consumer fields are present only on throttle suggestions.",
        "required": [
          "requests",
          "anonymous_requests",
          "server_errors",
          "timeouts",
          "cold_boots",
          "p95_latency_ms"
        ],
        "properties": {
          "requests": {
            "type": "integer",
            "format": "int64"
          },
          "anonymous_requests": {
            "type": "integer",
            "format": "int64"
          },
          "server_errors": {
            "type": "integer",
            "format": "int64"
          },
          "timeouts": {
            "type": "integer",
            "format": "int64"
          },
          "cold_boots": {
            "type": "integer",
            "format": "int64"
          },
          "p95_latency_ms": {
            "type": "integer"
          },
          "consumers": {
            "type": "integer",
            "format": "int64"
          },
          "top_consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "top_consumer_requests": {
            "type": "integer",
            "format": "int64"
          },
          "top_consumer_peak_per_minute": {
            "type": "integer",
            "format": "int64"
          },
          "next_consumer_peak_per_minute": {
            "type": "integer",
            "format": "int64"
          },
          "content_observed": {
            "type": "integer",
            "format": "int64",
            "description": "Anonymous GET responses the gateways compared with the previous response for their URL. Cache suggestions only."
          },
          "content_repeats": {
            "type": "integer",
            "format": "int64",
            "description": "Observed responses identical to the previous one for their URL within the longest content window (1 h)."
          },
          "content_changes": {
            "type": "integer",
            "format": "int64",
            "description": "Observed responses that differed from the previous one for their URL within the longest content window."
          },
          "content_uncacheable": {
            "type": "integer",
            "format": "int64",
            "description": "Observed responses the edge cache could not store (Set-Cookie, Cache-Control no-store or private, Vary, or size)."
          },
          "safe_max_age_seconds": {
            "type": "integer",
            "enum": [
              60,
              300,
              3600
            ],
            "description": "Longest cache lifetime at which the observed repeats would have served at most 1% stale bodies; absent until enough repeats are measured."
          }
        }
      },
      "RouteAdviceImpact": {
        "type": "object",
        "description": "What-if estimate replayed from aggregated telemetry over the same window; observed_only, not a guarantee.",
        "required": [
          "summary",
          "estimated_cache_hits",
          "estimated_wakes_avoided",
          "estimated_throttled_requests",
          "timeouts_affected"
        ],
        "properties": {
          "summary": {
            "type": "string",
            "description": "One-sentence what-if estimate for the suggested rule."
          },
          "estimated_cache_hits": {
            "type": "integer",
            "format": "int64"
          },
          "estimated_wakes_avoided": {
            "type": "integer",
            "format": "int64"
          },
          "estimated_throttled_requests": {
            "type": "integer",
            "format": "int64"
          },
          "timeouts_affected": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "ServiceWakeAheadResponse": {
        "type": "object",
        "description": "An app's service wake-ahead opt-in.",
        "required": [
          "slug",
          "enabled"
        ],
        "properties": {
          "slug": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean",
            "description": "Whether a cold wake of this app also wakes the services it declares or is measured to call."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Omitted until the opt-in is first changed."
          },
          "learned": {
            "$ref": "#/components/schemas/ServiceWakeAheadLearned"
          }
        }
      },
      "ServiceWakeAheadLearned": {
        "type": "object",
        "description": "What the gateways measured for this caller app: its top service edges and what wake-ahead did over the evidence window. Present on GET; source is unavailable when gateway metrics cannot be read.",
        "required": [
          "source",
          "window",
          "caller_wakes",
          "targets"
        ],
        "properties": {
          "source": {
            "type": "string",
            "enum": [
              "live",
              "unavailable"
            ]
          },
          "window": {
            "type": "string",
            "description": "Window of the outcome counts, for example 24h."
          },
          "caller_wakes": {
            "type": "integer",
            "format": "int64",
            "description": "Cold wakes of this app the evidence covers (older wakes decay)."
          },
          "targets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ServiceWakeAheadTarget"
            }
          }
        }
      },
      "ServiceWakeAheadTarget": {
        "type": "object",
        "description": "One measured caller-to-service edge and its wake-ahead outcomes.",
        "required": [
          "app_id",
          "slug",
          "call_share",
          "cold_share",
          "qualifies",
          "started",
          "used",
          "unused",
          "failed"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string"
          },
          "call_share": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "Share of cold wakes followed by a call to this service."
          },
          "cold_share": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "Share of those calls that found it parked or woken ahead."
          },
          "qualifies": {
            "type": "boolean",
            "description": "The edge meets the wake-ahead thresholds."
          },
          "started": {
            "type": "integer",
            "format": "int64"
          },
          "used": {
            "type": "integer",
            "format": "int64"
          },
          "unused": {
            "type": "integer",
            "format": "int64"
          },
          "failed": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "SetServiceWakeAheadRequest": {
        "type": "object",
        "description": "Turns service wake-ahead on or off for one app.",
        "required": [
          "enabled"
        ],
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "true to wake measured services ahead, false to wake them only when called."
          }
        }
      },
      "RoutePriorityRule": {
        "type": "object",
        "description": "Assigns a priority class to requests matching a method and path.",
        "required": [
          "path",
          "class"
        ],
        "additionalProperties": false,
        "properties": {
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "HEAD",
              "POST",
              "PUT",
              "PATCH",
              "DELETE",
              "OPTIONS"
            ],
            "description": "Omitted matches every method."
          },
          "path": {
            "type": "string",
            "maxLength": 240,
            "description": "Route template such as /users/{id}, or an edge-rule glob such as /exports/*."
          },
          "class": {
            "type": "string",
            "enum": [
              "critical",
              "bulk"
            ]
          }
        }
      },
      "RoutePrioritiesResponse": {
        "type": "object",
        "description": "An app's effective route priorities and where they come from.",
        "required": [
          "slug",
          "source",
          "routes"
        ],
        "properties": {
          "slug": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "configured",
              "route_health",
              "none"
            ]
          },
          "routes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RoutePriorityRule"
            }
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "When saved rules last changed; omitted for the route-health default."
          },
          "queue": {
            "$ref": "#/components/schemas/RoutePriorityQueueStats"
          }
        }
      },
      "RoutePriorityQueueStats": {
        "type": "object",
        "description": "How the app's warm-capacity queue behaved per priority class over the evidence window. Present on GET; source is unavailable when gateway metrics cannot be read.",
        "required": [
          "source",
          "window",
          "classes"
        ],
        "properties": {
          "source": {
            "type": "string",
            "enum": [
              "live",
              "unavailable"
            ]
          },
          "window": {
            "type": "string",
            "description": "Window of the counts, for example 24h."
          },
          "classes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RoutePriorityQueueClass"
            }
          }
        }
      },
      "RoutePriorityQueueClass": {
        "type": "object",
        "description": "Queue outcomes for one priority class.",
        "required": [
          "class",
          "queued",
          "displacing",
          "displaced",
          "rejected"
        ],
        "properties": {
          "class": {
            "type": "string",
            "enum": [
              "critical",
              "normal",
              "bulk"
            ]
          },
          "queued": {
            "type": "integer",
            "format": "int64",
            "description": "Requests that waited for capacity."
          },
          "displacing": {
            "type": "integer",
            "format": "int64",
            "description": "Requests that took a lower class's queue place."
          },
          "displaced": {
            "type": "integer",
            "format": "int64",
            "description": "Requests that lost their place to a higher class."
          },
          "rejected": {
            "type": "integer",
            "format": "int64",
            "description": "Requests turned away because the queue was full."
          }
        }
      },
      "SetRoutePrioritiesRequest": {
        "type": "object",
        "description": "Replaces the saved route priorities; an empty list saves none.",
        "required": [
          "routes"
        ],
        "additionalProperties": false,
        "properties": {
          "routes": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/RoutePriorityRule"
            }
          }
        }
      },
      "RouteMonitorReport": {
        "type": "object",
        "description": "Read-only absolute-budget evidence for the sole fully serving default-scope deployment. Coverage is limited to stored telemetry.",
        "required": [
          "version",
          "app_id",
          "enabled",
          "revision",
          "checked_at",
          "coverage",
          "status",
          "reason",
          "minimum_requests",
          "minimum_latency_requests",
          "routes"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "enabled": {
            "type": "boolean"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "customer_group_by": {
            "type": "string",
            "enum": [
              "tenant",
              "consumer"
            ]
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "commit_sha": {
            "type": "string"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "observation_anchor": {
            "type": "string",
            "format": "date-time"
          },
          "coverage": {
            "type": "string",
            "enum": [
              "observed_only"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "healthy",
              "violated",
              "unknown",
              "disabled"
            ]
          },
          "reason": {
            "type": "string"
          },
          "minimum_requests": {
            "type": "integer",
            "format": "int64"
          },
          "minimum_latency_requests": {
            "type": "integer",
            "format": "int64"
          },
          "routes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteMonitorFinding"
            },
            "maxItems": 20
          },
          "customers": {
            "$ref": "#/components/schemas/RouteMonitorCustomerReport"
          }
        }
      },
      "RouteMonitorPreview": {
        "type": "object",
        "description": "Read-only proposed-budget evaluation. config_change_resets_observation_anchor is true when saving the proposal would change monitor intent and start a fresh observation anchor; unchanged intent preserves its current anchor.",
        "required": [
          "current_revision",
          "preview_only",
          "config_change_resets_observation_anchor",
          "report"
        ],
        "properties": {
          "current_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "preview_only": {
            "type": "boolean",
            "const": true
          },
          "config_change_resets_observation_anchor": {
            "type": "boolean"
          },
          "report": {
            "$ref": "#/components/schemas/RouteMonitorReport"
          }
        }
      },
      "RouteMonitorCustomerWindow": {
        "type": "object",
        "description": "Request-time identity attribution totals for one monitored window. These are observed telemetry counts, not unique people or billing data.",
        "required": [
          "start",
          "end",
          "identified_requests",
          "unattributed_requests",
          "unresolved_identity_requests",
          "other_customer_requests"
        ],
        "properties": {
          "start": {
            "type": "string",
            "format": "date-time"
          },
          "end": {
            "type": "string",
            "format": "date-time"
          },
          "identified_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unattributed_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unresolved_identity_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "other_customer_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Identified requests belonging to cohorts outside the displayed five."
          }
        }
      },
      "RouteMonitorCustomerCohort": {
        "type": "object",
        "description": "One bounded request-time customer cohort; its UUID is returned only when customer_details=true.",
        "required": [
          "observed",
          "status",
          "reason",
          "error_status",
          "latency_status",
          "windows"
        ],
        "properties": {
          "customer_id": {
            "type": "string",
            "format": "uuid"
          },
          "observed": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "enum": [
              "healthy",
              "violated",
              "unknown",
              "disabled"
            ]
          },
          "reason": {
            "type": "string"
          },
          "error_status": {
            "type": "string",
            "enum": [
              "healthy",
              "violated",
              "unknown",
              "disabled"
            ]
          },
          "latency_status": {
            "type": "string",
            "enum": [
              "healthy",
              "violated",
              "unknown",
              "disabled"
            ]
          },
          "windows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteMonitorWindow"
            },
            "minItems": 2,
            "maxItems": 2
          }
        }
      },
      "RouteMonitorCustomerRoute": {
        "type": "object",
        "description": "Full-population route counts plus at most five displayed cohorts and one hundred violating identities.",
        "required": [
          "method",
          "path",
          "observed_customers",
          "violated_customers",
          "unknown_customers",
          "recovery_missing_customers",
          "recovery_remaining_customers",
          "customers_truncated",
          "violating_customers_truncated",
          "windows",
          "customers"
        ],
        "properties": {
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE",
              "HEAD",
              "OPTIONS"
            ]
          },
          "path": {
            "type": "string",
            "minLength": 1,
            "maxLength": 240
          },
          "observed_customers": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "violated_customers": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unknown_customers": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "recovery_missing_customers": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "recovery_remaining_customers": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "customers_truncated": {
            "type": "boolean"
          },
          "violating_customers_truncated": {
            "type": "boolean"
          },
          "violating_customer_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "maxItems": 100,
            "description": "Present only when customer_details=true."
          },
          "windows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteMonitorCustomerWindow"
            },
            "minItems": 2,
            "maxItems": 2
          },
          "customers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteMonitorCustomerCohort"
            },
            "maxItems": 5
          }
        }
      },
      "RouteMonitorCustomerReport": {
        "type": "object",
        "description": "Request-time tenant or API-consumer budget summary. Identity details are redacted unless explicitly requested.",
        "required": [
          "group_by",
          "details_included",
          "coverage",
          "status",
          "reason",
          "customers_limit",
          "observed_customers",
          "violated_customers",
          "unknown_customers",
          "recovery_remaining_customers",
          "recovery_inventory_incomplete",
          "routes"
        ],
        "properties": {
          "group_by": {
            "type": "string",
            "enum": [
              "tenant",
              "consumer"
            ]
          },
          "details_included": {
            "type": "boolean"
          },
          "coverage": {
            "type": "string",
            "enum": [
              "observed_only"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "healthy",
              "violated",
              "unknown",
              "disabled"
            ]
          },
          "reason": {
            "type": "string"
          },
          "customers_limit": {
            "type": "integer",
            "minimum": 5,
            "maximum": 5
          },
          "observed_customers": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "violated_customers": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unknown_customers": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "recovery_remaining_customers": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Distinct known violating identities not yet observed healthy again."
          },
          "recovery_inventory_incomplete": {
            "type": "boolean"
          },
          "routes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteMonitorCustomerRoute"
            },
            "maxItems": 20
          }
        }
      },
      "RouteMonitorEvidenceWindow": {
        "type": "object",
        "description": "Saved bounded request examples and optional one-sided dependency diagnostics for an opening window.",
        "required": [
          "start",
          "end",
          "requests"
        ],
        "properties": {
          "start": {
            "type": "string",
            "format": "date-time"
          },
          "end": {
            "type": "string",
            "format": "date-time"
          },
          "requests": {
            "$ref": "#/components/schemas/RouteHealthInvestigationSide"
          },
          "diagnostics": {
            "$ref": "#/components/schemas/RouteHealthLatencyDiagnostics",
            "description": "Candidate describes the monitored deployment. Stable is empty; dependency groups are one-sided with no delta. Percentiles are separate retained populations and are not additive or proof of cause."
          }
        }
      },
      "RouteMonitorEvidence": {
        "type": "object",
        "description": "One violated route and selected signal captured at incident opening or escalation. Customer-only opening violations are scoped to the affected request-time identity; escalation evidence is aggregate and contains no customer identity.",
        "required": [
          "method",
          "path",
          "signal",
          "windows"
        ],
        "properties": {
          "customer_group_by": {
            "type": "string",
            "enum": [
              "tenant",
              "consumer"
            ]
          },
          "customer_id": {
            "type": "string",
            "format": "uuid",
            "description": "Affected request-time identity UUID; included only on explicitly opted-in reads."
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE",
              "HEAD",
              "OPTIONS"
            ]
          },
          "path": {
            "type": "string",
            "minLength": 1,
            "maxLength": 240
          },
          "signal": {
            "type": "string",
            "enum": [
              "errors",
              "latency"
            ]
          },
          "windows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteMonitorEvidenceWindow"
            },
            "minItems": 2,
            "maxItems": 2
          }
        }
      },
      "RouteMonitorDeploymentBaseline": {
        "type": "object",
        "description": "The last different fully serving deployment with a healthy route-monitor report before this incident opened. Provenance values are sanitized declared metadata and do not attest to deployment archive bytes.",
        "required": [
          "deployment_id"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "commit_sha": {
            "type": "string",
            "pattern": "^(?:[a-fA-F0-9]{40}|[a-fA-F0-9]{64})$"
          },
          "repository": {
            "type": "string",
            "pattern": "^github.com/[a-z0-9._-]+/[a-z0-9._-]+$"
          },
          "source_root": {
            "type": "string",
            "maxLength": 256
          }
        }
      },
      "RouteMonitorIncident": {
        "type": "object",
        "description": "Saved opening evidence, the previous healthy deployment when known, bounded route-impact timeline, transition-linked escalation evidence, optional comparable recovery report and explicit incident lifecycle. Opening evidence stays fixed even when telemetry expires. Timeline entries contain aggregate customer counts only and preserve the opening baseline plus the newest evaluations.",
        "required": [
          "version",
          "id",
          "app_id",
          "deployment_id",
          "revision",
          "status",
          "opened_at",
          "opening_report",
          "evidence",
          "evidence_truncated"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "recovered",
              "superseded"
            ]
          },
          "opened_at": {
            "type": "string",
            "format": "date-time"
          },
          "closed_at": {
            "type": "string",
            "format": "date-time"
          },
          "baseline": {
            "$ref": "#/components/schemas/RouteMonitorDeploymentBaseline",
            "description": "Saved last-known healthy deployment. Absent for legacy incidents or when no different prior healthy deployment is available."
          },
          "opening_report": {
            "$ref": "#/components/schemas/RouteMonitorReport"
          },
          "recovery_report": {
            "$ref": "#/components/schemas/RouteMonitorReport"
          },
          "evidence": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteMonitorEvidence"
            },
            "maxItems": 3
          },
          "evidence_truncated": {
            "type": "boolean"
          },
          "timeline": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteMonitorIncidentTimelineEntry"
            },
            "maxItems": 60,
            "description": "Opening baseline and up to 59 most recent confirmed evaluations. Route indexes refer to opening_report.routes."
          },
          "timeline_truncated": {
            "type": "boolean",
            "description": "True when older evaluations were dropped to preserve the opening baseline and bounded incident size."
          },
          "escalations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteMonitorIncidentEscalation"
            },
            "maxItems": 20,
            "description": "Newest newly violated route/signal transitions with bounded evidence captured at each transition."
          },
          "escalations_truncated": {
            "type": "boolean",
            "description": "True when older escalation records were dropped to preserve the newest transition details and incident size."
          },
          "rollback": {
            "$ref": "#/components/schemas/RouteMonitorIncidentRollback"
          }
        }
      },
      "RouteMonitorIncidentRollback": {
        "type": "object",
        "description": "The single automatic rollback decision for an incident when on_violation is rollback. claimed is transient while the checked rollback is requested.",
        "required": [
          "status",
          "decided_at"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "claimed",
              "requested",
              "skipped"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "latency_only_violation",
              "outside_rollback_window",
              "no_healthy_baseline",
              "rollback_target_ineligible",
              "project_release"
            ]
          },
          "route": {
            "type": "string",
            "maxLength": 256,
            "description": "First error-budget route that triggered the decision, as METHOD /path."
          },
          "target_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "operation_id": {
            "type": "string",
            "format": "uuid",
            "description": "Checked rollback operation readable at /v1/apps/{slug}/rollbacks/{operation}."
          },
          "decided_at": {
            "type": "string",
            "format": "date-time"
          },
          "refusal_code": {
            "type": "string",
            "pattern": "^[a-z0-9_]{1,64}$",
            "description": "The checked rollback's problem code when it refused a rollback_target_ineligible request, for example rollback_in_progress."
          }
        }
      },
      "RouteMonitorIncidentTimelineEntry": {
        "type": "object",
        "description": "One confirmed production monitor evaluation. It contains no customer identifiers or request details.",
        "required": [
          "checked_at",
          "coverage",
          "status",
          "reason",
          "routes"
        ],
        "properties": {
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "coverage": {
            "type": "string",
            "enum": [
              "observed_only"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "healthy",
              "violated",
              "unknown",
              "disabled"
            ]
          },
          "reason": {
            "type": "string"
          },
          "customer_impact": {
            "$ref": "#/components/schemas/RouteMonitorCustomerImpact"
          },
          "routes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteMonitorIncidentTimelineRoute"
            },
            "maxItems": 20
          }
        }
      },
      "RouteMonitorIncidentTimelineRoute": {
        "type": "object",
        "description": "Status for one route in the incident's fixed opening selector order.",
        "required": [
          "route_index",
          "status",
          "error_status",
          "latency_status"
        ],
        "properties": {
          "route_index": {
            "type": "integer",
            "minimum": 0,
            "maximum": 19
          },
          "status": {
            "type": "string",
            "enum": [
              "healthy",
              "violated",
              "unknown",
              "disabled"
            ]
          },
          "error_status": {
            "type": "string",
            "enum": [
              "healthy",
              "violated",
              "unknown",
              "disabled"
            ]
          },
          "latency_status": {
            "type": "string",
            "enum": [
              "healthy",
              "violated",
              "unknown",
              "disabled"
            ]
          },
          "customer_impact": {
            "$ref": "#/components/schemas/RouteMonitorCustomerImpact"
          }
        }
      },
      "RouteMonitorIncidentEscalationSignal": {
        "type": "object",
        "description": "A route/signal that changed from non-violated to violated. Route indexes refer to opening_report.routes.",
        "required": [
          "route_index",
          "signal",
          "finding"
        ],
        "properties": {
          "route_index": {
            "type": "integer",
            "minimum": 0,
            "maximum": 19
          },
          "signal": {
            "type": "string",
            "enum": [
              "errors",
              "latency"
            ]
          },
          "finding": {
            "$ref": "#/components/schemas/RouteMonitorFinding"
          }
        }
      },
      "RouteMonitorIncidentEscalation": {
        "type": "object",
        "description": "One stable route-monitor escalation transition. It preserves the newly violated signals and up to three fresh aggregate request/latency diagnostic entries; no customer identifiers are included.",
        "required": [
          "transition_id",
          "checked_at",
          "previous_checked_at",
          "newly_violated_routes",
          "newly_violated_signals",
          "signals",
          "evidence",
          "evidence_truncated"
        ],
        "properties": {
          "transition_id": {
            "type": "string",
            "format": "uuid",
            "description": "Same stable identifier as the corresponding routes.monitor.escalated outbox event."
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "previous_checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "newly_violated_routes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20
          },
          "newly_violated_signals": {
            "type": "integer",
            "minimum": 1,
            "maximum": 40
          },
          "signals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteMonitorIncidentEscalationSignal"
            },
            "minItems": 1,
            "maxItems": 40
          },
          "evidence": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteMonitorEvidence"
            },
            "maxItems": 3
          },
          "evidence_truncated": {
            "type": "boolean",
            "description": "True when more signals changed than the three-entry evidence cap, or incident-size compaction removed evidence."
          }
        }
      },
      "RouteMonitorIncidentPage": {
        "type": "object",
        "description": "Bounded owned incident history ordered by opening time and UUID descending.",
        "required": [
          "app_id",
          "incidents"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "incidents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteMonitorIncident"
            },
            "maxItems": 10
          },
          "next_before": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "RouteMonitorWebhookPayload": {
        "type": "object",
        "description": "Incident lifecycle or escalation metadata and optional aggregate customer-impact counts with an authenticated saved incident path. Excludes customer IDs and request data.",
        "required": [
          "version",
          "app_id",
          "deployment_id",
          "incident_id",
          "revision",
          "status",
          "checked_at",
          "incident_path"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "incident_id": {
            "type": "string",
            "format": "uuid"
          },
          "transition_id": {
            "type": "string",
            "format": "uuid",
            "description": "Stable identifier for one escalation transition; omitted for incident open and recovery events."
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "recovered"
            ]
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "incident_path": {
            "type": "string"
          },
          "customer_impact": {
            "$ref": "#/components/schemas/RouteMonitorCustomerImpact"
          },
          "escalation": {
            "$ref": "#/components/schemas/RouteMonitorWebhookEscalation"
          }
        }
      },
      "RouteMonitorWebhookEscalation": {
        "type": "object",
        "description": "Counts newly violated route and signal budgets since the prior incident evaluation.",
        "required": [
          "previous_checked_at",
          "newly_violated_routes",
          "newly_violated_signals"
        ],
        "properties": {
          "previous_checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "newly_violated_routes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20
          },
          "newly_violated_signals": {
            "type": "integer",
            "minimum": 1,
            "maximum": 40
          }
        }
      },
      "RouteMonitorCustomerImpact": {
        "type": "object",
        "description": "Aggregate observed request-time identity counts; never includes customer IDs.",
        "required": [
          "group_by",
          "coverage",
          "observed_customers",
          "violated_customers"
        ],
        "properties": {
          "group_by": {
            "type": "string",
            "enum": [
              "tenant",
              "consumer"
            ]
          },
          "coverage": {
            "type": "string",
            "enum": [
              "observed_only"
            ]
          },
          "observed_customers": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "violated_customers": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unknown_customers": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Distinct observed cohorts whose status cannot be established from retained evidence."
          }
        }
      },
      "RouteHealthRoute": {
        "type": "object",
        "description": "Exact normalized telemetry operation selected for canary error checks and optional latency checks.",
        "required": [
          "method",
          "path"
        ],
        "properties": {
          "watch_statuses": {
            "type": "array",
            "maxItems": 5,
            "uniqueItems": true,
            "items": {
              "type": "integer",
              "enum": [
                401,
                403,
                404,
                422,
                429
              ]
            },
            "description": "Opt-in live advisory comparisons, evaluated independently per code. Omission or an empty array disables them. Findings do not alter 5xx/latency gates or automatic recovery. Replacement edits increment revision and require fresh windows."
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE",
              "HEAD",
              "OPTIONS"
            ]
          },
          "path": {
            "type": "string",
            "minLength": 1,
            "maxLength": 240,
            "description": "Exact gateway-normalized telemetry path without method prefix, query, fragment or wildcard. For example /profiles/{id}."
          },
          "check_latency": {
            "type": "boolean",
            "description": "Opt in to the relative p95 slowdown check (at least 1.5 times stable and 100 ms slower). Omitted or false disables this check independently of max_p95_ms."
          },
          "max_p95_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 86400000,
            "description": "Absolute candidate p95 latency budget in milliseconds. A positive value enables this check; omitted or zero disables it. Does not enable the relative slowdown check."
          },
          "probe": {
            "$ref": "#/components/schemas/RouteHealthProbe"
          }
        }
      },
      "RouteHealthProbe": {
        "type": "object",
        "description": "Opt-in synthetic probe for a GET or HEAD selector. While a canary is in flight and organic evidence stays sparse, Gregale sends a few bodyless requests per minute to the candidate and stable deployments with customer auth gates unchanged. Probe requests never appear in request telemetry, analytics or usage; they wake the app like any request. At most 5 selectors per app.",
        "additionalProperties": false,
        "required": [
          "path"
        ],
        "properties": {
          "path": {
            "type": "string",
            "minLength": 1,
            "maxLength": 240,
            "description": "Concrete absolute path matching the selector, with a value for each {parameter}, for example /users/42 for /users/{id}. No query, fragment or wildcard."
          }
        }
      },
      "RouteHealthGate": {
        "type": "object",
        "description": "Current critical-route selection, health guard mode, recovery policy, and configuration revision.",
        "required": [
          "app_id",
          "mode",
          "revision",
          "routes"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "mode": {
            "type": "string",
            "enum": [
              "report",
              "enforce"
            ]
          },
          "on_regression": {
            "type": "string",
            "enum": [
              "hold",
              "abort"
            ],
            "description": "Defaults to hold, including when omitted in a replacement update. Abort opts into automatic recovery for confirmed route 5xx regressions during an enforced canary; report mode is observational."
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "routes": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/RouteHealthRoute"
            }
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "warnings": {
            "type": "array",
            "maxItems": 21,
            "items": {
              "type": "string"
            },
            "description": "Returned by a save: an on_regression abort no Safe Deploy worker can run now, and selectors no request matched within the plan's telemetry lookback (at most 7 days). An enforced guard holds a canary on such a route until the 24-hour route health hold deadline aborts it."
          }
        }
      },
      "SetRouteHealthGateRequest": {
        "type": "object",
        "description": "Replacement critical-route health configuration and the revision the caller expects to update.",
        "required": [
          "mode",
          "expected_revision",
          "routes"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "report",
              "enforce"
            ]
          },
          "on_regression": {
            "type": "string",
            "enum": [
              "hold",
              "abort"
            ],
            "description": "Recovery action to save. Omission resets it to hold; abort requires enforce mode and two confirmed critical-route 5xx windows before automatic recovery."
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1152921504606847000
          },
          "routes": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/RouteHealthRoute"
            }
          }
        }
      },
      "RouteHealthInvestigationSelection": {
        "type": "object",
        "description": "Exact configured route and signal, optionally scoped to a recorded customer identity.",
        "required": [
          "method",
          "path",
          "status_code"
        ],
        "properties": {
          "method": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "status_code": {
            "type": "integer",
            "enum": [
              0,
              401,
              403,
              404,
              422,
              429
            ]
          },
          "signal": {
            "type": "string",
            "enum": [
              "latency"
            ],
            "description": "Present for latency; omitted for the default errors selection."
          },
          "customer_group_by": {
            "type": "string",
            "enum": [
              "tenant",
              "consumer"
            ]
          },
          "customer_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "RouteHealthInvestigationExample": {
        "type": "object",
        "description": "Metadata for one retained matching telemetry row. Its weight may exceed one request; a trace ID is a link rather than a promise of retained spans.",
        "required": [
          "telemetry_id",
          "received_at",
          "status",
          "latency_ms",
          "represented_requests",
          "evidence_path"
        ],
        "properties": {
          "telemetry_id": {
            "type": "string",
            "format": "uuid"
          },
          "received_at": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599
          },
          "latency_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "represented_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "trace_id": {
            "type": "string"
          },
          "evidence_path": {
            "type": "string",
            "description": "Authenticated app debugger evidence path for this telemetry row. Retention and authorization are checked again when followed."
          }
        }
      },
      "RouteHealthInvestigationSide": {
        "type": "object",
        "description": "Matching response weights and row inventory for one deployment/window, counted before the example cap. Error examples prioritize trace-linked rows, then newest timestamp and descending telemetry UUID. Latency examples prioritize the slowest latency bucket, then those same ties.",
        "required": [
          "matching_requests",
          "observed_rows",
          "examples_truncated",
          "examples"
        ],
        "properties": {
          "matching_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "observed_rows": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "examples_truncated": {
            "type": "boolean"
          },
          "examples": {
            "type": "array",
            "maxItems": 3,
            "items": {
              "$ref": "#/components/schemas/RouteHealthInvestigationExample"
            }
          }
        }
      },
      "RouteHealthInvestigationWindow": {
        "type": "object",
        "description": "Independently bounded candidate and stable diagnostic rows within one exact health observation window.",
        "required": [
          "start",
          "end",
          "candidate",
          "stable"
        ],
        "properties": {
          "start": {
            "type": "string",
            "format": "date-time"
          },
          "end": {
            "type": "string",
            "format": "date-time"
          },
          "candidate": {
            "$ref": "#/components/schemas/RouteHealthInvestigationSide"
          },
          "stable": {
            "$ref": "#/components/schemas/RouteHealthInvestigationSide"
          },
          "diagnostics": {
            "$ref": "#/components/schemas/RouteHealthLatencyDiagnostics"
          }
        }
      },
      "RouteHealthInvestigation": {
        "type": "object",
        "description": "Shareable read-only investigation. The full aggregate report preserves rollout health context; finding is the selected aggregate or customer-specific route. Status and reason describe the selected error or latency signal, independently of rollout decisions. Examples reference retained metadata only. Missing stable comparisons return explicit unavailable evidence and zero rows. Coverage stays observed_only.",
        "required": [
          "version",
          "selection",
          "report",
          "finding",
          "status",
          "reason",
          "coverage",
          "evidence_status",
          "examples_limit",
          "windows"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1
          },
          "selection": {
            "$ref": "#/components/schemas/RouteHealthInvestigationSelection"
          },
          "report": {
            "$ref": "#/components/schemas/RouteHealthReport"
          },
          "finding": {
            "$ref": "#/components/schemas/RouteHealthFinding"
          },
          "status": {
            "type": "string",
            "enum": [
              "healthy",
              "regressed",
              "unknown"
            ]
          },
          "reason": {
            "type": "string"
          },
          "coverage": {
            "type": "string",
            "enum": [
              "observed_only"
            ]
          },
          "evidence_status": {
            "type": "string",
            "enum": [
              "observed",
              "unavailable"
            ]
          },
          "examples_limit": {
            "type": "integer",
            "minimum": 3,
            "maximum": 3
          },
          "windows": {
            "type": "array",
            "minItems": 2,
            "maxItems": 2,
            "items": {
              "$ref": "#/components/schemas/RouteHealthInvestigationWindow"
            }
          }
        }
      },
      "RouteHealthLatencyDiagnostics": {
        "type": "object",
        "description": "Newest 32 retained rows per deployment/window, including rows without spans. Normalized type/kind groups exclude names, SQL and attributes. Sample percentiles are not additive and do not establish cause or complete capture.",
        "required": [
          "coverage",
          "rows_limit",
          "dependencies_truncated",
          "candidate",
          "stable",
          "dependencies"
        ],
        "properties": {
          "coverage": {
            "type": "string",
            "enum": [
              "retained_samples"
            ]
          },
          "rows_limit": {
            "type": "integer",
            "minimum": 32,
            "maximum": 32
          },
          "dependencies_truncated": {
            "type": "boolean"
          },
          "candidate": {
            "$ref": "#/components/schemas/RouteHealthLatencySample"
          },
          "stable": {
            "$ref": "#/components/schemas/RouteHealthLatencySample"
          },
          "dependencies": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/RouteHealthDependencyComparison"
            }
          }
        }
      },
      "RouteHealthLatencySample": {
        "type": "object",
        "description": "Retained row counts and publisher weights. Span samples are actual retained spans, at most 100 per row. Guest p95 weights measured rows, including zero. Wake boot p95 counts each distinct wake once and requires scheduler events scoped to the app and recorded instance on the selected deployment. Missing stage evidence is omitted; incomplete timing suppresses exclusive percentiles.",
        "required": [
          "sampled_rows",
          "sampled_requests",
          "samples_truncated",
          "span_rows",
          "missing_span_rows",
          "span_samples",
          "spans_truncated",
          "timing_incomplete",
          "guest_rows",
          "guest_requests",
          "cold_boot_requests",
          "wake_samples"
        ],
        "properties": {
          "sampled_rows": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "sampled_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "samples_truncated": {
            "type": "boolean"
          },
          "span_rows": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "missing_span_rows": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "span_samples": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "spans_truncated": {
            "type": "boolean"
          },
          "timing_incomplete": {
            "type": "boolean"
          },
          "guest_rows": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "guest_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cold_boot_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "wake_samples": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "guest_p95_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 86400000
          },
          "wake_boot_p95_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 86400000
          }
        }
      },
      "RouteHealthDependencyTiming": {
        "type": "object",
        "description": "Weighted nearest-rank p95 of retained spans. Calls use collapsed request weights and can exceed request counts with multiple spans. Exclusive p95 subtracts overlapping direct children; omitted if timing is incomplete or spans are capped. Examples are bounded request references.",
        "required": [
          "span_samples",
          "represented_calls",
          "error_calls",
          "examples"
        ],
        "properties": {
          "span_samples": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "represented_calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "p95_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 86400000
          },
          "exclusive_p95_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 86400000
          },
          "examples": {
            "type": "array",
            "maxItems": 3,
            "items": {
              "$ref": "#/components/schemas/RouteHealthInvestigationExample"
            }
          }
        }
      },
      "RouteHealthDependencyComparison": {
        "type": "object",
        "description": "Retained dependency comparison. Deltas require measurements from both deployments. Ordered by positive comparable p95 change, candidate p95, type and kind; at most 16 groups.",
        "required": [
          "type",
          "status",
          "candidate",
          "stable"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "application",
              "managed_binding",
              "outbound_integration",
              "guest_transport",
              "platform_internal",
              "app_dependency"
            ]
          },
          "kind": {
            "type": "string",
            "maxLength": 64,
            "pattern": "^[a-z0-9._-]+$"
          },
          "status": {
            "type": "string",
            "enum": [
              "compared",
              "one_sided"
            ]
          },
          "candidate": {
            "$ref": "#/components/schemas/RouteHealthDependencyTiming"
          },
          "stable": {
            "$ref": "#/components/schemas/RouteHealthDependencyTiming"
          },
          "p95_delta_ms": {
            "type": "integer",
            "format": "int64"
          },
          "exclusive_p95_delta_ms": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "RouteHealthStatusCounts": {
        "type": "object",
        "description": "Weighted requests and responses for one watched HTTP code in one deployment/window. Rate is responses divided by requests, zero when requests are zero.",
        "required": [
          "requests",
          "responses",
          "rate"
        ],
        "properties": {
          "requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "responses": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "rate": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          }
        }
      },
      "RouteHealthClientErrorWindow": {
        "type": "object",
        "description": "Candidate/stable observations for one watched code within the shared aggregate observation window. Only deployment-attributed responses participate; pre-routing rejections without a deployment cannot be compared.",
        "required": [
          "start",
          "end",
          "candidate",
          "stable",
          "status",
          "reason"
        ],
        "properties": {
          "start": {
            "type": "string",
            "format": "date-time"
          },
          "end": {
            "type": "string",
            "format": "date-time"
          },
          "candidate": {
            "$ref": "#/components/schemas/RouteHealthStatusCounts"
          },
          "stable": {
            "$ref": "#/components/schemas/RouteHealthStatusCounts"
          },
          "status": {
            "type": "string",
            "enum": [
              "healthy",
              "regressed",
              "unknown"
            ]
          },
          "reason": {
            "type": "string"
          }
        }
      },
      "RouteHealthClientErrorFinding": {
        "type": "object",
        "description": "Independent consecutive-window verdict for one watched status code. Different codes in different windows cannot confirm a sustained regression.",
        "required": [
          "status_code",
          "status",
          "reason",
          "windows"
        ],
        "properties": {
          "status_code": {
            "type": "integer",
            "enum": [
              401,
              403,
              404,
              422,
              429
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "healthy",
              "regressed",
              "unknown"
            ]
          },
          "reason": {
            "type": "string"
          },
          "windows": {
            "type": "array",
            "minItems": 2,
            "maxItems": 2,
            "items": {
              "$ref": "#/components/schemas/RouteHealthClientErrorWindow"
            }
          }
        }
      },
      "RouteHealthClientErrorReport": {
        "type": "object",
        "description": "Live advisory watched-code evidence, independent of the 5xx/latency verdict. Each code uses at least 20 represented requests on both deployments per window, two matching regression windows, at least two candidate responses, a rate of at least 5 percent, three times stable, and at least five percentage points above stable. Stable expected rejection rates remain healthy. Sparse, one-sided, missing or pre-anchor evidence is unknown. Coverage inherits observed_only from the containing report; these observations neither prove a defect nor certify an SLO. Excluded from saved decisions, recovery and webhook payloads.",
        "required": [
          "status",
          "reason",
          "minimum_requests",
          "minimum_responses",
          "rate_floor",
          "rate_delta",
          "rate_factor",
          "statuses"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "healthy",
              "regressed",
              "unknown"
            ]
          },
          "reason": {
            "type": "string"
          },
          "minimum_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 20,
            "maximum": 20
          },
          "minimum_responses": {
            "type": "integer",
            "format": "int64",
            "minimum": 2,
            "maximum": 2
          },
          "rate_floor": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "rate_delta": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "rate_factor": {
            "type": "number",
            "minimum": 0
          },
          "statuses": {
            "type": "array",
            "minItems": 1,
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/RouteHealthClientErrorFinding"
            }
          }
        }
      },
      "RouteHealthCounts": {
        "type": "object",
        "description": "Represented request and server-error counts, error rate, and optional weighted p95 for one deployment in one window.",
        "required": [
          "requests",
          "server_errors",
          "error_rate"
        ],
        "properties": {
          "requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "server_errors": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_rate": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "p95_latency_ms": {
            "type": "number",
            "minimum": 0,
            "description": "Weighted p95 estimate in milliseconds from collapsed telemetry representatives. Omitted when latency is not selected or evidence is unavailable; zero is a valid observation."
          },
          "latency_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Requests the p95 ranked, to which the latency minimum applies. The canary guard ranks only requests that did not cold boot, and no reader ranks a long-lived response such as a WebSocket or an event stream. Omitted when every request was ranked."
          },
          "unauthenticated": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Synthetic probe responses rejected by customer auth gates (401/403). Only present in synthetic_windows; a window where at least half of either side was rejected is unknown (probe_unauthenticated)."
          }
        }
      },
      "RouteHealthWindowEvidence": {
        "type": "object",
        "description": "Candidate and stable observations within one closed window, with independent error and latency verdicts.",
        "required": [
          "start",
          "end",
          "candidate",
          "stable",
          "status",
          "reason"
        ],
        "properties": {
          "start": {
            "type": "string",
            "format": "date-time"
          },
          "end": {
            "type": "string",
            "format": "date-time"
          },
          "candidate": {
            "$ref": "#/components/schemas/RouteHealthCounts"
          },
          "stable": {
            "$ref": "#/components/schemas/RouteHealthCounts"
          },
          "status": {
            "type": "string",
            "enum": [
              "healthy",
              "regressed",
              "unknown"
            ]
          },
          "reason": {
            "type": "string"
          },
          "error_status": {
            "type": "string",
            "enum": [
              "healthy",
              "regressed",
              "unknown"
            ]
          },
          "error_reason": {
            "type": "string"
          },
          "latency_status": {
            "type": "string",
            "enum": [
              "healthy",
              "regressed",
              "unknown"
            ],
            "description": "Present when either latency check is selected."
          },
          "latency_reason": {
            "type": "string"
          },
          "latency_delta_ms": {
            "type": "number",
            "description": "Candidate p95 minus stable p95 in milliseconds when latency evidence is sufficient."
          },
          "latency_factor": {
            "type": "number",
            "minimum": 0,
            "description": "Candidate p95 divided by stable p95. Omitted when stable p95 is zero or evidence is insufficient."
          }
        }
      },
      "RouteHealthFinding": {
        "type": "object",
        "description": "Combined verdict and both closed-window evidence records for one selected critical route.",
        "required": [
          "method",
          "path",
          "status",
          "reason",
          "windows"
        ],
        "properties": {
          "client_errors": {
            "$ref": "#/components/schemas/RouteHealthClientErrorReport"
          },
          "watch_statuses": {
            "type": "array",
            "maxItems": 5,
            "uniqueItems": true,
            "items": {
              "type": "integer",
              "enum": [
                401,
                403,
                404,
                422,
                429
              ]
            },
            "description": "Configured watched response codes for this exact route. Live client_errors contains their independent advisory evidence; saved decisions retain selectors without code evidence."
          },
          "method": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "check_latency": {
            "type": "boolean",
            "description": "Whether the relative p95 slowdown check is selected."
          },
          "max_p95_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 86400000,
            "description": "Absolute candidate p95 budget in milliseconds; zero or omitted disables this check."
          },
          "status": {
            "type": "string",
            "enum": [
              "healthy",
              "regressed",
              "unknown"
            ]
          },
          "reason": {
            "type": "string"
          },
          "error_status": {
            "type": "string",
            "enum": [
              "healthy",
              "regressed",
              "unknown"
            ]
          },
          "error_reason": {
            "type": "string"
          },
          "latency_status": {
            "type": "string",
            "enum": [
              "healthy",
              "regressed",
              "unknown"
            ],
            "description": "Independently confirmed latency verdict across both windows when selected."
          },
          "latency_reason": {
            "type": "string"
          },
          "evidence_window": {
            "type": "string",
            "enum": [
              "pooled",
              "synthetic"
            ],
            "description": "pooled when the verdict comes from pooled_windows because the one-minute windows lacked requests; synthetic when it comes from synthetic_windows because organic evidence stayed sparse. Thresholds are unchanged."
          },
          "windows": {
            "type": "array",
            "minItems": 2,
            "maxItems": 2,
            "items": {
              "$ref": "#/components/schemas/RouteHealthWindowEvidence"
            }
          },
          "pooled_windows": {
            "type": "array",
            "minItems": 2,
            "maxItems": 2,
            "items": {
              "$ref": "#/components/schemas/RouteHealthWindowEvidence"
            },
            "description": "Two consecutive halves of up to the newest 30 minutes of the stage, read only for routes whose one-minute windows were sparse."
          },
          "synthetic_windows": {
            "type": "array",
            "minItems": 2,
            "maxItems": 2,
            "items": {
              "$ref": "#/components/schemas/RouteHealthWindowEvidence"
            },
            "description": "Synthetic probe results over the pooled bounds for probed selectors that organic evidence left sparse. They settle the 5xx signal only."
          }
        }
      },
      "RouteCustomerHealthAttribution": {
        "type": "object",
        "description": "Weighted request attribution for one selected identity dimension across both shared windows. Missing identities and unresolved scoped identities remain separate. Other requests are identified traffic outside the cohort output cap.",
        "required": [
          "identified_requests",
          "unattributed_requests",
          "unresolved_identity_requests",
          "other_customer_requests"
        ],
        "properties": {
          "identified_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unattributed_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unresolved_identity_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "other_customer_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "RouteCustomerHealthCohort": {
        "type": "object",
        "description": "One observed tenant or API consumer, compared independently with the same route thresholds and windows. Sparse or one-sided evidence is unknown.",
        "required": [
          "health"
        ],
        "properties": {
          "customer_id": {
            "type": "string",
            "format": "uuid",
            "description": "Present only when customer_details=true. Identity names and external references are excluded."
          },
          "health": {
            "$ref": "#/components/schemas/RouteHealthFinding"
          }
        }
      },
      "RouteCustomerHealthRoute": {
        "type": "object",
        "description": "Exact selected route with bounded identity cohorts from the union of candidate and stable observations. Ranking uses candidate 5xx counts descending, then selected client response counts descending, combined request volume descending, and UUID ascending. Totals precede caps.",
        "required": [
          "method",
          "path",
          "observed_customers",
          "customers_truncated",
          "candidate",
          "stable",
          "customers"
        ],
        "properties": {
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE",
              "HEAD",
              "OPTIONS"
            ]
          },
          "path": {
            "type": "string",
            "maxLength": 240
          },
          "observed_customers": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "customers_truncated": {
            "type": "boolean"
          },
          "candidate": {
            "$ref": "#/components/schemas/RouteCustomerHealthAttribution"
          },
          "stable": {
            "$ref": "#/components/schemas/RouteCustomerHealthAttribution"
          },
          "customers": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/RouteCustomerHealthCohort"
            }
          }
        }
      },
      "RouteCustomerHealthReport": {
        "type": "object",
        "description": "Advisory live comparisons in the same repeatable-read snapshot as aggregate health. Reuses sample minima and consecutive-window error and selected latency checks per identity, with watched client responses included in the advisory customer summary. A confirmed observed regression takes precedence; empty, sparse, capped, unattributed, unresolved or unavailable evidence prevents a healthy summary. Healthy means the retained observed cohort comparisons passed, not proof of complete capture or a statistical SLO. Request-time tenant IDs never follow current consumer links. Revoked consumers remain eligible historical observations. No identities enter decisions, history, audits or webhooks.",
        "required": [
          "group_by",
          "details_included",
          "coverage",
          "status",
          "reason",
          "customers_limit",
          "routes"
        ],
        "properties": {
          "group_by": {
            "type": "string",
            "enum": [
              "tenant",
              "consumer"
            ]
          },
          "details_included": {
            "type": "boolean"
          },
          "coverage": {
            "type": "string",
            "enum": [
              "observed_only"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "healthy",
              "regressed",
              "unknown",
              "disabled"
            ]
          },
          "reason": {
            "type": "string"
          },
          "customers_limit": {
            "type": "integer",
            "minimum": 20,
            "maximum": 20
          },
          "routes": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/RouteCustomerHealthRoute"
            }
          }
        }
      },
      "RouteHealthHold": {
        "type": "object",
        "description": "Present on a route health report read while the enforced guard holds the canary: when the hold began (its first blocking decision) and when the hold deadline aborts the canary if the rollout worker still finds it held.",
        "required": [
          "since",
          "aborts_at"
        ],
        "properties": {
          "since": {
            "type": "string",
            "format": "date-time"
          },
          "aborts_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "RouteHealthReport": {
        "type": "object",
        "description": "Current observed-only critical-route health comparison with candidate, predecessor, policy, and telemetry provenance. When the app's automatic profile policy is enabled, profile_signal adds an ephemeral report-only comparison for an active canary; it never affects canary advancement or rollback and is not persisted.",
        "required": [
          "app_id",
          "deployment_id",
          "candidate_commit_sha",
          "stable_deployment_id",
          "stable_commit_sha",
          "canary_step",
          "mode",
          "revision",
          "checked_at",
          "coverage",
          "status",
          "reason",
          "minimum_requests",
          "routes"
        ],
        "properties": {
          "client_error_status": {
            "type": "string",
            "enum": [
              "healthy",
              "regressed",
              "unknown"
            ],
            "description": "Live advisory summary of selected status-code comparisons. Independent of the status used for rollout decisions. Omitted when no codes are selected."
          },
          "client_error_reason": {
            "type": "string"
          },
          "customers": {
            "$ref": "#/components/schemas/RouteCustomerHealthReport"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "candidate_commit_sha": {
            "type": "string"
          },
          "stable_deployment_id": {
            "type": "string",
            "description": "Empty when no unique serving predecessor exists."
          },
          "stable_commit_sha": {
            "type": "string"
          },
          "canary_step": {
            "type": "integer",
            "minimum": 0
          },
          "mode": {
            "type": "string",
            "enum": [
              "report",
              "enforce"
            ]
          },
          "on_regression": {
            "type": "string",
            "enum": [
              "hold",
              "abort"
            ],
            "description": "Recovery policy used for this observation. Abort permits worker recovery on confirmed critical-route errors in enforce mode; reading the report never performs that action."
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "observation_anchor": {
            "type": "string",
            "format": "date-time",
            "description": "Latest stage or configuration timestamp that both windows must follow."
          },
          "coverage": {
            "type": "string",
            "enum": [
              "observed_only"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "healthy",
              "regressed",
              "unknown",
              "disabled"
            ]
          },
          "reason": {
            "type": "string"
          },
          "minimum_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 20,
            "maximum": 20
          },
          "minimum_latency_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 100,
            "maximum": 100,
            "description": "Present when any route has a latency check selected. Applies to each deployment per route per window."
          },
          "routes": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/RouteHealthFinding"
            }
          },
          "profile_signal": {
            "$ref": "#/components/schemas/CanaryProfileSignal"
          },
          "hold": {
            "$ref": "#/components/schemas/RouteHealthHold"
          }
        }
      },
      "CanaryProfileSignal": {
        "type": "object",
        "description": "Latest retained sampled CPU comparison for a deployment's canary stages, produced by a background worker using the app's enabled automatic profile policy and equal fixed windows. The stage and policy revision identify the assessment. Route-health reads return the saved result and never query profile storage. Checks are advisory unless canary_gate is explicitly configured. Gate evidence requires consecutive distinct qualified route windows; timeout behavior is configured explicitly. Completed assessments are retained for 30 days.",
        "required": [
          "mode",
          "status",
          "reason",
          "canary_step",
          "canary_step_started_at",
          "created_at",
          "attempts",
          "policy_revision",
          "metric",
          "window_seconds",
          "options",
          "evidence",
          "uncomparable_entries"
        ],
        "properties": {
          "gate": {
            "$ref": "#/components/schemas/ProfileCanaryGateState"
          },
          "attribution": {
            "$ref": "#/components/schemas/ProfileAttributionComparison",
            "readOnly": true
          },
          "route_checks": {
            "type": "array",
            "maxItems": 10,
            "readOnly": true,
            "items": {
              "$ref": "#/components/schemas/ProfileRouteRegression"
            }
          },
          "request_mix": {
            "$ref": "#/components/schemas/ProfileRequestMixSnapshot",
            "readOnly": true
          },
          "mode": {
            "type": "string",
            "enum": [
              "report_only",
              "gate"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "regressed",
              "no_regression_detected",
              "inconclusive",
              "cancelled"
            ]
          },
          "reason": {
            "type": "string"
          },
          "canary_step": {
            "type": "integer",
            "minimum": 0
          },
          "canary_step_started_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time",
            "description": "Last completed assessment attempt, absent until the worker has queried both profile windows."
          },
          "attempts": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time",
            "description": "Scheduled first check or retry time while the result is pending."
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          },
          "policy_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740990
          },
          "metric": {
            "type": "string",
            "enum": [
              "cpu_per_second",
              "cpu_per_request"
            ]
          },
          "window_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 60,
            "maximum": 1800
          },
          "options": {
            "$ref": "#/components/schemas/ProfileRegressionOptions"
          },
          "baseline": {
            "$ref": "#/components/schemas/ProfileQuery"
          },
          "candidate": {
            "$ref": "#/components/schemas/ProfileQuery"
          },
          "baseline_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "candidate_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "baseline_coverage": {
            "$ref": "#/components/schemas/ProfileCoverage"
          },
          "candidate_coverage": {
            "$ref": "#/components/schemas/ProfileCoverage"
          },
          "baseline_source": {
            "$ref": "#/components/schemas/ProfileSource",
            "readOnly": true,
            "description": "Request-time source revision for the stable deployment. Commit URLs are derived from recorded deployment provenance and are not retained with the assessment."
          },
          "candidate_source": {
            "$ref": "#/components/schemas/ProfileSource",
            "readOnly": true,
            "description": "Request-time source revision for the canary deployment. Commit URLs are derived from recorded deployment provenance and are not retained with the assessment."
          },
          "comparison_url": {
            "type": "string",
            "maxLength": 2048,
            "readOnly": true,
            "description": "Dashboard link to load the exact stable and canary profile windows for a completed assessment."
          },
          "total": {
            "$ref": "#/components/schemas/ProfileRegressionMetric"
          },
          "evidence": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/ProfileRegressionEvidence"
            }
          },
          "uncomparable_entries": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "ProfileCanaryGatePolicy": {
        "description": "Opt-in policy requiring consecutive qualified route CPU/request comparisons before a canary stage advances.",
        "type": "object",
        "required": [
          "confirmations",
          "timeout_seconds",
          "on_timeout",
          "auto_rollback"
        ],
        "properties": {
          "confirmations": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5,
            "default": 2
          },
          "timeout_seconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 86400,
            "default": 1800,
            "description": "Must cover warmup plus all confirmation windows and ingestion grace."
          },
          "on_timeout": {
            "type": "string",
            "enum": [
              "hold",
              "continue"
            ],
            "default": "hold",
            "description": "Continuing is an explicit acceptance of inconclusive profile evidence. Confirmed regressions remain held."
          },
          "auto_rollback": {
            "type": "boolean",
            "default": false,
            "description": "Worker-only opt-in recovery for request-mode canaries to the exact current stable predecessor. Service recovery uses the checked handoff flow."
          }
        }
      },
      "ProfileGateRouteStreak": {
        "description": "Consecutive qualified observations for one configured route in the current canary stage.",
        "type": "object",
        "required": [
          "route",
          "status",
          "count"
        ],
        "properties": {
          "route": {
            "type": "string",
            "maxLength": 256
          },
          "status": {
            "type": "string",
            "enum": [
              "regressed",
              "no_regression_detected",
              "insufficient_data"
            ]
          },
          "count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5
          }
        }
      },
      "ProfileCanaryGateState": {
        "description": "Retained stage evidence and bounded route streaks used to qualify the profiling gate.",
        "type": "object",
        "required": [
          "policy",
          "status",
          "reason",
          "deadline",
          "windows",
          "streaks"
        ],
        "properties": {
          "policy": {
            "$ref": "#/components/schemas/ProfileCanaryGatePolicy"
          },
          "status": {
            "type": "string",
            "enum": [
              "collecting",
              "passed",
              "regressed",
              "timed_out",
              "inconclusive"
            ]
          },
          "reason": {
            "type": "string"
          },
          "deadline": {
            "type": "string",
            "format": "date-time"
          },
          "windows": {
            "type": "integer",
            "minimum": 0
          },
          "last_window_end": {
            "type": "string",
            "format": "date-time"
          },
          "streaks": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/ProfileGateRouteStreak"
            }
          },
          "next_candidate": {
            "$ref": "#/components/schemas/ProfileQuery",
            "description": "Separate next capture selection. Retained code evidence always refers to the signal's baseline and candidate queries."
          }
        }
      },
      "ProfileGateOverride": {
        "description": "Audited customer exception bound to the current profiling policy revision.",
        "type": "object",
        "required": [
          "expected_policy_revision",
          "reason"
        ],
        "properties": {
          "expected_policy_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "description": "Nonblank customer reason recorded atomically with the traffic change. Workers cannot override."
          }
        }
      },
      "ProfileCanaryGateDecision": {
        "description": "Current profiling gate decision for an owned canary stage and its exact stable predecessor.",
        "type": "object",
        "required": [
          "status",
          "reason",
          "policy_revision",
          "canary_step",
          "auto_rollback"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "disabled",
              "collecting",
              "passed",
              "regressed",
              "timed_out",
              "overridden",
              "rolled_back"
            ]
          },
          "reason": {
            "type": "string"
          },
          "policy_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "canary_step": {
            "type": "integer",
            "minimum": 0
          },
          "canary_step_started_at": {
            "type": "string",
            "format": "date-time"
          },
          "deadline": {
            "type": "string",
            "format": "date-time"
          },
          "on_timeout": {
            "type": "string",
            "enum": [
              "hold",
              "continue"
            ]
          },
          "auto_rollback": {
            "type": "boolean"
          },
          "stable_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "signal": {
            "$ref": "#/components/schemas/CanaryProfileSignal"
          }
        }
      },
      "ProfileCanaryHistoryPage": {
        "type": "object",
        "description": "Bounded newest-first canary profile assessments for one deployment. Each entry pins one stage and automatic-profile policy revision. next_cursor is opaque and may expire when its retained entry is pruned.",
        "required": [
          "app_id",
          "deployment_id",
          "entries"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "entries": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/CanaryProfileSignal"
            }
          },
          "next_cursor": {
            "type": "string",
            "maxLength": 512
          }
        }
      },
      "RouteHealthDecision": {
        "type": "object",
        "description": "Metadata-only decision evaluated inside the canary traffic transaction; history_id correlates the exact saved evidence with the advance response and traffic audit.",
        "required": [
          "mode",
          "revision",
          "deployment_id",
          "stable_deployment_id",
          "status",
          "reason",
          "checked_at"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "report",
              "enforce"
            ]
          },
          "on_regression": {
            "type": "string",
            "enum": [
              "hold",
              "abort"
            ],
            "description": "Hold or abort policy captured with this rollout evaluation so retained decisions can be interpreted independently of later configuration updates."
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "stable_deployment_id": {
            "type": "string"
          },
          "history_id": {
            "type": "string",
            "format": "uuid",
            "description": "Retained saved decision UUID when selected routes were evaluated."
          },
          "status": {
            "type": "string",
            "enum": [
              "allowed",
              "blocked",
              "report_only",
              "aborted"
            ]
          },
          "reason": {
            "type": "string"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "RouteHealthEvaluationPolicy": {
        "type": "object",
        "description": "Versioned thresholds captured with the decision; never inferred from current settings.",
        "required": [
          "version",
          "windows",
          "window_seconds",
          "ingestion_lag_seconds",
          "minimum_requests",
          "minimum_errors",
          "error_rate_floor",
          "error_rate_delta",
          "error_rate_factor",
          "minimum_latency_requests",
          "latency_quantile",
          "latency_factor",
          "latency_delta_ms",
          "comparison_epsilon"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "windows": {
            "type": "integer",
            "minimum": 2,
            "maximum": 2
          },
          "window_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 60,
            "maximum": 60
          },
          "ingestion_lag_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 30,
            "maximum": 30
          },
          "minimum_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 20,
            "maximum": 20
          },
          "minimum_errors": {
            "type": "integer",
            "format": "int64",
            "minimum": 2,
            "maximum": 2
          },
          "error_rate_floor": {
            "type": "number",
            "description": "Minimum candidate 5xx rate as a fraction."
          },
          "error_rate_delta": {
            "type": "number",
            "description": "Minimum additional 5xx rate as a fraction."
          },
          "error_rate_factor": {
            "type": "number"
          },
          "minimum_latency_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 100,
            "maximum": 100
          },
          "latency_quantile": {
            "type": "number"
          },
          "latency_factor": {
            "type": "number"
          },
          "latency_delta_ms": {
            "type": "number"
          },
          "comparison_epsilon": {
            "type": "number",
            "description": "Floating point tolerance used in comparisons."
          }
        }
      },
      "RouteHealthHistoryEntry": {
        "type": "object",
        "description": "Immutable evidence from a real canary advance evaluation or committed automatic route health abort, bounded to 64 KiB encoded JSON. Identical advance retries retain the original id and checked_at.",
        "required": [
          "version",
          "id",
          "checked_at",
          "source",
          "traffic_percent",
          "requested_traffic_percent",
          "policy",
          "decision",
          "report"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "worker"
            ]
          },
          "purpose": {
            "type": "string",
            "enum": [
              "abort"
            ],
            "description": "Abort identifies a committed automatic rollback with worker source and requested traffic 0. Omitted for advance evaluations."
          },
          "traffic_percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Candidate traffic before evaluation."
          },
          "requested_traffic_percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "policy": {
            "$ref": "#/components/schemas/RouteHealthEvaluationPolicy"
          },
          "decision": {
            "$ref": "#/components/schemas/RouteHealthDecision"
          },
          "report": {
            "$ref": "#/components/schemas/RouteHealthReport"
          }
        }
      },
      "RouteHealthHistoryPage": {
        "type": "object",
        "description": "Newest-first page of immutable rollout health decisions and an optional cursor for older entries.",
        "required": [
          "app_id",
          "deployment_id",
          "entries"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "entries": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/RouteHealthHistoryEntry"
            }
          },
          "next_cursor": {
            "type": "string",
            "format": "uuid",
            "description": "Last returned decision UUID when another page exists."
          }
        }
      },
      "CanaryRouteGate": {
        "type": "object",
        "description": "Per-app gate for canary route-requirements evidence and production lifecycle declarations. Absence is report mode with revision 0. Lifecycle enforcement includes initial positive activation, promotions, traffic redistribution and ordinary rollback. Dark staging, validated abort and automatic incident recovery remain available.",
        "required": [
          "app_id",
          "mode",
          "revision"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "mode": {
            "type": "string",
            "enum": [
              "report",
              "enforce"
            ]
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SetCanaryRouteGateRequest": {
        "type": "object",
        "description": "Route requirements gate mode to save after comparing the current gate revision.",
        "required": [
          "mode",
          "expected_revision"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "report",
              "enforce"
            ]
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1152921504606847000
          }
        }
      },
      "RouteGateDecision": {
        "type": "object",
        "description": "Metadata-only decision from the same transaction as a canary traffic advance. Findings remain in the route result API.",
        "required": [
          "mode",
          "revision",
          "deployment_id",
          "status",
          "reasons",
          "check_queued"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "report",
              "enforce"
            ]
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "allowed",
              "blocked",
              "report_only"
            ]
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "Route-check reason or lifecycle declaration code with the lifecycle_ prefix."
            }
          },
          "check_queued": {
            "type": "boolean"
          },
          "lifecycle_approval_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Exact persisted successor-review receipts accepted inside this advance transaction."
          }
        }
      },
      "AutomaticRouteCheck": {
        "type": "object",
        "description": "Latest bounded deployment verdict and independently computed freshness. Recent completed checks have bounded immutable history and finding deltas; history is not current passing evidence. Queue runs after capture or saved intent changes; refresh reevaluates policy drift.",
        "required": [
          "version",
          "app",
          "app_id",
          "deployment_id",
          "state",
          "freshness",
          "stale_reasons",
          "current_requirements_revision",
          "current_requirements_sha256",
          "attempts",
          "queued_at"
        ],
        "properties": {
          "version": {
            "type": "integer"
          },
          "app": {
            "type": "string"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "running",
              "retrying",
              "complete"
            ]
          },
          "freshness": {
            "type": "string",
            "enum": [
              "unavailable",
              "current",
              "stale"
            ]
          },
          "stale_reasons": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "requirements_changed",
                "capture_changed",
                "configuration_changed"
              ]
            }
          },
          "current_requirements_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "current_requirements_sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "attempts": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "last_error_code": {
            "type": "string",
            "enum": [
              "check_failed"
            ]
          },
          "queued_at": {
            "type": "string",
            "format": "date-time"
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "check_id": {
            "type": "string",
            "format": "uuid",
            "description": "Identity of the stored completed check; may refer to a historical verdict while work is pending."
          },
          "changes": {
            "$ref": "#/components/schemas/RouteCheckChanges"
          },
          "check": {
            "$ref": "#/components/schemas/RouteRequirementsCheck"
          }
        }
      },
      "RouteCheckChangeSummary": {
        "type": "object",
        "description": "Exact finding-change counts across the bounded comparison, including observations omitted from truncated detail.",
        "required": [
          "newly_violated",
          "resolved",
          "changed",
          "unknown",
          "removed",
          "observed"
        ],
        "properties": {
          "newly_violated": {
            "type": "integer",
            "minimum": 0
          },
          "resolved": {
            "type": "integer",
            "minimum": 0
          },
          "changed": {
            "type": "integer",
            "minimum": 0
          },
          "unknown": {
            "type": "integer",
            "minimum": 0
          },
          "removed": {
            "type": "integer",
            "minimum": 0
          },
          "observed": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "RouteFindingChange": {
        "type": "object",
        "description": "One finding compared with its last known observation for unchanged saved intent. Removed findings are not fixes; unknown evidence retains the previous known verdict.",
        "required": [
          "method",
          "path",
          "requirement",
          "kind"
        ],
        "properties": {
          "method": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "requirement": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "newly_violated",
              "resolved",
              "changed",
              "unknown",
              "removed",
              "observed"
            ]
          },
          "before_check_id": {
            "type": "string",
            "format": "uuid"
          },
          "before": {
            "$ref": "#/components/schemas/RouteRequirementsFinding"
          },
          "after": {
            "$ref": "#/components/schemas/RouteRequirementsFinding"
          }
        }
      },
      "RouteCheckChanges": {
        "type": "object",
        "description": "Deterministic bounded comparison with exact summary counts. Initial checks and intent changes establish a baseline without claiming resolution. Truncated detail never changes summary counts. Previous observations can outlive retained history.",
        "required": [
          "version",
          "check_id",
          "status",
          "summary",
          "truncated",
          "findings"
        ],
        "properties": {
          "version": {
            "type": "integer"
          },
          "check_id": {
            "type": "string",
            "format": "uuid"
          },
          "compared_to_check_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "initial",
              "comparable",
              "requirements_changed",
              "unavailable",
              "ambiguous",
              "tracking_limit"
            ]
          },
          "summary": {
            "$ref": "#/components/schemas/RouteCheckChangeSummary"
          },
          "truncated": {
            "type": "boolean"
          },
          "findings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteFindingChange"
            }
          }
        }
      },
      "RouteCheckHistoryEntry": {
        "type": "object",
        "description": "Immutable retained completion evidence. Historical verdicts do not establish current safety. May expire under per-deployment retention caps.",
        "required": [
          "version",
          "id",
          "checked_at",
          "check",
          "changes"
        ],
        "properties": {
          "version": {
            "type": "integer"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "check": {
            "$ref": "#/components/schemas/RouteRequirementsCheck"
          },
          "changes": {
            "$ref": "#/components/schemas/RouteCheckChanges"
          }
        }
      },
      "RouteCheckHistorySummary": {
        "type": "object",
        "description": "Compact completion metadata; use its ID to read retained full evidence.",
        "required": [
          "version",
          "id",
          "checked_at",
          "status",
          "requirements_revision",
          "requirements_sha256",
          "comparison_status",
          "summary"
        ],
        "properties": {
          "version": {
            "type": "integer"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": [
              "satisfied",
              "violated",
              "unknown"
            ]
          },
          "requirements_revision": {
            "type": "integer",
            "format": "int64"
          },
          "requirements_sha256": {
            "type": "string"
          },
          "comparison_status": {
            "type": "string",
            "enum": [
              "initial",
              "comparable",
              "requirements_changed",
              "unavailable",
              "ambiguous",
              "tracking_limit"
            ]
          },
          "summary": {
            "$ref": "#/components/schemas/RouteCheckChangeSummary"
          }
        }
      },
      "RouteCheckHistoryPage": {
        "type": "object",
        "description": "Deployment-scoped page of retained route check summaries and an optional continuation cursor.",
        "required": [
          "app_id",
          "deployment_id",
          "entries"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteCheckHistorySummary"
            }
          },
          "next_cursor": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "RoutePolicyPlan": {
        "type": "object",
        "description": "Server proposal binding normalized requirements, current configuration, options, and proposed changes. Version 2 uses concrete requirements; version 3 also binds the captured deployment contract and full inventory impact. Saved plans additionally bind requirements_revision and requirements_sha256; apply rejects changed saved intent.",
        "required": [
          "version",
          "app",
          "status",
          "configuration_sha256",
          "requirements_sha256",
          "scope",
          "before",
          "after",
          "changes",
          "unresolved"
        ],
        "properties": {
          "authority": {
            "type": "string",
            "enum": [
              "server"
            ]
          },
          "requirements": {
            "$ref": "#/components/schemas/RouteRequirementsConfig"
          },
          "throttle_burst": {
            "type": "integer"
          },
          "consolidate_budgets": {
            "type": "boolean",
            "description": "Opt-in version 3 budget synthesis within declared group prefixes, including uncaptured and future paths."
          },
          "rule_usage": {
            "$ref": "#/components/schemas/RoutePolicyRuleUsage"
          },
          "version": {
            "type": "integer",
            "enum": [
              2,
              3
            ]
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "app": {
            "type": "string"
          },
          "app_id": {
            "type": "string"
          },
          "host": {
            "type": "string"
          },
          "plan_name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "ready",
              "partial",
              "blocked",
              "no_changes"
            ]
          },
          "sha256": {
            "type": "string"
          },
          "configuration_sha256": {
            "type": "string"
          },
          "requirements_sha256": {
            "type": "string"
          },
          "requirements_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "Present when planning from saved requirements; part of the reviewed fingerprint."
          },
          "scope": {
            "type": "string"
          },
          "before": {
            "$ref": "#/components/schemas/RouteRequirementsReport"
          },
          "after": {
            "$ref": "#/components/schemas/RouteRequirementsReport"
          },
          "changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RoutePolicyChange"
            }
          },
          "unresolved": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RoutePlanUnresolved"
            }
          }
        }
      },
      "RoutePolicyChange": {
        "type": "object",
        "description": "Generated concrete or family selector creation or action-only update with expected outcome and affected traffic.",
        "required": [
          "operation",
          "kind",
          "expected",
          "after",
          "impact",
          "reason"
        ],
        "properties": {
          "operation": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "budget_group": {
            "type": "string",
            "description": "Declared group used for a consolidated budget selector."
          },
          "rule_id": {
            "type": "string"
          },
          "simulated_rule_id": {
            "type": "string"
          },
          "create": {
            "$ref": "#/components/schemas/CreateEdgeRuleRequest"
          },
          "update": {
            "$ref": "#/components/schemas/UpdateEdgeRuleRequest"
          },
          "expected": {
            "type": "string"
          },
          "before": {
            "type": "string"
          },
          "after": {
            "type": "string"
          },
          "displaced_rule_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "impact": {
            "$ref": "#/components/schemas/RoutePolicyImpact"
          },
          "reason": {
            "type": "string"
          }
        }
      },
      "RoutePolicyRuleUsage": {
        "type": "object",
        "description": "App rule count before and after the proposed changes and current plan quota, including disabled rules. No existing rules are deleted.",
        "required": [
          "before",
          "after",
          "limit"
        ],
        "properties": {
          "before": {
            "type": "integer"
          },
          "after": {
            "type": "integer"
          },
          "limit": {
            "type": "integer"
          }
        }
      },
      "RoutePolicyImpact": {
        "type": "object",
        "description": "Platform host, method and concrete or family path whose policy selection can change. Captured impact is bounded to the selected contract; wildcard rules can also affect uncaptured paths.",
        "required": [
          "host",
          "method",
          "path",
          "scope"
        ],
        "properties": {
          "host": {
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          },
          "beyond_capture": {
            "type": "boolean"
          },
          "captured": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RoutePolicyAffectedOperation"
            }
          }
        }
      },
      "RoutePolicyAffectedOperation": {
        "type": "object",
        "description": "Policy selection impact for an intersecting captured operation, including any preserved public exception.",
        "required": [
          "method",
          "path",
          "relation"
        ],
        "properties": {
          "method": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "relation": {
            "type": "string"
          },
          "public": {
            "type": "boolean"
          },
          "before_rule_id": {
            "type": "string"
          },
          "after_rule_id": {
            "type": "string"
          }
        }
      },
      "RoutePlanUnresolved": {
        "type": "object",
        "description": "Requirement that remains violated or unknown after simulation, with a reason and suggested action.",
        "required": [
          "method",
          "path",
          "requirement",
          "status",
          "code",
          "reason",
          "next_action"
        ],
        "properties": {
          "method": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "requirement": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "next_action": {
            "type": "string"
          }
        }
      },
      "RoutePolicyPlanRequest": {
        "type": "object",
        "description": "Supply exactly one source: inline requirements or saved=true. Saved mode reads current app intent in the same snapshot as policy and capture; deployment_id is required. expected_revision optionally pins saved planning. Explicit burst choice is required for creating throttles without a selected policy.",
        "additionalProperties": false,
        "properties": {
          "saved": {
            "type": "boolean",
            "default": false,
            "description": "Use current saved app requirements instead of inline requirements."
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "Saved mode only; optional for planning and mandatory for applying the reviewed saved plan."
          },
          "requirements": {
            "$ref": "#/components/schemas/RouteRequirementsConfig"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Required for saved or inline version 2 requirements; captured deployment must belong to the app."
          },
          "throttle_burst": {
            "type": "integer",
            "minimum": 0
          },
          "consolidate_budgets": {
            "type": "boolean",
            "default": false,
            "description": "Version 2 requirements only. Propose compatible budgets within declared group prefixes; explicitly permits uncaptured and future path scope. Throttles remain separate."
          }
        }
      },
      "RoutePolicyApplyRequest": {
        "type": "object",
        "description": "Supply exactly one source: inline requirements or saved=true. Saved apply requires expected_revision from the reviewed plan and rejects any saved intent revision change. The reviewed fingerprint binds its content hash, capture, options and configuration; patch bodies are recomputed under transaction locks. Identical committed retries return the original receipt even after saved intent changes.",
        "additionalProperties": false,
        "required": [
          "expected_plan_sha256",
          "confirm"
        ],
        "properties": {
          "saved": {
            "type": "boolean",
            "default": false,
            "description": "Apply using the saved app intent bound by the reviewed plan rather than an inline requirements document."
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "Required saved intent revision from the reviewed plan when saved=true; a changed revision rejects the apply."
          },
          "requirements": {
            "$ref": "#/components/schemas/RouteRequirementsConfig"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "App-owned captured deployment required for saved or version 2 apply; its contract must match the reviewed plan."
          },
          "throttle_burst": {
            "type": "integer",
            "minimum": 0
          },
          "consolidate_budgets": {
            "type": "boolean",
            "default": false,
            "description": "Must match the reviewed group plan; synthesis is recomputed under transaction locks."
          },
          "expected_plan_sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "confirm": {
            "type": "boolean",
            "const": true
          }
        }
      },
      "RoutePolicyAppliedChange": {
        "type": "object",
        "description": "Committed rule operation with the real persistent rule identifier.",
        "required": [
          "operation",
          "kind",
          "rule_id"
        ],
        "properties": {
          "operation": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "rule_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "RoutePolicyReceipt": {
        "type": "object",
        "description": "Durable historical transaction outcome, verified configuration, and actual rule identifiers.",
        "required": [
          "id",
          "app_id",
          "plan_sha256",
          "applied_at",
          "changes",
          "verification"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "plan_sha256": {
            "type": "string"
          },
          "applied_at": {
            "type": "string",
            "format": "date-time"
          },
          "changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RoutePolicyAppliedChange"
            }
          },
          "verification": {
            "$ref": "#/components/schemas/RouteRequirementsReport"
          }
        }
      },
      "RoutePolicyApplyResponse": {
        "type": "object",
        "description": "Successful committed receipt with retry replay information and separate gateway convergence metadata.",
        "required": [
          "receipt",
          "replayed",
          "gateway_state"
        ],
        "properties": {
          "receipt": {
            "$ref": "#/components/schemas/RoutePolicyReceipt"
          },
          "replayed": {
            "type": "boolean"
          },
          "gateway_state": {
            "type": "string",
            "enum": [
              "active",
              "converging",
              "unknown",
              "unobserved"
            ]
          },
          "gateway_generation": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "ServiceAuthorizationCheck": {
        "type": "object",
        "description": "Stable rule and sanitized reason from a service policy observation.",
        "required": [
          "rule",
          "result",
          "reason"
        ],
        "properties": {
          "rule": {
            "type": "string"
          },
          "result": {
            "type": "string",
            "enum": [
              "allowed",
              "denied",
              "indeterminate"
            ]
          },
          "reason": {
            "type": "string"
          },
          "setting": {
            "type": "string"
          },
          "hint": {
            "type": "string"
          }
        }
      },
      "ServiceBindingExplanation": {
        "type": "object",
        "description": "Separate-read policy and routing observation, not live identity, guest adoption or connectivity evidence.",
        "required": [
          "caller",
          "target",
          "method",
          "path",
          "result",
          "scope",
          "checked_at",
          "checks",
          "limitations"
        ],
        "properties": {
          "caller": {
            "type": "string"
          },
          "target": {
            "type": "string",
            "description": "Requested service name, which may differ from the resolved physical app slug."
          },
          "method": {
            "type": "string"
          },
          "path": {
            "type": "string",
            "description": "Decoded request path without query values."
          },
          "result": {
            "type": "string",
            "enum": [
              "allowed",
              "denied",
              "indeterminate"
            ]
          },
          "scope": {
            "type": "string",
            "description": "Environment of the exact caller deployment."
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "caller_fingerprint": {
            "type": "string",
            "description": "Observed app settings fingerprint; frozen environment policy may override these settings."
          },
          "target_fingerprint": {
            "type": "string",
            "description": "Observed target app settings fingerprint; not a frozen release policy digest."
          },
          "caller_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "target_app_id": {
            "type": "string",
            "format": "uuid"
          },
          "target_deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Absent when the service route is unpinned or unavailable."
          },
          "release_id": {
            "type": "string",
            "format": "uuid",
            "description": "Resolved release, including retained project releases when permitted by the gateway."
          },
          "policy_source": {
            "type": "string",
            "enum": [
              "app",
              "environment_release"
            ]
          },
          "canonical_transport": {
            "$ref": "#/components/schemas/ServiceBindingTransport"
          },
          "checks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ServiceAuthorizationCheck"
            }
          },
          "limitations": {
            "type": "string"
          }
        }
      },
      "ServiceBindingInventoryContext": {
        "type": "object",
        "description": "Frozen deployment service edge and current reviewed route metadata. Only the named managed verification contract can qualify this context; ordinary app receipts cannot.",
        "required": [
          "source",
          "caller_deployment_id",
          "revision",
          "routing_status",
          "routing_reason",
          "verification_supported",
          "verification_reason"
        ],
        "properties": {
          "source": {
            "type": "string",
            "enum": [
              "environment_release"
            ]
          },
          "caller_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "target_app_id": {
            "type": "string",
            "format": "uuid",
            "description": "Account-owned frozen target app; omitted when unreadable or foreign."
          },
          "target_app": {
            "type": "string",
            "description": "Physical target app slug; the binding name remains the logical workload."
          },
          "release_id": {
            "type": "string",
            "format": "uuid",
            "description": "Active reviewed release selected by the managed route resolver, when available."
          },
          "revision": {
            "type": "string",
            "description": "Opaque digest of reviewed graph identities and public edge facts; changes invalidate a verification review. Not a connectivity receipt or authorization capability."
          },
          "routing_status": {
            "type": "string",
            "enum": [
              "resolved",
              "denied",
              "unavailable"
            ]
          },
          "routing_reason": {
            "type": "string",
            "description": "Stable sanitized reason for managed route resolution."
          },
          "verification_supported": {
            "type": "boolean",
            "description": "True only for an active request/service or worker caller with a supported frozen HTTPS edge to a request/service target."
          },
          "verification_contract": {
            "type": "string",
            "description": "managed-https-v1 identifies the supported managed guest probe contract. Missing or unknown contracts remain unsupported."
          },
          "verification_reason": {
            "type": "string",
            "description": "Empty for a supported managed contract; otherwise managed_service_verification_unsupported."
          }
        }
      },
      "ManagedServiceProbeSpec": {
        "type": "object",
        "description": "Server-selected frozen context for a managed service route probe. Contains no credentials or application request. Changing context or policy invalidates the receipt.",
        "required": [
          "version",
          "caller_deployment_id",
          "scope",
          "service",
          "binding",
          "target_app_id",
          "target_deployment_id",
          "release_id",
          "context_revision"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "description": "Managed probe contract version; currently 1."
          },
          "caller_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "service": {
            "type": "string",
            "description": "Logical frozen service workload."
          },
          "binding": {
            "type": "string",
            "description": "Frozen environment key, including custom keys."
          },
          "target_app_id": {
            "type": "string",
            "format": "uuid"
          },
          "target_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "release_id": {
            "type": "string",
            "format": "uuid"
          },
          "context_revision": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "transport": {
            "$ref": "#/components/schemas/ServiceBindingTransport",
            "description": "Caller transport the probe verifies. Absent means the original HTTPS probe; `http` probes the caller's plaintext `.svc.gregale` URL."
          }
        }
      },
      "AppBindingInventory": {
        "type": "object",
        "description": "Best-effort app binding metadata with explicit completeness and sanitized section issues.",
        "required": [
          "app",
          "generated_at",
          "complete",
          "bindings"
        ],
        "properties": {
          "service_binding_source": {
            "type": "string",
            "enum": [
              "app",
              "environment_release",
              "unavailable"
            ],
            "description": "Source used for the service namespace. Managed empty or unreadable namespaces never fall back to app settings."
          },
          "service_targets": {
            "type": "object",
            "description": "Applied exact service target selectors; absent for ordinary evidence selection.",
            "additionalProperties": {
              "type": "string",
              "format": "uuid"
            }
          },
          "app": {
            "type": "string"
          },
          "scope": {
            "type": "string",
            "description": "Resource scope filter. Absent means all scopes."
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "requested_deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Confirms that the explicit deployment_id selector was applied. Absent for default selection."
          },
          "verification_deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Deployment selected for evidence: explicit selector or current manual-task deployment."
          },
          "verification_scope": {
            "type": "string",
            "description": "Scope of the selected verification deployment."
          },
          "verification_probes_available": {
            "type": "boolean",
            "description": "Whether this control-plane host can run bindings verify probes (deployment-attached app tasks). False means probe evidence cannot be produced here; absent from older servers."
          },
          "runtime_freshness": {
            "$ref": "#/components/schemas/BindingRuntimeFreshness"
          },
          "complete": {
            "type": "boolean",
            "description": "All binding sections could be read; this does not mean that bindings are healthy or verified."
          },
          "bindings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppBindingInventoryItem"
            }
          },
          "issues": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BindingInventoryIssue"
            }
          },
          "warnings": {
            "type": "array",
            "description": "Human-readable, sanitized messages for each issue.",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "BindingAdoptionCounts": {
        "type": "object",
        "description": "Counts of authorized workload/secret pairs, derived from versioned receipts.",
        "required": [
          "current",
          "failed",
          "stale",
          "unknown"
        ],
        "properties": {
          "current": {
            "type": "integer",
            "minimum": 0
          },
          "failed": {
            "type": "integer",
            "minimum": 0
          },
          "stale": {
            "type": "integer",
            "minimum": 0
          },
          "unknown": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "BindingApplicationAckTarget": {
        "type": "object",
        "description": "Authorized resident workload and managed secret metadata, with independently versioned reload and application observations. Contains no credential values, hashes or private binding IDs. Empty workload_name means the main workload.",
        "required": [
          "deployment_id",
          "instance_id",
          "runtime_state",
          "key",
          "reload_support",
          "current_version",
          "reload_version",
          "application_ack_version"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "instance_id": {
            "type": "string",
            "format": "uuid"
          },
          "workload_name": {
            "type": "string"
          },
          "runtime_state": {
            "type": "string"
          },
          "key": {
            "type": "string"
          },
          "reload_support": {
            "type": "string",
            "enum": [
              "enabled",
              "disabled",
              "unknown"
            ]
          },
          "current_version": {
            "type": "integer",
            "format": "int64"
          },
          "reload_version": {
            "type": "integer",
            "format": "int64"
          },
          "projection": {
            "type": "string",
            "enum": [
              "updated",
              "unchanged",
              "failed"
            ]
          },
          "signal": {
            "type": "string",
            "enum": [
              "sent",
              "queued",
              "failed",
              "not_attempted"
            ]
          },
          "reload_at": {
            "type": "string",
            "format": "date-time"
          },
          "application_ack_version": {
            "type": "integer",
            "format": "int64"
          },
          "application_ack": {
            "type": "string",
            "enum": [
              "applied",
              "failed"
            ]
          },
          "application_ack_at": {
            "type": "string",
            "format": "date-time"
          },
          "process_generation": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$",
            "description": "Active execution identity; absent for legacy or retired processes."
          },
          "application_ack_generation": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$",
            "description": "Execution identity supplied in the application ACK; strict adoption requires it to match process_generation."
          },
          "reload_status": {
            "type": "string",
            "enum": [
              "current",
              "failed",
              "stale",
              "unknown"
            ],
            "description": "Derived status for this workload and its secret projection and notification."
          },
          "reload_reason": {
            "type": "string",
            "enum": [
              "current",
              "binding_secret_unexpected",
              "target_inconsistent",
              "reload_observation_missing",
              "reload_observation_time_invalid",
              "reload_version_invalid",
              "projection_failed",
              "signal_failed",
              "reload_outcome_unknown",
              "reload_stale"
            ],
            "description": "Stable sanitized reason for reload_status; contains no raw errors or secret data."
          },
          "application_ack_status": {
            "type": "string",
            "enum": [
              "current",
              "failed",
              "stale",
              "unknown"
            ],
            "description": "Derived status for this workload and its application acknowledgement, including process-generation fencing."
          },
          "application_ack_reason": {
            "type": "string",
            "enum": [
              "current",
              "binding_secret_unexpected",
              "process_generation_missing",
              "process_generation_invalid",
              "application_ack_generation_missing",
              "application_ack_generation_mismatch",
              "target_inconsistent",
              "reload_disabled",
              "reload_support_unknown",
              "application_ack_missing",
              "application_ack_time_invalid",
              "application_ack_version_invalid",
              "application_ack_outcome_unknown",
              "application_ack_stale",
              "application_ack_failed"
            ],
            "description": "Stable sanitized reason for application_ack_status; contains no generation values, raw errors or secret data."
          }
        }
      },
      "BindingApplicationAdoption": {
        "type": "object",
        "description": "Metadata-only application self-attestations for managed PostgreSQL or object-storage secrets. Counts refer to workload/secret pairs. Reads use a single state snapshot and include missing reports. Task guests, jobs, mirrors and unauthorized workloads are excluded. Receipts expire when secret versions change, independently of probe age. An older guest projection does not erase a newer application receipt. complete describes this optional observation read; a read failure leaves default checks unchanged and blocks strict checks.",
        "required": [
          "source",
          "status",
          "observed_at",
          "complete",
          "secrets_expected",
          "secrets_observed",
          "reload",
          "application",
          "targets"
        ],
        "properties": {
          "source": {
            "type": "string",
            "enum": [
              "application_ack"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "current",
              "failed",
              "stale",
              "unknown",
              "inactive"
            ]
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "complete": {
            "type": "boolean"
          },
          "secrets_expected": {
            "type": "integer",
            "minimum": 1
          },
          "secrets_observed": {
            "type": "integer",
            "minimum": 0
          },
          "reload": {
            "$ref": "#/components/schemas/BindingAdoptionCounts"
          },
          "application": {
            "$ref": "#/components/schemas/BindingAdoptionCounts"
          },
          "targets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BindingApplicationAckTarget"
            }
          }
        }
      },
      "BindingCheckFinding": {
        "type": "object",
        "description": "Stable, sanitized blocker or warning for the bindings policy.",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "binding": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "BindingCheckBindingResult": {
        "type": "object",
        "description": "Preflight status and safe evidence summary for one binding.",
        "required": [
          "type",
          "name",
          "scope",
          "status"
        ],
        "properties": {
          "required_queue_evidence": {
            "type": "string",
            "enum": [
              "consumer_readiness",
              "handler_completion"
            ],
            "description": "Explicit scheduler readiness requirement; a passed policy result does not imply queue connectivity."
          },
          "object_storage_mode": {
            "type": "string",
            "enum": [
              "read",
              "write",
              "read_write"
            ],
            "description": "Exact admitted canary mode. Older evidence with no mode is listing-only and cannot satisfy write requirements."
          },
          "required_object_storage_mode": {
            "type": "string",
            "enum": [
              "read",
              "write",
              "read_write"
            ]
          },
          "type": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "binding": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "description": "passed, blocked, unsupported or skipped."
          },
          "reason": {
            "type": "string"
          },
          "verification_status": {
            "type": "string"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "refresh_status": {
            "type": "string"
          },
          "application_adoption": {
            "$ref": "#/components/schemas/BindingApplicationAdoption"
          }
        }
      },
      "BindingCheckReport": {
        "type": "object",
        "description": "Safe preflight findings for the declared policy at checked_at. Coverage may be complete, partial or none; a passed report does not independently establish application readiness or credential use. Optional application acknowledgements are version-bound self-attestations.",
        "required": [
          "app",
          "scope",
          "deployment_id",
          "checked_at",
          "inventory_generated_at",
          "max_verification_age",
          "allow_unsupported",
          "passed",
          "coverage",
          "bindings",
          "runtime",
          "issues",
          "blockers",
          "warnings"
        ],
        "properties": {
          "queue_requirements": {
            "$ref": "#/components/schemas/QueueReleaseRequirements"
          },
          "object_storage_requirements": {
            "$ref": "#/components/schemas/ObjectStorageReleaseRequirements"
          },
          "expected_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "app": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "inventory_generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "max_verification_age": {
            "type": "string"
          },
          "allow_unsupported": {
            "type": "boolean"
          },
          "require_application_ack": {
            "type": "boolean",
            "description": "Whether this check required application self-attestations for current managed PostgreSQL/object-storage secrets."
          },
          "passed": {
            "type": "boolean"
          },
          "coverage": {
            "type": "string"
          },
          "bindings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BindingCheckBindingResult"
            }
          },
          "runtime": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BindingRuntimeDeployment"
            }
          },
          "issues": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BindingInventoryIssue"
            }
          },
          "blockers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BindingCheckFinding"
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BindingCheckFinding"
            }
          }
        }
      },
      "OutboundBindingProbePolicy": {
        "type": "object",
        "description": "Explicit provider endpoint declared safe to probe using managed outbound admission. Queries, redirects and unsuccessful expected statuses are unsupported.",
        "required": [
          "method",
          "path",
          "expected_status"
        ],
        "properties": {
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "HEAD"
            ]
          },
          "path": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "expected_status": {
            "type": "integer",
            "minimum": 200,
            "maximum": 299
          }
        }
      },
      "ObjectStorageReleaseRequirements": {
        "type": "object",
        "maxProperties": 32,
        "description": "Managed environment prefix to required canary mode in the selected scope. Prefixes match ^[A-Z][A-Z0-9_]{0,47}$. read covers listing; read_write requires byte transfer; write and read_write require successful cleanup. No implicit probes or writes.",
        "additionalProperties": {
          "type": "string",
          "enum": [
            "read",
            "write",
            "read_write"
          ]
        }
      },
      "SetObjectStorageBindingReleasePolicyRequest": {
        "description": "Revision-guarded release policy replacement with explicit required object-storage canary modes.",
        "allOf": [
          {
            "$ref": "#/components/schemas/SetBindingReleasePolicyRequest"
          },
          {
            "type": "object",
            "required": [
              "object_storage_requirements"
            ],
            "properties": {
              "object_storage_requirements": {
                "$ref": "#/components/schemas/ObjectStorageReleaseRequirements"
              }
            }
          }
        ]
      },
      "BindingReleasePolicy": {
        "type": "object",
        "description": "Stored binding verification requirements and revision for an app deployment scope; unconfigured scopes default to off.",
        "required": [
          "app_id",
          "scope",
          "mode",
          "revision",
          "max_verification_age",
          "require_application_ack"
        ],
        "properties": {
          "queue_requirements": {
            "$ref": "#/components/schemas/QueueReleaseRequirements"
          },
          "object_storage_requirements": {
            "$ref": "#/components/schemas/ObjectStorageReleaseRequirements"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "off",
              "enforce"
            ]
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "max_verification_age": {
            "type": "string",
            "description": "Canonical Go duration between 1s and 24h; default 10m0s."
          },
          "require_application_ack": {
            "type": "boolean"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "reason": {
            "type": "string",
            "description": "Recorded single-line change reason, at most 256 UTF-8 bytes."
          }
        }
      },
      "SetBindingReleasePolicyRequest": {
        "type": "object",
        "description": "Compare-and-set binding release enforcement for one deployment scope, including evidence age, application acknowledgements and an explicit change reason.",
        "required": [
          "mode",
          "expected_revision"
        ],
        "properties": {
          "queue_requirements": {
            "$ref": "#/components/schemas/QueueReleaseRequirements"
          },
          "object_storage_requirements": {
            "$ref": "#/components/schemas/ObjectStorageReleaseRequirements"
          },
          "mode": {
            "type": "string",
            "enum": [
              "off",
              "enforce"
            ]
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740990
          },
          "max_verification_age": {
            "type": "string",
            "default": "10m",
            "description": "Whole-second Go duration between 1s and 24h."
          },
          "require_application_ack": {
            "type": "boolean",
            "default": false
          },
          "reason": {
            "type": "string",
            "description": "Required for off mode; single line, at most 256 UTF-8 bytes."
          }
        }
      },
      "BindingPromotionRequest": {
        "type": "object",
        "description": "Policy for a server-enforced bindings promotion; the gate is always required on this route. Stored scope policy may require a shorter age or application ACKs and disallow unsupported waivers. The response reports the effective policy.",
        "properties": {
          "use_regular_cache_refresh": {
            "type": "boolean",
            "description": "Discard an unused cache preparation for this deployment during promotion and let the saved refresh plan run."
          },
          "expected_serving_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "max_verification_age": {
            "type": "string",
            "default": "10m",
            "description": "Positive Go duration; maximum age of passed verification evidence."
          },
          "allow_unsupported": {
            "type": "boolean",
            "default": false,
            "description": "Explicit queue/outbound connectivity probe waiver; coverage remains partial. Push consumer readiness and the independent 30-second poll window cannot be waived."
          },
          "require_application_ack": {
            "type": "boolean",
            "default": false,
            "description": "Require current managed-secret application receipts; use the dedicated promote-with-application-ack route for compatibility with older servers. The dedicated route always forces true."
          }
        }
      },
      "PreparedCachePromotionRequest": {
        "type": "object",
        "required": [
          "cache_plan_version"
        ],
        "properties": {
          "cache_attempt_id": {
            "type": "string",
            "format": "uuid",
            "description": "Caller-generated attempt ID for reading gateway readiness while promotion is in progress."
          },
          "cache_plan_version": {
            "type": "string",
            "format": "date-time",
            "description": "Version of the saved cache plan chosen for promotion."
          },
          "expected_serving_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "max_verification_age": {
            "type": "string"
          },
          "allow_unsupported": {
            "type": "boolean"
          },
          "require_application_ack": {
            "type": "boolean"
          }
        }
      },
      "BindingPromotionResponse": {
        "type": "object",
        "description": "Atomic traffic transition and the bindings check enforced at its write boundary.",
        "required": [
          "deployment",
          "from_percent",
          "to_percent",
          "already_promoted",
          "bindings_check"
        ],
        "properties": {
          "deployment": {
            "$ref": "#/components/schemas/DeploymentResponse"
          },
          "from_percent": {
            "type": "integer"
          },
          "to_percent": {
            "type": "integer"
          },
          "already_promoted": {
            "type": "boolean"
          },
          "bindings_check": {
            "$ref": "#/components/schemas/BindingCheckReport"
          }
        }
      },
      "BindingVerification": {
        "type": "object",
        "description": "Sanitized durable evidence from the latest admitted service, PostgreSQL or object-storage task guest canary. Object-storage verification records bucket listing or explicitly requested permission-aware object operations and cleanup; inspect checks for coverage. Resident application adoption is not checked.",
        "required": [
          "result",
          "source",
          "deployment_id",
          "scope"
        ],
        "properties": {
          "managed_service": {
            "$ref": "#/components/schemas/ManagedServiceProbeSpec"
          },
          "task_id": {
            "type": "string",
            "format": "uuid",
            "description": "Original probe task identity for pending observation and durable receipts."
          },
          "target_deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Service recipient qualified by the probe; absent for legacy any-replica evidence."
          },
          "object_storage_mode": {
            "type": "string",
            "enum": [
              "read",
              "write",
              "read_write"
            ],
            "description": "Object operation level admitted for this stored verification; missing values denote a legacy listing canary and do not qualify required write operations."
          },
          "result": {
            "type": "string",
            "description": "Outcome of the recorded canary: passed, failed or unknown. May describe stale evidence."
          },
          "reason": {
            "type": "string",
            "description": "Stable reason such as configuration_changed, deployment_changed, probe_pending, report_invalid or report_truncated."
          },
          "source": {
            "type": "string",
            "description": "Currently task_guest."
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "credential_generation": {
            "type": "integer",
            "format": "int64"
          },
          "checks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BindingVerificationCheck"
            }
          }
        }
      },
      "BindingVerificationCheck": {
        "type": "object",
        "description": "One platform canary stage with its bounded status; raw details and errors are omitted.",
        "required": [
          "name",
          "status"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "description": "passed, failed or not_checked."
          }
        }
      },
      "BindingInventoryIssue": {
        "type": "object",
        "description": "Stable and sanitized reason why a binding inventory section could not be read.",
        "required": [
          "type",
          "code",
          "severity",
          "message"
        ],
        "properties": {
          "type": {
            "type": "string",
            "description": "Binding family or runtime_freshness or binding_refresh whose read was incomplete."
          },
          "code": {
            "type": "string",
            "description": "Stable reason such as forbidden, unavailable, query_failed, consumer_status_unavailable or managed_postgres_unavailable."
          },
          "severity": {
            "type": "string",
            "enum": [
              "warning",
              "error"
            ]
          },
          "message": {
            "type": "string",
            "description": "Sanitized explanation without raw provider errors."
          }
        }
      },
      "AppBindingInventoryItem": {
        "type": "object",
        "description": "Public binding configuration with separately reported runtime observations and verification status.",
        "required": [
          "type",
          "name",
          "binding",
          "scope",
          "access",
          "state",
          "runtime_status",
          "verification_status"
        ],
        "properties": {
          "service_context": {
            "$ref": "#/components/schemas/ServiceBindingInventoryContext"
          },
          "service_target_deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Exact service recipient selected explicitly or resolved from the managed reviewed release."
          },
          "queue_canary": {
            "$ref": "#/components/schemas/QueueBindingCanary"
          },
          "queue_canary_supported": {
            "type": "boolean",
            "description": "Whether the exact selected deployment and current consumer can admit a canary."
          },
          "queue_canary_reason": {
            "type": "string",
            "description": "Sanitized reason canary publication is unavailable."
          },
          "queue_environment": {
            "type": "string",
            "description": "Explicit queue environment; empty means shared legacy binding. Distinguishes app-wide scope from an environment named app. Consumer-readiness policies require this field; older inventories omit it."
          },
          "type": {
            "type": "string",
            "enum": [
              "service",
              "postgres",
              "object_storage",
              "queue",
              "outbound"
            ]
          },
          "name": {
            "type": "string"
          },
          "binding": {
            "type": "string",
            "description": "Logical binding name or environment key. Empty for outbound bindings."
          },
          "scope": {
            "type": "string",
            "description": "Resource environment scope or app for an app-wide binding."
          },
          "access": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "description": "Configuration or provisioning state; never evidence of connectivity."
          },
          "runtime_status": {
            "type": "string",
            "description": "Last-known queue consumer liveness (healthy, stale or degraded), otherwise unknown."
          },
          "verification_status": {
            "type": "string",
            "description": "Latest platform canary: passed, failed, unknown or stale. Managed edges without a known verification contract remain unsupported. Deployment or configuration changes invalidate old evidence. Inventory does not run probes."
          },
          "verification": {
            "$ref": "#/components/schemas/BindingVerification"
          },
          "refresh": {
            "$ref": "#/components/schemas/BindingRefresh"
          },
          "application_adoption": {
            "$ref": "#/components/schemas/BindingApplicationAdoption"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Scheduler observation time. Absent when no observation exists."
          },
          "http_url": {
            "type": "string"
          },
          "https_env": {
            "type": "string"
          },
          "https_url": {
            "type": "string"
          },
          "transport": {
            "type": "string"
          },
          "credential_generation": {
            "type": "integer",
            "format": "int64"
          },
          "rotation_pending": {
            "type": "boolean"
          },
          "consumer_state": {
            "type": "string"
          },
          "consumer_state_reason": {
            "type": "string"
          },
          "consumer_liveness": {
            "type": "string"
          },
          "outbound_probe": {
            "$ref": "#/components/schemas/OutboundBindingProbePolicy"
          },
          "credential_configured": {
            "type": "boolean"
          },
          "allowed_methods": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "allowed_path_prefixes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "BindingRuntimeFreshness": {
        "type": "object",
        "description": "App-wide timestamp-based configuration freshness, independent of canary verification. This is not guest acknowledgement, readiness or proof of credential use. Scope filtering selects deployments; task guests, jobs and mirrors are excluded.",
        "required": [
          "source",
          "observed_at",
          "deployments"
        ],
        "properties": {
          "source": {
            "type": "string",
            "description": "Currently instance_started_at."
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "config_changed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Latest app-wide environment or secret change. Without a stamp, resident freshness is unknown."
          },
          "deployments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BindingRuntimeDeployment"
            }
          }
        }
      },
      "BindingRuntimeDeployment": {
        "type": "object",
        "description": "A live deployment or one retaining resident app instances. Serving counts running rows; resident includes serving, starting, warm, snapshotting, draining and migrating rows. Parked and terminal rows are excluded.",
        "required": [
          "deployment_id",
          "scope",
          "deployment_status",
          "status",
          "serving",
          "resident",
          "starting"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "deployment_status": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "current",
              "stale",
              "unknown",
              "updating",
              "inactive"
            ],
            "description": "Stale residents take precedence, then unknown residents, then starting instances. Current does not imply connectivity or readiness."
          },
          "serving": {
            "$ref": "#/components/schemas/BindingRuntimeInstanceCounts"
          },
          "resident": {
            "$ref": "#/components/schemas/BindingRuntimeInstanceCounts"
          },
          "starting": {
            "type": "integer",
            "minimum": 0,
            "description": "Waking or cold-booting instances, also included in resident counts."
          }
        }
      },
      "BindingRuntimeInstanceCounts": {
        "type": "object",
        "description": "Disjoint counts compared with the app-wide change stamp. Current means admitted after the stamp; stale means admitted at or before it; unknown means missing stamp or start timestamp.",
        "required": [
          "current",
          "stale",
          "unknown"
        ],
        "properties": {
          "current": {
            "type": "integer",
            "minimum": 0
          },
          "stale": {
            "type": "integer",
            "minimum": 0
          },
          "unknown": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "BindingRefresh": {
        "type": "object",
        "description": "Durable rolling restart handoff for a pending PostgreSQL or object-storage rotation. Completion does not imply fresh resident instances or successful verification. Not_queued means no retained outbox record was found; unknown means progress could not be read.",
        "required": [
          "wake_id",
          "status",
          "attempts"
        ],
        "properties": {
          "wake_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "retrying",
              "running",
              "completed",
              "failed",
              "not_queued",
              "unknown"
            ]
          },
          "attempts": {
            "type": "integer",
            "minimum": 0
          },
          "failure_reason": {
            "type": "string",
            "enum": [
              "telemetry_missing",
              "requests_active",
              "quiet_period_not_elapsed",
              "restart_attempt_failed"
            ]
          },
          "requested_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "FinancialBudgetResponse": {
        "type": "object",
        "description": "Saved policy intent with current-revision monitoring, alert delivery and preview stop acknowledgements. Notifications alone never establish workload stopping.",
        "required": [
          "id",
          "account_id",
          "revision",
          "spec",
          "created_at",
          "updated_at",
          "status",
          "enforcement_ready",
          "reasons"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "spec": {
            "$ref": "#/components/schemas/FinancialBudgetSpec"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "deleted_at": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "unavailable",
              "active",
              "deleted"
            ]
          },
          "enforcement_ready": {
            "type": "boolean",
            "description": "True when the selected stopping integration is available; actual per-target teardown is reported in runtime.stops. Strict compute balances are reported in runtime.compute."
          },
          "notification_ready": {
            "type": "boolean",
            "description": "True for an enabled supported monitored policy; inspect runtime for evaluation freshness and delivery status."
          },
          "runtime": {
            "$ref": "#/components/schemas/FinancialBudgetRuntime"
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "FinancialBudgetEvaluation": {
        "type": "object",
        "description": "Retained evidence boundary; an absent known_millicents means evaluation unavailable, never zero. Partial known costs can trigger labelled notifications; stale observations cannot create new alerts.",
        "required": [
          "period_start",
          "period_end",
          "as_of",
          "evaluated_at",
          "evidence_through_id",
          "coverage_complete",
          "fresh",
          "reasons"
        ],
        "properties": {
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "period_end": {
            "type": "string",
            "format": "date-time"
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time"
          },
          "evidence_through_id": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "known_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "coverage_complete": {
            "type": "boolean"
          },
          "fresh": {
            "type": "boolean"
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "projected_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Month-end amount at the current run rate: an estimate, not an invoice. Absent, with projection_reason, when a selected meter has no forecast or the evidence is incomplete or stale."
          },
          "projection_reason": {
            "type": "string",
            "description": "Why no projection is available, for example compute:insufficient_history (less than a day of evidence) or incomplete_evidence."
          }
        }
      },
      "FinancialBudgetAlert": {
        "type": "object",
        "description": "One threshold event per policy revision and UTC month. Edits re-evaluate monthly spending. Delivery is at least once with a stable transport idempotency key; delivered means accepted by the configured transport, not confirmed inbox receipt.",
        "required": [
          "id",
          "policy_revision",
          "threshold_millicents",
          "evaluation",
          "state",
          "attempts",
          "next_attempt_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "projection"
            ],
            "description": "Absent for a crossed threshold. projection marks a projected-overrun alert, whose threshold_millicents is the limit."
          },
          "policy_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "threshold_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "evaluation": {
            "$ref": "#/components/schemas/FinancialBudgetEvaluation"
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "sending",
              "retrying",
              "delivered"
            ]
          },
          "attempts": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "delivered_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_error": {
            "type": "string",
            "enum": [
              "mail_delivery_failed"
            ]
          }
        }
      },
      "FinancialBudgetStopTarget": {
        "type": "object",
        "description": "Scheduler observation for one preview target. Enforced means teardown was confirmed and no resident instance remains. Old observations are reported as unavailable.",
        "required": [
          "app_id",
          "state",
          "observed_at",
          "resident_count"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "environment_id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "requested",
              "draining",
              "enforced",
              "failed",
              "unavailable"
            ]
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "resident_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "last_error": {
            "type": "string",
            "enum": [
              "runtime_identity_unavailable",
              "vm_teardown_failed",
              "instance_settlement_failed",
              "scheduler_observation_stale"
            ]
          }
        }
      },
      "FinancialBudgetStop": {
        "type": "object",
        "description": "Latched monitored compute threshold decision. Corrections cannot resume work. Policy revisions release only their own hold; in-flight teardown may finish. New matching previews are held too. Metering, scheduler and teardown delay can exceed the limit.",
        "required": [
          "id",
          "policy_id",
          "revision",
          "period_start",
          "period_end",
          "requested_at",
          "drain_deadline",
          "resume_rule",
          "evaluation",
          "targets"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "policy_id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "period_end": {
            "type": "string",
            "format": "date-time"
          },
          "requested_at": {
            "type": "string",
            "format": "date-time"
          },
          "drain_deadline": {
            "type": "string",
            "format": "date-time"
          },
          "resume_rule": {
            "type": "string",
            "enum": [
              "manual",
              "next_period"
            ]
          },
          "evaluation": {
            "$ref": "#/components/schemas/FinancialBudgetEvaluation"
          },
          "targets": {
            "type": "array",
            "maxItems": 10000,
            "items": {
              "$ref": "#/components/schemas/FinancialBudgetStopTarget"
            }
          }
        }
      },
      "FinancialEgressBalance": {
        "type": "object",
        "description": "Egress contribution to a shared account compute and egress budget. Its funding allowance is pinned to the lowest recorded grant for the UTC month; increases benefit funding in a new month. Funded interface bytes include framing margin. Unused or uncertain credits commit conservatively after physical absence; invoice usage remains measured bytes.",
        "required": [
          "initialized",
          "committed_bytes",
          "reserved_bytes",
          "allowance_granted_bytes",
          "allowance_committed_bytes",
          "allowance_reserved_bytes",
          "allowance_remaining_bytes",
          "committed_millicents",
          "reserved_millicents"
        ],
        "properties": {
          "initialized": {
            "type": "boolean"
          },
          "committed_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "reserved_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "allowance_granted_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "allowance_committed_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "allowance_reserved_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "allowance_remaining_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "committed_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "reserved_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        }
      },
      "FinancialComputeBalance": {
        "type": "object",
        "description": "Conservative admission ledger. App/job budgets cap gross compute. Account budgets share included quantities; with meters compute and egress the monetary totals sum both meters under one paid limit and egress shows its contribution. Byte credits include framing and unused credits commit after physical retirement; these upper bounds can exceed invoice charges. Expired funding stays reserved until physical retirement. Subscriptions, storage, builds, object-storage delivery and taxes are excluded. Independent job attempts share account funding with apps.",
        "required": [
          "initialized",
          "period_start",
          "period_end",
          "committed_millicents",
          "reserved_millicents",
          "remaining_millicents",
          "unconfirmed_leases",
          "held",
          "observed_at"
        ],
        "properties": {
          "egress": {
            "$ref": "#/components/schemas/FinancialEgressBalance"
          },
          "initialized": {
            "type": "boolean"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "project_id": {
            "type": "string",
            "format": "uuid",
            "description": "The capped project of a strict project budget (amendment 1): one gross book shared by every app in the project. Jobs are not covered."
          },
          "environment_id": {
            "type": "string",
            "format": "uuid",
            "description": "The capped environment of a strict environment budget (amendment 2): one gross book shared by every deployment that runs in the environment. Capacity floors and jobs are not covered."
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope_kind": {
            "type": "string",
            "enum": [
              "account",
              "app",
              "job",
              "project",
              "environment"
            ]
          },
          "basis": {
            "type": "string",
            "enum": [
              "net_usage",
              "gross_usage"
            ]
          },
          "allowance_granted_mb_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "allowance_committed_mb_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "allowance_reserved_mb_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "allowance_remaining_mb_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "period_end": {
            "type": "string",
            "format": "date-time"
          },
          "committed_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "reserved_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "remaining_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "unconfirmed_leases": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          },
          "held": {
            "type": "boolean"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "FinancialBudgetRuntime": {
        "type": "object",
        "description": "Evaluation and alerts cover the current revision and UTC month. Active manual stop decisions can carry over from earlier months until a policy mutation releases that revision.",
        "required": [
          "alerts"
        ],
        "properties": {
          "compute": {
            "$ref": "#/components/schemas/FinancialComputeBalance"
          },
          "evaluation": {
            "$ref": "#/components/schemas/FinancialBudgetEvaluation"
          },
          "alerts": {
            "type": "array",
            "maxItems": 9,
            "items": {
              "$ref": "#/components/schemas/FinancialBudgetAlert"
            }
          },
          "projection": {
            "$ref": "#/components/schemas/FinancialBudgetAlert"
          },
          "stops": {
            "type": "array",
            "maxItems": 1,
            "items": {
              "$ref": "#/components/schemas/FinancialBudgetStop"
            }
          }
        }
      },
      "FinancialBudgetListResponse": {
        "type": "object",
        "description": "Nondeleted account-owned policy intents with separately reported readiness.",
        "required": [
          "budgets"
        ],
        "properties": {
          "budgets": {
            "type": "array",
            "maxItems": 128,
            "items": {
              "$ref": "#/components/schemas/FinancialBudgetResponse"
            }
          }
        }
      },
      "CreateFinancialBudgetRequest": {
        "type": "object",
        "description": "New budget intent; activation supports monitored notify, monitored compute-only stop_previews, and strict suspend_workloads (app/job gross compute or account net compute optionally combined with egress) with zero drain and no alert thresholds. Strict activation requires quiet covered workloads, complete accounting, and native owners. Account strict activation also requires recorded allowances and native owners capable of funded jobs. Combining compute and egress additionally requires complete egress accounting and byte-capable native owners.",
        "required": [
          "spec"
        ],
        "properties": {
          "spec": {
            "$ref": "#/components/schemas/FinancialBudgetSpec"
          }
        }
      },
      "UpdateFinancialBudgetRequest": {
        "type": "object",
        "description": "Complete replacement of budget intent guarded by its current revision.",
        "required": [
          "expected_revision",
          "spec"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740990
          },
          "spec": {
            "$ref": "#/components/schemas/FinancialBudgetSpec"
          }
        }
      },
      "DeleteFinancialBudgetRequest": {
        "type": "object",
        "description": "Optimistic revision condition for retaining a policy deletion tombstone.",
        "required": [
          "expected_revision"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740990
          }
        }
      },
      "SetFinancialBudgetChannelsRequest": {
        "type": "object",
        "description": "The full replacement set of notification channels for a budget's alerts.",
        "required": [
          "channel_ids"
        ],
        "properties": {
          "channel_ids": {
            "type": "array",
            "maxItems": 5,
            "uniqueItems": true,
            "description": "Account-owned notification channel ids; empty leaves only the account email.",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      },
      "FinancialBudgetChannelsResponse": {
        "type": "object",
        "description": "The notification channels a budget's threshold alerts also go to, with each channel's latest delivery outcome.",
        "required": [
          "policy_id",
          "channels"
        ],
        "properties": {
          "policy_id": {
            "type": "string",
            "format": "uuid"
          },
          "channels": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/NotificationChannelResponse"
            }
          }
        }
      },
      "FinancialBudgetRevisionResponse": {
        "type": "object",
        "description": "Immutable intent audit written in the same transaction as the policy.",
        "required": [
          "policy_id",
          "revision",
          "actor",
          "mutation",
          "spec",
          "recorded_at"
        ],
        "properties": {
          "policy_id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "actor": {
            "type": "string",
            "description": "Authenticated account or API key identity; never a supplied actor value."
          },
          "mutation": {
            "type": "string",
            "enum": [
              "created",
              "updated",
              "deleted"
            ]
          },
          "spec": {
            "$ref": "#/components/schemas/FinancialBudgetSpec"
          },
          "recorded_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "FinancialBudgetHistoryResponse": {
        "type": "object",
        "description": "Immutable policy revision page and an optional exclusive continuation cursor.",
        "required": [
          "revisions"
        ],
        "properties": {
          "revisions": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/FinancialBudgetRevisionResponse"
            }
          },
          "next_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991
          }
        }
      },
      "FinancialBudgetScope": {
        "type": "object",
        "description": "Authoritative account or resource identity; resource ids must belong to the account.",
        "required": [
          "kind"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "account",
              "project",
              "environment",
              "app",
              "job"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Omitted for account scope and required for resource scopes."
          }
        }
      },
      "FinancialBudgetSpec": {
        "type": "object",
        "description": "Customer budget intent; activation and enforcement are separately acknowledged.",
        "required": [
          "name",
          "scope",
          "currency",
          "meters",
          "basis",
          "limit_millicents",
          "notify_millicents",
          "mode",
          "action",
          "drain_seconds",
          "resume_rule",
          "enabled"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "description": "Nonblank name bounded to 128 UTF-8 bytes."
          },
          "scope": {
            "$ref": "#/components/schemas/FinancialBudgetScope"
          },
          "currency": {
            "type": "string",
            "enum": [
              "USD",
              "EUR"
            ],
            "description": "New writes require USD; EUR is retained only for historical policy responses."
          },
          "meters": {
            "type": "array",
            "minItems": 1,
            "maxItems": 3,
            "uniqueItems": true,
            "description": "Sorted meter names; strict account net_usage may combine compute and egress under one paid limit; app/job strict covers compute only. object_storage is priced from the live object-storage estimate and only monitored account budgets may select it.",
            "items": {
              "type": "string",
              "enum": [
                "compute",
                "egress",
                "object_storage"
              ]
            }
          },
          "basis": {
            "type": "string",
            "enum": [
              "net_usage",
              "gross_usage"
            ],
            "description": "Net usage after the shared account allowance or gross usage before it; strict resource scopes require gross usage."
          },
          "limit_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "notify_millicents": {
            "type": "array",
            "maxItems": 8,
            "uniqueItems": true,
            "description": "Increasing nonnegative thresholds at or below the limit. Strict compute requires an empty array; configure a separate monitored policy for alerts.",
            "items": {
              "type": "integer",
              "format": "int64",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          "mode": {
            "type": "string",
            "enum": [
              "monitored",
              "strict"
            ]
          },
          "action": {
            "type": "string",
            "enum": [
              "notify",
              "reject_traffic",
              "suspend_background",
              "stop_previews",
              "suspend_workloads"
            ]
          },
          "drain_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 300,
            "description": "Notify and strict app compute use zero; monitored stopping targets drain before the deadline."
          },
          "resume_rule": {
            "type": "string",
            "enum": [
              "manual",
              "next_period"
            ]
          },
          "enabled": {
            "type": "boolean"
          }
        }
      },
      "FinancialBudgetPreviewRequest": {
        "type": "object",
        "description": "Proposed budget intent to inspect without saving or activating it.",
        "required": [
          "spec"
        ],
        "properties": {
          "spec": {
            "$ref": "#/components/schemas/FinancialBudgetSpec"
          }
        }
      },
      "FinancialBudgetTarget": {
        "type": "object",
        "description": "Current workload selected or left running by a proposed response.",
        "required": [
          "kind",
          "id",
          "name",
          "effect"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "app",
              "job"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "environment_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "effect": {
            "type": "string"
          }
        }
      },
      "FinancialBudgetPreviewResponse": {
        "type": "object",
        "description": "Known spending, evidence gaps, workload consequences and explicit readiness.",
        "required": [
          "spec",
          "period_start",
          "period_end",
          "as_of",
          "known_millicents",
          "known_limit_reached",
          "coverage_complete",
          "fresh",
          "reasons",
          "enforcement_ready",
          "guarantee",
          "targets",
          "continuing_targets"
        ],
        "properties": {
          "spec": {
            "$ref": "#/components/schemas/FinancialBudgetSpec"
          },
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "period_end": {
            "type": "string",
            "format": "date-time"
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "known_millicents": {
            "type": "integer",
            "format": "int64"
          },
          "known_limit_reached": {
            "type": "boolean",
            "description": "Known subtotal is at or above the limit; inspect coverage before inferring complete spending."
          },
          "coverage_complete": {
            "type": "boolean"
          },
          "fresh": {
            "type": "boolean"
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "enforcement_ready": {
            "type": "boolean",
            "description": "False while durable decisions and owner integrations lack acceptance; preview never activates a policy."
          },
          "guarantee": {
            "type": "string"
          },
          "targets": {
            "type": "array",
            "maxItems": 10000,
            "items": {
              "$ref": "#/components/schemas/FinancialBudgetTarget"
            }
          },
          "continuing_targets": {
            "type": "array",
            "maxItems": 10000,
            "items": {
              "$ref": "#/components/schemas/FinancialBudgetTarget"
            }
          }
        }
      },
      "FinancialPrice": {
        "type": "object",
        "description": "Immutable version of a meter's exact price and allowance terms.",
        "required": [
          "version",
          "meter",
          "currency",
          "unit",
          "unit_quantity",
          "millicents_per_unit",
          "included_quantity"
        ],
        "properties": {
          "version": {
            "type": "string"
          },
          "meter": {
            "type": "string"
          },
          "currency": {
            "type": "string",
            "enum": [
              "USD",
              "EUR"
            ]
          },
          "unit": {
            "type": "string"
          },
          "unit_quantity": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "millicents_per_unit": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "included_quantity": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "FinancialPriceContract": {
        "type": "object",
        "description": "Historical activation of recorded account pricing.",
        "required": [
          "price",
          "plan",
          "effective_from",
          "delivery_mode"
        ],
        "properties": {
          "price": {
            "$ref": "#/components/schemas/FinancialPrice"
          },
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "hobby",
              "pro",
              "scale"
            ]
          },
          "effective_from": {
            "type": "string",
            "format": "date-time"
          },
          "delivery_mode": {
            "type": "string",
            "enum": [
              "live",
              "shadow",
              "off"
            ]
          }
        }
      },
      "FinancialAttribution": {
        "type": "object",
        "description": "Workload identity retained at first observation, surviving rename and deletion.",
        "properties": {
          "app_id": {
            "type": "string"
          },
          "job_id": {
            "type": "string"
          },
          "project_id": {
            "type": "string"
          },
          "environment_id": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        }
      },
      "FinancialAllocation": {
        "type": "object",
        "description": "Exact quantity-share allocation; row amounts and account totals reconcile.",
        "required": [
          "attribution",
          "quantity",
          "gross_millicents",
          "allowance_millicents",
          "net_millicents"
        ],
        "properties": {
          "attribution": {
            "$ref": "#/components/schemas/FinancialAttribution"
          },
          "quantity": {
            "type": "integer",
            "format": "int64"
          },
          "gross_millicents": {
            "type": "integer",
            "format": "int64"
          },
          "allowance_millicents": {
            "type": "integer",
            "format": "int64"
          },
          "net_millicents": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "FinancialMeterCost": {
        "type": "object",
        "description": "Meter cost priced by one immutable contract with its assigned allowance.",
        "required": [
          "price",
          "quantity",
          "included_quantity",
          "gross_millicents",
          "allowance_millicents",
          "net_millicents",
          "allocation_method",
          "allocations"
        ],
        "properties": {
          "price": {
            "$ref": "#/components/schemas/FinancialPrice"
          },
          "quantity": {
            "type": "integer",
            "format": "int64"
          },
          "included_quantity": {
            "type": "integer",
            "format": "int64"
          },
          "gross_millicents": {
            "type": "integer",
            "format": "int64"
          },
          "allowance_millicents": {
            "type": "integer",
            "format": "int64"
          },
          "net_millicents": {
            "type": "integer",
            "format": "int64"
          },
          "allocation_method": {
            "type": "string"
          },
          "allocations": {
            "type": "array",
            "maxItems": 10000,
            "items": {
              "$ref": "#/components/schemas/FinancialAllocation"
            }
          }
        }
      },
      "FinancialContractCosts": {
        "type": "object",
        "description": "One shared period allowance applied across historical rate versions.",
        "required": [
          "meter",
          "quantity",
          "included_quantity",
          "net_millicents",
          "allowance_method",
          "contracts"
        ],
        "properties": {
          "meter": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "format": "int64"
          },
          "included_quantity": {
            "type": "integer",
            "format": "int64"
          },
          "net_millicents": {
            "type": "integer",
            "format": "int64"
          },
          "allowance_method": {
            "type": "string"
          },
          "contracts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FinancialMeterCost"
            }
          }
        }
      },
      "FinancialForecast": {
        "type": "object",
        "description": "Quantity run-rate projection; absent amounts mean unavailable, never zero.",
        "required": [
          "method",
          "available",
          "account_id",
          "period_start",
          "period_end",
          "complete_through",
          "price_version",
          "meter",
          "currency"
        ],
        "properties": {
          "method": {
            "type": "string"
          },
          "available": {
            "type": "boolean"
          },
          "reason": {
            "type": "string"
          },
          "account_id": {
            "type": "string"
          },
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "period_end": {
            "type": "string",
            "format": "date-time"
          },
          "complete_through": {
            "type": "string",
            "format": "date-time"
          },
          "price_version": {
            "type": "string"
          },
          "meter": {
            "type": "string"
          },
          "currency": {
            "type": "string",
            "enum": [
              "USD"
            ]
          },
          "projected_quantity": {
            "type": "integer",
            "format": "int64"
          },
          "projected_net_millicents": {
            "type": "integer",
            "format": "int64"
          },
          "projected_gross_millicents": {
            "type": "integer",
            "format": "int64",
            "description": "Set only for account-level meters priced by more than one rate, such as object_storage."
          }
        }
      },
      "FinancialMeterCoverage": {
        "type": "object",
        "description": "Completeness and freshness of authoritative retained meter evidence.",
        "required": [
          "complete",
          "fresh",
          "expected_minutes",
          "complete_minutes",
          "unpriced_quantity",
          "non_billable_quantity",
          "reasons"
        ],
        "properties": {
          "complete": {
            "type": "boolean"
          },
          "fresh": {
            "type": "boolean"
          },
          "expected_minutes": {
            "type": "integer",
            "format": "int64"
          },
          "complete_minutes": {
            "type": "integer",
            "format": "int64"
          },
          "unpriced_quantity": {
            "type": "integer",
            "format": "int64"
          },
          "non_billable_quantity": {
            "type": "integer",
            "format": "int64"
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "FinancialMeterCosts": {
        "type": "object",
        "description": "Accrued meter costs, source coverage, historical terms, and forecast.",
        "required": [
          "meter",
          "coverage",
          "accrued",
          "forecast",
          "price_contracts"
        ],
        "properties": {
          "meter": {
            "type": "string"
          },
          "coverage": {
            "$ref": "#/components/schemas/FinancialMeterCoverage"
          },
          "accrued": {
            "$ref": "#/components/schemas/FinancialContractCosts"
          },
          "forecast": {
            "$ref": "#/components/schemas/FinancialForecast"
          },
          "price_contracts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FinancialPriceContract"
            }
          }
        }
      },
      "FinancialAppCostAllocation": {
        "type": "object",
        "description": "Workload share of a meter cost attributed to one application.",
        "required": [
          "attribution",
          "unit",
          "quantity",
          "net_millicents"
        ],
        "properties": {
          "attribution": {
            "$ref": "#/components/schemas/FinancialAttribution"
          },
          "unit": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "format": "int64"
          },
          "net_millicents": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "FinancialAppMeterCosts": {
        "type": "object",
        "description": "Application-attributed meter costs with source coverage and workload allocations.",
        "required": [
          "meter",
          "coverage",
          "quantity",
          "net_millicents",
          "allocations"
        ],
        "properties": {
          "meter": {
            "type": "string"
          },
          "coverage": {
            "$ref": "#/components/schemas/FinancialMeterCoverage"
          },
          "unit": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "format": "int64"
          },
          "net_millicents": {
            "type": "integer",
            "format": "int64"
          },
          "allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FinancialAppCostAllocation"
            }
          }
        }
      },
      "AppResourceInventoryBinding": {
        "type": "object",
        "description": "Selected-app database linkage without provider identities or credential references.",
        "required": [
          "id",
          "database_id",
          "app_id",
          "scope",
          "access",
          "state",
          "environment_key",
          "rotation_pending"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "database_id": {
            "type": "string"
          },
          "app_id": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          },
          "access": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "environment_key": {
            "type": "string"
          },
          "rotation_pending": {
            "type": "boolean"
          }
        }
      },
      "AppResourceInventoryItem": {
        "type": "object",
        "description": "Allowlisted resource metadata; optional fields depend on the page kind.",
        "required": [
          "id",
          "app_id",
          "scope"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "app_id": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "verified": {
            "type": "boolean"
          },
          "cert_status": {
            "type": "string"
          },
          "schedule": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "timezone": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "region": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "postgres_major": {
            "type": "integer"
          },
          "bucket_id": {
            "type": "string"
          },
          "bucket": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "rotation_pending": {
            "type": "boolean"
          },
          "binding": {
            "$ref": "#/components/schemas/AppResourceInventoryBinding"
          }
        }
      },
      "AppResourceInventoryResponse": {
        "type": "object",
        "description": "One native app and scope metadata page with a filtered total and optional next offset.",
        "required": [
          "schema_version",
          "app_id",
          "scope",
          "kind",
          "limit",
          "offset",
          "total",
          "items",
          "has_more",
          "generated_at"
        ],
        "properties": {
          "schema_version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "app_id": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          },
          "project_id": {
            "type": "string"
          },
          "environment_id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "domains",
              "crons",
              "buckets",
              "storage_bindings",
              "databases"
            ]
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          },
          "total": {
            "type": "integer",
            "format": "int64"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppResourceInventoryItem"
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "next_offset": {
            "type": "integer"
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AppOperationCheck": {
        "type": "object",
        "description": "One current native policy observation with a stable reason code.",
        "required": [
          "status",
          "reason"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "allowed",
              "blocked",
              "unknown"
            ]
          },
          "reason": {
            "type": "string",
            "description": "Stable native policy reason code; no customer-provided text."
          }
        }
      },
      "AppOperationPreview": {
        "type": "object",
        "description": "Read-only operation authorization snapshot with separate admission limitations.",
        "required": [
          "schema_version",
          "app_id",
          "scope",
          "operation",
          "authorization",
          "admission",
          "required_scopes",
          "checks",
          "checked_at"
        ],
        "properties": {
          "schema_version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "app_id": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          },
          "project_id": {
            "type": "string"
          },
          "environment_id": {
            "type": "string"
          },
          "operation": {
            "type": "string",
            "enum": [
              "deploy",
              "restart",
              "scale",
              "env_change"
            ]
          },
          "authorization": {
            "type": "string",
            "enum": [
              "allowed",
              "blocked",
              "unknown"
            ]
          },
          "admission": {
            "type": "string",
            "enum": [
              "allowed",
              "blocked",
              "unknown"
            ]
          },
          "required_scopes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "checks": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/AppOperationCheck"
            }
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AppCostCoverage": {
        "type": "object",
        "description": "Source sampling windows with per-app quantity coverage explicitly unknown.",
        "required": [
          "complete",
          "fresh",
          "expected_minutes",
          "complete_minutes",
          "quantity_coverage_known",
          "reasons"
        ],
        "properties": {
          "complete": {
            "type": "boolean"
          },
          "fresh": {
            "type": "boolean"
          },
          "expected_minutes": {
            "type": "integer",
            "format": "int64"
          },
          "complete_minutes": {
            "type": "integer",
            "format": "int64"
          },
          "quantity_coverage_known": {
            "type": "boolean",
            "description": "False; account-wide unpriced and nonbillable quantities are not exposed."
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "AppCostMeter": {
        "type": "object",
        "description": "Exact retained quantity and cost allocations for one app and meter.",
        "required": [
          "meter",
          "coverage",
          "quantity",
          "net_millicents",
          "allocations"
        ],
        "properties": {
          "meter": {
            "type": "string"
          },
          "coverage": {
            "$ref": "#/components/schemas/AppCostCoverage"
          },
          "unit": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "format": "int64"
          },
          "net_millicents": {
            "type": "integer",
            "format": "int64"
          },
          "allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FinancialAppCostAllocation"
            }
          }
        }
      },
      "AppCostsResponse": {
        "type": "object",
        "description": "Retained application usage costs with coverage limitations and no account financial totals.",
        "required": [
          "app_id",
          "app_slug",
          "currency",
          "period_start",
          "period_end",
          "as_of",
          "known_usage_millicents",
          "meters",
          "scope",
          "scope_description",
          "bill_estimate_available",
          "missing_bill_components"
        ],
        "properties": {
          "app_id": {
            "type": "string"
          },
          "app_slug": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "period_end": {
            "type": "string",
            "format": "date-time"
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "known_usage_millicents": {
            "type": "integer",
            "format": "int64"
          },
          "meters": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppCostMeter"
            }
          },
          "scope": {
            "type": "string"
          },
          "scope_description": {
            "type": "string"
          },
          "bill_estimate_available": {
            "type": "boolean"
          },
          "missing_bill_components": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "FinancialAppCostsResponse": {
        "type": "object",
        "description": "Retained usage costs directly attributed to one application; invoice and forecast amounts remain account scoped.",
        "required": [
          "app_id",
          "app_slug",
          "currency",
          "period_start",
          "period_end",
          "as_of",
          "known_usage_millicents",
          "meters",
          "scope",
          "scope_description",
          "bill_estimate_available",
          "missing_bill_components"
        ],
        "properties": {
          "app_id": {
            "type": "string"
          },
          "app_slug": {
            "type": "string"
          },
          "currency": {
            "type": "string",
            "enum": [
              "USD"
            ]
          },
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "period_end": {
            "type": "string",
            "format": "date-time"
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "known_usage_millicents": {
            "type": "integer",
            "format": "int64"
          },
          "meters": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FinancialAppMeterCosts"
            }
          },
          "scope": {
            "type": "string"
          },
          "scope_description": {
            "type": "string"
          },
          "bill_estimate_available": {
            "type": "boolean"
          },
          "missing_bill_components": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "FinancialCostsResponse": {
        "type": "object",
        "description": "Account usage costs for a UTC period; invoice facts remain separate.",
        "required": [
          "account_id",
          "currency",
          "period_start",
          "period_end",
          "as_of",
          "retained_from",
          "evidence_through_id",
          "known_usage_millicents",
          "meters",
          "scope",
          "invoices",
          "invoice_reconciliation",
          "missing_bill_components"
        ],
        "properties": {
          "account_id": {
            "type": "string"
          },
          "currency": {
            "type": "string",
            "enum": [
              "USD"
            ]
          },
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "period_end": {
            "type": "string",
            "format": "date-time"
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "retained_from": {
            "type": "string",
            "format": "date-time"
          },
          "evidence_through_id": {
            "type": "integer",
            "format": "int64"
          },
          "known_usage_millicents": {
            "type": "integer",
            "format": "int64"
          },
          "meters": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FinancialMeterCosts"
            }
          },
          "scope": {
            "type": "string"
          },
          "invoices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Invoice"
            }
          },
          "invoice_reconciliation": {
            "type": "string",
            "enum": [
              "not_reconciled"
            ]
          },
          "missing_bill_components": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "FinancialForecastResponse": {
        "type": "object",
        "description": "Meter projections; a complete bill forecast requires all bill components.",
        "required": [
          "period_start",
          "period_end",
          "as_of",
          "currency",
          "meters",
          "bill_estimate_available",
          "missing_bill_components"
        ],
        "properties": {
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "period_end": {
            "type": "string",
            "format": "date-time"
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "currency": {
            "type": "string",
            "enum": [
              "USD"
            ]
          },
          "meters": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FinancialMeterCosts"
            }
          },
          "projected_subtotal_millicents": {
            "type": "integer",
            "format": "int64",
            "description": "Plan fee plus every meter's projected usage charge for the month, in millicents. Present only when every meter has an available forecast; it excludes the components listed in missing_bill_components."
          },
          "bill_estimate_available": {
            "type": "boolean"
          },
          "missing_bill_components": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "CreateDevBridgeRequest": {
        "type": "object",
        "description": "Owned app and explicit development graph for local execution.",
        "required": [
          "app",
          "environment",
          "developer_id"
        ],
        "properties": {
          "app": {
            "type": "string"
          },
          "environment": {
            "type": "string"
          },
          "developer_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "dependencies": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "type": "string"
            }
          },
          "entrypoint": {
            "type": "string",
            "description": "Remote frontend included in the selected graph and used for the session URL."
          }
        }
      },
      "CreateDevBridgeResponse": {
        "type": "object",
        "description": "New development lease with credentials returned exactly once.",
        "required": [
          "session",
          "credentials",
          "environment_url"
        ],
        "properties": {
          "session": {
            "$ref": "#/components/schemas/DevBridgeSession"
          },
          "credentials": {
            "$ref": "#/components/schemas/DevBridgeCredentials"
          },
          "environment_url": {
            "type": "string",
            "format": "uri"
          },
          "dependencies": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DevBridgeDependency"
            }
          }
        }
      },
      "DevBridgeDependency": {
        "type": "object",
        "description": "Discovered remote service in the selected project environment.",
        "required": [
          "app_id",
          "name",
          "environment_url"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "environment_url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "DevBridgeScope": {
        "type": "object",
        "description": "Server-resolved account, developer, environment and permitted apps.",
        "required": [
          "account_id",
          "developer_id",
          "project_id",
          "environment_id",
          "target_app_id"
        ],
        "properties": {
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "developer_id": {
            "type": "string"
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "environment_id": {
            "type": "string",
            "format": "uuid"
          },
          "target_app_id": {
            "type": "string",
            "format": "uuid"
          },
          "dependency_app_ids": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      },
      "DevBridgeSession": {
        "type": "object",
        "description": "Durable session metadata with credential digests excluded.",
        "required": [
          "id",
          "scope",
          "expires_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 43,
            "maxLength": 43
          },
          "scope": {
            "$ref": "#/components/schemas/DevBridgeScope"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "revoked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "ListDevBridgesResponse": {
        "type": "object",
        "description": "Bounded active development sessions owned by the account.",
        "required": [
          "sessions"
        ],
        "properties": {
          "sessions": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/DevBridgeSessionSummary"
            }
          }
        }
      },
      "DevBridgeSessionSummary": {
        "type": "object",
        "description": "A durable session and its informational observed connection state.",
        "required": [
          "session",
          "connection_state"
        ],
        "properties": {
          "session": {
            "$ref": "#/components/schemas/DevBridgeSession"
          },
          "connection_state": {
            "type": "string",
            "enum": [
              "unknown",
              "connected",
              "disconnected",
              "expired",
              "revoked"
            ]
          }
        }
      },
      "DevBridgeActivity": {
        "type": "object",
        "description": "Temporary connection and request observations without credentials or payloads.",
        "required": [
          "connection_state",
          "requests"
        ],
        "properties": {
          "connection_state": {
            "type": "string",
            "enum": [
              "unknown",
              "connected",
              "disconnected",
              "expired",
              "revoked"
            ]
          },
          "connected_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "disconnected_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "requests": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/DevBridgeRequestRecord"
            }
          }
        }
      },
      "DevBridgeRequestRecord": {
        "type": "object",
        "description": "Redacted request metadata without queries, headers or bodies.",
        "required": [
          "id",
          "started_at",
          "method",
          "path",
          "status",
          "duration_ms",
          "response_bytes",
          "complete"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "minimum": 1
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "method": {
            "type": "string"
          },
          "path": {
            "type": "string",
            "maxLength": 1024
          },
          "status": {
            "type": "integer"
          },
          "duration_ms": {
            "type": "integer",
            "minimum": 0
          },
          "response_bytes": {
            "type": "integer",
            "minimum": 0
          },
          "complete": {
            "type": "boolean"
          },
          "error": {
            "type": "string"
          }
        }
      },
      "DevBridgeCredentials": {
        "type": "object",
        "description": "Distinct secrets for laptop attachment and request routing.",
        "required": [
          "attachment_token",
          "request_token"
        ],
        "properties": {
          "attachment_token": {
            "type": "string",
            "format": "password",
            "minLength": 43,
            "maxLength": 43
          },
          "request_token": {
            "type": "string",
            "format": "password",
            "minLength": 43,
            "maxLength": 43
          }
        }
      },
      "ReplayDevBridgeWebhookRequest": {
        "type": "object",
        "description": "Explicit verified receipt selection with scoped routing authority.",
        "required": [
          "invocation_id",
          "request_token",
          "idempotency_key"
        ],
        "properties": {
          "invocation_id": {
            "type": "string",
            "format": "uuid"
          },
          "request_token": {
            "type": "string",
            "format": "password",
            "writeOnly": true,
            "minLength": 43,
            "maxLength": 43
          },
          "idempotency_key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          }
        }
      },
      "DevBridgeWebhookReplay": {
        "type": "object",
        "description": "Durable outcome of one development copy, separate from original delivery.",
        "required": [
          "id",
          "session_id",
          "invocation_id",
          "state",
          "http_status",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "session_id": {
            "type": "string"
          },
          "invocation_id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "dispatching",
              "completed",
              "uncertain"
            ]
          },
          "http_status": {
            "type": "integer",
            "minimum": 0,
            "maximum": 599
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "FlagRule": {
        "description": "Ordered targeting rule; customer/group and subject constraints combine with AND. Subject rules require a customer or group constraint. Subject IDs are opaque application IDs and are evaluated only after application authentication. Boolean flags require a boolean value; variant flags may omit value to use weighted assignment. Progressive rollout is limited to boolean true rules.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_-]{0,63}$"
          },
          "customers": {
            "type": "array",
            "maxItems": 1000,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "group": {
            "type": "string",
            "description": "Owner-managed customer group key."
          },
          "subjects": {
            "type": "array",
            "minItems": 1,
            "maxItems": 1000,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^[!-~]{1,128}$"
            },
            "description": "Opaque application subject IDs, matched inside the selected customers/group. Use stable internal IDs, not emails or display names."
          },
          "rollout": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000,
            "description": "Basis points of eligible customers by default, or eligible subjects when rollout_unit is subject; omitted means all eligible targets."
          },
          "rollout_unit": {
            "type": "string",
            "enum": [
              "customer",
              "subject"
            ],
            "description": "Allocation unit for rollout percentages. Omitted preserves customer-level allocation. Subject rollout requires a customer or group constraint and an authenticated subject context."
          },
          "progression": {
            "$ref": "#/components/schemas/ProgressiveRollout"
          },
          "value": {
            "oneOf": [
              {
                "type": "boolean"
              },
              {
                "type": "string",
                "pattern": "^[a-z][a-z0-9_-]{0,63}$",
                "description": "Directly select a configured variant."
              }
            ]
          }
        }
      },
      "ProgressiveRollout": {
        "description": "Health-gated stages for a boolean true rule. Promotion is manual by default; auto_advance opts into server-managed promotion after a full healthy evidence window. The rule rollout must equal stages[current_stage]; stages must strictly increase and end at 10000 basis points.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "stages",
          "current_stage",
          "minimum_used_requests",
          "maximum_http_5xx_rate_basis_points",
          "maximum_p95_latency_ms",
          "window_seconds"
        ],
        "properties": {
          "stages": {
            "type": "array",
            "minItems": 2,
            "maxItems": 8,
            "items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            },
            "description": "Strictly increasing rollout percentages in basis points, ending at 10000."
          },
          "current_stage": {
            "type": "integer",
            "minimum": 0,
            "maximum": 7,
            "description": "Zero-based active stage index."
          },
          "auto_advance": {
            "type": "boolean",
            "default": false,
            "description": "When true, the platform automatically advances one stage after the full observation window passes all evidence gates. Omitted or false keeps promotion manual."
          },
          "minimum_used_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 100000000,
            "description": "Minimum application-reported used requests for the targeted rule before promotion."
          },
          "maximum_http_5xx_rate_basis_points": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000,
            "description": "Highest allowed 5xx rate for the targeted rule; 100 basis points is one percent."
          },
          "maximum_p95_latency_ms": {
            "type": "integer",
            "minimum": 1,
            "maximum": 600000,
            "description": "Highest allowed conservative p95 latency bucket bound for the targeted rule."
          },
          "window_seconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 604800,
            "description": "Evidence lookback window; must fit within debugger retention."
          }
        }
      },
      "FlagRolloutPromotionRequest": {
        "description": "Optimistic stage promotion request; an expected-version conflict requires a fresh read.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version",
          "rule_id"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "rule_id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_-]{0,63}$"
          }
        }
      },
      "FlagRolloutPromotion": {
        "description": "Health-gate evaluation for a progressive rollout stage. A held or complete status does not publish a new configuration version.",
        "type": "object",
        "required": [
          "status",
          "flag",
          "rule_id",
          "config_version",
          "current_stage",
          "stage_count",
          "rollout_basis_points",
          "request_count",
          "used_count",
          "http_5xx_count",
          "http_5xx_rate",
          "p95_latency_ms",
          "latency_quantized",
          "minimum_used_requests",
          "maximum_http_5xx_rate_basis_points",
          "maximum_p95_latency_ms"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "held",
              "promoted",
              "complete"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "insufficient_used_requests",
              "http_5xx_rate_exceeded",
              "p95_latency_exceeded",
              "all_stages_complete"
            ]
          },
          "flag": {
            "type": "string"
          },
          "rule_id": {
            "type": "string"
          },
          "config_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Current version after promotion, unchanged when held or complete."
          },
          "current_stage": {
            "type": "integer",
            "minimum": 1,
            "description": "One-based ordinal of the currently configured stage."
          },
          "stage_count": {
            "type": "integer",
            "minimum": 2
          },
          "rollout_basis_points": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000,
            "description": "Active rollout percentage in basis points."
          },
          "next_rollout_basis_points": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000,
            "description": "Next configured percentage after promotion, omitted when already at the final stage."
          },
          "request_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "used_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "http_5xx_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "http_5xx_rate": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "Observed 5xx count divided by the target rule request count."
          },
          "p95_latency_ms": {
            "type": "integer",
            "minimum": 0
          },
          "latency_quantized": {
            "type": "boolean",
            "description": "True when p95 came from stored bucket bounds; false when no matching evidence was available."
          },
          "minimum_used_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "maximum_http_5xx_rate_basis_points": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          },
          "maximum_p95_latency_ms": {
            "type": "integer",
            "minimum": 1
          },
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "window_end": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "FlagVariant": {
        "description": "Variant allocation weight in basis points; all weights on a flag total 10000.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "key",
          "weight"
        ],
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_-]{0,63}$"
          },
          "weight": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          }
        }
      },
      "FeatureFlag": {
        "description": "Application behavior flag; business logic must check it explicitly. Omitted type means boolean for backward compatibility.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "key",
          "enabled",
          "default",
          "rules"
        ],
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_-]{0,63}$"
          },
          "description": {
            "type": "string",
            "maxLength": 512
          },
          "type": {
            "type": "string",
            "enum": [
              "boolean",
              "variant"
            ],
            "default": "boolean"
          },
          "enabled": {
            "type": "boolean"
          },
          "default": {
            "description": "Boolean fallback for boolean flags or named fallback variant for variant flags.",
            "oneOf": [
              {
                "type": "boolean"
              },
              {
                "type": "string",
                "pattern": "^[a-z][a-z0-9_-]{0,63}$"
              }
            ]
          },
          "seed": {
            "type": "string",
            "maxLength": 128,
            "description": "Server-supplied stable allocation seed; omit for a new flag."
          },
          "rules": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/FlagRule"
            }
          },
          "variants": {
            "type": "array",
            "minItems": 2,
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/FlagVariant"
            },
            "description": "Required for variant flags; weights must total 10000 basis points."
          }
        }
      },
      "FlagsConfig": {
        "description": "Complete atomic environment configuration; omitted flags are removed from current evaluation.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "flags",
          "groups"
        ],
        "properties": {
          "flags": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/FeatureFlag"
            }
          },
          "groups": {
            "type": "object",
            "maxProperties": 100,
            "additionalProperties": {
              "type": "array",
              "maxItems": 1000,
              "uniqueItems": true,
              "items": {
                "type": "string",
                "format": "uuid"
              }
            }
          }
        }
      },
      "FlagsBundle": {
        "description": "Immutable runtime configuration snapshot.",
        "allOf": [
          {
            "$ref": "#/components/schemas/FlagsConfig"
          },
          {
            "type": "object",
            "required": [
              "environment_id",
              "version"
            ],
            "properties": {
              "environment_id": {
                "type": "string",
                "format": "uuid"
              },
              "version": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              }
            }
          }
        ]
      },
      "FeatureFlagVersion": {
        "description": "Configuration publication with audit metadata; version zero is an unpublished empty environment.",
        "allOf": [
          {
            "$ref": "#/components/schemas/FlagsBundle"
          },
          {
            "type": "object",
            "required": [
              "actor",
              "created_at"
            ],
            "properties": {
              "actor": {
                "type": "string",
                "description": "Publishing account identity."
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "restored_from": {
                "type": "integer",
                "format": "int64",
                "minimum": 1
              }
            }
          }
        ]
      },
      "UpdateFeatureFlagsRequest": {
        "description": "Optimistic atomic configuration publication.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version",
          "config"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "config": {
            "$ref": "#/components/schemas/FlagsConfig"
          }
        }
      },
      "RollbackFeatureFlagsRequest": {
        "description": "Publish the selected historical version while checking current version.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version",
          "version"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        }
      },
      "InspectFeatureFlagRequest": {
        "description": "Owner-authorized simulation context; does not record exposure.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "customer_id": {
            "type": "string",
            "format": "uuid",
            "description": "Omit for anonymous evaluation."
          },
          "subject_id": {
            "type": "string",
            "pattern": "^[!-~]{1,128}$",
            "description": "Opaque application subject ID after authentication; requires customer_id and does not record the ID in evidence."
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Zero or omitted selects current configuration."
          },
          "fallback": {
            "type": "boolean",
            "default": false
          },
          "fallback_variant": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_-]{0,63}$",
            "description": "Fallback variant for an absent flag; configured variant flags use their own default."
          }
        }
      },
      "FlagDecision": {
        "description": "Explainable boolean or named-variant decision against a configuration version.",
        "type": "object",
        "required": [
          "flag",
          "value",
          "config_version",
          "reason",
          "source"
        ],
        "properties": {
          "flag": {
            "type": "string"
          },
          "value": {
            "oneOf": [
              {
                "type": "boolean"
              },
              {
                "type": "string",
                "pattern": "^[a-z][a-z0-9_-]{0,63}$"
              }
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "boolean",
              "variant"
            ],
            "description": "Present as variant for named-variant decisions; omitted for legacy boolean decisions."
          },
          "config_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "rule_id": {
            "type": "string"
          },
          "reason": {
            "type": "string",
            "enum": [
              "flag_missing",
              "default",
              "disabled",
              "customer_missing",
              "subject_missing",
              "rule_match",
              "configuration_stale",
              "type_mismatch"
            ]
          },
          "bucket": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9999,
            "description": "Boolean rollout bucket or weighted variant assignment bucket."
          },
          "rollout_bucket": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9999,
            "description": "Eligibility bucket for rollout-gated variant rules."
          },
          "source": {
            "type": "string",
            "enum": [
              "configuration",
              "fallback",
              "inherited"
            ]
          },
          "inherited_from": {
            "type": "object",
            "required": [
              "app_id",
              "environment_id"
            ],
            "properties": {
              "app_id": {
                "type": "string",
                "format": "uuid"
              },
              "environment_id": {
                "type": "string",
                "format": "uuid"
              }
            }
          }
        }
      },
      "FlagEvidence": {
        "description": "Application-reported evaluation and exposure, attributed by the gateway.",
        "allOf": [
          {
            "$ref": "#/components/schemas/FlagDecision"
          },
          {
            "type": "object",
            "required": [
              "used"
            ],
            "properties": {
              "used": {
                "type": "boolean"
              }
            }
          }
        ]
      },
      "FlagRequestEvidence": {
        "description": "Retained request aggregate containing bounded flag decisions.",
        "type": "object",
        "required": [
          "id",
          "app_id",
          "deployment_id",
          "received_at",
          "route",
          "method",
          "status",
          "latency_ms",
          "count",
          "cold_boot",
          "flags"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "customer_id": {
            "type": "string",
            "format": "uuid"
          },
          "received_at": {
            "type": "string",
            "format": "date-time"
          },
          "route": {
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "latency_ms": {
            "type": "integer"
          },
          "count": {
            "type": "integer"
          },
          "cold_boot": {
            "type": "boolean"
          },
          "trace_id": {
            "type": "string"
          },
          "flags": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/FlagEvidence"
            }
          }
        }
      },
      "FlagEvidencePage": {
        "description": "Stable window of up to 100 retained request aggregates; preserve filters for pagination.",
        "type": "object",
        "required": [
          "items",
          "window_start",
          "window_end"
        ],
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/FlagRequestEvidence"
            }
          },
          "next_cursor": {
            "type": "string"
          },
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "window_end": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "FlagOutcomesResponse": {
        "description": "Operational outcomes grouped by evaluated flag type and value over one bounded window.",
        "type": "object",
        "required": [
          "outcomes",
          "truncated",
          "window_start",
          "window_end"
        ],
        "properties": {
          "outcomes": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/FlagOutcome"
            }
          },
          "truncated": {
            "type": "boolean",
            "description": "True when additional low-volume cohorts were omitted after retaining the 100 highest-volume groups."
          },
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "window_end": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "FlagOutcome": {
        "description": "Request-weighted observations for one boolean value or named variant. Boolean values are encoded as the strings \"true\" and \"false\".",
        "type": "object",
        "required": [
          "type",
          "value",
          "request_count",
          "used_count",
          "http_5xx_count",
          "http_5xx_rate",
          "p50_latency_ms",
          "p95_latency_ms",
          "latency_quantized"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "boolean",
              "variant"
            ]
          },
          "value": {
            "type": "string",
            "description": "Boolean value \"true\"/\"false\" or the selected variant key."
          },
          "request_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "used_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Application-reported requests where the decision was marked used."
          },
          "http_5xx_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "http_5xx_rate": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "HTTP 5xx request count divided by request_count."
          },
          "p50_latency_ms": {
            "type": "integer",
            "minimum": 0,
            "description": "Request-weighted nearest-rank p50 from stored latency bucket upper bounds."
          },
          "p95_latency_ms": {
            "type": "integer",
            "minimum": 0,
            "description": "Request-weighted nearest-rank p95 from stored latency bucket upper bounds."
          },
          "latency_quantized": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Latency values are conservative bucket upper bounds."
          }
        }
      },
      "CreateCommitSourceRequest": {
        "description": "Register an immutable database source bound to managed Operations or application-event publication. Event destinations require version 3, no operation policy and no customer selection.",
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "operation_policy": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$",
            "description": "Required for operation destinations and forbidden for event destinations. Active queue policy containing this application. Scope must be account or platform_tenant according to allow_tenant_selection. Environment-scoped policies are unsupported."
          },
          "contract_version": {
            "type": "integer",
            "enum": [
              1,
              2,
              3
            ],
            "default": 1,
            "description": "Immutable contract. Version 1 uses one source lane; version 2 requires explicit operation routing; version 3 requires an event destination."
          },
          "allow_tenant_selection": {
            "type": "boolean",
            "default": false,
            "description": "Immutable owner grant authorizing this trusted database to select active customers linked to the fixed target application. Requires contract version 2 and a platform_tenant queue policy."
          },
          "destination": {
            "type": "string",
            "enum": [
              "operation",
              "event"
            ],
            "default": "operation",
            "description": "Immutable destination. Event publishes under the bound application source instead of invoking that application."
          }
        }
      },
      "CommitSourceResponse": {
        "type": "object",
        "description": "Commit source destination, enabled state and latest bounded relay health observation.",
        "required": [
          "id",
          "app_id",
          "name",
          "enabled",
          "contract_version",
          "allow_tenant_selection"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "operation_policy": {
            "type": "string",
            "description": "Immutable managed Operations policy. Absent for legacy internal sources and event destinations."
          },
          "contract_version": {
            "type": "integer",
            "enum": [
              1,
              2,
              3
            ]
          },
          "allow_tenant_selection": {
            "type": "boolean"
          },
          "relay_status": {
            "type": "string"
          },
          "last_checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "pending_events": {
            "type": "integer",
            "format": "int64"
          },
          "blocked_events": {
            "type": "integer",
            "format": "int64"
          },
          "oldest_pending_at": {
            "type": "string",
            "format": "date-time"
          },
          "destination": {
            "type": "string",
            "enum": [
              "operation",
              "event"
            ],
            "default": "operation"
          }
        }
      },
      "CommitPublicationHistoryItem": {
        "description": "Retained publication acceptance receipt with event metadata; excludes event data.",
        "allOf": [
          {
            "$ref": "#/components/schemas/CommitReceiptResponse"
          },
          {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "type": "string",
                "description": "Original committed event type."
              },
              "schema_version": {
                "type": "string",
                "description": "Selected schema version when supplied."
              }
            }
          }
        ]
      },
      "CommitPublicationHistoryResponse": {
        "type": "object",
        "description": "Newest-first retained acceptance history, independent of subscriber evidence retention.",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 200,
            "items": {
              "$ref": "#/components/schemas/CommitPublicationHistoryItem"
            }
          },
          "next_before": {
            "type": "string",
            "description": "Opaque source-scoped continuation cursor; absent on the last observed page."
          }
        }
      },
      "CommitBlockedEventsResponse": {
        "type": "object",
        "description": "Bounded snapshot of blocked source events, with the observation time and snapshot limit.",
        "required": [
          "items",
          "limit",
          "observation"
        ],
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/CommitBlockedEventResponse"
            }
          },
          "limit": {
            "type": "integer"
          },
          "observation": {
            "type": "string"
          }
        }
      },
      "CommitBlockedEventResponse": {
        "type": "object",
        "description": "Blocked event identity and diagnostic code without customer event payloads.",
        "required": [
          "event_id",
          "type",
          "blocked_code",
          "created_at",
          "observed_at"
        ],
        "properties": {
          "event_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string"
          },
          "blocked_code": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CommitEventRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "type",
          "data"
        ],
        "description": "At-least-once handoff. Repeating the identity with identical JSON data and routing returns the original receipt; changed type, schema version, data or routing conflicts.",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "data": {},
          "routing": {
            "$ref": "#/components/schemas/CommitRouting"
          },
          "schema_version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Optional registered application event schema version. Only event destinations support this field."
          }
        }
      },
      "CommitRouting": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "key"
        ],
        "description": "Version 2 routing authority is granted by the account owner on the source. Customer identity is separate from untrusted event data. Business keys share a queue only within the same policy and customer scope; scalar types remain distinct. Canonical keys are limited to 256 bytes including the type prefix.",
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              2
            ]
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid",
            "description": "Required for sources with allow_tenant_selection; forbidden otherwise. Must be active, in the source account and linked to the target app through an active surface."
          },
          "key": {
            "oneOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              }
            ]
          }
        }
      },
      "CommitReceiptResponse": {
        "type": "object",
        "required": [
          "receipt_id",
          "source_id",
          "event_id",
          "accepted_at"
        ],
        "description": "Newly created sources return operation_id for a managed Gregale Operation. Retained legacy internal receipts return invocation_id instead. Event destinations instead return publication. Exactly one invocation, operation or publication identity is present. The publication receipt survives event retention and does not imply subscriber success.",
        "properties": {
          "receipt_id": {
            "type": "string",
            "format": "uuid"
          },
          "source_id": {
            "type": "string",
            "format": "uuid"
          },
          "event_id": {
            "type": "string",
            "format": "uuid"
          },
          "operation_url": {
            "type": "string",
            "description": "Present for operation or legacy invocation destinations."
          },
          "invocation_id": {
            "type": "string",
            "format": "uuid"
          },
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "accepted_at": {
            "type": "string",
            "format": "date-time"
          },
          "publication": {
            "$ref": "#/components/schemas/CommitEventPublication"
          }
        }
      },
      "CommitEventPublication": {
        "description": "Retained event-publication acceptance and a guarded URL for subscriber delivery evidence.",
        "type": "object",
        "required": [
          "acceptance_id",
          "source",
          "id",
          "accepted_at",
          "receipt_url"
        ],
        "properties": {
          "acceptance_id": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "source": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "accepted_at": {
            "type": "string",
            "format": "date-time"
          },
          "receipt_url": {
            "type": "string",
            "description": "Read-only event receipt with an acceptance-time guard; exposes paginated subscriber delivery evidence while retained."
          }
        }
      },
      "CommitOperationResponse": {
        "type": "object",
        "description": "Retained Commit acceptance and execution facts after managed Operation cleanup.",
        "required": [
          "id",
          "receipt_id",
          "source_id",
          "event_id",
          "state",
          "accepted_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "receipt_id": {
            "type": "string",
            "format": "uuid"
          },
          "source_id": {
            "type": "string",
            "format": "uuid"
          },
          "event_id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "accepted",
              "pending",
              "running",
              "completed",
              "cancelled",
              "failed",
              "expired",
              "unknown"
            ]
          },
          "result": {
            "description": "Business result of a completed managed Commit operation; any JSON value."
          },
          "effects": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/OperationEffectRecord"
            }
          },
          "accepted_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OutboundIntegrationOffer": {
        "type": "object",
        "description": "Account-owned managed integration metadata; never contains a provider key or gateway token.",
        "required": [
          "id",
          "name",
          "origin",
          "allowed_methods",
          "allowed_path_prefixes",
          "enabled",
          "runs_enabled",
          "credential_source",
          "credential_configured",
          "owner_kind",
          "daily_request_limit",
          "request_policy"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "origin": {
            "type": "string",
            "format": "uri"
          },
          "allowed_methods": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "allowed_path_prefixes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "enabled": {
            "type": "boolean"
          },
          "runs_enabled": {
            "type": "boolean",
            "description": "Whether account policy grants use by stateless Runs."
          },
          "credential_source": {
            "type": "string",
            "enum": [
              "operator_env",
              "customer_sealed"
            ],
            "description": "Who supplies the provider Authorization value."
          },
          "credential_configured": {
            "type": "boolean",
            "description": "Whether the selected source currently has a credential; never reveals its value."
          },
          "owner_kind": {
            "type": "string",
            "enum": [
              "operator",
              "customer"
            ],
            "description": "Whether the integration is operator-provisioned or customer-created."
          },
          "daily_request_limit": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 100000000,
            "description": "Effective per-integration UTC-day admitted-request limit; null means no configured limit."
          },
          "request_policy": {
            "$ref": "#/components/schemas/OutboundRequestPolicy"
          },
          "ai_provider": {
            "type": "string",
            "enum": [
              "openai",
              "anthropic",
              "gemini",
              "azure_openai",
              "bedrock",
              "vertex"
            ],
            "description": "Present for AI gateway integrations. openai is the OpenAI-compatible wire format; the provider also selects how the managed credential is applied (header, AWS SigV4 for bedrock, Google service-account token for vertex) and how token usage is read."
          },
          "ai_daily_token_limit": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 1,
            "maximum": 100000000000,
            "description": "UTC-day input plus output token limit; admission stops new calls once settled usage reaches it. null means no limit."
          },
          "ai_daily_cost_limit_millicents": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 1,
            "maximum": 1000000000000,
            "description": "UTC-day cost limit priced from the integration's price list."
          },
          "ai_monthly_cost_limit_millicents": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 1,
            "maximum": 1000000000000,
            "description": "Calendar-month cost limit priced from the integration's price list."
          },
          "ai_request_log_enabled": {
            "type": "boolean",
            "description": "Whether every settled AI call writes one metadata row to the request log."
          },
          "ai_request_log_content": {
            "type": "boolean",
            "description": "Whether logged calls also keep the first 32 KiB of their request and response bodies for 3 days."
          },
          "ai_content_policy": {
            "$ref": "#/components/schemas/OutboundAIContentPolicy"
          },
          "ai_log_export": {
            "type": "boolean",
            "description": "Whether each settled app call writes one metadata line to the app's log drains."
          },
          "ai_allow_unmetered": {
            "type": "boolean",
            "description": "Whether writes the gateway can neither meter nor knows to be free go through, outside the caps."
          },
          "ai_auto_prompt_cache": {
            "type": "boolean",
            "description": "Whether the gateway adds prompt-cache breakpoints to Claude requests that carry none."
          },
          "ai_trace_max_calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 1000000,
            "description": "Calls each AI trace may make, settled and in flight. Absent when unlimited."
          },
          "ai_trace_max_cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 1000000000000,
            "description": "Cost each AI trace may reach, with live reservations. Absent when unlimited."
          },
          "ai_trace_max_repeated_tool_calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 1000,
            "description": "Consecutive calls of a trace whose responses may request the same tools with the same arguments. Absent when unlimited."
          },
          "ai_user_daily_token_limit": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 1,
            "maximum": 100000000000,
            "description": "UTC-day input plus output token limit for each end user named by X-Gregale-AI-User."
          },
          "ai_user_daily_cost_limit_millicents": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 1,
            "maximum": 1000000000000,
            "description": "UTC-day cost limit for each end user named by X-Gregale-AI-User."
          },
          "ai_online_evaluation": {
            "allOf": [
              {
                "$ref": "#/components/schemas/OutboundAIOnlineEvaluation"
              }
            ],
            "description": "The sample of answered app calls a judge model scores."
          },
          "ai_quality_alerts": {
            "type": "boolean",
            "description": "Drift alerts on the integration's quality signals are on."
          }
        }
      },
      "CreateOutboundIntegrationRequest": {
        "type": "object",
        "description": "A fixed public HTTPS destination, maximum HTTP route policy, and optional admission policy and daily admitted-request limit.",
        "required": [
          "name",
          "origin",
          "allowed_methods",
          "allowed_path_prefixes"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$"
          },
          "origin": {
            "type": "string",
            "format": "uri"
          },
          "allowed_methods": {
            "type": "array",
            "uniqueItems": true,
            "minItems": 1,
            "maxItems": 6,
            "items": {
              "type": "string",
              "enum": [
                "GET",
                "HEAD",
                "POST",
                "PUT",
                "PATCH",
                "DELETE"
              ]
            }
          },
          "allowed_path_prefixes": {
            "type": "array",
            "uniqueItems": true,
            "minItems": 1,
            "maxItems": 32,
            "items": {
              "type": "string",
              "maxLength": 512
            }
          },
          "daily_request_limit": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 100000000,
            "description": "Optional per-integration daily admitted-request limit; account plan ceilings may be lower."
          },
          "request_policy": {
            "allOf": [
              {
                "$ref": "#/components/schemas/OutboundRequestPolicy"
              }
            ],
            "description": "Optional full request policy. Omission selects the default 10 RPS, burst 20, 10 in flight, and 30-second timeout."
          },
          "ai_provider": {
            "type": "string",
            "enum": [
              "openai",
              "anthropic",
              "gemini",
              "azure_openai",
              "bedrock",
              "vertex"
            ],
            "description": "Optional AI gateway mode. Enables token usage extraction for that provider's response format."
          },
          "ai_daily_token_limit": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 1,
            "maximum": 100000000000,
            "description": "Optional UTC-day input plus output token limit. Requires ai_provider."
          }
        }
      },
      "PutOutboundAIPolicyRequest": {
        "type": "object",
        "description": "Replace an integration's AI gateway settings. An empty ai_provider turns AI handling off and requires a null daily_token_limit.",
        "required": [
          "ai_provider",
          "daily_token_limit"
        ],
        "properties": {
          "ai_provider": {
            "type": "string",
            "enum": [
              "",
              "openai",
              "anthropic",
              "gemini",
              "azure_openai",
              "bedrock",
              "vertex"
            ]
          },
          "daily_token_limit": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 1,
            "maximum": 100000000000
          },
          "daily_cost_limit_millicents": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 1,
            "maximum": 1000000000000
          },
          "monthly_cost_limit_millicents": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 1,
            "maximum": 1000000000000
          },
          "request_log_enabled": {
            "type": "boolean",
            "description": "Log per-call metadata (caller, route, model, status, tokens, cost, timing) for 7 days. Requires ai_provider."
          },
          "request_log_content": {
            "type": "boolean",
            "description": "Also keep the first 32 KiB of each logged call's request and response bodies, never headers, for 3 days and at most 1,000 calls per UTC day. Requires request_log_enabled."
          },
          "log_export": {
            "type": "boolean",
            "description": "Send each settled app call to the app's log drains as one JSON line of metadata, never prompts or completions, about 15 seconds after it settles. Requires ai_provider."
          },
          "allow_unmetered": {
            "type": "boolean",
            "description": "Let through writes the gateway can neither meter nor knows to be free, such as realtime client secrets, vector stores, containers, fine-tuning jobs and context caches. They are otherwise refused with 403 outbound_ai_endpoint_unmetered; let through, they carry X-Gregale-AI-Unmetered and their spend is outside the caps. Requires ai_provider."
          },
          "auto_prompt_cache": {
            "type": "boolean",
            "description": "Add prompt-cache breakpoints to Claude requests on the Anthropic API, Vertex AI and Amazon Bedrock that carry none: after a system prompt or tool list seen again within five minutes, and after the last message of a conversation that carries earlier turns or names X-Gregale-AI-Session. Prompts under about 1,024 tokens are not marked; the response names the added breakpoints in X-Gregale-AI-Prompt-Cache. Requires ai_provider."
          },
          "trace_max_calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 1000000,
            "description": "Refuse a trace's call once the trace made this many calls, settled and in flight, with 429 outbound_budget_exhausted and X-Gregale-Outbound-Rejection trace_call_limit. Requires ai_provider."
          },
          "trace_max_cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 1000000000000,
            "description": "Refuse a trace's call that would take the trace's cost past this, with trace_cost_limit. Requires ai_provider."
          },
          "trace_max_repeated_tool_calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 1000,
            "description": "Refuse a trace's call once this many consecutive calls requested the same tools with the same arguments, with trace_tool_loop: the agent is looping. Requires ai_provider."
          },
          "user_daily_token_limit": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 1,
            "maximum": 100000000000,
            "description": "Per-end-user UTC-day token limit for calls that send X-Gregale-AI-User. Requires ai_provider."
          },
          "user_daily_cost_limit_millicents": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 1,
            "maximum": 1000000000000,
            "description": "Per-end-user UTC-day cost limit for calls that send X-Gregale-AI-User. Requires ai_provider."
          },
          "online_evaluation": {
            "allOf": [
              {
                "$ref": "#/components/schemas/OutboundAIOnlineEvaluation"
              }
            ],
            "description": "Score a sample of answered app calls with a judge model. Requires ai_provider and request_log_content."
          },
          "quality_alerts": {
            "type": "boolean",
            "description": "Alert bound apps with outbound.ai_quality.drift when a model's quality signals move away from its previous 7 days. Requires ai_provider."
          }
        }
      },
      "OutboundAIUsageItem": {
        "type": "object",
        "description": "One UTC-day rollup for a caller and model. input_tokens includes cached reads and cache writes, which are also reported separately.",
        "required": [
          "caller",
          "model",
          "requests",
          "error_requests",
          "usage_unknown_requests",
          "input_tokens",
          "cached_input_tokens",
          "cache_write_tokens",
          "output_tokens",
          "images",
          "audio_seconds",
          "characters",
          "video_seconds",
          "web_searches",
          "file_searches",
          "code_session_gb",
          "cached_requests",
          "cache_saved_millicents",
          "prompt_cache_saved_millicents",
          "input_audio_tokens",
          "output_audio_tokens",
          "truncated_requests",
          "refused_requests",
          "empty_requests",
          "invalid_json_requests",
          "tool_error_requests",
          "good_feedback",
          "bad_feedback",
          "evaluated_requests",
          "evaluation_score_sum",
          "evaluation_errors"
        ],
        "properties": {
          "caller": {
            "type": "string",
            "description": "App UUID, \"runs\" for stateless Runs, or \"replay\" for replayed calls."
          },
          "model": {
            "type": "string",
            "maxLength": 128,
            "description": "Provider-reported model; \"other\" collects models beyond the daily distinct-model cap and \"unknown\" covers responses without one."
          },
          "requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "usage_unknown_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Successful calls whose response reported no usage, such as an OpenAI stream without stream_options.include_usage."
          },
          "input_tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cached_input_tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cache_write_tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "output_tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Priced from the list in effect at each call, else the built-in catalog, and rounded up per call; zero for an unpriced model."
          },
          "images": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Images billed per image."
          },
          "audio_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Seconds of transcribed audio."
          },
          "characters": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Characters of speech input."
          },
          "video_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Seconds of generated video."
          },
          "web_searches": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Web searches as the provider bills them: per call, query or grounded prompt."
          },
          "file_searches": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "File search calls."
          },
          "code_session_gb": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "GB of code-interpreter container sessions."
          },
          "cached_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Requests the response cache served, with no tokens or cost."
          },
          "cache_saved_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Provider cost the response cache avoided, priced from the cached responses at the current price list."
          },
          "prompt_cache_saved_millicents": {
            "type": "integer",
            "format": "int64",
            "description": "What provider prompt caching saved against plain input prices; negative when cache writes outweighed reads."
          },
          "input_audio_tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Audio part of input_tokens, priced at the audio input price."
          },
          "output_audio_tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Audio part of output_tokens, priced at the audio output price."
          },
          "truncated_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Answered calls that stopped at the output-token limit."
          },
          "refused_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Answered calls the provider refused or filtered."
          },
          "empty_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Answered calls with no text and no requested tools."
          },
          "invalid_json_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Answered calls whose requested JSON, or tool-call arguments, did not parse."
          },
          "tool_error_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Calls whose newest turn reported a failed tool."
          },
          "good_feedback": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Calls rated good."
          },
          "bad_feedback": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Calls rated bad."
          },
          "evaluated_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Calls an online evaluation scored."
          },
          "evaluation_score_sum": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Sum of their scores from 1 to 5; divide by evaluated_requests for the mean."
          },
          "evaluation_errors": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Sampled calls the judge could not score."
          }
        }
      },
      "OutboundAIUsageResponse": {
        "type": "object",
        "description": "One UTC day of AI gateway usage for an integration.",
        "required": [
          "usage_date",
          "ai_provider",
          "daily_token_count",
          "daily_token_limit",
          "resets_at",
          "items"
        ],
        "properties": {
          "usage_date": {
            "type": "string",
            "format": "date"
          },
          "ai_provider": {
            "type": "string",
            "description": "Empty when AI handling is off."
          },
          "daily_token_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Settled admission counter for today; the rollup sum of input and output tokens for an earlier day."
          },
          "daily_token_limit": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 1,
            "maximum": 100000000000
          },
          "resets_at": {
            "type": "string",
            "format": "date-time",
            "description": "End of usage_date in UTC."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutboundAIUsageItem"
            }
          },
          "daily_cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "daily_cost_limit_millicents": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "month": {
            "type": "string",
            "description": "Calendar month of usage_date as YYYY-MM."
          },
          "monthly_cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Settled cost of the month through usage_date."
          },
          "monthly_cost_limit_millicents": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          }
        }
      },
      "OutboundRequestPolicy": {
        "type": "object",
        "description": "Effective customer-selected per-integration policy, bounded by the account plan.",
        "required": [
          "rate_per_second",
          "burst",
          "max_in_flight",
          "request_timeout_ms"
        ],
        "properties": {
          "rate_per_second": {
            "type": "number",
            "format": "double",
            "exclusiveMinimum": true,
            "minimum": 0,
            "maximum": 500
          },
          "burst": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2000
          },
          "max_in_flight": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000
          },
          "request_timeout_ms": {
            "type": "integer",
            "minimum": 1,
            "maximum": 300000
          },
          "max_retries": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2,
            "default": 0,
            "description": "Extra attempts for bodyless GET/HEAD requests after selected transient failures. Retries share the request timeout and count as one admission."
          },
          "response_cache_ttl_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 300,
            "default": 0,
            "description": "Opt-in maximum freshness for eligible bodyless GET responses. Zero disables caching; provider cache directives can shorten or prohibit storage."
          },
          "circuit_breaker_failure_threshold": {
            "type": "integer",
            "minimum": 0,
            "maximum": 20,
            "default": 0,
            "description": "Consecutive transient provider failures before the integration circuit opens. Zero disables the breaker and requires circuit_breaker_open_seconds to be zero too."
          },
          "circuit_breaker_open_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 300,
            "default": 0,
            "description": "Cool-down after the breaker opens; after it elapses, only one cross-replica half-open provider probe is allowed. Must be set with a nonzero failure threshold."
          },
          "retry_budget_per_minute": {
            "type": "integer",
            "minimum": 0,
            "maximum": 3000,
            "default": 0,
            "description": "Shared token-bucket cap on extra safe-method provider attempts per minute across gateway replicas. Capacity equals the configured rate; zero disables this aggregate cap while max_retries remains the per-call ceiling."
          }
        }
      },
      "PutOutboundRequestPolicyRequest": {
        "type": "object",
        "description": "Replace admission policy values for a customer-owned integration.",
        "required": [
          "request_policy"
        ],
        "properties": {
          "request_policy": {
            "$ref": "#/components/schemas/OutboundRequestPolicy"
          }
        }
      },
      "PutOutboundRunsBindingRequest": {
        "type": "object",
        "description": "Explicit account decision to allow or deny stateless Runs access to an integration.",
        "additionalProperties": false,
        "required": [
          "enabled"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          }
        }
      },
      "PutOutboundDailyRequestBudgetRequest": {
        "type": "object",
        "description": "Set a lower per-integration daily request limit or clear it with null.",
        "required": [
          "daily_request_limit"
        ],
        "properties": {
          "daily_request_limit": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 100000000
          }
        }
      },
      "OutboundIntegrationUsageResponse": {
        "type": "object",
        "description": "Current UTC-day admitted-request count and the effective optional request limit.",
        "required": [
          "daily_request_count",
          "daily_request_limit",
          "usage_date",
          "resets_at"
        ],
        "properties": {
          "daily_request_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "daily_request_limit": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 100000000
          },
          "usage_date": {
            "type": "string",
            "format": "date"
          },
          "resets_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PutOutboundBindingDailyRequestBudgetRequest": {
        "type": "object",
        "description": "Set a lower per-binding daily request limit or clear it with null.",
        "required": [
          "daily_request_limit"
        ],
        "properties": {
          "daily_request_limit": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 100000000
          }
        }
      },
      "OutboundBindingUsageResponse": {
        "type": "object",
        "description": "Current UTC-day admitted-request count and the effective optional binding request limit.",
        "required": [
          "daily_request_count",
          "daily_request_limit",
          "usage_date",
          "resets_at"
        ],
        "properties": {
          "daily_request_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "daily_request_limit": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 100000000
          },
          "usage_date": {
            "type": "string",
            "format": "date"
          },
          "resets_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PutOutboundCredentialRequest": {
        "type": "object",
        "description": "Provider Authorization header value, accepted once and never returned.",
        "required": [
          "authorization"
        ],
        "properties": {
          "authorization": {
            "type": "string",
            "minLength": 1,
            "maxLength": 8192
          }
        }
      },
      "OutboundIntegrationOfferList": {
        "type": "object",
        "description": "Enabled managed integrations this account may bind to its apps.",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutboundIntegrationOffer"
            }
          }
        }
      },
      "OutboundAppBinding": {
        "type": "object",
        "description": "An app's attachment to a managed integration.",
        "required": [
          "integration",
          "app_id",
          "allowed_methods",
          "allowed_path_prefixes",
          "daily_request_limit",
          "created_at"
        ],
        "properties": {
          "integration": {
            "$ref": "#/components/schemas/OutboundIntegrationOffer"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "allowed_methods": {
            "type": "array",
            "description": "App-specific methods, bounded by the integration ceiling.",
            "items": {
              "type": "string"
            }
          },
          "allowed_path_prefixes": {
            "type": "array",
            "description": "App-specific path prefixes, bounded by the integration ceiling.",
            "items": {
              "type": "string"
            }
          },
          "daily_request_limit": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 100000000,
            "description": "Optional per-binding daily admitted-request limit."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "ai_daily_token_limit": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 1,
            "maximum": 100000000000,
            "description": "This app's own UTC-day AI input plus output token limit on an AI integration."
          },
          "ai_requests_per_minute": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 1,
            "maximum": 100000,
            "description": "Admitted calls per UTC minute for this app."
          },
          "ai_tokens_per_minute": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 1,
            "maximum": 1000000000,
            "description": "Settled tokens plus live reservations per UTC minute for this app."
          },
          "ai_allowed_models": {
            "type": [
              "array",
              "null"
            ],
            "description": "Exact model names or prefixes ending in \"*\" this app may call; null allows every model.",
            "items": {
              "type": "string",
              "maxLength": 128
            }
          },
          "ai_max_output_tokens": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 1,
            "maximum": 1000000,
            "description": "Per-request output-token ceiling; added to requests that name none."
          }
        }
      },
      "PutOutboundBindingAIBudgetRequest": {
        "type": "object",
        "description": "Set or clear (null) an app binding's daily AI token limit.",
        "required": [
          "daily_token_limit"
        ],
        "properties": {
          "daily_token_limit": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 1,
            "maximum": 100000000000
          }
        }
      },
      "OutboundAIPriceEntry": {
        "type": "object",
        "description": "Price for model names starting with model_prefix (\"*\" matches any model; the longest prefix wins). Token prices are millicents per million tokens; absent cached, cache-write and input-image prices use the input price and an absent output-image price uses the output price. Media prices are per image, per minute of input audio and per million input characters, and are zero when absent.",
        "required": [
          "model_prefix",
          "input_millicents_per_mtok",
          "output_millicents_per_mtok"
        ],
        "properties": {
          "model_prefix": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "input_millicents_per_mtok": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000000000
          },
          "cached_input_millicents_per_mtok": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000000000
          },
          "cache_write_millicents_per_mtok": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000000000
          },
          "output_millicents_per_mtok": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000000000
          },
          "input_image_millicents_per_mtok": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000000000
          },
          "output_image_millicents_per_mtok": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000000000
          },
          "millicents_per_image": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 10000000,
            "description": "Charged per image when a call reports no output image tokens."
          },
          "millicents_per_audio_minute": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 10000000,
            "description": "Charged per minute of transcribed audio."
          },
          "millicents_per_million_characters": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "Charged per million characters of speech input."
          },
          "millicents_per_video_second": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 10000000,
            "description": "Charged per second of generated video. A model_prefix of <model>@<resolution>, such as veo-3.1-generate-001@4k, prices that resolution apart."
          },
          "millicents_per_web_search": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 10000000,
            "description": "Charged per web search as the provider bills it: per call, query or grounded prompt."
          },
          "millicents_per_file_search": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 10000000,
            "description": "Charged per file search call."
          },
          "millicents_per_code_session_gb": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 10000000,
            "description": "Charged per GB of code-interpreter container memory per session."
          },
          "input_audio_millicents_per_mtok": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "Charged per million uncached audio input tokens; the input price when absent."
          },
          "cached_input_audio_millicents_per_mtok": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "Charged per million cached audio input tokens; the cached input price when absent."
          },
          "output_audio_millicents_per_mtok": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "Charged per million audio output tokens; the output price when absent."
          }
        }
      },
      "PutOutboundAIPricesRequest": {
        "type": "object",
        "description": "Replace an integration's price list. It takes effect immediately; earlier lists stay for costs already settled.",
        "required": [
          "entries"
        ],
        "properties": {
          "entries": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "$ref": "#/components/schemas/OutboundAIPriceEntry"
            }
          }
        }
      },
      "OutboundAIPriceListResponse": {
        "type": "object",
        "description": "The price list in effect; effective_from is null when none was ever set. Models the list does not name are priced from the built-in catalog.",
        "required": [
          "effective_from",
          "entries"
        ],
        "properties": {
          "effective_from": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutboundAIPriceEntry"
            }
          }
        }
      },
      "OutboundAIPriceCatalogResponse": {
        "type": "object",
        "description": "One provider's built-in AI price catalog, generated from LiteLLM's MIT-licensed price data. model_prefix holds the catalog model name.",
        "required": [
          "ai_provider",
          "source",
          "generated",
          "entries"
        ],
        "properties": {
          "ai_provider": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "description": "URL of the price data the catalog was generated from."
          },
          "generated": {
            "type": "string",
            "format": "date"
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency of every catalog price: the billing currency, USD. Absent from responses of older releases."
          },
          "usd_per_eur": {
            "type": "string",
            "deprecated": true,
            "description": "Deprecated: always 1, since the catalog is in US dollars."
          },
          "fx_source": {
            "type": "string",
            "deprecated": true,
            "description": "Deprecated: names no exchange rate."
          },
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutboundAIPriceEntry"
            }
          }
        }
      },
      "OutboundAIUserUsageItem": {
        "type": "object",
        "description": "One end user's UTC-day AI usage on an integration; tokens is input plus output, the amount the per-user token limit counts.",
        "required": [
          "end_user",
          "requests",
          "error_requests",
          "input_tokens",
          "output_tokens",
          "tokens",
          "cost_millicents"
        ],
        "properties": {
          "end_user": {
            "type": "string",
            "maxLength": 64,
            "description": "X-Gregale-AI-User value; \"~other\" collects end users beyond the daily cap."
          },
          "requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "input_tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "output_tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "OutboundAIUserUsageResponse": {
        "type": "object",
        "description": "One UTC day of per-end-user AI usage, most expensive first.",
        "required": [
          "usage_date",
          "user_daily_token_limit",
          "user_daily_cost_limit_millicents",
          "tracked_users",
          "items"
        ],
        "properties": {
          "usage_date": {
            "type": "string",
            "format": "date"
          },
          "user_daily_token_limit": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "user_daily_cost_limit_millicents": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "tracked_users": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Distinct end-user rows of the day, including \"~other\"."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutboundAIUserUsageItem"
            }
          }
        }
      },
      "OutboundAITagUsageItem": {
        "type": "object",
        "description": "One tag's UTC-day AI usage on an integration; tokens is input plus output. A key's tags past the day's cap of distinct tags add to its overflow row, <key>=~other.",
        "required": [
          "tag",
          "requests",
          "error_requests",
          "input_tokens",
          "output_tokens",
          "tokens",
          "cost_millicents",
          "daily_cost_limit_millicents"
        ],
        "properties": {
          "tag": {
            "type": "string",
            "maxLength": 97
          },
          "requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "input_tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "output_tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "daily_cost_limit_millicents": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          }
        }
      },
      "OutboundAITagUsageResponse": {
        "type": "object",
        "description": "One UTC day of AI usage by tag, most expensive first.",
        "required": [
          "usage_date",
          "tracked_tags",
          "items"
        ],
        "properties": {
          "usage_date": {
            "type": "string",
            "format": "date"
          },
          "tracked_tags": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Distinct tag rows of the day, overflow rows included."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutboundAITagUsageItem"
            }
          }
        }
      },
      "OutboundAITagUsageExportRow": {
        "type": "object",
        "description": "One NDJSON line of a tag usage export; CSV rows carry the same fields in this order.",
        "required": [
          "usage_date",
          "tag",
          "requests",
          "error_requests",
          "input_tokens",
          "output_tokens",
          "tokens",
          "cost_millicents"
        ],
        "properties": {
          "usage_date": {
            "type": "string",
            "format": "date"
          },
          "tag": {
            "type": "string",
            "maxLength": 97
          },
          "requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "input_tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "output_tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "OutboundAITagLimit": {
        "type": "object",
        "description": "A UTC-day cost limit on one exact tag.",
        "required": [
          "tag",
          "daily_cost_limit_millicents"
        ],
        "properties": {
          "tag": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_.-]{0,31}=[A-Za-z0-9._:@+/-]{1,64}$"
          },
          "daily_cost_limit_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 1000000000000
          }
        }
      },
      "OutboundAITagLimits": {
        "type": "object",
        "description": "An integration's per-tag daily cost limits, ordered by tag.",
        "required": [
          "limits"
        ],
        "properties": {
          "limits": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutboundAITagLimit"
            }
          }
        }
      },
      "PutOutboundAITagLimitsRequest": {
        "type": "object",
        "description": "The complete list of tag limits; an empty list removes them.",
        "required": [
          "limits"
        ],
        "properties": {
          "limits": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/OutboundAITagLimit"
            }
          }
        }
      },
      "OutboundAIUserUsageExportRow": {
        "description": "One NDJSON line of a per-end-user usage export; CSV rows carry the same fields in this order.",
        "allOf": [
          {
            "type": "object",
            "required": [
              "usage_date"
            ],
            "properties": {
              "usage_date": {
                "type": "string",
                "format": "date"
              }
            }
          },
          {
            "$ref": "#/components/schemas/OutboundAIUserUsageItem"
          }
        ]
      },
      "OutboundAIRouteTarget": {
        "type": "object",
        "description": "One ordered fallback step; model replaces the request's \"model\" for this target.",
        "required": [
          "integration_id"
        ],
        "properties": {
          "integration_id": {
            "type": "string",
            "format": "uuid"
          },
          "model": {
            "type": "string",
            "maxLength": 128
          },
          "weight": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "A weighted route's share of first attempts for this target; 0 makes it a fallback only."
          }
        }
      },
      "OutboundAIRoute": {
        "type": "object",
        "description": "An ordered list of managed AI integrations. Apps call $GREGALE_OUTBOUND_URL/r/{id}/{provider path}. An openai-format route accepts OpenAI chat completions and embeddings and translates them for each target's provider.",
        "required": [
          "id",
          "name",
          "format",
          "targets",
          "created_at",
          "updated_at",
          "strategy"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "format": {
            "type": "string",
            "enum": [
              "native",
              "openai"
            ]
          },
          "targets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutboundAIRouteTarget"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "strategy": {
            "type": "string",
            "enum": [
              "ordered",
              "weighted",
              "latency",
              "cost"
            ],
            "description": "How a call picks its first target."
          },
          "max_ttfb_ms": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 600000,
            "description": "A cost route's latency target, or null."
          },
          "canary": {
            "description": "The route's model canary, or null.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/OutboundAIRouteCanary"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "OutboundAIRouteCanary": {
        "type": "object",
        "description": "A route's model canary. target is the 1-based route position tried first by percent of the route's calls, chosen per X-Gregale-AI-Session, else X-Gregale-AI-User, else at random. The outbound gateway rolls the canary back when, after min_calls canary attempts in the window, its error rate exceeds the first target's by more than max_error_rate_increase percentage points, or its mean time to first byte by more than max_latency_increase_percent.",
        "required": [
          "target",
          "percent",
          "max_error_rate_increase",
          "max_latency_increase_percent",
          "min_calls",
          "window_minutes",
          "state",
          "reason",
          "started_at",
          "decided_at"
        ],
        "properties": {
          "target": {
            "type": "integer",
            "minimum": 2,
            "maximum": 5
          },
          "percent": {
            "type": "integer",
            "minimum": 1,
            "maximum": 50
          },
          "max_error_rate_increase": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "max_latency_increase_percent": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 1000
          },
          "min_calls": {
            "type": "integer",
            "minimum": 10,
            "maximum": 100000
          },
          "window_minutes": {
            "type": "integer",
            "minimum": 5,
            "maximum": 1440
          },
          "state": {
            "type": "string",
            "enum": [
              "active",
              "rolled_back"
            ]
          },
          "reason": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "error_rate",
                  "latency"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "decided_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "PutOutboundAIRouteCanaryRequest": {
        "type": "object",
        "description": "Start or replace a route's model canary. Omitted margins take their defaults: 5 error-rate points, 50 calls, 30 minutes, and no latency margin.",
        "required": [
          "target",
          "percent"
        ],
        "properties": {
          "target": {
            "type": "integer",
            "minimum": 2,
            "maximum": 5,
            "description": "The 1-based route position tried first."
          },
          "percent": {
            "type": "integer",
            "minimum": 1,
            "maximum": 50
          },
          "max_error_rate_increase": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "max_latency_increase_percent": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000
          },
          "min_calls": {
            "type": "integer",
            "minimum": 10,
            "maximum": 100000
          },
          "window_minutes": {
            "type": "integer",
            "minimum": 5,
            "maximum": 1440
          }
        }
      },
      "OutboundAIRouteTargetStats": {
        "type": "object",
        "description": "One target's settled attempts in a canary's or a strategy's window. Errors are attempts with a provider status of 400 or above; mean_ttfb_ms averages successful attempts that received a first byte, and mean_cost_millicents is the cost per successful attempt; each is null without one.",
        "required": [
          "target",
          "calls",
          "errors",
          "error_rate",
          "mean_ttfb_ms",
          "cost_millicents",
          "mean_cost_millicents"
        ],
        "properties": {
          "target": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5
          },
          "calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "errors": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_rate": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "mean_ttfb_ms": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          },
          "cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "mean_cost_millicents": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "OutboundAIRouteStats": {
        "type": "object",
        "description": "Each target's settled attempts since window_start, the window latency and cost routes judge.",
        "required": [
          "strategy",
          "window_start",
          "targets"
        ],
        "properties": {
          "strategy": {
            "type": "string",
            "enum": [
              "ordered",
              "weighted",
              "latency",
              "cost"
            ]
          },
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "targets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutboundAIRouteTargetStats"
            }
          }
        }
      },
      "OutboundAIRouteCanaryStatus": {
        "type": "object",
        "description": "A canary with the route's first target's and its own counts since window_start.",
        "required": [
          "canary",
          "window_start",
          "baseline",
          "canary_stats"
        ],
        "properties": {
          "canary": {
            "$ref": "#/components/schemas/OutboundAIRouteCanary"
          },
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "baseline": {
            "$ref": "#/components/schemas/OutboundAIRouteTargetStats"
          },
          "canary_stats": {
            "$ref": "#/components/schemas/OutboundAIRouteTargetStats"
          }
        }
      },
      "CreateOutboundAIEvaluationRequest": {
        "type": "object",
        "description": "Evaluate a route target against the route's first target. Omitted settings take their defaults: a sample of 20 and a max_loss_rate of 20. canary, when set, must name the same target and starts if the evaluation passes.",
        "required": [
          "target",
          "judge_integration_id",
          "judge_model"
        ],
        "properties": {
          "target": {
            "type": "integer",
            "minimum": 2,
            "maximum": 5,
            "description": "The 1-based route position evaluated."
          },
          "judge_integration_id": {
            "type": "string",
            "format": "uuid",
            "description": "One of the account's enabled AI integrations."
          },
          "judge_model": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "sample_size": {
            "type": "integer",
            "minimum": 1,
            "maximum": 50
          },
          "max_loss_rate": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "canary": {
            "$ref": "#/components/schemas/PutOutboundAIRouteCanaryRequest"
          }
        }
      },
      "OutboundAIEvaluationTargetStats": {
        "type": "object",
        "description": "One side's total cost over the sample and mean time to first byte over the calls that reported one.",
        "required": [
          "cost_millicents",
          "mean_ttfb_ms"
        ],
        "properties": {
          "cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "mean_ttfb_ms": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "OutboundAIEvaluationItem": {
        "type": "object",
        "description": "One sample: a captured call of the first target and the candidate's replay of it. A judge error counts as a tie. Output texts are redacted and cut to 4 KiB.",
        "required": [
          "log_id",
          "verdict",
          "candidate_status",
          "candidate_cost_millicents",
          "candidate_ttfb_ms",
          "baseline_cost_millicents",
          "baseline_ttfb_ms",
          "baseline_output_text",
          "candidate_output_text"
        ],
        "properties": {
          "log_id": {
            "type": "string",
            "format": "uuid"
          },
          "verdict": {
            "type": "string",
            "enum": [
              "win",
              "tie",
              "loss",
              "candidate_error",
              "judge_error"
            ]
          },
          "candidate_status": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 100,
            "maximum": 599
          },
          "candidate_cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "candidate_ttfb_ms": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          },
          "baseline_cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "baseline_ttfb_ms": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          },
          "baseline_output_text": {
            "type": "string"
          },
          "candidate_output_text": {
            "type": "string"
          }
        }
      },
      "OutboundAIEvaluation": {
        "type": "object",
        "description": "An evaluation of a route target. verdict is set when state is done, error_code when it is failed. items are returned only when one evaluation is read.",
        "required": [
          "id",
          "route_id",
          "target",
          "judge_integration_id",
          "judge_model",
          "sample_size",
          "max_loss_rate",
          "canary",
          "state",
          "verdict",
          "error_code",
          "samples",
          "wins",
          "ties",
          "losses",
          "candidate_errors",
          "judge_errors",
          "baseline",
          "candidate",
          "canary_started",
          "created_at",
          "started_at",
          "finished_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "route_id": {
            "type": "string",
            "format": "uuid"
          },
          "target": {
            "type": "integer",
            "minimum": 2,
            "maximum": 5
          },
          "judge_integration_id": {
            "type": "string",
            "format": "uuid"
          },
          "judge_model": {
            "type": "string"
          },
          "sample_size": {
            "type": "integer",
            "minimum": 1,
            "maximum": 50
          },
          "max_loss_rate": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "canary": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PutOutboundAIRouteCanaryRequest"
              },
              {
                "type": "null"
              }
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "running",
              "done",
              "failed"
            ]
          },
          "verdict": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "pass",
                  "fail"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "error_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "samples": {
            "type": "integer",
            "minimum": 0
          },
          "wins": {
            "type": "integer",
            "minimum": 0
          },
          "ties": {
            "type": "integer",
            "minimum": 0
          },
          "losses": {
            "type": "integer",
            "minimum": 0
          },
          "candidate_errors": {
            "type": "integer",
            "minimum": 0
          },
          "judge_errors": {
            "type": "integer",
            "minimum": 0
          },
          "baseline": {
            "$ref": "#/components/schemas/OutboundAIEvaluationTargetStats"
          },
          "candidate": {
            "$ref": "#/components/schemas/OutboundAIEvaluationTargetStats"
          },
          "canary_started": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutboundAIEvaluationItem"
            }
          },
          "content_withheld": {
            "type": "boolean",
            "description": "The items' output texts were left out; reading them needs admin or secrets:read."
          }
        }
      },
      "OutboundAIEvaluationList": {
        "type": "object",
        "description": "A route's latest evaluations, newest first.",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutboundAIEvaluation"
            }
          }
        }
      },
      "CreateOutboundAIAccessTokenRequest": {
        "type": "object",
        "description": "Issue an access token for an app. expires_in_hours defaults to 168 (7 days). integration_ids narrows the token to listed AI integrations bound to the app; empty allows every AI integration bound to the app and the account's routes.",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$"
          },
          "expires_in_hours": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2160
          },
          "integration_ids": {
            "type": "array",
            "maxItems": 32,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      },
      "OutboundAIAccessToken": {
        "type": "object",
        "description": "An issued access token. prefix is the token's first 12 characters, to recognise it.",
        "required": [
          "id",
          "name",
          "app_id",
          "prefix",
          "integration_ids",
          "expires_at",
          "created_at",
          "last_used_at",
          "revoked_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "prefix": {
            "type": "string"
          },
          "integration_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_used_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "revoked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "AIDeploymentUsage": {
        "type": "object",
        "description": "One deployment's AI gateway calls over the last 14 days.",
        "required": [
          "deployment_id",
          "first_call_at",
          "last_call_at",
          "calls",
          "error_calls",
          "flagged_calls",
          "cost_millicents",
          "input_tokens",
          "output_tokens",
          "error_rate",
          "flagged_rate",
          "cost_per_call_millicents"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "first_call_at": {
            "type": "string",
            "format": "date-time",
            "description": "The UTC minute of its first call in the window."
          },
          "last_call_at": {
            "type": "string",
            "format": "date-time",
            "description": "The UTC minute of its latest call."
          },
          "calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Calls the provider failed."
          },
          "flagged_calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Calls whose answer had a quality flag."
          },
          "cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "input_tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "output_tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_rate": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "flagged_rate": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "cost_per_call_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "mean_ttfb_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Mean time to first byte; omitted when no call had one."
          }
        }
      },
      "AIDeploymentUsageList": {
        "type": "object",
        "description": "An app's deployments with AI gateway calls, latest call first.",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/AIDeploymentUsage"
            }
          }
        }
      },
      "OutboundAIAccessTokenList": {
        "type": "object",
        "description": "An app's access tokens, newest first.",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutboundAIAccessToken"
            }
          }
        }
      },
      "CreatedOutboundAIAccessToken": {
        "type": "object",
        "description": "A new token with its secret, which is shown only once.",
        "required": [
          "access_token",
          "token"
        ],
        "properties": {
          "access_token": {
            "$ref": "#/components/schemas/OutboundAIAccessToken"
          },
          "token": {
            "type": "string",
            "pattern": "^ggai_[A-Za-z0-9_-]{43}$"
          }
        }
      },
      "OutboundAIRouteList": {
        "type": "object",
        "description": "The account's AI routes.",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutboundAIRoute"
            }
          }
        }
      },
      "CreateOutboundAIRouteRequest": {
        "type": "object",
        "description": "A new AI route with a DNS-label name, an optional format and 1 to 5 ordered targets.",
        "required": [
          "name",
          "targets"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$"
          },
          "format": {
            "type": "string",
            "enum": [
              "native",
              "openai"
            ],
            "description": "native (default) needs one ai_provider across targets; openai accepts openai, azure_openai, anthropic, gemini, bedrock and vertex targets, every target but openai must name its model, and a vertex target's integration must name one /v1/projects/{project}/locations/{location} path prefix."
          },
          "targets": {
            "type": "array",
            "minItems": 1,
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/OutboundAIRouteTarget"
            }
          },
          "strategy": {
            "type": "string",
            "enum": [
              "ordered",
              "weighted",
              "latency",
              "cost"
            ],
            "description": "How a call picks its first target. ordered (the default) follows route order; weighted draws by target weight; latency picks the healthy target with the lowest recent mean time to first byte; cost picks the healthy target with the lowest recent mean cost per call. The other targets follow as fallbacks."
          },
          "max_ttfb_ms": {
            "type": "integer",
            "minimum": 1,
            "maximum": 600000,
            "description": "A cost route's latency target; targets slower on average go after those within it."
          }
        }
      },
      "PutOutboundAIRouteTargetsRequest": {
        "type": "object",
        "description": "The complete ordered target list that replaces an AI route's targets, with its strategy (default ordered). New targets end the route's canary and reset its targets' recent attempts.",
        "required": [
          "targets"
        ],
        "properties": {
          "targets": {
            "type": "array",
            "minItems": 1,
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/OutboundAIRouteTarget"
            }
          },
          "strategy": {
            "type": "string",
            "enum": [
              "ordered",
              "weighted",
              "latency",
              "cost"
            ],
            "description": "The route's strategy from now on, as on creation; omitted means ordered."
          },
          "max_ttfb_ms": {
            "type": "integer",
            "minimum": 1,
            "maximum": 600000,
            "description": "The cost route's latency target from now on, as on creation; omitted means none."
          }
        }
      },
      "PutOutboundBindingAIGuardrailsRequest": {
        "type": "object",
        "description": "Replace an app's AI guardrails on one integration. Null fields remove that guardrail.",
        "properties": {
          "requests_per_minute": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 1,
            "maximum": 100000
          },
          "tokens_per_minute": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 1,
            "maximum": 1000000000
          },
          "allowed_models": {
            "type": [
              "array",
              "null"
            ],
            "minItems": 1,
            "maxItems": 32,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          "max_output_tokens": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 1,
            "maximum": 1000000
          }
        }
      },
      "OutboundCredentialKey": {
        "type": "object",
        "description": "One extra provider key of an integration's pool. The value is write-only.",
        "required": [
          "id",
          "label",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "label": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OutboundCredentialKeyList": {
        "type": "object",
        "description": "An integration's extra provider keys, oldest first; values are never returned.",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutboundCredentialKey"
            }
          }
        }
      },
      "CreateOutboundCredentialKeyRequest": {
        "type": "object",
        "description": "An extra provider key to seal for the outbound gateway, with a DNS-label label.",
        "required": [
          "label",
          "authorization"
        ],
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z0-9]([a-z0-9-]{0,62}[a-z0-9])?$"
          },
          "authorization": {
            "type": "string",
            "minLength": 1,
            "maxLength": 8192,
            "description": "Same format as the integration's primary credential; sealed for the outbound gateway and never returned."
          }
        }
      },
      "OutboundAIBudgetAlert": {
        "type": "object",
        "description": "The first settlement that reached a budget threshold in its period. limit and used are tokens for token budgets and millicents for cost budgets.",
        "required": [
          "id",
          "integration_id",
          "budget",
          "app_id",
          "end_user",
          "period_start",
          "threshold_percent",
          "limit",
          "used",
          "crossed_at",
          "tag"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "integration_id": {
            "type": "string",
            "format": "uuid"
          },
          "budget": {
            "type": "string",
            "enum": [
              "daily_tokens",
              "app_daily_tokens",
              "daily_cost",
              "monthly_cost",
              "user_daily_tokens",
              "user_daily_cost",
              "tag_daily_cost"
            ]
          },
          "app_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "end_user": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The end user of a user_daily_tokens or user_daily_cost alert."
          },
          "period_start": {
            "type": "string",
            "format": "date"
          },
          "threshold_percent": {
            "type": "integer",
            "format": "int32",
            "enum": [
              80,
              100
            ]
          },
          "limit": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "used": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "crossed_at": {
            "type": "string",
            "format": "date-time"
          },
          "tag": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 97,
            "description": "The tag of a tag_daily_cost alert."
          }
        }
      },
      "OutboundAIBudgetAlertList": {
        "type": "object",
        "description": "An integration's AI budget alerts, newest first.",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutboundAIBudgetAlert"
            }
          }
        }
      },
      "OutboundAIRequestLogEntry": {
        "type": "object",
        "description": "One settled AI call's metadata. Its bodies are kept only when the integration captures content.",
        "required": [
          "id",
          "created_at",
          "caller",
          "route_id",
          "model",
          "status",
          "outcome",
          "input_tokens",
          "cached_input_tokens",
          "cache_write_tokens",
          "output_tokens",
          "cost_millicents",
          "duration_ms",
          "ttfb_ms",
          "attempts",
          "end_user",
          "content_captured",
          "tags"
        ],
        "properties": {
          "quality_flags": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "type": "string",
              "enum": [
                "truncated",
                "refused",
                "empty",
                "invalid_json",
                "tool_error"
              ]
            },
            "description": "What went wrong with the answer."
          },
          "feedback": {
            "type": "string",
            "enum": [
              "good",
              "bad"
            ],
            "description": "The call's rating."
          },
          "feedback_label": {
            "type": "string",
            "maxLength": 32,
            "pattern": "^[a-z][a-z0-9_.-]{0,31}$",
            "description": "The rating's label."
          },
          "evaluation_score": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 5,
            "description": "The online evaluation's score."
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "caller": {
            "type": "string",
            "description": "App UUID, or \"runs\"."
          },
          "route_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "model": {
            "type": "string"
          },
          "status": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599
          },
          "outcome": {
            "type": "string",
            "enum": [
              "known",
              "unknown",
              "error"
            ]
          },
          "input_tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cached_input_tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cache_write_tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "output_tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "duration_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "ttfb_ms": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          },
          "attempts": {
            "type": "integer",
            "minimum": 0
          },
          "end_user": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The call's X-Gregale-AI-User value."
          },
          "content_captured": {
            "type": "boolean",
            "description": "Whether the call's bodies can be read from its content endpoint."
          },
          "tags": {
            "type": "array",
            "maxItems": 5,
            "description": "The call's X-Gregale-AI-Tags as key=value, sorted by key.",
            "items": {
              "type": "string",
              "maxLength": 97
            }
          },
          "trace_id": {
            "type": "string",
            "maxLength": 64,
            "description": "The call's AI trace, when the integration records traces."
          },
          "tool_calls": {
            "type": "array",
            "maxItems": 16,
            "description": "The names of the tools the call's response requested, in order.",
            "items": {
              "type": "string",
              "maxLength": 64
            }
          }
        }
      },
      "OutboundAIContentBody": {
        "type": "object",
        "description": "The start of one captured body.",
        "required": [
          "body",
          "encoding",
          "truncated",
          "content_type"
        ],
        "properties": {
          "body": {
            "type": "string",
            "description": "The captured bytes as text, or base64 when they are not UTF-8."
          },
          "encoding": {
            "type": "string",
            "enum": [
              "utf-8",
              "base64"
            ]
          },
          "truncated": {
            "type": "boolean",
            "description": "True when the body was longer than the 32 KiB kept, or streamed without buffering."
          },
          "content_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "The response Content-Type; null for requests."
          }
        }
      },
      "OutboundAIRequestContent": {
        "type": "object",
        "description": "One logged AI call's captured bodies as the gateway sent them to the provider and read them back; never headers. Personal data and secrets are redacted.",
        "required": [
          "request_id",
          "created_at",
          "request_path",
          "request",
          "response"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "request_path": {
            "type": [
              "string",
              "null"
            ],
            "description": "The provider path of the call; null for older captures."
          },
          "request": {
            "$ref": "#/components/schemas/OutboundAIContentBody"
          },
          "response": {
            "$ref": "#/components/schemas/OutboundAIContentBody"
          }
        }
      },
      "OutboundAIContentPolicy": {
        "type": "object",
        "description": "An integration's content guardrails. Each detector is off, redacts its findings before the request reaches the provider, or blocks the request. A request containing a blocked term, compared without case, is blocked. The gateway checks the string values of JSON bodies and the text fields of forms.",
        "required": [
          "email",
          "payment_card",
          "iban",
          "secret",
          "blocked_terms"
        ],
        "properties": {
          "email": {
            "type": "string",
            "enum": [
              "",
              "off",
              "redact",
              "block"
            ]
          },
          "payment_card": {
            "type": "string",
            "enum": [
              "",
              "off",
              "redact",
              "block"
            ]
          },
          "iban": {
            "type": "string",
            "enum": [
              "",
              "off",
              "redact",
              "block"
            ]
          },
          "secret": {
            "type": "string",
            "enum": [
              "",
              "off",
              "redact",
              "block"
            ],
            "description": "API keys, tokens and private keys."
          },
          "blocked_terms": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          "moderation": {
            "$ref": "#/components/schemas/OutboundAIModeration"
          },
          "response": {
            "$ref": "#/components/schemas/OutboundAIResponsePolicy"
          }
        }
      },
      "OutboundAIResponsePolicy": {
        "type": "object",
        "description": "Checks of the text a model sends back, before the caller sees it. The detectors redact or block as on requests; blocked_terms block refuses a response that contains one of the policy's blocked terms; moderation runs the policy's moderation check on the response, without prompt_injection, and flags or blocks it. A refused whole response answers 422 outbound_ai_response_blocked or outbound_ai_response_flagged; a refused stream ends with an error event. Tool call arguments and reasoning text are not checked.",
        "properties": {
          "email": {
            "type": "string",
            "enum": [
              "",
              "off",
              "redact",
              "block"
            ]
          },
          "payment_card": {
            "type": "string",
            "enum": [
              "",
              "off",
              "redact",
              "block"
            ]
          },
          "iban": {
            "type": "string",
            "enum": [
              "",
              "off",
              "redact",
              "block"
            ]
          },
          "secret": {
            "type": "string",
            "enum": [
              "",
              "off",
              "redact",
              "block"
            ]
          },
          "blocked_terms": {
            "type": "string",
            "enum": [
              "",
              "off",
              "block"
            ]
          },
          "moderation": {
            "type": "string",
            "enum": [
              "",
              "off",
              "flag",
              "block"
            ],
            "description": "Uses the policy's moderation check settings, which must be complete even while moderation.action is off."
          }
        }
      },
      "OutboundAIModeration": {
        "type": "object",
        "description": "A model-based check of the request's user, tool and input text before the provider call. It runs through another of the account's AI integrations and is billed by that integration's provider: openai_moderation calls OpenAI's /v1/moderations on an OpenAI integration; classifier asks a chat model which categories apply. flag lets the call through and names the categories in X-Gregale-AI-Moderation; block refuses it with 400 outbound_ai_content_flagged. on_error decides what a failed check does; block answers 503 outbound_ai_moderation_unavailable.",
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "",
              "off",
              "flag",
              "block"
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "openai_moderation",
              "classifier"
            ]
          },
          "integration_id": {
            "type": "string",
            "format": "uuid"
          },
          "model": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "description": "Required for classifier."
          },
          "categories": {
            "type": "array",
            "maxItems": 7,
            "items": {
              "type": "string",
              "enum": [
                "prompt_injection",
                "harassment",
                "hate",
                "self_harm",
                "sexual",
                "violence",
                "illicit"
              ]
            }
          },
          "on_error": {
            "type": "string",
            "enum": [
              "",
              "allow",
              "block"
            ]
          }
        }
      },
      "OutboundAIReplayTarget": {
        "type": "object",
        "description": "One integration a captured call is replayed on; a target on another provider than the captured call's needs a model.",
        "required": [
          "integration_id"
        ],
        "properties": {
          "integration_id": {
            "type": "string",
            "format": "uuid"
          },
          "model": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      },
      "CreateOutboundAIReplayRequest": {
        "type": "object",
        "description": "Replay a captured call on up to 5 targets.",
        "required": [
          "targets"
        ],
        "properties": {
          "targets": {
            "type": "array",
            "minItems": 1,
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/OutboundAIReplayTarget"
            }
          }
        }
      },
      "OutboundAIReplaySource": {
        "type": "object",
        "description": "The captured call a replay resends.",
        "required": [
          "model",
          "status",
          "input_tokens",
          "output_tokens",
          "cost_millicents",
          "duration_ms",
          "ttfb_ms",
          "output_text"
        ],
        "properties": {
          "model": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "input_tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "output_tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "duration_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "ttfb_ms": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          },
          "output_text": {
            "type": [
              "string",
              "null"
            ],
            "description": "Text read from the captured response."
          }
        }
      },
      "OutboundAIReplayResult": {
        "type": "object",
        "description": "One target's replayed call. status is null without a response and outcome null when the call was refused before it reached the provider.",
        "required": [
          "integration_id",
          "model",
          "status",
          "outcome",
          "error_code",
          "input_tokens",
          "output_tokens",
          "cost_millicents",
          "duration_ms",
          "ttfb_ms",
          "output_text",
          "response"
        ],
        "properties": {
          "integration_id": {
            "type": "string",
            "format": "uuid"
          },
          "model": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": [
              "integer",
              "null"
            ]
          },
          "outcome": {
            "type": [
              "string",
              "null"
            ],
            "description": "known, unknown or error; null when the call did not settle."
          },
          "error_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "Problem code of a refused or failed call."
          },
          "input_tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "output_tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "duration_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "ttfb_ms": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          },
          "output_text": {
            "type": "string",
            "maxLength": 4096,
            "description": "Up to 4 KiB of the response text, redacted."
          },
          "response": {
            "$ref": "#/components/schemas/OutboundAIContentBody"
          }
        }
      },
      "OutboundAIReplay": {
        "type": "object",
        "description": "A replay of one captured call and, once done, its results in target order.",
        "required": [
          "id",
          "integration_id",
          "request_id",
          "state",
          "error_code",
          "created_at",
          "finished_at",
          "targets",
          "source",
          "results"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "integration_id": {
            "type": "string",
            "format": "uuid"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "running",
              "done",
              "failed"
            ]
          },
          "error_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "targets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutboundAIReplayTarget"
            }
          },
          "source": {
            "$ref": "#/components/schemas/OutboundAIReplaySource"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutboundAIReplayResult"
            }
          },
          "content_withheld": {
            "type": "boolean",
            "description": "The source's and results' answers were left out; reading them needs admin or secrets:read."
          }
        }
      },
      "OutboundAIRequestLogList": {
        "type": "object",
        "description": "One newest-first page of the AI request log.",
        "required": [
          "items",
          "next_before"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutboundAIRequestLogEntry"
            }
          },
          "next_before": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Pass as before to read the next page; null on the last page."
          }
        }
      },
      "OutboundAITrace": {
        "type": "object",
        "description": "One AI trace's totals. app_id and end_user are its first call's; repeated_tool_calls is its current streak of calls that requested the same tools with the same arguments.",
        "required": [
          "trace_id",
          "app_id",
          "end_user",
          "first_at",
          "last_at",
          "calls",
          "error_calls",
          "usage_unknown_calls",
          "input_tokens",
          "output_tokens",
          "cost_millicents",
          "tool_calls",
          "repeated_tool_calls",
          "models"
        ],
        "properties": {
          "trace_id": {
            "type": "string",
            "maxLength": 64
          },
          "app_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "end_user": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64
          },
          "first_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_at": {
            "type": "string",
            "format": "date-time"
          },
          "calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "usage_unknown_calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "input_tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "output_tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "tool_calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Tool calls the trace's responses requested."
          },
          "repeated_tool_calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "models": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "type": "string"
            }
          }
        }
      },
      "OutboundAIOnlineEvaluation": {
        "type": "object",
        "description": "Score sample_percent of answered app calls from 1 to 5 with judge_model through judge_integration_id, one of the account's AI integrations, metered under the caller evaluation.",
        "required": [
          "sample_percent",
          "judge_integration_id",
          "judge_model"
        ],
        "properties": {
          "sample_percent": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 100
          },
          "judge_integration_id": {
            "type": "string",
            "format": "uuid"
          },
          "judge_model": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "rubric": {
            "type": "string",
            "maxLength": 1000,
            "description": "What a good answer does for this app",
            "given to the judge.": null
          }
        }
      },
      "PutOutboundAIFeedbackRequest": {
        "type": "object",
        "description": "A rating of one logged call. A later rating replaces the earlier one.",
        "required": [
          "rating"
        ],
        "properties": {
          "rating": {
            "type": "string",
            "enum": [
              "good",
              "bad"
            ]
          },
          "label": {
            "type": "string",
            "maxLength": 32,
            "pattern": "^[a-z][a-z0-9_.-]{0,31}$"
          }
        }
      },
      "OutboundAIQualityAlert": {
        "type": "object",
        "description": "One drift the check found: a model's metric today against its previous 7 days. Rates are basis points of answered calls (of rated calls for bad_feedback); evaluation_score is the mean score in hundredths.",
        "required": [
          "id",
          "integration_id",
          "usage_date",
          "model",
          "metric",
          "current_value",
          "baseline_value",
          "current_count",
          "baseline_count",
          "detected_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "integration_id": {
            "type": "string",
            "format": "uuid"
          },
          "usage_date": {
            "type": "string",
            "format": "date"
          },
          "model": {
            "type": "string",
            "maxLength": 200
          },
          "metric": {
            "type": "string",
            "enum": [
              "truncated",
              "refused",
              "empty",
              "invalid_json",
              "tool_error",
              "bad_feedback",
              "evaluation_score"
            ]
          },
          "current_value": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "baseline_value": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "current_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "baseline_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "detected_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OutboundAIQualityAlertList": {
        "type": "object",
        "description": "A page of an integration's AI quality drift alerts, newest first.",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OutboundAIQualityAlert"
            }
          }
        }
      },
      "OutboundAITraceList": {
        "type": "object",
        "description": "One page of AI traces, newest last call first.",
        "required": [
          "items",
          "next_before"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutboundAITrace"
            }
          },
          "next_before": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "The last page item's last call, to pass as before for older traces; null on the last page."
          }
        }
      },
      "OutboundAITraceCall": {
        "type": "object",
        "description": "One logged call of an AI trace.",
        "required": [
          "id",
          "created_at",
          "caller",
          "model",
          "status",
          "outcome",
          "input_tokens",
          "output_tokens",
          "cost_millicents",
          "duration_ms",
          "ttfb_ms",
          "tool_calls"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "caller": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "status": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599
          },
          "outcome": {
            "type": "string",
            "enum": [
              "known",
              "unknown",
              "error"
            ]
          },
          "input_tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "output_tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "duration_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "ttfb_ms": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          },
          "tool_calls": {
            "type": "array",
            "maxItems": 16,
            "description": "The names of the tools the call's response requested.",
            "items": {
              "type": "string",
              "maxLength": 64
            }
          }
        }
      },
      "OutboundAITraceResponse": {
        "type": "object",
        "description": "One AI trace with its logged calls, oldest first.",
        "required": [
          "trace",
          "calls",
          "calls_truncated"
        ],
        "properties": {
          "trace": {
            "$ref": "#/components/schemas/OutboundAITrace"
          },
          "calls": {
            "type": "array",
            "maxItems": 500,
            "items": {
              "$ref": "#/components/schemas/OutboundAITraceCall"
            }
          },
          "calls_truncated": {
            "type": "boolean",
            "description": "Whether the trace logged more calls than were returned."
          }
        }
      },
      "UpdateOutboundBindingPolicyRequest": {
        "type": "object",
        "description": "Explicit nonempty method and path subsets for a bound app.",
        "required": [
          "allowed_methods",
          "allowed_path_prefixes"
        ],
        "properties": {
          "allowed_methods": {
            "type": "array",
            "minItems": 1,
            "maxItems": 6,
            "items": {
              "type": "string"
            }
          },
          "allowed_path_prefixes": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "items": {
              "type": "string"
            }
          }
        }
      },
      "OutboundAppBindingList": {
        "type": "object",
        "description": "Customer-owned outbound attachments for one app.",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutboundAppBinding"
            }
          }
        }
      },
      "PreflightLevel": {
        "type": "string",
        "enum": [
          "green",
          "amber",
          "red"
        ],
        "description": "`green` satisfies the container contract as written, `amber` needs a\ndeclared change, `red` cannot run.\n"
      },
      "PreflightSource": {
        "type": "object",
        "description": "A validated public GitHub repository reference. Every field has passed\nthe character and length rules, so it is safe to interpolate upstream.\n",
        "required": [
          "owner",
          "repo"
        ],
        "properties": {
          "owner": {
            "type": "string"
          },
          "repo": {
            "type": "string"
          },
          "ref": {
            "type": "string",
            "description": "Branch or tag parsed from the input; empty means the default branch."
          }
        }
      },
      "PreflightFinding": {
        "type": "object",
        "description": "One actionable observation about the source. `detail` says what was\nobserved; `remedy` says what to change about it.\n",
        "required": [
          "code",
          "level",
          "title",
          "detail"
        ],
        "properties": {
          "code": {
            "type": "string",
            "description": "Stable machine-readable finding code."
          },
          "level": {
            "$ref": "#/components/schemas/PreflightLevel"
          },
          "title": {
            "type": "string"
          },
          "detail": {
            "type": "string",
            "description": "What was observed in the source."
          },
          "remedy": {
            "type": "string",
            "description": "What to change. Empty for informational findings."
          },
          "sources": {
            "type": "array",
            "description": "Repository-relative paths the finding came from. Never file contents.",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "PreflightProfile": {
        "type": "object",
        "description": "The run contract inferred from the source tree.",
        "properties": {
          "version": {
            "type": "string"
          },
          "framework": {
            "type": "string"
          },
          "framework_version": {
            "type": "string"
          },
          "package_manager": {
            "type": "string"
          },
          "dockerfile_path": {
            "type": "string"
          },
          "start_command": {
            "type": "string"
          },
          "port": {
            "type": "integer"
          },
          "health_path": {
            "type": "string"
          },
          "config_file": {
            "type": "string"
          },
          "inferred": {
            "type": "boolean"
          }
        }
      },
      "PreflightVerdict": {
        "type": "object",
        "description": "The assessed result for one source tree: a headline level, the findings\nbehind it, and the run contract that was inferred.\n",
        "required": [
          "level",
          "profile"
        ],
        "properties": {
          "level": {
            "$ref": "#/components/schemas/PreflightLevel"
          },
          "findings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PreflightFinding"
            }
          },
          "profile": {
            "$ref": "#/components/schemas/PreflightProfile"
          }
        }
      },
      "PreflightPlanBudget": {
        "type": "object",
        "description": "What one plan includes, expressed as running time. Preflight does not\nestimate an app's memory use, so it reports each tier's allowance\nrather than recommending one.\n",
        "required": [
          "plan",
          "ram_mb",
          "billed_ram_mb",
          "included_running_minutes",
          "included_gb_hours",
          "price_millicents"
        ],
        "properties": {
          "plan": {
            "type": "string"
          },
          "ram_mb": {
            "type": "integer"
          },
          "billed_ram_mb": {
            "type": "integer",
            "description": "Plan RAM plus the fixed per-VM overhead."
          },
          "included_running_minutes": {
            "type": "integer",
            "description": "The included allowance as wall-clock running time at this plan's billed RAM."
          },
          "included_gb_hours": {
            "type": "integer"
          },
          "price_millicents": {
            "type": "integer",
            "format": "int64",
            "description": "Monthly subscription price in millicents."
          },
          "overage_millicents_per_gb_hour": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "PreflightReport": {
        "type": "object",
        "description": "One complete preflight answer, pinned to the commit it was computed\nfrom so a permalink always re-renders the same verdict.\n",
        "required": [
          "source",
          "commit_sha",
          "verdict",
          "plan_budgets",
          "checked_at"
        ],
        "properties": {
          "source": {
            "$ref": "#/components/schemas/PreflightSource"
          },
          "commit_sha": {
            "type": "string",
            "description": "The commit the verdict was computed from."
          },
          "verdict": {
            "$ref": "#/components/schemas/PreflightVerdict"
          },
          "plan_budgets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PreflightPlanBudget"
            }
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "StatusUptimeBucket": {
        "description": "Daily platform-availability point. Successful and total count available and observed complete five-minute platform intervals; customer workload outcomes are excluded.",
        "type": "object",
        "required": [
          "date",
          "uptime_pct",
          "successful",
          "total"
        ],
        "properties": {
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "uptime_pct": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 100
          },
          "successful": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Complete five-minute platform intervals that were available."
          },
          "total": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Complete five-minute platform intervals with telemetry."
          }
        }
      },
      "StatusIncident": {
        "description": "Public operator-authored status incident.",
        "type": "object",
        "required": [
          "started_at",
          "resolved_at",
          "severity",
          "summary"
        ],
        "properties": {
          "component": {
            "type": "string"
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "resolved_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "severity": {
            "type": "string",
            "enum": [
              "degraded",
              "partial_outage",
              "full_outage",
              "maintenance"
            ]
          },
          "summary": {
            "type": "string"
          }
        }
      },
      "PublicStatusDaily": {
        "description": "One UTC day's status, uptime, and telemetry coverage observation.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "date",
          "status",
          "uptime_pct",
          "coverage_pct"
        ],
        "properties": {
          "date": {
            "type": "string",
            "format": "date"
          },
          "status": {
            "type": "string",
            "enum": [
              "operational",
              "maintenance",
              "degraded",
              "partial_outage",
              "major_outage",
              "unknown",
              "pre_release"
            ]
          },
          "uptime_pct": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "maximum": 100
          },
          "coverage_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          }
        }
      },
      "PublicStatusComponent": {
        "description": "Current and 30-day status summary for one public capability.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "name",
          "status",
          "uptime_30d_pct",
          "coverage_30d_pct",
          "daily"
        ],
        "properties": {
          "id": {
            "type": "string",
            "enum": [
              "api_console",
              "deployments",
              "app_execution",
              "networking",
              "observability"
            ]
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "operational",
              "maintenance",
              "degraded",
              "partial_outage",
              "major_outage",
              "unknown"
            ]
          },
          "uptime_30d_pct": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "maximum": 100
          },
          "coverage_30d_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "daily": {
            "type": "array",
            "minItems": 30,
            "maxItems": 30,
            "items": {
              "$ref": "#/components/schemas/PublicStatusDaily"
            }
          }
        }
      },
      "PublicStatusIndicator": {
        "description": "Current error-budget indicator with its unit, target, and comparison direction.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "label",
          "value",
          "sample_status",
          "unit",
          "target",
          "comparison"
        ],
        "properties": {
          "id": {
            "type": "string",
            "enum": [
              "api_availability",
              "wake_p95",
              "build_success"
            ]
          },
          "label": {
            "type": "string"
          },
          "value": {
            "type": [
              "number",
              "null"
            ]
          },
          "sample_status": {
            "type": "string",
            "description": "Distinguishes an observed value, a successful query with insufficient samples, and a telemetry failure."
          },
          "unit": {
            "type": "string"
          },
          "target": {
            "type": "number"
          },
          "comparison": {
            "type": "string",
            "enum": [
              "gte",
              "lte"
            ]
          }
        }
      },
      "PublicStatusUpdate": {
        "description": "One chronological event timeline entry. posted_at is immutable; edited_at discloses a later text correction. Optional impact and components record a re-rating made with this update.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "state",
          "message",
          "posted_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "investigating",
              "identified",
              "monitoring",
              "resolved",
              "scheduled",
              "in_progress",
              "completed",
              "cancelled"
            ]
          },
          "message": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          },
          "posted_at": {
            "type": "string",
            "format": "date-time"
          },
          "edited_at": {
            "type": "string",
            "format": "date-time"
          },
          "impact": {
            "type": "string",
            "enum": [
              "maintenance",
              "degraded",
              "partial_outage",
              "major_outage"
            ]
          },
          "components": {
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "api_console",
                "deployments",
                "app_execution",
                "networking",
                "observability"
              ]
            }
          }
        }
      },
      "PublicStatusEvent": {
        "description": "Public incident or maintenance metadata and chronological timeline.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "kind",
          "title",
          "impact",
          "components",
          "state",
          "updated_at",
          "updates"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "incident",
              "maintenance"
            ]
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "impact": {
            "type": "string",
            "enum": [
              "maintenance",
              "degraded",
              "partial_outage",
              "major_outage"
            ]
          },
          "components": {
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "api_console",
                "deployments",
                "app_execution",
                "networking",
                "observability"
              ]
            }
          },
          "state": {
            "type": "string",
            "enum": [
              "investigating",
              "identified",
              "monitoring",
              "resolved",
              "scheduled",
              "in_progress",
              "completed",
              "cancelled"
            ]
          },
          "starts_at": {
            "type": "string",
            "format": "date-time"
          },
          "scheduled_start_at": {
            "type": "string",
            "format": "date-time"
          },
          "scheduled_end_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "edited_at": {
            "type": "string",
            "format": "date-time"
          },
          "resolved_at": {
            "type": "string",
            "format": "date-time"
          },
          "updates": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/PublicStatusUpdate"
            }
          }
        }
      },
      "PublicStatusOverview": {
        "description": "Complete public status snapshot for the single Gregale region.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "overall_status",
          "data_status",
          "updated_at",
          "region_scope",
          "components",
          "indicators",
          "active_events",
          "upcoming_maintenance",
          "resolved_incidents"
        ],
        "properties": {
          "overall_status": {
            "type": "string",
            "enum": [
              "operational",
              "maintenance",
              "degraded",
              "partial_outage",
              "major_outage",
              "unknown"
            ]
          },
          "data_status": {
            "type": "string",
            "enum": [
              "fresh",
              "stale",
              "unavailable"
            ]
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "region_scope": {
            "type": "string",
            "enum": [
              "single-region"
            ]
          },
          "components": {
            "type": "array",
            "minItems": 5,
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/PublicStatusComponent"
            }
          },
          "indicators": {
            "type": "array",
            "minItems": 3,
            "maxItems": 3,
            "items": {
              "$ref": "#/components/schemas/PublicStatusIndicator"
            }
          },
          "active_events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicStatusEvent"
            }
          },
          "upcoming_maintenance": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicStatusEvent"
            }
          },
          "resolved_incidents": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/PublicStatusEvent"
            }
          }
        }
      },
      "AdminStatusEventCreateRequest": {
        "description": "Operator request to publish an incident or schedule maintenance, discriminated by kind.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/AdminStatusIncidentCreateRequest"
          },
          {
            "$ref": "#/components/schemas/AdminStatusMaintenanceCreateRequest"
          }
        ],
        "discriminator": {
          "propertyName": "kind",
          "mapping": {
            "incident": "#/components/schemas/AdminStatusIncidentCreateRequest",
            "maintenance": "#/components/schemas/AdminStatusMaintenanceCreateRequest"
          }
        }
      },
      "AdminStatusIncidentCreateRequest": {
        "description": "Publish an active incident. Terminal and maintenance lifecycle states are not valid at creation.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "kind",
          "title",
          "impact",
          "components",
          "message"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "incident"
            ]
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "impact": {
            "type": "string",
            "enum": [
              "degraded",
              "partial_outage",
              "major_outage"
            ]
          },
          "components": {
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "api_console",
                "deployments",
                "app_execution",
                "networking",
                "observability"
              ]
            }
          },
          "state": {
            "type": "string",
            "enum": [
              "investigating",
              "identified",
              "monitoring"
            ],
            "default": "investigating"
          },
          "starts_at": {
            "type": "string",
            "format": "date-time"
          },
          "message": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          }
        }
      },
      "AdminStatusMaintenanceCreateRequest": {
        "description": "Schedule maintenance with a bounded start/end window.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "kind",
          "title",
          "components",
          "scheduled_start_at",
          "scheduled_end_at",
          "message"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "maintenance"
            ]
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "impact": {
            "type": "string",
            "enum": [
              "maintenance"
            ],
            "default": "maintenance"
          },
          "components": {
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "api_console",
                "deployments",
                "app_execution",
                "networking",
                "observability"
              ]
            }
          },
          "state": {
            "type": "string",
            "enum": [
              "scheduled"
            ],
            "default": "scheduled"
          },
          "scheduled_start_at": {
            "type": "string",
            "format": "date-time"
          },
          "scheduled_end_at": {
            "type": "string",
            "format": "date-time"
          },
          "message": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          }
        }
      },
      "AdminStatusEventUpdateRequest": {
        "description": "Operator request to append a lifecycle update and optionally re-rate its impact or affected components.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "state",
          "message"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "investigating",
              "identified",
              "monitoring",
              "resolved",
              "scheduled",
              "in_progress",
              "completed",
              "cancelled"
            ]
          },
          "message": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          },
          "impact": {
            "type": "string",
            "enum": [
              "maintenance",
              "degraded",
              "partial_outage",
              "major_outage"
            ]
          },
          "components": {
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "api_console",
                "deployments",
                "app_execution",
                "networking",
                "observability"
              ]
            }
          }
        }
      },
      "AdminStatusEventEditRequest": {
        "description": "Operator correction to a published event title.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "title"
        ],
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          }
        }
      },
      "AdminStatusUpdateEditRequest": {
        "description": "Operator correction to a published timeline message.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "message"
        ],
        "properties": {
          "message": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          }
        }
      },
      "StatusPage": {
        "description": "Backwards-compatible three-indicator status response.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "api_availability_pct",
          "wake_p95_ms",
          "build_success_pct",
          "uptime_30d_pct",
          "uptime_30d",
          "incidents",
          "degraded",
          "as_of",
          "source"
        ],
        "properties": {
          "api_availability_pct": {
            "type": "number"
          },
          "wake_p95_ms": {
            "type": "number"
          },
          "build_success_pct": {
            "type": "number"
          },
          "uptime_30d_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "uptime_30d": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StatusUptimeBucket"
            }
          },
          "incidents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StatusIncident"
            }
          },
          "degraded": {
            "type": "boolean"
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "source": {
            "type": "string"
          }
        }
      },
      "ManagedPostgresCapabilities": {
        "description": "Versioned PostgreSQL support for the default backend in a region, intersected with customer plan limits. Provider identities, costs, endpoints and credentials are excluded. Capabilities remain visible while the rollout gate is closed.",
        "type": "object",
        "required": [
          "contract_version",
          "region",
          "provisioning_enabled",
          "database_limit",
          "postgres_majors",
          "service_classes",
          "availability",
          "credential_access",
          "scale_to_zero",
          "always_on",
          "pooled_connections",
          "point_in_time_restore",
          "class_resize",
          "scale_to_zero_update",
          "storage_limit_bytes",
          "restore_window_seconds"
        ],
        "properties": {
          "contract_version": {
            "type": "integer",
            "minimum": 1
          },
          "region": {
            "type": "string"
          },
          "provisioning_enabled": {
            "type": "boolean"
          },
          "database_limit": {
            "type": "integer",
            "minimum": 0
          },
          "postgres_majors": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 12,
              "maximum": 99
            }
          },
          "service_classes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "development",
                "burstable",
                "production"
              ]
            }
          },
          "availability": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "single_zone",
                "high_availability"
              ]
            }
          },
          "credential_access": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "read_write",
                "read_only",
                "migration",
                "data_api",
                "auth",
                "session"
              ]
            }
          },
          "scale_to_zero": {
            "type": "boolean"
          },
          "always_on": {
            "type": "boolean"
          },
          "pooled_connections": {
            "type": "boolean"
          },
          "point_in_time_restore": {
            "type": "boolean"
          },
          "scale_to_zero_update": {
            "type": "boolean",
            "description": "Changing scale-to-zero on existing databases is supported. Disabling suspension additionally requires always_on plan entitlement; reservations require the pinned backend and admission."
          },
          "class_resize": {
            "type": "boolean",
            "description": "Compute-class resizing supported by the configured regional backend. Reservations still require admission and the database pinned backend."
          },
          "storage_limit_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "restore_window_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ChangeManagedPostgresComputePolicyRequest": {
        "description": "Canonical UUID request for a scale-to-zero change on an existing managed PostgreSQL database.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "request_id",
          "scale_to_zero"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid",
            "description": "Canonical nonzero UUID for this policy intent; replay with the same database and scale-to-zero setting after uncertain responses."
          },
          "scale_to_zero": {
            "type": "boolean"
          }
        }
      },
      "ManagedPostgresComputePolicyChange": {
        "description": "Durable compute policy change progress. Provider identity and credentials are never returned; existing connections may be interrupted.",
        "type": "object",
        "required": [
          "id",
          "database_id",
          "from_scale_to_zero",
          "target_scale_to_zero",
          "generation",
          "state",
          "connection_interruption_expected",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "database_id": {
            "type": "string"
          },
          "from_scale_to_zero": {
            "type": "boolean"
          },
          "target_scale_to_zero": {
            "type": "boolean"
          },
          "generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 2
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "succeeded",
              "failed"
            ]
          },
          "connection_interruption_expected": {
            "type": "boolean"
          },
          "last_error_code": {
            "type": "string",
            "description": "Safe policy-change diagnostic. A confirmed rejection retains the source policy; uncertain outcomes remain pending."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ResizeManagedPostgresDatabaseRequest": {
        "description": "Canonical UUID request for a compute-class change on an existing managed PostgreSQL database.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "request_id",
          "service_class"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid",
            "description": "Canonical nonzero UUID; reuse with the same database and target after uncertain responses."
          },
          "service_class": {
            "type": "string",
            "enum": [
              "development",
              "burstable",
              "production"
            ]
          }
        }
      },
      "ManagedPostgresResize": {
        "description": "Durable compute resize progress. Provider identity and credentials are never returned; existing connections may be interrupted.",
        "type": "object",
        "required": [
          "id",
          "database_id",
          "from_class",
          "target_class",
          "generation",
          "state",
          "connection_interruption_expected",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "database_id": {
            "type": "string"
          },
          "from_class": {
            "type": "string",
            "enum": [
              "development",
              "burstable",
              "production"
            ]
          },
          "target_class": {
            "type": "string",
            "enum": [
              "development",
              "burstable",
              "production"
            ]
          },
          "generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 2
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "succeeded",
              "failed"
            ]
          },
          "connection_interruption_expected": {
            "type": "boolean"
          },
          "last_error_code": {
            "type": "string",
            "description": "Safe diagnostic code. A failed resize retains the confirmed source configuration; uncertain outcomes remain pending."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ManagedPostgresDatabase": {
        "description": "Managed PostgreSQL metadata. Provider IDs and credentials are never returned.",
        "type": "object",
        "required": [
          "id",
          "name",
          "region",
          "postgres_major",
          "service_class",
          "availability",
          "scale_to_zero",
          "storage_limit_bytes",
          "restore_window_seconds",
          "state",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "health": {
            "$ref": "#/components/schemas/ManagedPostgresHealth"
          },
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "region": {
            "type": "string"
          },
          "postgres_major": {
            "type": "integer",
            "minimum": 12,
            "maximum": 99
          },
          "service_class": {
            "type": "string",
            "enum": [
              "development",
              "burstable",
              "production"
            ]
          },
          "availability": {
            "type": "string",
            "enum": [
              "single_zone",
              "high_availability"
            ]
          },
          "scale_to_zero": {
            "type": "boolean"
          },
          "storage_limit_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "restore_window_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "restore_source_database_id": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 128
          },
          "restore_point_in_time": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "state": {
            "type": "string",
            "enum": [
              "provisioning",
              "ready",
              "updating",
              "deleting",
              "failed",
              "deleted"
            ]
          },
          "last_error_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "restorable_until": {
            "type": "string",
            "format": "date-time",
            "description": "Set while the database's delete is scheduled: it can be undeleted until then, and is purged after."
          },
          "restore_slot_until": {
            "type": "string",
            "format": "date-time",
            "description": "Set while a restored database is one past the plan's database limit. It becomes an ordinary database once the account has room; otherwise its delete is scheduled at this time."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "Set on a database restored with ttl_seconds. Its bindings are revoked and it is purged at this time."
          },
          "plan_excess": {
            "type": "string",
            "enum": [
              "database_limit",
              "service_class"
            ],
            "description": "Set while the plan no longer includes this database, for example after a subscription ended, and it is suspended: database_limit when it ranks past the plan's database limit (oldest databases are kept), service_class when the plan does not include its class. Its data is kept. Upgrading, deleting a database or resizing to an included class resumes it."
          },
          "hold": {
            "type": "string",
            "enum": [
              "compute_ceiling",
              "egress",
              "inactive",
              "plan_excess",
              "preview"
            ],
            "description": "Set while the platform stops this database's compute and refuses its connections although its state is ready: compute_ceiling once the account used its monthly compute ceiling; egress once this database sent its own monthly egress allowance (500 GB); inactive while the account is suspended; plan_excess (see plan_excess); preview for a PR preview database once the account used 80% of its compute. Its data is kept. Omitted while nothing holds it; the platform applies a change within a few minutes."
          },
          "restore_range": {
            "$ref": "#/components/schemas/ManagedPostgresRestoreRange"
          }
        }
      },
      "ManagedPostgresRestoreRange": {
        "description": "The span a point-in-time restore from this database can target now. Absent while the database cannot be restored from.",
        "type": "object",
        "required": [
          "earliest",
          "latest"
        ],
        "properties": {
          "earliest": {
            "type": "string",
            "format": "date-time",
            "description": "The later of the database's creation and the start of its restore window."
          },
          "latest": {
            "type": "string",
            "format": "date-time",
            "description": "When the response was made; a restore point must be before it."
          }
        }
      },
      "ManagedPostgresDatabaseList": {
        "description": "Account-scoped managed PostgreSQL database collection.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ManagedPostgresDatabase"
            }
          }
        }
      },
      "ManagedPostgresHealth": {
        "description": "Cached read-only provider observation, separate from lifecycle state. Healthy does not prove SQL connectivity. Failed checks update checked_at while retaining last_success_at; stale observations must not imply current availability.",
        "type": "object",
        "required": [
          "enabled",
          "status",
          "fresh",
          "provider_status",
          "compute_state",
          "stale_after_seconds"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "enum": [
              "disabled",
              "unknown",
              "healthy",
              "degraded",
              "stale"
            ]
          },
          "fresh": {
            "type": "boolean"
          },
          "provider_status": {
            "type": "string",
            "enum": [
              "unknown",
              "missing",
              "pending",
              "ready",
              "deleting",
              "failed"
            ]
          },
          "compute_state": {
            "type": "string",
            "enum": [
              "unknown",
              "active",
              "suspended",
              "waking"
            ]
          },
          "stale_after_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "checked_at": {
            "type": "string",
            "format": "date-time",
            "description": "Latest metadata attempt, including provider request failures."
          },
          "last_success_at": {
            "type": "string",
            "format": "date-time",
            "description": "Latest valid metadata response, including responses describing degraded resources."
          },
          "last_error_code": {
            "type": "string",
            "enum": [
              "resource_missing",
              "observer_unsupported",
              "provider_unavailable",
              "backend_unavailable",
              "observation_invalid",
              "spec_mismatch",
              "provider_failed"
            ]
          }
        }
      },
      "ManagedPostgresUsageResponse": {
        "description": "Customer-safe current UTC-month managed PostgreSQL usage and guardrail state.",
        "type": "object",
        "required": [
          "period_start",
          "policy_enabled",
          "fresh",
          "guardrail_state",
          "ready_databases",
          "database_limit",
          "storage_limit_bytes",
          "compute_unit_seconds",
          "storage_byte_seconds",
          "storage_byte_seconds_limit",
          "storage_byte_seconds_remaining",
          "history_byte_seconds",
          "egress_bytes"
        ],
        "properties": {
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "observed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "policy_enabled": {
            "type": "boolean"
          },
          "fresh": {
            "type": "boolean"
          },
          "guardrail_state": {
            "type": "string",
            "enum": [
              "disabled",
              "healthy",
              "stale",
              "reached"
            ]
          },
          "ready_databases": {
            "type": "integer",
            "minimum": 0
          },
          "database_limit": {
            "type": "integer",
            "minimum": 0
          },
          "storage_limit_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "compute_unit_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "storage_byte_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "storage_byte_seconds_limit": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "storage_byte_seconds_remaining": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "history_byte_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "egress_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "compute_allowance_unit_seconds": {
            "description": "The plan's monthly compute allowance in compute-unit seconds, pooled across the account's databases.",
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "compute_ceiling_unit_seconds": {
            "description": "Compute-unit seconds this month at which running databases are suspended. Absent while the usage ledger is off.",
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "compute_cap_state": {
            "description": "healthy; warning at 80% of the allowance; overage past the allowance while the account allows overage; suspended once the ceiling is reached and the platform enforces caps. Suspended databases keep their data and resume next month or after an upgrade.",
            "type": "string",
            "enum": [
              "healthy",
              "warning",
              "overage",
              "suspended"
            ]
          },
          "overage_enabled": {
            "description": "True while the account runs its databases past the allowance, up to the ceiling.",
            "type": "boolean"
          },
          "compute_suspended_at": {
            "description": "When the compute cap suspended the account's databases this month; present while compute_cap_state is suspended.",
            "type": "string",
            "format": "date-time"
          },
          "egress_allowance_bytes": {
            "description": "Each database's own monthly egress allowance, 500 GB (10^9 bytes) as Neon includes per project. Database egress does not count toward the plan's app egress allowance. Absent on a plan without databases.",
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "app_egress_bytes": {
            "deprecated": true,
            "description": "Deprecated and always omitted. Apps no longer share the databases' egress allowance.",
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "egress_state": {
            "description": "The state of the database that sent the most egress this month: healthy; warning at 80% of its hold; overage past its allowance while the account's egress overage election bills database egress (at Neon's price plus 5%, up to twice the allowance); held once it reaches its allowance (twice it with overage billed) and the platform enforces caps, until the month ends. Only that database is held.",
            "type": "string",
            "enum": [
              "healthy",
              "warning",
              "overage",
              "held"
            ]
          },
          "hold": {
            "description": "Set while every database of the account is held, with the same reason each database reports. Egress holds one database at a time, so it is reported on that database, not here.",
            "type": "string",
            "enum": [
              "compute_ceiling",
              "egress",
              "inactive"
            ]
          }
        }
      },
      "ManagedPostgresOverage": {
        "description": "An account's managed PostgreSQL compute overage setting.",
        "type": "object",
        "required": [
          "enabled",
          "compute_allowance_unit_seconds",
          "compute_ceiling_unit_seconds"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "compute_allowance_unit_seconds": {
            "description": "The plan's monthly compute allowance in compute-unit seconds.",
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "compute_ceiling_unit_seconds": {
            "description": "Where running databases are suspended before the operator's usage cap; twice the allowance with overage on.",
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ManagedPostgresOverageRequest": {
        "description": "Turn an account's managed PostgreSQL compute overage on or off.",
        "type": "object",
        "required": [
          "enabled"
        ],
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean"
          }
        }
      },
      "ManagedPostgresUsageLineItem": {
        "description": "Normalized operator-only managed PostgreSQL ledger line.",
        "type": "object",
        "required": [
          "code",
          "meter",
          "unit",
          "quantity",
          "cost_millicents"
        ],
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "managed_postgres.compute",
              "managed_postgres.storage",
              "managed_postgres.restore_history",
              "managed_postgres.egress"
            ]
          },
          "meter": {
            "type": "string"
          },
          "unit": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ManagedPostgresUsageOperatorResponse": {
        "description": "Operator-only managed PostgreSQL usage, effective ceilings, and internal COGS line items.",
        "type": "object",
        "required": [
          "account_id",
          "period_start",
          "policy_enabled",
          "fresh",
          "guardrail_state",
          "ready_databases",
          "database_limit",
          "storage_limit_bytes",
          "compute_unit_seconds",
          "storage_byte_seconds",
          "storage_byte_seconds_limit",
          "storage_byte_seconds_remaining",
          "history_byte_seconds",
          "egress_bytes",
          "cost_millicents",
          "max_monthly_cost_millicents",
          "max_monthly_compute_unit_seconds",
          "max_monthly_storage_byte_seconds",
          "max_monthly_history_byte_seconds",
          "max_monthly_egress_bytes",
          "line_items"
        ],
        "properties": {
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "observed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "policy_enabled": {
            "type": "boolean"
          },
          "fresh": {
            "type": "boolean"
          },
          "guardrail_state": {
            "type": "string",
            "enum": [
              "disabled",
              "healthy",
              "stale",
              "reached"
            ]
          },
          "ready_databases": {
            "type": "integer",
            "minimum": 0
          },
          "database_limit": {
            "type": "integer",
            "minimum": 0
          },
          "storage_limit_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "compute_unit_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "storage_byte_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "storage_byte_seconds_limit": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "storage_byte_seconds_remaining": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "history_byte_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "egress_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "max_monthly_cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "max_monthly_compute_unit_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "max_monthly_storage_byte_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "max_monthly_history_byte_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "max_monthly_egress_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ManagedPostgresUsageLineItem"
            }
          }
        }
      },
      "ManagedPostgresAccountingDiagnostic": {
        "description": "Local evidence for one accountable database. Shared restores refer to their accounting root. Reasons explain stale admission only; an empty list does not establish invoice settlement or remaining budget. An unknown legacy tombstone has no confirmed terminal deadline.",
        "type": "object",
        "required": [
          "database_id",
          "name",
          "state",
          "accounting_required",
          "identity_known",
          "accounting_database_id",
          "blocking",
          "reasons",
          "collected_window_seconds"
        ],
        "properties": {
          "database_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "provisioning",
              "ready",
              "updating",
              "deleting",
              "failed",
              "deleted"
            ]
          },
          "accounting_required": {
            "type": "boolean"
          },
          "identity_known": {
            "type": "boolean"
          },
          "accounting_database_id": {
            "type": "string",
            "format": "uuid"
          },
          "blocking": {
            "type": "boolean",
            "description": "This resource blocks admission due to stale accounting under the enabled policy. False when the policy is disabled."
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "identity_unknown",
                "legacy_identity_unknown",
                "coverage_missing",
                "window_mismatch",
                "shutdown_unconfirmed",
                "coverage_incomplete",
                "observation_stale",
                "final_correction_pending"
              ]
            }
          },
          "collected_window_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "required_from": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "required_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "collected_from": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "collected_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "observed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "correction_observed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "correction_required_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "lease_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "ManagedPostgresAccountingReconciliationRequest": {
        "type": "object",
        "description": "Operator-attested immutable backend identity and actual provider shutdown for one unresolved legacy tombstone. The operator verifies artifact ownership and lineage; the server does not fetch or authenticate the source. Missing lookup results are not shutdown evidence.",
        "additionalProperties": false,
        "required": [
          "reconciliation_id",
          "database_id",
          "backend_id",
          "backend_fingerprint",
          "provider_resource_id",
          "shutdown_at",
          "observed_at",
          "evidence_reference",
          "evidence_sha256",
          "reason"
        ],
        "properties": {
          "reconciliation_id": {
            "type": "string",
            "format": "uuid",
            "description": "Durable reconciliation identity."
          },
          "database_id": {
            "type": "string",
            "format": "uuid",
            "description": "Deleted accountable database with no provider identity."
          },
          "backend_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "description": "Exact immutable catalog backend ID."
          },
          "backend_fingerprint": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Exact immutable catalog backend fingerprint."
          },
          "provider_resource_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "description": "Verified opaque provider identity; include branch identity where required by the adapter."
          },
          "shutdown_at": {
            "type": "string",
            "format": "date-time",
            "description": "Actual confirmed provider shutdown at or after catalog creation; microsecond precision."
          },
          "observed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Actual evidence observation at or after shutdown and retained ledger observations; no future timestamps."
          },
          "evidence_reference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Retained nonsecret artifact reference; no credentials or signed URLs."
          },
          "evidence_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "SHA-256 of the operator-verified source artifact."
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512,
            "description": "Audited reason for reconciliation."
          },
          "expected_revision": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Omit for preview; required for apply using the returned revision."
          }
        }
      },
      "ManagedPostgresAccountingReconciliationResult": {
        "type": "object",
        "description": "Preview or original committed repair response. Requires usage recovery describes the post-repair state; receipt replay is not a live admission or coverage read. Use accounting diagnostics for current status.",
        "required": [
          "reconciliation_id",
          "database_id",
          "revision",
          "applied",
          "shutdown_at",
          "observed_at",
          "shared_accounting",
          "requires_usage_recovery"
        ],
        "properties": {
          "reconciliation_id": {
            "type": "string",
            "format": "uuid",
            "description": "Identity of the previewed or committed repair receipt."
          },
          "database_id": {
            "type": "string",
            "format": "uuid",
            "description": "Reconciled catalog database."
          },
          "revision": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Revision fencing the reviewed request and relevant catalog/ledger/coverage state."
          },
          "applied": {
            "type": "boolean",
            "description": "True for a committed repair or durable replay."
          },
          "previous_deleted_at": {
            "type": "string",
            "format": "date-time",
            "description": "Previous logical deletion timestamp retained in the audit; it did not prove shutdown."
          },
          "shutdown_at": {
            "type": "string",
            "format": "date-time",
            "description": "Attested actual shutdown boundary."
          },
          "observed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Preserved evidence observation time."
          },
          "shared_accounting": {
            "type": "boolean",
            "description": "Restore descendant still shares its existing accounting root."
          },
          "requires_usage_recovery": {
            "type": "boolean",
            "description": "Coverage resets on apply; recovery and final correction evidence must satisfy admission."
          }
        }
      },
      "ManagedPostgresUsageImportReading": {
        "description": "One normalized integer meter quantity from retained provider evidence.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "meter",
          "quantity"
        ],
        "properties": {
          "meter": {
            "type": "string",
            "enum": [
              "active_seconds",
              "compute_unit_seconds",
              "storage_byte_seconds",
              "history_byte_seconds",
              "egress_bytes",
              "operations"
            ]
          },
          "quantity": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ManagedPostgresUsageImportWindow": {
        "description": "A complete policy-sized usage window with its actual source observation time.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "from",
          "to",
          "observed_at",
          "readings"
        ],
        "properties": {
          "from": {
            "type": "string",
            "format": "date-time"
          },
          "to": {
            "type": "string",
            "format": "date-time"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Actual export observation time, at or after the closed window and no later than the server clock; microsecond precision maximum. Import time is never substituted."
          },
          "readings": {
            "type": "array",
            "minItems": 1,
            "maxItems": 6,
            "items": {
              "$ref": "#/components/schemas/ManagedPostgresUsageImportReading"
            }
          }
        }
      },
      "ManagedPostgresUsageImportRequest": {
        "description": "Operator-attested retained usage for a known independently accounted database.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "import_id",
          "database_id",
          "evidence_reference",
          "evidence_sha256",
          "reason",
          "windows"
        ],
        "properties": {
          "import_id": {
            "type": "string",
            "format": "uuid",
            "description": "Durable request identity; preserve across retries."
          },
          "database_id": {
            "type": "string",
            "format": "uuid",
            "description": "Independently accounted database; shared restores must import against their root."
          },
          "evidence_reference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Non-secret retained evidence locator; never a credential or signed URL."
          },
          "evidence_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "SHA-256 of the retained source artifact, attested by the operator; no artifact is fetched by this API."
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "windows": {
            "type": "array",
            "minItems": 1,
            "maxItems": 256,
            "description": "Ascending contiguous complete policy-sized windows with exactly the backend's advertised meters. Costs are calculated from the current server policy. Maximum request size 1 MiB.",
            "items": {
              "$ref": "#/components/schemas/ManagedPostgresUsageImportWindow"
            }
          },
          "expected_revision": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Omit for preview; required for apply."
          }
        }
      },
      "ManagedPostgresUsageImportResult": {
        "description": "Cost changes and resulting coverage from preview or an immutable applied import receipt.",
        "type": "object",
        "required": [
          "import_id",
          "database_id",
          "revision",
          "applied",
          "window_count",
          "previous_cost_millicents",
          "imported_cost_millicents",
          "cost_delta_millicents",
          "collected_from",
          "collected_until",
          "observed_at"
        ],
        "properties": {
          "import_id": {
            "type": "string",
            "format": "uuid"
          },
          "database_id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "applied": {
            "type": "boolean"
          },
          "window_count": {
            "type": "integer",
            "minimum": 1,
            "maximum": 256
          },
          "previous_cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "imported_cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cost_delta_millicents": {
            "type": "integer",
            "format": "int64"
          },
          "collected_from": {
            "type": "string",
            "format": "date-time"
          },
          "collected_until": {
            "type": "string",
            "format": "date-time"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ManagedPostgresAccountingDiagnosticsResponse": {
        "description": "One live account-scoped page of local accounting evidence.",
        "type": "object",
        "required": [
          "account_id",
          "evaluated_at",
          "policy_enabled",
          "window_seconds",
          "items"
        ],
        "properties": {
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time"
          },
          "policy_enabled": {
            "type": "boolean"
          },
          "window_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "items": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/ManagedPostgresAccountingDiagnostic"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          }
        }
      },
      "CreateManagedPostgresDatabaseRequest": {
        "description": "Customer request to reserve a managed PostgreSQL database.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "region"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid",
            "description": "Optional reserved database identity for durable workflows. Identical retries recover the same resource independently of the HTTP response cache. A different reservation cannot adopt an existing name."
          },
          "name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "region": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "postgres_major": {
            "type": "integer",
            "minimum": 12,
            "maximum": 99,
            "default": 16
          },
          "service_class": {
            "type": "string",
            "enum": [
              "development",
              "burstable",
              "production"
            ],
            "default": "development"
          },
          "availability": {
            "type": "string",
            "enum": [
              "single_zone",
              "high_availability"
            ],
            "default": "single_zone"
          },
          "scale_to_zero": {
            "type": "boolean",
            "default": true
          },
          "storage_limit_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "restore_window_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "RestoreManagedPostgresDatabaseRequest": {
        "description": "Point-in-time restore request that creates a new database. A restore is a copy-on-write branch of the source where the backend supports it.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "point_in_time": {
            "type": "string",
            "format": "date-time",
            "description": "A time inside the source's restore_range. Omit it to restore from the latest point, a couple of seconds before the request."
          },
          "ttl_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 300,
            "maximum": 2592000,
            "description": "Purge the new database this many seconds after it is created. Its bindings are revoked first; the source is never touched. The database shows expires_at."
          }
        }
      },
      "ManagedPostgresBinding": {
        "description": "Workload binding metadata. Credentials are delivered through the app secret surface and never returned here.",
        "type": "object",
        "required": [
          "id",
          "database_id",
          "app_id",
          "scope",
          "environment_key",
          "access",
          "credential_generation",
          "rotation_pending",
          "state",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "database_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "app_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "scope": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
          },
          "environment_key": {
            "type": "string",
            "pattern": "^[A-Z][A-Z0-9_]*$"
          },
          "access": {
            "type": "string",
            "enum": [
              "read_write",
              "read_only",
              "migration",
              "data_api",
              "auth",
              "session"
            ]
          },
          "credential_generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "rotation_pending": {
            "type": "boolean",
            "description": "The previous provider credential remains valid until the rolling app runtime refresh completes."
          },
          "state": {
            "type": "string",
            "enum": [
              "provisioning",
              "ready",
              "deleting",
              "retiring",
              "failed",
              "deleted"
            ]
          },
          "last_error_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DataAPIRuntime": {
        "description": "The Data API runtime the control plane serves.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "archive_sha256",
          "archive"
        ],
        "properties": {
          "version": {
            "type": "string",
            "pattern": "^[0-9a-f]{16}$",
            "description": "Digest of the runtime's image files; running Data APIs report it as runtime_version on /healthz."
          },
          "archive_sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Lowercase hex SHA-256 of the decoded archive."
          },
          "archive": {
            "type": "string",
            "format": "byte",
            "maxLength": 2796204,
            "description": "Base64 gzipped tar of the runtime under one data-api/ directory, at most 2 MiB decoded."
          }
        }
      },
      "DataAPIStatus": {
        "description": "What the platform knows about a Data API without waking it.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "runtime_version",
          "runtime_reports"
        ],
        "properties": {
          "runtime_version": {
            "type": "string",
            "pattern": "^[0-9a-f]{16}$",
            "description": "The runtime version this control plane serves; running Data APIs report theirs as runtime_version on /healthz."
          },
          "runtime_reports": {
            "type": "string",
            "enum": [
              "available",
              "unavailable"
            ],
            "description": "unavailable when this installation accepts no runtime reports: usage reports, monthly caps, keyless live reads and change hooks then do not reach the platform."
          },
          "change_hooks": {
            "$ref": "#/components/schemas/DataAPIChangeHookStatus"
          }
        }
      },
      "DataAPIChangeHookStatus": {
        "description": "The change hook delivery the app's runtime last reported.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "reported_at",
          "pending",
          "failed",
          "publishing"
        ],
        "properties": {
          "reported_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the platform received the report."
          },
          "pending": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000000000000,
            "description": "Recorded changes waiting to publish."
          },
          "failed": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000000000000,
            "description": "Changes the platform rejected, kept until retried or discarded in SQL."
          },
          "oldest_pending_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the oldest waiting change was recorded."
          },
          "last_published_at": {
            "type": "string",
            "format": "date-time",
            "description": "When a runtime last published changes."
          },
          "last_failure_code": {
            "type": "string",
            "pattern": "^[a-z0-9_]{1,64}$",
            "description": "The code of the latest rejected change."
          },
          "publishing": {
            "type": "string",
            "enum": [
              "ok",
              "retrying"
            ],
            "description": "retrying when waiting changes are held back by publications that keep failing."
          },
          "last_dropped_at": {
            "type": "string",
            "format": "date-time",
            "description": "When capture last left a change out because the backlog was full; those changes were not recorded."
          }
        }
      },
      "DataAPIChangeHookReport": {
        "description": "A runtime's change hook delivery report, read from its change event table. oldest_pending_at is present exactly when changes are pending.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "pending",
          "failed",
          "publishing"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "pending": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000000000000
          },
          "failed": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000000000000
          },
          "oldest_pending_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_published_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_failure_code": {
            "type": "string",
            "pattern": "^[a-z0-9_]{1,64}$"
          },
          "publishing": {
            "type": "string",
            "enum": [
              "ok",
              "retrying"
            ]
          },
          "last_dropped_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DataAPIConnectionBudgets": {
        "description": "Read-only planning snapshots. Not applicable means the app has no visible Data API binding.",
        "type": "object",
        "required": [
          "version",
          "app",
          "state",
          "truncated",
          "databases"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "app": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "not_applicable",
              "unknown",
              "within_budget",
              "over_budget"
            ]
          },
          "truncated": {
            "type": "boolean"
          },
          "databases": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/ManagedPostgresConnectionBudget"
            }
          }
        }
      },
      "ManagedPostgresConnectionBudget": {
        "description": "Canonical pool planning, not live SQL usage or reservation. A comparison requires complete verified capacity and consumer evidence; current adapters report unknown.",
        "type": "object",
        "required": [
          "version",
          "database_id",
          "database_name",
          "state",
          "checked_at",
          "expires_at",
          "enforced",
          "model",
          "inventory",
          "demand",
          "capacity",
          "reasons"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "database_id": {
            "type": "string",
            "format": "uuid"
          },
          "database_name": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "unknown",
              "within_budget",
              "over_budget"
            ]
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "enforced": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "model": {
            "type": "string",
            "enum": [
              "canonical_runtime_pools"
            ]
          },
          "inventory": {
            "$ref": "#/components/schemas/ConnectionBudgetInventory"
          },
          "demand": {
            "$ref": "#/components/schemas/ConnectionBudgetDemand"
          },
          "capacity": {
            "$ref": "#/components/schemas/ConnectionBudgetCapacity"
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "ConnectionBudgetInventory": {
        "description": "Deduplicated app/scope potential consumers; counts are not live SQL sessions.",
        "type": "object",
        "required": [
          "bindings",
          "data_api_consumers",
          "auth_consumers",
          "migration_bindings",
          "other_bindings",
          "resident_instances",
          "parked_instances",
          "auxiliary_instances",
          "active_tasks",
          "rotation_pending",
          "overlap_consumers",
          "stale_node_instances"
        ],
        "properties": {
          "bindings": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "data_api_consumers": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "auth_consumers": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "migration_bindings": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "other_bindings": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "session_bindings": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Session bindings are modeled at their role connection limit and are not counted in other_bindings."
          },
          "resident_instances": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "parked_instances": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "auxiliary_instances": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "active_tasks": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "rotation_pending": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "overlap_consumers": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "stale_node_instances": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ConnectionBudgetDemand": {
        "description": "Canonical runtime pools and explicit planning headroom. Unbounded consumers remain unknown.",
        "type": "object",
        "required": [
          "data_api_resident_estimate",
          "data_api_wake_estimate",
          "auth_wake_estimate",
          "control_headroom",
          "migration_headroom",
          "modeled_peak_connections"
        ],
        "properties": {
          "data_api_resident_estimate": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "data_api_wake_estimate": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "auth_wake_estimate": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "session_connection_ceiling": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "The session role connection limit per session binding; two roles while a binding rotates."
          },
          "control_headroom": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "migration_headroom": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "modeled_peak_connections": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "runtime_observations": {
            "$ref": "#/components/schemas/ConnectionBudgetRuntimeObservations"
          }
        }
      },
      "DataAPIRuntimeConnectionReport": {
        "description": "Private versioned runtime configuration report. Instance, deployment, node and database placement authority are resolved from workload identity and the catalog, never accepted from this body. observed_at bounds replay; unknown invalidates the previous observation.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "binding_id",
          "database_identity",
          "database_generation",
          "credential_generation",
          "role",
          "state",
          "runtime_model",
          "engine_connections",
          "refresh_connections",
          "observed_at"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "binding_id": {
            "type": "string",
            "format": "uuid"
          },
          "database_identity": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "SHA-256 of backend_fingerprint, a colon and the frozen data_resource_id, from operator configuration."
          },
          "database_generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "credential_generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "role": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63
          },
          "state": {
            "type": "string",
            "enum": [
              "observed",
              "unknown"
            ]
          },
          "runtime_model": {
            "type": "string",
            "enum": [
              "postgrest-14.3-pools-v1"
            ]
          },
          "engine_connections": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2
          },
          "refresh_connections": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DataAPIUsageCounts": {
        "description": "Data API usage counts. Admitted requests by access kind, gateway and engine rejections (4xx), errors (5xx), requests refused by owner caps, rows the engine reported and response bytes. Owner telemetry from the app's runtime, not billing records.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "user_requests",
          "anonymous_requests",
          "server_requests",
          "rejected_requests",
          "error_requests",
          "capped_requests",
          "rows_returned",
          "response_bytes"
        ],
        "properties": {
          "user_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "anonymous_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "server_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "rejected_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "capped_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "rows_returned": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "response_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "DataAPIUsageHour": {
        "description": "One UTC hour's usage delta in a runtime report.",
        "allOf": [
          {
            "$ref": "#/components/schemas/DataAPIUsageCounts"
          },
          {
            "type": "object",
            "required": [
              "hour"
            ],
            "properties": {
              "hour": {
                "type": "string",
                "format": "date-time",
                "description": "UTC hour the delta belongs to; aligned to the hour."
              }
            }
          }
        ]
      },
      "DataAPIUsageReport": {
        "description": "Private versioned runtime usage report. A report id names the reporting instance and process and is applied once; hours are unique.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "report_id",
          "hours"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "report_id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$"
          },
          "hours": {
            "type": "array",
            "maxItems": 48,
            "items": {
              "$ref": "#/components/schemas/DataAPIUsageHour"
            }
          },
          "access": {
            "$ref": "#/components/schemas/DataAPIAccessConfig"
          }
        }
      },
      "DataAPIAccessConfig": {
        "description": "Access settings the runtime reports for live reads, sent after start and hourly. It replaces the stored settings unless the stored ones come from a runtime process that started later; turning usage reporting off forgets them. Holds key hashes, never keys.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "schemas"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "schemas": {
            "type": "array",
            "minItems": 1,
            "maxItems": 8,
            "items": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,62}$"
            }
          },
          "auth": {
            "$ref": "#/components/schemas/DataAPIUserAuth"
          },
          "public_read": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,62}\\.[A-Za-z_][A-Za-z0-9_]{0,62}$"
            }
          },
          "server_keys": {
            "type": "array",
            "maxItems": 2,
            "items": {
              "$ref": "#/components/schemas/DataAPIServerKey"
            }
          },
          "allow_without_rls": {
            "type": "array",
            "maxItems": 64,
            "description": "Relations signed-in users may read without row-level security; live reads apply the same exemptions.",
            "items": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,62}\\.[A-Za-z_][A-Za-z0-9_]{0,62}$"
            }
          },
          "started_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the reporting runtime process started. A report never replaces settings from a process that started later."
          }
        }
      },
      "DataAPIUserAuth": {
        "description": "The issuer, JWKS URL and audience the Data API verifies user tokens against. Live reads verify user tokens with the same settings.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "issuer",
          "jwks_url",
          "audience"
        ],
        "properties": {
          "issuer": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048
          },
          "jwks_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048
          },
          "audience": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        }
      },
      "DataAPIServerKey": {
        "description": "One server-key rotation slot as the runtime reports it, the SHA-256 of the key and any permissions.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "slot",
          "sha256"
        ],
        "properties": {
          "slot": {
            "type": "string",
            "enum": [
              "a",
              "b"
            ]
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "permissions": {
            "$ref": "#/components/schemas/DataAPIServerKeyPermissionSet"
          }
        }
      },
      "DataAPIServerKeyPermissionSet": {
        "description": "Narrows a server key. Absent fields keep full access; live reads use relations and subjects.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "access": {
            "type": "string",
            "enum": [
              "read",
              "write"
            ]
          },
          "relations": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "type": "string"
            }
          },
          "rpcs": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "type": "string"
            }
          },
          "subjects": {
            "type": "boolean"
          }
        }
      },
      "DataAPIUsageMonthToDate": {
        "description": "Admitted requests in the current UTC calendar month, all and anonymous, which owner caps compare against.",
        "type": "object",
        "required": [
          "month",
          "requests",
          "anonymous_requests"
        ],
        "properties": {
          "month": {
            "type": "string",
            "pattern": "^[0-9]{4}-[0-9]{2}$",
            "description": "UTC calendar month as YYYY-MM."
          },
          "requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "anonymous_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "DataAPIUsageReportResponse": {
        "description": "Answer to a runtime usage report.",
        "type": "object",
        "required": [
          "month_to_date"
        ],
        "properties": {
          "month_to_date": {
            "$ref": "#/components/schemas/DataAPIUsageMonthToDate"
          }
        }
      },
      "DataAPIChangeEvent": {
        "description": "One recorded row change. The id is the change's UUID in the database; the platform derives the producer key data-api.change.ID from it.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "type",
          "data"
        ],
        "properties": {
          "schema_version": {
            "type": "string",
            "maxLength": 64,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$",
            "description": "Version captured with this row change; unchanged on retry."
          },
          "id": {
            "type": "string",
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
          },
          "type": {
            "type": "string",
            "maxLength": 256,
            "pattern": "^[!-~]+\\.(inserted|updated|deleted)$",
            "description": "SCHEMA.TABLE.inserted",
            ".updated or .deleted.": null
          },
          "time": {
            "type": "string",
            "format": "date-time",
            "description": "When the change was recorded."
          },
          "data": {
            "description": "The change",
            "at most 64 KiB of JSON.": null
          }
        }
      },
      "DataAPIChangeEventBatch": {
        "description": "A runtime's private publication of recorded changes, in recorded order.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "events"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "events": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/DataAPIChangeEvent"
            }
          }
        }
      },
      "DataAPIChangeEventBatchResponse": {
        "description": "Per-event outcomes in input order, with the app source the events published under.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "source",
          "results"
        ],
        "properties": {
          "source": {
            "type": "string",
            "description": "The app's producer source",
            "app.APP_UUID.": null
          },
          "results": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/PublishEventBatchResult"
            }
          }
        }
      },
      "DataAPIUsageBucket": {
        "description": "One hour or UTC day of an owner usage view.",
        "allOf": [
          {
            "$ref": "#/components/schemas/DataAPIUsageCounts"
          },
          {
            "type": "object",
            "required": [
              "start"
            ],
            "properties": {
              "start": {
                "type": "string",
                "format": "date-time",
                "description": "Start of the bucket."
              }
            }
          }
        ]
      },
      "CreateDataAPIContractTaskRequest": {
        "description": "The contract inspection to run.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "kind"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "types",
              "validators",
              "schema"
            ],
            "description": "`types` (TypeScript contract), `validators` (input validators) or `schema` (JSON contract snapshot)."
          }
        }
      },
      "DataAPIUsage": {
        "description": "An app's reported Data API usage over a window, zero-filled per bucket.",
        "type": "object",
        "required": [
          "app",
          "from",
          "to",
          "granularity",
          "totals",
          "month_to_date",
          "buckets"
        ],
        "properties": {
          "app": {
            "type": "string"
          },
          "from": {
            "type": "string",
            "format": "date-time"
          },
          "to": {
            "type": "string",
            "format": "date-time"
          },
          "granularity": {
            "type": "string",
            "enum": [
              "hour",
              "day"
            ]
          },
          "totals": {
            "$ref": "#/components/schemas/DataAPIUsageCounts"
          },
          "month_to_date": {
            "$ref": "#/components/schemas/DataAPIUsageMonthToDate"
          },
          "buckets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DataAPIUsageBucket"
            }
          }
        }
      },
      "ConnectionBudgetRuntimeObservations": {
        "description": "Authenticated workload reports of configured resident Data API pools, including the refresh reader. Not live SQL sessions or independent guest attestation. Parked runtimes and future wakes remain estimates; this does not verify Auth or external consumers.",
        "type": "object",
        "required": [
          "state",
          "source",
          "observed_instances",
          "unobserved_instances",
          "parked_instances",
          "configured_connections"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "unknown",
              "partial",
              "observed",
              "not_applicable"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "workload_report"
            ]
          },
          "observed_instances": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unobserved_instances": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "parked_instances": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "configured_connections": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ConnectionBudgetCapacity": {
        "description": "Operator-qualified tenant allocation clamped to observed SQL ceilings for the exact database generation and placement. Unknown without fresh evidence; this does not reserve connections or establish complete consumer coverage.",
        "type": "object",
        "required": [
          "state"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "unknown",
              "verified"
            ]
          },
          "usable_connections": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "source": {
            "type": "string",
            "enum": [
              "provider_api",
              "native_qualification"
            ]
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ManagedPostgresBindingList": {
        "description": "Workload bindings attached to one managed PostgreSQL database.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ManagedPostgresBinding"
            }
          }
        }
      },
      "AppPostgresBinding": {
        "description": "One live managed PostgreSQL binding of an app, without credential material.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "database",
          "scope",
          "environment_key",
          "access",
          "state"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "The binding ID that revoking the binding takes."
          },
          "database": {
            "type": "string",
            "description": "The bound database's name."
          },
          "scope": {
            "type": "string"
          },
          "environment_key": {
            "type": "string"
          },
          "access": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "description": "A binding in the deleting state no longer blocks deleting the app."
          }
        }
      },
      "AppPostgresBindingList": {
        "description": "An app's live managed PostgreSQL bindings on every database it is bound to.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppPostgresBinding"
            }
          }
        }
      },
      "CreateManagedPostgresBindingRequest": {
        "description": "Request to inject a managed database credential into an app environment. Access values are provider-neutral; the selected database backend may support only a subset.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "app_id",
          "scope",
          "environment_key",
          "access"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "scope": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
          },
          "environment_key": {
            "type": "string",
            "pattern": "^[A-Z][A-Z0-9_]*$"
          },
          "access": {
            "type": "string",
            "enum": [
              "read_write",
              "read_only",
              "migration",
              "data_api",
              "auth",
              "session"
            ],
            "description": "Portable credential mode. Unsupported modes are rejected before a binding is reserved."
          }
        }
      },
      "PrepareManagedPostgresCutoverRequest": {
        "description": "Stage source bindings for one app and scope on a ready database restored from that source.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "source_database_id",
          "target_database_id",
          "app_id",
          "scope"
        ],
        "properties": {
          "source_database_id": {
            "type": "string",
            "format": "uuid"
          },
          "target_database_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
          }
        }
      },
      "ManagedPostgresCutover": {
        "description": "Staged cutover metadata. Verified means control-plane SQL evidence; workloads still use the source. Provider identities and sealed credentials are never returned.",
        "type": "object",
        "required": [
          "id",
          "source_database_id",
          "target_database_id",
          "app_id",
          "scope",
          "state",
          "verification_fresh",
          "verification_max_age_seconds",
          "members",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "source_database_id": {
            "type": "string",
            "format": "uuid"
          },
          "target_database_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
          },
          "state": {
            "type": "string",
            "enum": [
              "preparing",
              "prepared",
              "verifying",
              "verified",
              "cancelling",
              "cancelled",
              "activated"
            ]
          },
          "verification_fresh": {
            "type": "boolean",
            "description": "All staged members have SQL evidence no older than verification_max_age_seconds."
          },
          "verification_max_age_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "verified_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_error_code": {
            "type": "string"
          },
          "members": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ManagedPostgresCutoverMember"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ManagedPostgresCutoverPreflight": {
        "description": "Historical catalog checks and remaining activation blockers. Never an activation token; sealed credentials and provider identities are private.",
        "type": "object",
        "required": [
          "cutover_id",
          "state",
          "revision",
          "activation_allowed",
          "stale",
          "binding_ids",
          "blockers",
          "verification_fresh",
          "source_matches",
          "target_matches",
          "bindings_match",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "cutover_id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "blocked"
            ]
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "activation_allowed": {
            "type": "boolean",
            "enum": [
              false
            ],
            "description": "Always false; customer activation remains disabled."
          },
          "stale": {
            "type": "boolean",
            "description": "Recomputed on read for pending checks, expiry, future check time, cutover changes, cancellation or changed runtime authority and receipts. Older reports without runtime observations require a new check."
          },
          "binding_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Affected source binding IDs observed during evaluation."
          },
          "blockers": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "activation_disabled",
                "runtime_safety_unproven",
                "source_sessions_unfenced",
                "routes_unconverged",
                "snapshot_invalidation_unproven",
                "resume_plan_missing",
                "cutover_inactive",
                "source_changed",
                "target_changed",
                "verification_required",
                "bindings_changed"
              ]
            }
          },
          "verification_fresh": {
            "type": "boolean",
            "description": "All staged credentials had fresh SQL verification at checked_at."
          },
          "source_matches": {
            "type": "boolean"
          },
          "target_matches": {
            "type": "boolean"
          },
          "bindings_match": {
            "type": "boolean"
          },
          "runtime_drain": {
            "$ref": "#/components/schemas/ManagedPostgresCutoverRuntimeDrain"
          },
          "source_sessions": {
            "$ref": "#/components/schemas/ManagedPostgresCutoverSourceSessions"
          },
          "observed_cutover_updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ManagedPostgresCutoverSourceSessions": {
        "description": "Historical source SQL admission and session observations for the frozen selected database set. Never complete writer-isolation proof. Preflight and GET initiate no SQL fences. Absent on pending and older reports. Inspect the parent stale and expires_at fields.",
        "type": "object",
        "required": [
          "state",
          "admission_closed",
          "selected_databases_drained",
          "selected_database_count",
          "sessions",
          "prepared_transactions",
          "unselected_databases",
          "blockers"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "unavailable",
              "not_requested",
              "pending",
              "closing",
              "closed",
              "abandoning",
              "released"
            ]
          },
          "admission_closed": {
            "type": "boolean",
            "description": "Admission closure was independently confirmed and fresh at checked_at."
          },
          "selected_databases_drained": {
            "type": "boolean",
            "description": "Selected databases had no observed sessions or prepared transactions at checked_at. Background writers and future catalog stability remain unproven."
          },
          "selected_database_count": {
            "type": "integer",
            "minimum": 0
          },
          "sessions": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "prepared_transactions": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unselected_databases": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "blockers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "writer_isolation": {
            "$ref": "#/components/schemas/ManagedPostgresCutoverWriterIsolation"
          }
        }
      },
      "ManagedPostgresCutoverWriterIsolation": {
        "description": "Historical SQL writer inventory and optional provider guard evidence. Confirmed requires fresh matching evidence and idle complete SQL inventory; it does not qualify a deployed provider or allow activation. Neon currently lacks the stronger provider guarantee. Names, catalog fingerprints and ownership tokens remain private.",
        "type": "object",
        "required": [
          "state",
          "confirmed",
          "inventory_available",
          "catalog_matches",
          "catalog_stable",
          "background_writers_fenced",
          "client_sessions",
          "background_workers",
          "replication_workers",
          "unknown_backends"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "unsupported",
              "unavailable",
              "blocked",
              "confirmed",
              "expired",
              "inactive"
            ]
          },
          "confirmed": {
            "type": "boolean"
          },
          "inventory_available": {
            "type": "boolean"
          },
          "catalog_matches": {
            "type": "boolean",
            "description": "The complete observed catalog matches its immutable original fingerprint; this is not a catalog lock."
          },
          "catalog_stable": {
            "type": "boolean",
            "description": "Fresh provider evidence attests a durable catalog guard."
          },
          "background_writers_fenced": {
            "type": "boolean",
            "description": "Fresh provider evidence covers background and replication write paths across all dataset endpoints."
          },
          "client_sessions": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "background_workers": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "replication_workers": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unknown_backends": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Backends whose type is hidden by privileges or not recognized; these prevent confirmation."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ManagedPostgresCutoverRuntimeDrain": {
        "description": "Historical scheduler instance catalog evidence at checked_at. Catalog retirement does not prove complete writer isolation. No fence or drain is initiated by preflight. Absent on pending requests and reports created before runtime observations were supported.",
        "type": "object",
        "required": [
          "state",
          "inventory_count",
          "pending",
          "retired",
          "blocked",
          "blockers",
          "members"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "unavailable",
              "not_fenced",
              "missing",
              "draining",
              "blocked",
              "catalog_retired"
            ]
          },
          "inventory_count": {
            "type": "integer",
            "minimum": 0,
            "description": "Captured catalog count; a lower bound when inventory_limit_exceeded is reported."
          },
          "pending": {
            "type": "integer",
            "minimum": 0
          },
          "retired": {
            "type": "integer",
            "minimum": 0,
            "description": "Members with matching native retirement receipts."
          },
          "blocked": {
            "type": "integer",
            "minimum": 0
          },
          "blockers": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Plan and authority blocker codes. Member blockers appear on each member."
          },
          "members": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ManagedPostgresCutoverRuntimeDrainMember"
            }
          }
        }
      },
      "ManagedPostgresCutoverRuntimeDrainMember": {
        "description": "Safe captured workload identity and retirement finding. Host identities and native proof details remain private.",
        "type": "object",
        "required": [
          "instance_id",
          "scope",
          "mode",
          "state"
        ],
        "properties": {
          "instance_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "mode": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "retired",
              "blocked"
            ]
          },
          "blocker_code": {
            "type": "string"
          }
        }
      },
      "ManagedPostgresCutoverMember": {
        "description": "Safe staging and SQL verification evidence for a source binding.",
        "type": "object",
        "required": [
          "source_binding_id",
          "environment_key",
          "access",
          "state"
        ],
        "properties": {
          "source_binding_id": {
            "type": "string",
            "format": "uuid"
          },
          "environment_key": {
            "type": "string",
            "pattern": "^[A-Z][A-Z0-9_]*$"
          },
          "access": {
            "type": "string",
            "enum": [
              "read_write",
              "read_only",
              "migration",
              "data_api",
              "auth",
              "session"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "sealed",
              "revoked"
            ]
          },
          "verified_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ObjectBucket": {
        "description": "Logical bucket metadata without upstream credentials or placement details.",
        "type": "object",
        "required": [
          "id",
          "name",
          "scope",
          "region",
          "state",
          "public",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          },
          "region": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "provisioning",
              "ready",
              "deleting"
            ]
          },
          "public": {
            "type": "boolean"
          },
          "serve_at": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "retry": {
            "$ref": "#/components/schemas/ObjectBucketRetry"
          }
        }
      },
      "ObjectBucketRetry": {
        "description": "Set while a bucket create or delete has failed and Gregale is retrying it. Reason is a bounded code, never a provider message.",
        "type": "object",
        "required": [
          "reason",
          "detail",
          "attempts",
          "retry_at"
        ],
        "properties": {
          "reason": {
            "type": "string",
            "enum": [
              "temporary",
              "conflict",
              "configuration",
              "invalid",
              "protected",
              "cleanup_pending"
            ]
          },
          "detail": {
            "type": "string",
            "description": "Customer-facing explanation of the reason."
          },
          "attempts": {
            "type": "integer",
            "format": "int32"
          },
          "retry_at": {
            "type": "string",
            "format": "date-time",
            "description": "When Gregale next tries the operation."
          }
        }
      },
      "ObjectEncryptionCapabilities": {
        "description": "Operator enrollment for this bucket placement. Contains no native key identity, key material or permission assertion.",
        "type": "object",
        "required": [
          "algorithms",
          "key_ids",
          "bucket_defaults"
        ],
        "properties": {
          "algorithms": {
            "type": "array",
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "AES256",
                "aws:kms",
                "aws:kms:dsse"
              ]
            }
          },
          "bucket_defaults": {
            "type": "boolean",
            "description": "Whether this placement supports durable native bucket defaults."
          },
          "key_ids": {
            "type": "array",
            "uniqueItems": true,
            "maxItems": 256,
            "items": {
              "type": "string",
              "maxLength": 512,
              "description": "Owned arn:gregale:kms reference accepted by the branded S3 endpoint."
            }
          }
        }
      },
      "ObjectBucketList": {
        "description": "App bucket catalog and operator-configured preview capabilities.",
        "type": "object",
        "required": [
          "items",
          "enabled",
          "regions",
          "default_region",
          "max_upload_bytes",
          "max_buckets_per_app"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ObjectBucket"
            }
          },
          "enabled": {
            "type": "boolean"
          },
          "regions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "default_region": {
            "type": "string"
          },
          "max_upload_bytes": {
            "type": "integer",
            "format": "int64"
          },
          "max_buckets_per_app": {
            "type": "integer"
          },
          "max_single_put_bytes": {
            "type": "integer",
            "format": "int64",
            "description": "Largest single PUT accepted by the configured upload profile."
          },
          "max_part_bytes": {
            "type": "integer",
            "format": "int64",
            "description": "Largest multipart part accepted by the configured upload profile."
          },
          "transfer_timeout_seconds": {
            "type": "integer",
            "format": "int64",
            "description": "Combined request staging and forwarding deadline in seconds."
          },
          "upload_profile": {
            "type": "string",
            "enum": [
              "proxied",
              "direct"
            ],
            "description": "Configured body size contract for the branded storage origin."
          }
        }
      },
      "ObjectUploadRoute": {
        "description": "Policy-controlled edge upload route. The edge generates the final object key and never exposes provider placement.",
        "type": "object",
        "required": [
          "id",
          "name",
          "bucket_id",
          "max_bytes",
          "enabled",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "bucket_id": {
            "type": "string",
            "format": "uuid"
          },
          "key_prefix": {
            "type": "string",
            "maxLength": 256
          },
          "max_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "allowed_content_types": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 32
          },
          "enabled": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "encryption": {
            "$ref": "#/components/schemas/ObjectEncryption"
          }
        }
      },
      "ObjectUploadRouteList": {
        "description": "Policy-controlled edge upload routes for one app.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ObjectUploadRoute"
            }
          }
        }
      },
      "CreateObjectUploadRouteRequest": {
        "description": "Upload policy declaration for POST /uploads/{name}. Optional owned encryption is captured per receipt; encrypted routes require a tracked capable provider and use the configured single PUT limit.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "bucket_id"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "bucket_id": {
            "type": "string",
            "format": "uuid"
          },
          "key_prefix": {
            "type": "string",
            "maxLength": 256
          },
          "max_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "allowed_content_types": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 32
          },
          "enabled": {
            "type": "boolean",
            "default": true
          },
          "encryption": {
            "$ref": "#/components/schemas/ObjectEncryption"
          }
        }
      },
      "ObjectBucketAccessGrant": {
        "description": "Provider-independent access binding between one Gregale API key and one logical bucket.",
        "type": "object",
        "required": [
          "key_id",
          "key_label",
          "key_status",
          "permission",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "key_id": {
            "type": "string",
            "format": "uuid"
          },
          "key_label": {
            "type": "string"
          },
          "key_status": {
            "type": "string",
            "enum": [
              "active",
              "grace",
              "revoked"
            ]
          },
          "permission": {
            "type": "string",
            "enum": [
              "read",
              "write",
              "read_write"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ObjectBucketAccessGrantList": {
        "description": "Access grants for one logical bucket.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ObjectBucketAccessGrant"
            }
          }
        }
      },
      "SetObjectBucketAccessGrantRequest": {
        "description": "Desired data-plane permission for the target API key.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "permission"
        ],
        "properties": {
          "permission": {
            "type": "string",
            "enum": [
              "read",
              "write",
              "read_write"
            ]
          }
        }
      },
      "ObjectS3CopySource": {
        "type": "object",
        "description": "Public copy-only authority for an owned source bucket. Placement and grant epoch are private.",
        "required": [
          "source_bucket_id",
          "prefix",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "source_bucket_id": {
            "type": "string",
            "format": "uuid"
          },
          "prefix": {
            "type": "string",
            "maxLength": 1024,
            "description": "Literal allowed source key prefix, bounded to 1024 UTF-8 bytes."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ObjectS3CopySourceList": {
        "type": "object",
        "description": "Copy source grants for one owned destination credential.",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/ObjectS3CopySource"
            }
          }
        }
      },
      "SetObjectS3CopySourceRequest": {
        "type": "object",
        "description": "Exact source key prefix. Empty or omitted prefix grants all keys in the owned source bucket solely for copy.",
        "additionalProperties": false,
        "properties": {
          "prefix": {
            "type": "string",
            "default": "",
            "maxLength": 1024
          }
        }
      },
      "ObjectS3Credential": {
        "description": "Bucket-scoped Gregale S3 credential metadata. The secret access key is never included in this shape.",
        "type": "object",
        "required": [
          "id",
          "bucket_id",
          "access_key_id",
          "label",
          "permission",
          "status",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bucket_id": {
            "type": "string",
            "format": "uuid"
          },
          "access_key_id": {
            "type": "string",
            "pattern": "^GRGA[A-Z2-7]{16}$"
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "permission": {
            "type": "string",
            "enum": [
              "read",
              "write",
              "read_write"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "revoked"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_used_at": {
            "type": "string",
            "format": "date-time"
          },
          "revoked_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ObjectS3CredentialList": {
        "description": "Active Gregale S3 credentials for one logical bucket.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ObjectS3Credential"
            }
          }
        }
      },
      "CreateObjectS3CredentialRequest": {
        "description": "Label and least-privilege access level for a new bucket-scoped S3 credential.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "label",
          "permission"
        ],
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "permission": {
            "type": "string",
            "enum": [
              "read",
              "write",
              "read_write"
            ]
          }
        }
      },
      "ObjectS3CredentialSecret": {
        "description": "One-time S3 credential creation response. Configure AWS clients for the returned endpoint, region, and path-style addressing.",
        "allOf": [
          {
            "$ref": "#/components/schemas/ObjectS3Credential"
          },
          {
            "type": "object",
            "required": [
              "secret_access_key",
              "endpoint",
              "region",
              "addressing_style"
            ],
            "properties": {
              "secret_access_key": {
                "type": "string",
                "minLength": 40,
                "maxLength": 40,
                "readOnly": true
              },
              "endpoint": {
                "type": "string",
                "format": "uri",
                "example": "https://s3.gregale.dev"
              },
              "region": {
                "type": "string",
                "example": "us-east-1"
              },
              "addressing_style": {
                "type": "string",
                "enum": [
                  "path"
                ]
              }
            }
          }
        ]
      },
      "CreateObjectStorageComputeBindingRequest": {
        "description": "Least-privilege S3 access and the environment-variable prefix for an app-to-bucket binding.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "permission"
        ],
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "default": "compute"
          },
          "permission": {
            "type": "string",
            "enum": [
              "read",
              "write",
              "read_write"
            ]
          },
          "prefix": {
            "type": "string",
            "pattern": "^[A-Z][A-Z0-9_]{0,47}$",
            "maxLength": 48
          },
          "key_prefix": {
            "type": "string",
            "minLength": 2,
            "maxLength": 512,
            "description": "Limit the binding's key to object keys under this literal prefix, such as segments/L0/. It must end in / and may not contain *, ? or [, empty segments, or . and .. segments. Requests outside it, unscoped listings and bucket-wide settings are denied. 403 object_storage_key_scopes_unavailable until key-scoped bindings are released to the account."
          }
        }
      },
      "ObjectStorageComputeBindingSecretKeys": {
        "description": "Names of sealed app secrets written for a compute binding; values are never returned.",
        "type": "object",
        "required": [
          "endpoint",
          "region",
          "bucket",
          "access_key_id",
          "secret_access_key",
          "addressing_style"
        ],
        "properties": {
          "endpoint": {
            "type": "string"
          },
          "region": {
            "type": "string"
          },
          "bucket": {
            "type": "string"
          },
          "access_key_id": {
            "type": "string"
          },
          "secret_access_key": {
            "type": "string"
          },
          "addressing_style": {
            "type": "string"
          }
        }
      },
      "ObjectStorageComputeBinding": {
        "description": "Provider-neutral app-to-bucket compute binding. Rotation responses and binding lists set rotation_pending while the previous key remains valid during a rolling runtime refresh.",
        "type": "object",
        "required": [
          "id",
          "bucket_id",
          "scope",
          "prefix",
          "credential",
          "secret_keys"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bucket_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "prefix": {
            "type": "string",
            "pattern": "^[A-Z][A-Z0-9_]{0,47}$"
          },
          "key_prefix": {
            "type": "string",
            "description": "Object keys this binding is limited to; absent for a whole-bucket binding."
          },
          "credential": {
            "$ref": "#/components/schemas/ObjectS3Credential"
          },
          "secret_keys": {
            "$ref": "#/components/schemas/ObjectStorageComputeBindingSecretKeys"
          },
          "rotation_pending": {
            "type": "boolean",
            "description": "Previous key is still valid until the rolling refresh has drained old instances."
          }
        }
      },
      "ObjectStorageComputeBindingList": {
        "description": "Active compute bindings for one logical bucket.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ObjectStorageComputeBinding"
            }
          }
        }
      },
      "ObjectStoragePolicy": {
        "description": "Operator safety limits. Empty accounting_mode requires qualified provider reports including cost. Explicit gateway_safety_v1 requires a coverage start, proxied transfers, billing off and no cost ceiling; all other budgets remain positive and finite.",
        "type": "object",
        "required": [
          "max_account_bytes",
          "max_bucket_bytes",
          "max_account_keys",
          "max_monthly_cost_millicents",
          "max_monthly_requests",
          "max_monthly_egress_bytes",
          "max_monthly_authorizations",
          "max_report_age_seconds"
        ],
        "properties": {
          "accounting_mode": {
            "type": "string",
            "enum": [
              "gateway_safety_v1"
            ]
          },
          "gateway_metering_since": {
            "type": "string",
            "format": "date-time"
          },
          "max_account_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "max_bucket_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "max_account_keys": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "max_monthly_cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "max_monthly_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "max_monthly_egress_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "max_monthly_authorizations": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "max_report_age_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ObjectStorageUsage": {
        "description": "Account-wide usage and reserved capacity. In gateway_safety_v1 requests count durable provider attempts and egress counts full response lengths reserved before forwarding; disconnects retain reservations. Fields named in unavailable_meters are unknown, their numeric placeholders are not measured zeros and must not be billed. Legacy costs are EUR millicents, not a customer invoice.",
        "type": "object",
        "required": [
          "observed_bytes",
          "capacity_bytes",
          "capacity_keys",
          "stored_byte_hours",
          "request_count",
          "egress_bytes",
          "cost_millicents",
          "authorizations",
          "fresh",
          "period_start"
        ],
        "properties": {
          "unavailable_meters": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "stored_byte_hours",
                "cost_millicents"
              ]
            }
          },
          "observed_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "capacity_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "capacity_keys": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "stored_byte_hours": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "request_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "egress_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "authorizations": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "fresh": {
            "type": "boolean"
          },
          "period_start": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ObjectStoragePricing": {
        "description": "Operator-supplied customer rate card. Rates are integer millicents and are not provider-specific.",
        "type": "object",
        "required": [
          "currency",
          "storage_millicents_per_gib_month",
          "requests_millicents_per_million",
          "egress_millicents_per_gib"
        ],
        "properties": {
          "currency": {
            "type": "string",
            "minLength": 3,
            "maxLength": 3,
            "pattern": "^[A-Z]{3}$"
          },
          "storage_millicents_per_gib_month": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "requests_millicents_per_million": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "egress_millicents_per_gib": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ObjectStorageCharge": {
        "description": "Current UTC-month customer charge estimate. This is not an invoice until a billing provider posts a line item.",
        "type": "object",
        "required": [
          "currency",
          "storage_millicents",
          "requests_millicents",
          "egress_millicents",
          "total_millicents"
        ],
        "properties": {
          "currency": {
            "type": "string",
            "minLength": 3,
            "maxLength": 3,
            "pattern": "^[A-Z]{3}$"
          },
          "storage_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "requests_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "egress_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ObjectStorageUsageResponse": {
        "description": "Current UTC-month accounting, customer charge estimate, billing rollout state, and operator safety policy.",
        "type": "object",
        "required": [
          "usage",
          "policy",
          "billing_mode"
        ],
        "properties": {
          "usage": {
            "$ref": "#/components/schemas/ObjectStorageUsage"
          },
          "policy": {
            "$ref": "#/components/schemas/ObjectStoragePolicy"
          },
          "charges": {
            "$ref": "#/components/schemas/ObjectStorageCharge"
          },
          "billing_mode": {
            "type": "string",
            "enum": [
              "off",
              "shadow",
              "live"
            ],
            "description": "Whether finalized object-storage charges are disabled, audited locally, or sent to the billing provider."
          },
          "billing_from": {
            "type": "string",
            "format": "date-time",
            "description": "UTC month boundary at which shadow/live handling starts. Periods before it are never charged."
          },
          "over_ceiling": {
            "$ref": "#/components/schemas/ObjectStorageOverCeilingDeletion"
          }
        }
      },
      "ObjectStorageOverCeilingDeletion": {
        "description": "Present while the account stores more than its object-storage ceiling. Unless the account gets back under the ceiling first, Gregale deletes the excess on deletion_scheduled_at.",
        "type": "object",
        "required": [
          "over_ceiling_since",
          "deletion_scheduled_at",
          "excess_bytes"
        ],
        "properties": {
          "over_ceiling_since": {
            "type": "string",
            "format": "date-time"
          },
          "deletion_scheduled_at": {
            "type": "string",
            "format": "date-time"
          },
          "excess_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Bytes stored above the ceiling at the last check."
          }
        }
      },
      "ObjectStorageUsageReport": {
        "description": "Authoritative cumulative provider usage for one account, backend and UTC month. Missing data is not zero; costs are EUR millicents.",
        "type": "object",
        "required": [
          "account_id",
          "backend_id",
          "backend_fingerprint",
          "source",
          "period_start",
          "observed_at",
          "stored_byte_hours",
          "request_count",
          "egress_bytes",
          "cost_millicents"
        ],
        "properties": {
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "backend_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63
          },
          "backend_fingerprint": {
            "type": "string",
            "minLength": 64,
            "maxLength": 64
          },
          "source": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "stored_byte_hours": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "request_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "egress_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ObjectEncryption": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "algorithm"
        ],
        "description": "Owned encryption selection for object writes and upload policies. KMS requires an enrolled Gregale key reference; bucket keys apply only to aws:kms. Context is canonical base64 of a bounded JSON object with unique string entries.",
        "properties": {
          "algorithm": {
            "type": "string",
            "enum": [
              "AES256",
              "aws:kms",
              "aws:kms:dsse"
            ]
          },
          "key_id": {
            "type": "string",
            "maxLength": 512,
            "description": "Owned arn:gregale:kms reference; required for KMS and forbidden for AES256."
          },
          "bucket_key_enabled": {
            "type": "boolean"
          },
          "context": {
            "type": "string",
            "maxLength": 10924
          }
        }
      },
      "ObjectVersion": {
        "type": "object",
        "additionalProperties": false,
        "description": "Logical object data and an owned public version selector; native provider identifiers remain private.",
        "required": [
          "key",
          "version_id",
          "is_latest",
          "delete_marker",
          "size_bytes",
          "last_modified"
        ],
        "properties": {
          "key": {
            "type": "string"
          },
          "version_id": {
            "type": "string"
          },
          "is_latest": {
            "type": "boolean"
          },
          "delete_marker": {
            "type": "boolean"
          },
          "size_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "etag": {
            "type": "string"
          },
          "last_modified": {
            "type": "string",
            "format": "date-time"
          },
          "storage_class": {
            "type": "string"
          }
        }
      },
      "ObjectVersionList": {
        "description": "An owned public version page with paired continuation markers.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "items",
          "common_prefixes"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ObjectVersion"
            }
          },
          "common_prefixes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "next_key_marker": {
            "type": "string"
          },
          "next_version_id_marker": {
            "type": "string",
            "description": "Owned public version selector to resume with next_key_marker."
          }
        }
      },
      "ObjectSignRequest": {
        "description": "Exact object operation to authorize at the branded S3 gateway. PUT binds one durable receipt and supports an explicit owned encryption selection.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "method",
          "key"
        ],
        "properties": {
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "HEAD",
              "PUT"
            ]
          },
          "key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          },
          "version_id": {
            "type": "string",
            "format": "uuid",
            "description": "GET/HEAD only. Exact owned immutable public version UUID. Mutable null and native provider selectors are rejected. Omit for the current object."
          },
          "if_match": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "PUT only. Mutually exclusive with if_none_match. GCS accepts one strong quoted XML ETag or * and binds the observed content generation; a concurrent replacement is rejected even if it has the same ETag. Conditions are fixed in the signed capability."
          },
          "if_none_match": {
            "type": "string",
            "enum": [
              "*"
            ],
            "description": "PUT only. Create only if no live object exists. Mutually exclusive with if_match."
          },
          "expires_in": {
            "type": "integer",
            "minimum": 0,
            "maximum": 900,
            "default": 300
          },
          "size_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Required for PUT; forbidden for GET."
          },
          "content_type": {
            "type": "string",
            "maxLength": 255,
            "description": "PUT only."
          },
          "cache_control": {
            "type": "string",
            "maxLength": 255,
            "description": "Cache-Control value for PUT."
          },
          "content_disposition": {
            "type": "string",
            "maxLength": 255,
            "description": "Content-Disposition value for PUT."
          },
          "content_encoding": {
            "type": "string",
            "maxLength": 255,
            "description": "Content-Encoding value for PUT."
          },
          "content_language": {
            "type": "string",
            "maxLength": 255,
            "description": "Content-Language value for PUT."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "maxLength": 2048
            },
            "maxProperties": 90,
            "description": "PUT-only x-amz-meta-* values."
          },
          "tags": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "maxLength": 256
            },
            "maxProperties": 10,
            "description": "PUT-only S3 object tags."
          },
          "protection": {
            "$ref": "#/components/schemas/ObjectWriteProtection"
          },
          "encryption": {
            "$ref": "#/components/schemas/ObjectEncryption"
          }
        }
      },
      "ObjectSignedRequest": {
        "description": "Temporary bearer capability. Bucket object GET/HEAD/PUT URLs use the branded S3 gateway; a PUT URL dispatches at most one write. Multipart part URLs retain their separate contract. Do not log or persist URLs.",
        "type": "object",
        "required": [
          "url",
          "method",
          "headers",
          "expires_at"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "HEAD",
              "PUT"
            ]
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "upload_id": {
            "type": "string",
            "format": "uuid",
            "description": "Durable write receipt for an object PUT URL. Omitted for reads and multipart part URLs."
          }
        }
      },
      "ObjectBucketNotificationsRequest": {
        "type": "object",
        "description": "Complete atomic replacement; an empty array clears notification intent.",
        "additionalProperties": false,
        "required": [
          "rules"
        ],
        "properties": {
          "rules": {
            "type": "array",
            "maxItems": 1000,
            "items": {
              "$ref": "#/components/schemas/ObjectNotificationRule"
            }
          }
        }
      },
      "ObjectBucketNotifications": {
        "type": "object",
        "description": "Durable normalized bucket notification configuration.",
        "additionalProperties": false,
        "required": [
          "bucket_id",
          "revision",
          "rules"
        ],
        "properties": {
          "bucket_id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "managed_rule_ids": {
            "type": "array",
            "maxItems": 1000,
            "items": {
              "type": "string"
            },
            "description": "Rules owned by declarative compute reconciliation. Full manual replacement clears ownership."
          },
          "rules": {
            "type": "array",
            "maxItems": 1000,
            "items": {
              "$ref": "#/components/schemas/ObjectNotificationRule"
            }
          }
        }
      },
      "ObjectStorageComputeTrigger": {
        "type": "object",
        "description": "Stable ObjectCreated filter targeting only the bucket's owning app.",
        "additionalProperties": false,
        "required": [
          "id"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "Stable manifest identity scoped to the bucket."
          },
          "events": {
            "type": "array",
            "maxItems": 10,
            "uniqueItems": true,
            "description": "Defaults to s3:ObjectCreated:* when omitted or empty.",
            "items": {
              "type": "string",
              "enum": [
                "s3:ObjectCreated:*",
                "s3:ObjectCreated:Put",
                "s3:ObjectCreated:Copy",
                "s3:ObjectCreated:CompleteMultipartUpload"
              ]
            }
          },
          "prefix": {
            "type": "string",
            "maxLength": 1024
          },
          "suffix": {
            "type": "string",
            "maxLength": 1024
          }
        }
      },
      "ReconcileObjectStorageComputeTriggersRequest": {
        "type": "object",
        "description": "Revision-checked replacement of only the bucket's declarative compute triggers.",
        "additionalProperties": false,
        "required": [
          "expected_revision",
          "triggers"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1152921504606847000
          },
          "triggers": {
            "type": "array",
            "maxItems": 1000,
            "items": {
              "$ref": "#/components/schemas/ObjectStorageComputeTrigger"
            }
          }
        }
      },
      "ObjectNotificationRule": {
        "type": "object",
        "description": "Proven mutation routing to a Gregale function or existing enabled queue binding. Prefix and suffix are decoded strings; overlapping filters for the same event are rejected. IDs are generated when omitted.",
        "additionalProperties": false,
        "required": [
          "destination",
          "events"
        ],
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 255
          },
          "destination": {
            "type": "string",
            "description": "arn:gregale:lambda:REGION:ACCOUNT:function:APP_UUID or arn:gregale:sqs:REGION:ACCOUNT:APP_UUID/QUEUE_NAME"
          },
          "events": {
            "type": "array",
            "minItems": 1,
            "maxItems": 10,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "s3:ObjectCreated:*",
                "s3:ObjectCreated:Put",
                "s3:ObjectCreated:Copy",
                "s3:ObjectCreated:CompleteMultipartUpload",
                "s3:ObjectRemoved:*",
                "s3:ObjectRemoved:Delete",
                "s3:ObjectRemoved:DeleteMarkerCreated",
                "s3:LifecycleExpiration:*",
                "s3:LifecycleExpiration:Delete",
                "s3:LifecycleExpiration:DeleteMarkerCreated"
              ]
            }
          },
          "prefix": {
            "type": "string",
            "maxLength": 1024
          },
          "suffix": {
            "type": "string",
            "maxLength": 1024
          }
        }
      },
      "ObjectBucketLifecycleRequest": {
        "type": "object",
        "description": "Complete lifecycle rule replacement; use DELETE to clear the configuration.",
        "additionalProperties": false,
        "required": [
          "rules"
        ],
        "properties": {
          "rules": {
            "type": "array",
            "minItems": 1,
            "maxItems": 1000,
            "items": {
              "$ref": "#/components/schemas/ObjectLifecycleRule"
            }
          }
        }
      },
      "ObjectBucketLifecycle": {
        "type": "object",
        "description": "Durable normalized lifecycle policy; removal retains revision history.",
        "additionalProperties": false,
        "required": [
          "bucket_id",
          "revision",
          "rules",
          "updated_at"
        ],
        "properties": {
          "bucket_id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "rules": {
            "type": "array",
            "maxItems": 1000,
            "items": {
              "$ref": "#/components/schemas/ObjectLifecycleRule"
            }
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ObjectLifecycleRule": {
        "type": "object",
        "description": "At least one action is required. Omitted IDs receive deterministic IDs. Tag filters cannot be combined with multipart abort or expired delete marker actions.",
        "additionalProperties": false,
        "required": [
          "status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 255,
            "description": "Unique rule ID; generated when omitted or empty."
          },
          "status": {
            "type": "string",
            "enum": [
              "Enabled",
              "Disabled"
            ]
          },
          "filter": {
            "$ref": "#/components/schemas/ObjectLifecycleFilter"
          },
          "expiration": {
            "$ref": "#/components/schemas/ObjectLifecycleExpiration"
          },
          "noncurrent_version_expiration": {
            "$ref": "#/components/schemas/ObjectLifecycleNoncurrentExpiration"
          },
          "abort_incomplete_multipart_days": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 2147483647
          }
        }
      },
      "ObjectLifecycleFilter": {
        "type": "object",
        "description": "Empty filter selects all keys. Prefix and tags are conjunctive; at most ten tags are supported.",
        "additionalProperties": false,
        "properties": {
          "prefix": {
            "type": "string",
            "description": "Exact key prefix; UTF-8 bytes are bounded by the portable key limit."
          },
          "tags": {
            "type": "object",
            "maxProperties": 10,
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      },
      "ObjectLifecycleExpiration": {
        "type": "object",
        "description": "Exactly one action is required. Date must be a UTC midnight. A false marker action is retained as a no-op.",
        "additionalProperties": false,
        "minProperties": 1,
        "maxProperties": 1,
        "properties": {
          "days": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 2147483647
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "expired_object_delete_marker": {
            "type": "boolean"
          }
        }
      },
      "ObjectLifecycleNoncurrentExpiration": {
        "type": "object",
        "description": "Expire noncurrent versions after their successor age and optional retained-version count both qualify.",
        "additionalProperties": false,
        "required": [
          "noncurrent_days"
        ],
        "properties": {
          "noncurrent_days": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 2147483647
          },
          "newer_noncurrent_versions": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 100
          }
        }
      },
      "ObjectLifecycleScan": {
        "type": "object",
        "description": "Discovery progress; completed discovery does not imply admitted cleanup has completed.",
        "additionalProperties": false,
        "required": [
          "id",
          "bucket_id",
          "revision",
          "state",
          "phase",
          "scanned_keys",
          "scanned_uploads",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bucket_id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "state": {
            "type": "string",
            "enum": [
              "scanning",
              "completed",
              "cancelled"
            ]
          },
          "phase": {
            "type": "string",
            "enum": [
              "objects",
              "multipart"
            ]
          },
          "scanned_keys": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "scanned_uploads": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ObjectBucketEncryptionRequest": {
        "type": "object",
        "description": "A non-empty enrolled default policy without per-object context.",
        "additionalProperties": false,
        "required": [
          "encryption"
        ],
        "properties": {
          "encryption": {
            "$ref": "#/components/schemas/ObjectEncryption",
            "description": "Non-empty enrolled default selection without a per-object context."
          }
        }
      },
      "ObjectBucketEncryption": {
        "type": "object",
        "description": "Owned desired and verified policies. Empty encryption means no owned override; providers may retain baseline encryption. New implicit writes require state ready.",
        "required": [
          "bucket_id",
          "state",
          "revision",
          "updated_at"
        ],
        "properties": {
          "bucket_id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "waiting",
              "applying",
              "ready"
            ]
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "encryption": {
            "$ref": "#/components/schemas/ObjectEncryption",
            "description": "Verified active default for new implicit writes."
          },
          "desired_encryption": {
            "$ref": "#/components/schemas/ObjectEncryption",
            "description": "Requested default awaiting native verification."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ObjectWriteProtection": {
        "type": "object",
        "additionalProperties": false,
        "description": "Fixed or enrolled event retention and an independent legal hold for a new object version. Omitted retention inherits the immutable admitted bucket default. Event hold ON requires one days or years duration and permits an optional minimum date. Event hold OFF on creation requires an explicit fixed date and no duration. Governance bypass is unsupported.",
        "properties": {
          "retention": {
            "$ref": "#/components/schemas/ObjectVersionRetention"
          },
          "legal_hold": {
            "$ref": "#/components/schemas/ObjectVersionLegalHold"
          }
        }
      },
      "ObjectVersionRetention": {
        "type": "object",
        "additionalProperties": false,
        "description": "Verified native retention or a retention intent. An empty object requests a clear. Active fixed retention cannot be shortened and active COMPLIANCE cannot be downgraded. Enrolled event hold ON requires one duration; OFF omits duration and lets the provider fix the final date from the existing hold. Observed dates and requested minimum dates are preserved. Governance bypass is unsupported. For new writes, OFF requires a fixed date; an undated OFF is reserved for releasing an existing hold.",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "GOVERNANCE",
              "COMPLIANCE"
            ]
          },
          "retain_until_date": {
            "type": "string",
            "format": "date-time"
          },
          "event_hold": {
            "type": "string",
            "enum": [
              "ON",
              "OFF"
            ]
          },
          "event_hold_duration": {
            "$ref": "#/components/schemas/ObjectRetentionPeriod"
          }
        }
      },
      "ObjectVersionLegalHold": {
        "type": "object",
        "description": "Independent exact-version legal hold status.",
        "additionalProperties": false,
        "required": [
          "status"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ON",
              "OFF"
            ]
          }
        }
      },
      "ObjectVersionRetentionRequest": {
        "type": "object",
        "description": "Stable identity and fixed or enrolled event hold retention intent for an owned version. ON requires a duration; OFF omits duration and requires a previously active hold unless a fixed date is supplied.",
        "additionalProperties": false,
        "required": [
          "id",
          "retention"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Stable caller-generated UUID v4; reuse only for the identical intent."
          },
          "retention": {
            "$ref": "#/components/schemas/ObjectVersionRetention"
          }
        }
      },
      "ObjectVersionLegalHoldRequest": {
        "type": "object",
        "description": "Stable identity and desired independent legal hold for an owned version.",
        "additionalProperties": false,
        "required": [
          "id",
          "legal_hold"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Caller-generated UUID v4 for this legal-hold intent; retain it when retrying."
          },
          "legal_hold": {
            "$ref": "#/components/schemas/ObjectVersionLegalHold"
          }
        }
      },
      "ObjectVersionRetentionResult": {
        "type": "object",
        "description": "Selected public version and its observed native retention.",
        "additionalProperties": false,
        "required": [
          "version_id",
          "retention"
        ],
        "properties": {
          "version_id": {
            "type": "string"
          },
          "retention": {
            "$ref": "#/components/schemas/ObjectVersionRetention"
          }
        }
      },
      "ObjectVersionLegalHoldResult": {
        "type": "object",
        "description": "Selected public version and its observed independent legal hold.",
        "additionalProperties": false,
        "required": [
          "version_id",
          "legal_hold"
        ],
        "properties": {
          "version_id": {
            "type": "string"
          },
          "legal_hold": {
            "$ref": "#/components/schemas/ObjectVersionLegalHold"
          }
        }
      },
      "ObjectVersionProtection": {
        "type": "object",
        "description": "Durable public protection receipt containing immutable intent and bounded reconciliation progress.",
        "additionalProperties": false,
        "required": [
          "id",
          "bucket_id",
          "key",
          "version_id",
          "kind",
          "state",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bucket_id": {
            "type": "string",
            "format": "uuid"
          },
          "key": {
            "type": "string"
          },
          "version_id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "retention",
              "legal_hold"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "waiting",
              "applying",
              "ready",
              "failed"
            ]
          },
          "retention": {
            "$ref": "#/components/schemas/ObjectVersionRetention"
          },
          "legal_hold": {
            "$ref": "#/components/schemas/ObjectVersionLegalHold"
          },
          "last_error_code": {
            "type": "string",
            "enum": [
              "provider_uncertain",
              "provider_unsupported",
              "provider_mismatch",
              "preparation_failed",
              "provider_rejected"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ObjectLockCapabilities": {
        "type": "object",
        "description": "Enrolled bucket configuration, default and per-version event holds, fixed version retention and legal-hold capabilities without a native health check.",
        "additionalProperties": false,
        "required": [
          "bucket_configuration",
          "default_event_hold",
          "version_retention",
          "version_legal_hold",
          "version_event_hold",
          "write_event_hold"
        ],
        "properties": {
          "bucket_configuration": {
            "type": "boolean"
          },
          "default_event_hold": {
            "type": "boolean"
          },
          "version_event_hold": {
            "type": "boolean",
            "description": "Separately enrolled durable per-version event hold mutations."
          },
          "write_event_hold": {
            "type": "boolean",
            "description": "Separately enrolled event holds on new writes and captured bucket defaults."
          },
          "version_retention": {
            "type": "boolean"
          },
          "version_legal_hold": {
            "type": "boolean"
          }
        }
      },
      "ObjectRetentionPeriod": {
        "type": "object",
        "description": "Exactly one positive days or years duration must be present. Null values are rejected.",
        "additionalProperties": false,
        "properties": {
          "days": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 36500
          },
          "years": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 100
          }
        },
        "oneOf": [
          {
            "required": [
              "days"
            ],
            "not": {
              "required": [
                "years"
              ]
            }
          },
          {
            "required": [
              "years"
            ],
            "not": {
              "required": [
                "days"
              ]
            }
          }
        ]
      },
      "ObjectLockDefaultRetention": {
        "type": "object",
        "description": "A mode with exactly one fixed duration, an event hold duration or both. Null values and an empty default are rejected.",
        "additionalProperties": false,
        "required": [
          "mode"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "GOVERNANCE",
              "COMPLIANCE"
            ]
          },
          "days": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 36500
          },
          "years": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 100
          },
          "default_event_hold": {
            "$ref": "#/components/schemas/ObjectRetentionPeriod"
          }
        },
        "anyOf": [
          {
            "required": [
              "days"
            ]
          },
          {
            "required": [
              "years"
            ]
          },
          {
            "required": [
              "default_event_hold"
            ]
          }
        ],
        "not": {
          "required": [
            "days",
            "years"
          ]
        }
      },
      "ObjectBucketObjectLockConfiguration": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "enabled"
        ],
        "description": "Native observation may report disabled. PUT requires enabled true. Omitting default_retention clears defaults while keeping Object Lock enabled.",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "default_retention": {
            "$ref": "#/components/schemas/ObjectLockDefaultRetention"
          }
        }
      },
      "ObjectBucketObjectLockRequest": {
        "type": "object",
        "description": "An enabled-only permanent bucket configuration request; omitted defaults clear future defaults.",
        "additionalProperties": false,
        "required": [
          "configuration"
        ],
        "properties": {
          "configuration": {
            "$ref": "#/components/schemas/ObjectBucketObjectLockConfiguration"
          }
        }
      },
      "ObjectBucketObjectLock": {
        "type": "object",
        "description": "Owned durable intent and native observation with permanent enablement history and reconciliation progress.",
        "additionalProperties": false,
        "required": [
          "bucket_id",
          "state",
          "revision",
          "enabled_required",
          "observed_known",
          "updated_at"
        ],
        "properties": {
          "bucket_id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "waiting",
              "applying",
              "ready"
            ]
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "enabled_required": {
            "type": "boolean",
            "description": "Permanent protection latch; enablement and version accounting cannot be disabled."
          },
          "observed_known": {
            "type": "boolean"
          },
          "observed_configuration": {
            "$ref": "#/components/schemas/ObjectBucketObjectLockConfiguration"
          },
          "desired_configuration": {
            "$ref": "#/components/schemas/ObjectBucketObjectLockConfiguration"
          },
          "last_error_code": {
            "type": "string",
            "enum": [
              "versioning_pending",
              "untracked_writes",
              "unsettled_writes",
              "multipart_active",
              "capacity_active",
              "provider_failed",
              "provider_mismatch",
              "provider_unsupported"
            ]
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ObjectBucketCORSRule": {
        "type": "object",
        "description": "One S3 CORSRule. Origins are \"*\" or an http(s) origin with at most one \"*\"; header patterns allow one \"*\".",
        "additionalProperties": false,
        "required": [
          "allowed_origins",
          "allowed_methods"
        ],
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 255
          },
          "allowed_origins": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "type": "string",
              "maxLength": 1024
            }
          },
          "allowed_methods": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "type": "string",
              "enum": [
                "GET",
                "PUT",
                "POST",
                "DELETE",
                "HEAD"
              ]
            }
          },
          "allowed_headers": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "string",
              "maxLength": 1024
            }
          },
          "expose_headers": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "string",
              "maxLength": 1024
            }
          },
          "max_age_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400
          }
        }
      },
      "ObjectBucketCORSRequest": {
        "type": "object",
        "description": "The complete set of CORS rules for a bucket.",
        "additionalProperties": false,
        "required": [
          "rules"
        ],
        "properties": {
          "rules": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/ObjectBucketCORSRule"
            }
          }
        }
      },
      "ObjectBucketCORS": {
        "type": "object",
        "description": "A bucket's CORS rules; revision 0 means none are set.",
        "required": [
          "bucket_id",
          "rules",
          "revision",
          "updated_at"
        ],
        "properties": {
          "bucket_id": {
            "type": "string",
            "format": "uuid"
          },
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ObjectBucketCORSRule"
            }
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ObjectBucketVersioningRequest": {
        "type": "object",
        "description": "Desired Enabled or Suspended status for a durable bucket configuration cutover.",
        "additionalProperties": false,
        "required": [
          "status"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "Enabled",
              "Suspended"
            ]
          }
        }
      },
      "ObjectBucketVersioning": {
        "type": "object",
        "description": "Desired and observed bucket versioning status with propagation and inventory progress.",
        "required": [
          "bucket_id",
          "desired_status",
          "observed_status",
          "state",
          "revision",
          "versions_required",
          "updated_at"
        ],
        "properties": {
          "bucket_id": {
            "type": "string",
            "format": "uuid"
          },
          "desired_status": {
            "type": "string",
            "enum": [
              "",
              "Enabled",
              "Suspended"
            ]
          },
          "observed_status": {
            "type": "string",
            "enum": [
              "",
              "Enabled",
              "Suspended"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "ready",
              "waiting",
              "propagating",
              "inventory"
            ]
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "versions_required": {
            "type": "boolean"
          },
          "propagation_until": {
            "type": "string",
            "format": "date-time"
          },
          "capacity_job_id": {
            "type": "string",
            "format": "uuid"
          },
          "last_error_code": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ObjectCapacityReconciliation": {
        "type": "object",
        "description": "Durable fenced capacity inventory and quota rebase. Failed or blocked jobs retain reservations; billing is unaffected.",
        "required": [
          "id",
          "bucket_id",
          "state",
          "inventory_scope",
          "scanned_pages",
          "scanned_bytes",
          "scanned_versions",
          "before_bytes",
          "before_keys",
          "after_bytes",
          "after_keys",
          "reclaimed_bytes",
          "reclaimed_keys",
          "pending_writes",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bucket_id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "waiting",
              "scanning",
              "completed",
              "blocked",
              "failed",
              "cancelled"
            ]
          },
          "inventory_scope": {
            "type": "string",
            "enum": [
              "current",
              "all_versions"
            ],
            "description": "Verified inventory scope; retained versions require all_versions."
          },
          "scanned_pages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "scanned_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "scanned_versions": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "before_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "before_keys": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "after_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "after_keys": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "reclaimed_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "reclaimed_keys": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "pending_writes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "last_error_code": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ObjectWriteReceipt": {
        "type": "object",
        "description": "Public receipt of one tracked PUT, CopyObject or application upload. Contains no credentials, provider placement, source identity or recovery lease tokens.",
        "required": [
          "id",
          "bucket_id",
          "key",
          "operation",
          "bytes",
          "content_type",
          "etag",
          "status",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "bucket_id": {
            "type": "string",
            "format": "uuid"
          },
          "key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          },
          "operation": {
            "type": "string",
            "enum": [
              "put",
              "copy",
              "upload"
            ]
          },
          "bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "content_type": {
            "type": "string"
          },
          "etag": {
            "type": "string",
            "description": "Confirmed ETag; empty until completion."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "completed",
              "failed"
            ]
          },
          "error_code": {
            "type": "string",
            "enum": [
              "preparation_expired",
              "usage_unavailable",
              "dispatch_failed",
              "provider_write_rejected",
              "provider_write_uncertain",
              "configuration"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "encryption": {
            "$ref": "#/components/schemas/ObjectEncryption"
          }
        }
      },
      "ObjectWriteReceiptList": {
        "type": "object",
        "description": "One live page of tracked bucket write receipts with an optional next-page cursor.",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/ObjectWriteReceipt"
            }
          },
          "next_cursor": {
            "type": "string",
            "maxLength": 512
          }
        }
      },
      "ObjectMultipartUpload": {
        "description": "Durable provider-neutral resumable upload session. The provider upload ID is private.",
        "type": "object",
        "required": [
          "id",
          "key",
          "size_bytes",
          "part_size_bytes",
          "part_count",
          "content_type",
          "state",
          "expires_at",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          },
          "size_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 5497558138880
          },
          "part_size_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 5368709120
          },
          "part_count": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000
          },
          "content_type": {
            "type": "string",
            "maxLength": 255
          },
          "state": {
            "type": "string",
            "enum": [
              "initiating",
              "active",
              "completing",
              "completing_conditional",
              "aborting",
              "completed",
              "aborted"
            ]
          },
          "completion_error_code": {
            "type": "string",
            "description": "Persisted conditional completion rejection; retries retain the outcome."
          },
          "etag": {
            "type": "string",
            "description": "Actual committed ETag when completion is confirmed."
          },
          "version_id": {
            "type": "string",
            "description": "Owned public version ID when completion is confirmed; null denotes a mutable provider version."
          },
          "encryption": {
            "$ref": "#/components/schemas/ObjectEncryption"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ObjectMultipartUploadList": {
        "description": "A page of durable provider-neutral resumable upload sessions.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ObjectMultipartUpload"
            }
          },
          "next_cursor": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "CreateObjectMultipartUploadRequest": {
        "description": "Final object identity, total size and optional owned encryption frozen at initiation for a resumable upload.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "key",
          "size_bytes"
        ],
        "properties": {
          "key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          },
          "size_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 5497558138880
          },
          "content_type": {
            "type": "string",
            "maxLength": 255
          },
          "protection": {
            "$ref": "#/components/schemas/ObjectWriteProtection"
          },
          "encryption": {
            "$ref": "#/components/schemas/ObjectEncryption"
          }
        }
      },
      "ObjectMultipartPartSignRequest": {
        "description": "Requested lifetime for one exact-length part capability.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expires_in": {
            "type": "integer",
            "minimum": 0,
            "maximum": 900,
            "default": 300
          }
        }
      },
      "ObjectMultipartCompletedPart": {
        "description": "Provider ETag returned after uploading one numbered part.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "part_number",
          "etag"
        ],
        "properties": {
          "part_number": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000
          },
          "etag": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        }
      },
      "ObjectMultipartPart": {
        "description": "A part confirmed by the upstream object storage provider.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "part_number",
          "etag",
          "size_bytes",
          "last_modified"
        ],
        "properties": {
          "part_number": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000
          },
          "etag": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "size_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "last_modified": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ObjectMultipartPartList": {
        "description": "A page of provider-confirmed parts for an active upload.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ObjectMultipartPart"
            }
          },
          "next_part_number_marker": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000
          }
        }
      },
      "CompleteObjectMultipartUploadRequest": {
        "description": "Complete ordered ETag manifest for every part in the session.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "parts"
        ],
        "properties": {
          "parts": {
            "type": "array",
            "minItems": 1,
            "maxItems": 10000,
            "items": {
              "$ref": "#/components/schemas/ObjectMultipartCompletedPart"
            }
          }
        }
      },
      "OperatorRuntimeConfig": {
        "description": "One entry from the closed operator runtime-configuration catalog.",
        "type": "object",
        "required": [
          "key",
          "label",
          "description",
          "category",
          "kind",
          "default_value",
          "desired_value",
          "effective_value",
          "source",
          "apply_mode",
          "controller_enabled",
          "mutable",
          "sensitive",
          "status",
          "version"
        ],
        "properties": {
          "key": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "boolean",
              "integer",
              "duration",
              "string",
              "enum",
              "secret_reference",
              "platform_flag",
              "platform_flag_groups",
              "platform_flag_opt_ins"
            ]
          },
          "default_value": {},
          "desired_value": {},
          "effective_value": {},
          "source": {
            "type": "string",
            "enum": [
              "default_or_environment",
              "operator"
            ]
          },
          "apply_mode": {
            "type": "string",
            "enum": [
              "hot",
              "graceful",
              "rolling",
              "break_glass"
            ]
          },
          "controller_enabled": {
            "type": "boolean"
          },
          "mutable": {
            "type": "boolean"
          },
          "sensitive": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "applied",
              "failed",
              "blocked"
            ]
          },
          "last_error": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "format": "int64"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "applied_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperatorRuntimeConfigOperation": {
        "description": "Durable asynchronous runtime-configuration apply request.",
        "type": "object",
        "required": [
          "id",
          "key",
          "scope",
          "scope_id",
          "version",
          "desired_value",
          "effective_value",
          "apply_mode",
          "status",
          "phase",
          "reason",
          "target_count",
          "applied_count",
          "failed_count",
          "requested_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "key": {
            "type": "string"
          },
          "scope": {
            "type": "string",
            "enum": [
              "global",
              "control_plane",
              "daemon",
              "node"
            ]
          },
          "scope_id": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "format": "int64"
          },
          "desired_value": {},
          "effective_value": {},
          "apply_mode": {
            "type": "string",
            "enum": [
              "graceful",
              "rolling",
              "break_glass"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "running",
              "succeeded",
              "failed",
              "blocked",
              "cancelled"
            ]
          },
          "phase": {
            "type": "string"
          },
          "error": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "target_count": {
            "type": "integer",
            "minimum": 0
          },
          "applied_count": {
            "type": "integer",
            "minimum": 0
          },
          "failed_count": {
            "type": "integer",
            "minimum": 0
          },
          "requested_at": {
            "type": "string",
            "format": "date-time"
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperatorRuntimeConfigRevision": {
        "description": "One append-only runtime configuration revision.",
        "type": "object",
        "required": [
          "id",
          "key",
          "scope",
          "scope_id",
          "version",
          "old_value",
          "new_value",
          "reason",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "key": {
            "type": "string"
          },
          "scope": {
            "type": "string",
            "enum": [
              "global",
              "control_plane",
              "daemon",
              "node"
            ]
          },
          "scope_id": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "format": "int64"
          },
          "old_value": {},
          "new_value": {},
          "actor_id": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "RollbackOperatorRuntimeConfigRequest": {
        "description": "Request to apply a historical runtime configuration revision.",
        "type": "object",
        "required": [
          "version",
          "reason"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "reason": {
            "type": "string",
            "minLength": 3,
            "maxLength": 500
          },
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "force": {
            "type": "boolean",
            "description": "Confirms restoring a revision that turns a core capability flag off for every account."
          }
        }
      },
      "Preview": {
        "description": "One self-serve platform preview.",
        "type": "object",
        "required": [
          "key",
          "label",
          "description",
          "joined",
          "eligible",
          "enabled"
        ],
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_-]{0,63}$"
          },
          "label": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "retire_by": {
            "type": "string",
            "format": "date",
            "description": "Planned end of the preview, by general availability or removal."
          },
          "joined": {
            "type": "boolean",
            "description": "Whether you (or, under /v1/orgs/{slug}, the organization) opted in."
          },
          "eligible": {
            "type": "boolean",
            "description": "Whether the preview is open to self-serve and your plan may join it."
          },
          "enabled": {
            "type": "boolean",
            "description": "Whether the preview is on for you now, for any reason."
          }
        }
      },
      "PreviewList": {
        "description": "Platform previews you can join or already joined.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Preview"
            }
          }
        }
      },
      "PlatformFlagRule": {
        "description": "One targeting rule of a platform flag. Accounts, orgs, group, plans and rollout combine with AND; the first matching rule decides. Orgs match the organization a request acts under.",
        "type": "object",
        "required": [
          "id",
          "value"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_-]{0,63}$"
          },
          "accounts": {
            "type": "array",
            "maxItems": 1000,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "orgs": {
            "type": "array",
            "maxItems": 1000,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "group": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_-]{0,63}$"
          },
          "plans": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "free",
                "hobby",
                "pro",
                "scale"
              ]
            }
          },
          "rollout": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000,
            "description": "Basis points of the accounts the other constraints admit."
          },
          "starts_at": {
            "type": "string",
            "format": "date-time",
            "description": "The rule applies from this moment (inclusive); stored in UTC."
          },
          "ends_at": {
            "type": "string",
            "format": "date-time",
            "description": "The rule stops applying at this moment (exclusive); must be after starts_at."
          },
          "ramp": {
            "$ref": "#/components/schemas/PlatformFlagRamp"
          },
          "value": {
            "type": "boolean"
          }
        }
      },
      "PlatformFlagRamp": {
        "description": "Advances the rule's rollout stage by stage. The rollout is the current stage; the API moves it on once the flag's version has held for interval_seconds and its health routes stayed under max_5xx_basis_points over that window with at least min_requests requests. On a breach it pauses (and for rollback returns one stage); a paused ramp waits for an operator to clear paused.",
        "type": "object",
        "required": [
          "stages",
          "interval_seconds",
          "max_5xx_basis_points",
          "min_requests",
          "on_breach"
        ],
        "properties": {
          "stages": {
            "type": "array",
            "minItems": 2,
            "maxItems": 10,
            "description": "Strictly ascending basis points; the rollout must be one of them.",
            "items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          "interval_seconds": {
            "type": "integer",
            "minimum": 300,
            "maximum": 604800
          },
          "max_5xx_basis_points": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          },
          "min_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "on_breach": {
            "type": "string",
            "enum": [
              "pause",
              "rollback"
            ]
          },
          "paused": {
            "type": "boolean"
          },
          "paused_reason": {
            "type": "string",
            "maxLength": 500
          }
        }
      },
      "PlatformFlagDefinition": {
        "description": "Stored value of a platform flag. Enabled is the kill switch; default applies to accounts no rule matches.",
        "type": "object",
        "required": [
          "enabled",
          "default"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "default": {
            "type": "boolean"
          },
          "rules": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/PlatformFlagRule"
            }
          },
          "self_serve": {
            "$ref": "#/components/schemas/PlatformFlagSelfServe"
          }
        }
      },
      "PlatformFlagSelfServe": {
        "description": "Lets customers join the preview themselves. An opted-in account or organization on an eligible plan gets the flag when no rule matched. Disabling it ignores existing opt-ins without deleting them.",
        "type": "object",
        "required": [
          "enabled"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "plans": {
            "type": "array",
            "description": "Eligible plans; empty means every plan. A flag that releases a paid capability must list only entitled plans.",
            "items": {
              "type": "string",
              "enum": [
                "free",
                "hobby",
                "pro",
                "scale"
              ]
            }
          },
          "max_subjects": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5000,
            "description": "Cap on opted-in accounts plus organizations; 0 means 5000."
          }
        }
      },
      "PlatformFlagOptIns": {
        "description": "Stored value of platform_flag_opt_ins.<key>: the accounts and organizations that joined a self-serve preview.",
        "type": "object",
        "properties": {
          "accounts": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "orgs": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      },
      "OperatorPlatformFlagOptIns": {
        "description": "How many accounts and organizations joined a self-serve preview, and the opt-in row's version.",
        "type": "object",
        "required": [
          "accounts",
          "orgs",
          "version"
        ],
        "properties": {
          "accounts": {
            "type": "integer",
            "minimum": 0
          },
          "orgs": {
            "type": "integer",
            "minimum": 0
          },
          "version": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "OperatorRuntimeConfigApplyReceipt": {
        "description": "What one daemon instance reported applying for a runtime-configuration key.",
        "type": "object",
        "required": [
          "config_key",
          "daemon",
          "instance",
          "version",
          "status",
          "reported_at"
        ],
        "properties": {
          "config_key": {
            "type": "string"
          },
          "daemon": {
            "type": "string"
          },
          "instance": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "format": "int64"
          },
          "status": {
            "type": "string",
            "enum": [
              "applied",
              "failed"
            ]
          },
          "error": {
            "type": "string"
          },
          "reported_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperatorPlatformFlagConvergence": {
        "description": "Consumers of a platform flag grouped by whether every instance applied its current version.",
        "type": "object",
        "required": [
          "converged",
          "pending",
          "failed"
        ],
        "properties": {
          "converged": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "pending": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "failed": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "OperatorPlatformFlag": {
        "description": "One catalogued platform flag with its live definition, apply receipts and convergence.",
        "type": "object",
        "required": [
          "key",
          "config_key",
          "label",
          "description",
          "adr",
          "consumers",
          "attributes",
          "legacy_env",
          "definition",
          "source",
          "version",
          "status",
          "receipts",
          "convergence",
          "opt_ins"
        ],
        "properties": {
          "key": {
            "type": "string"
          },
          "config_key": {
            "type": "string",
            "description": "Runtime-configuration key that stores the flag; write it with PATCH /v1/admin/config/{key}."
          },
          "label": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "capability": {
            "type": "string"
          },
          "adr": {
            "type": "string"
          },
          "consumers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "attributes": {
            "type": "array",
            "description": "Subject attributes every consumer can supply, so rules may constrain them; a write using any other is refused.",
            "items": {
              "type": "string",
              "enum": [
                "account",
                "plan",
                "org"
              ]
            }
          },
          "legacy_env": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "retire_by": {
            "type": "string",
            "format": "date"
          },
          "definition": {
            "$ref": "#/components/schemas/PlatformFlagDefinition"
          },
          "source": {
            "type": "string",
            "enum": [
              "default_or_environment",
              "operator"
            ]
          },
          "version": {
            "type": "integer",
            "format": "int64"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "applied",
              "failed",
              "blocked"
            ]
          },
          "last_error": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "receipts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OperatorRuntimeConfigApplyReceipt"
            }
          },
          "convergence": {
            "$ref": "#/components/schemas/OperatorPlatformFlagConvergence"
          },
          "opt_ins": {
            "$ref": "#/components/schemas/OperatorPlatformFlagOptIns"
          },
          "maturity": {
            "type": "string",
            "enum": [
              "ga",
              "beta",
              "preview",
              "internal"
            ],
            "description": "Tier of the capability the flag releases."
          },
          "parent": {
            "type": "string",
            "description": "Parent capability flag; a sub-feature is released only while its parent is."
          },
          "core": {
            "type": "boolean",
            "description": "Core capability flag: turning it off for every account needs force."
          },
          "enforcement": {
            "type": "string",
            "description": "What the flag gates today, joined with +: routes, settings, daemons; or handler or none."
          }
        }
      },
      "OperatorPlatformFlagGroups": {
        "description": "Shared named account sets referenced by platform-flag rules.",
        "type": "object",
        "required": [
          "config_key",
          "groups",
          "references",
          "version"
        ],
        "properties": {
          "config_key": {
            "type": "string"
          },
          "groups": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              }
            }
          },
          "references": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "version": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "OperatorPlatformFlagList": {
        "description": "Every platform flag and the shared account groups.",
        "type": "object",
        "required": [
          "items",
          "groups",
          "generated_at"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OperatorPlatformFlag"
            }
          },
          "groups": {
            "$ref": "#/components/schemas/OperatorPlatformFlagGroups"
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperatorPlatformFlagDecision": {
        "description": "One platform flag decided for one account. Available is the decision and the plan entitlement of the released capability.",
        "type": "object",
        "required": [
          "flag",
          "account_id",
          "plan",
          "enabled",
          "reason",
          "version",
          "available"
        ],
        "properties": {
          "flag": {
            "type": "string"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid",
            "description": "Organization the decision was made under, when the inspector was given one."
          },
          "plan": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "reason": {
            "type": "string",
            "enum": [
              "unknown_flag",
              "flag_disabled",
              "account_missing",
              "rule_match",
              "opt_in",
              "default"
            ]
          },
          "rule_id": {
            "type": "string"
          },
          "bucket": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9999
          },
          "version": {
            "type": "integer",
            "format": "int64"
          },
          "entitled": {
            "type": "boolean"
          },
          "available": {
            "type": "boolean"
          },
          "scheduled_rule_id": {
            "type": "string",
            "description": "First rule that matched but was outside its window."
          },
          "schedule_state": {
            "type": "string",
            "enum": [
              "rule_not_started",
              "rule_ended"
            ]
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "Decision time, when the inspector was asked about another moment than now."
          },
          "opt_in": {
            "type": "string",
            "enum": [
              "account",
              "org"
            ],
            "description": "Whose self-serve opt-in decided, when one did."
          }
        }
      },
      "OperatorAccountPlatformFlags": {
        "description": "Every platform flag decided for one account.",
        "type": "object",
        "required": [
          "account_id",
          "plan",
          "items"
        ],
        "properties": {
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "plan": {
            "type": "string"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OperatorPlatformFlagDecision"
            }
          }
        }
      },
      "PasswordLoginRequest": {
        "description": "Email + password for sign-in. Email is canonicalised server-side (lowercase + trim).",
        "type": "object",
        "required": [
          "email",
          "password"
        ],
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          },
          "password": {
            "type": "string",
            "minLength": 12,
            "maxLength": 256
          }
        }
      },
      "PasswordLoginResponse": {
        "description": "Successful sign-in. The session cookie is set via\n`Set-Cookie: faas_sid=…`; the body carries only\n`{account_id, plan}`. No API key is ever returned on\nlogin.\n",
        "type": "object",
        "required": [
          "account_id",
          "plan"
        ],
        "properties": {
          "account_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "hobby",
              "pro",
              "scale"
            ]
          }
        }
      },
      "AuthCapabilities": {
        "description": "Boot-resolved OAuth provider state for this API host.\n`enabled=true` means the consent route (`/v1/auth/<name>`)\nwill issue a 302 to the upstream consent screen;\n`enabled=false` means the consent route returns 503\n`oauth_provider_unavailable` because both the provider's\n`*_CLIENT_ID` and `*_CLIENT_SECRET` were unset at boot.\n",
        "type": "object",
        "required": [
          "providers"
        ],
        "properties": {
          "providers": {
            "$ref": "#/components/schemas/AuthProviders"
          }
        }
      },
      "AuthProviders": {
        "description": "Per-provider capability map. Closed set (google, github) —\nhandlers MUST add a new field here when adding a new\nprovider, not relax this to a free-form map.\n",
        "type": "object",
        "required": [
          "google",
          "github"
        ],
        "properties": {
          "google": {
            "$ref": "#/components/schemas/OAuthProviderCapability"
          },
          "github": {
            "$ref": "#/components/schemas/OAuthProviderCapability"
          }
        }
      },
      "OAuthProviderCapability": {
        "description": "One provider's capability flag. Source is\n`auth.SignInProvider.Enabled()` — the boot-resolved state.\n",
        "type": "object",
        "required": [
          "enabled"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          }
        }
      },
      "PasswordSignupRequest": {
        "description": "Email + password for signup. Same shape as PasswordLoginRequest with an optional referral code.",
        "type": "object",
        "required": [
          "email",
          "password"
        ],
        "properties": {
          "referral_code": {
            "type": "string",
            "pattern": "^([A-Za-z0-9]{6})?$",
            "description": "Optional six-character customer or salesperson referral code; case-insensitive. Requires the referral program to be enabled."
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "password": {
            "type": "string",
            "minLength": 12,
            "maxLength": 256
          }
        }
      },
      "ProgrammaticAuthResponse": {
        "description": "Body for the JSON-only POST /v1/auth/{signup,login} pair. Distinct from PasswordLoginResponse: this\none carries the `api_key` payload so the bearer-key CLI\ncan use the result without a dashboard round-trip. The\nplaintext is returned ONCE; the caller persists it via\n`saveToken` before this response is dropped.\n\nEmail is echoed back so the CLI's finalizeLogin step can\nrender \"Logged in as <email> (<plan> plan)\" without an\nextra Whoami round-trip.\n",
        "type": "object",
        "required": [
          "account_id",
          "email",
          "plan",
          "api_key"
        ],
        "properties": {
          "account_id": {
            "type": "string",
            "description": "Account UUID."
          },
          "email": {
            "type": "string",
            "format": "email",
            "description": "Email the client sent in the POST body. Echoed back so the CLI can render the success line without a Whoami round-trip."
          },
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "hobby",
              "pro",
              "scale"
            ]
          },
          "api_key": {
            "$ref": "#/components/schemas/ProgrammaticAPIKey"
          }
        }
      },
      "ProgrammaticAPIKey": {
        "description": "Freshly minted API key returned on the first\nrequest. The `plaintext` field is the only copy the\ncaller will ever see — store it in `~/.config/faas/auth.json`\nimmediately. The `id` is the row's UUID for later\nlist/delete via `/v1/keys`.\n",
        "type": "object",
        "required": [
          "plaintext",
          "prefix",
          "id"
        ],
        "properties": {
          "plaintext": {
            "type": "string",
            "description": "`fp_live_<48-hex>`. Returned ONCE.\n"
          },
          "prefix": {
            "type": "string",
            "description": "`fp_live_<8-hex>` — the prefix used in the auth\nheader for greppable identification.\n"
          },
          "id": {
            "type": "string",
            "description": "API key row UUID."
          }
        }
      },
      "MagicLinkSignupRequest": {
        "description": "Email for the magic-link signup path. Optional; the\nhandler accepts a missing or unparseable email and still\nreturns 200 so the response cannot be used to enumerate\naccounts.\n",
        "type": "object",
        "properties": {
          "referral_code": {
            "type": "string",
            "pattern": "^([A-Za-z0-9]{6})?$"
          },
          "email": {
            "type": "string",
            "format": "email"
          }
        }
      },
      "PasswordResetRequest": {
        "description": "Email for a password-reset request. Optional — the form-page path submits no body; the SDK sends the email.",
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          }
        }
      },
      "PasswordResetConfirm": {
        "description": "Token + new password for the password-reset submission.\nToken is the base64url-encoded 32-byte value from the\nemail link (NOT the SHA-256 hash the server stores).\n",
        "type": "object",
        "required": [
          "token",
          "new_password"
        ],
        "properties": {
          "token": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{43}$"
          },
          "new_password": {
            "type": "string",
            "minLength": 12,
            "maxLength": 256
          }
        }
      },
      "SetPasswordRequest": {
        "description": "New password for the authenticated account. Lets OAuth-only customers opt into password login, and customers who already have a password replace it.",
        "type": "object",
        "required": [
          "password",
          "csrf_token"
        ],
        "properties": {
          "password": {
            "type": "string",
            "minLength": 12,
            "maxLength": 256
          },
          "csrf_token": {
            "type": "string",
            "description": "Double-submit token from `GET /v1/auth/csrf?action=set_password`;\nmust equal the `faas_csrf` cookie that call set.\n"
          },
          "current_password": {
            "type": "string",
            "description": "Required when the account already has a password and the\nsession carries no step-up from the last 5 minutes. Ignored for OAuth-only accounts.\n"
          }
        }
      },
      "InstallBindRequest": {
        "description": "Body for both `POST /v1/install/repos/list` and\n`POST /v1/apps/{slug}/install/bind`. Carries the\n(installation_id, repo_full_name, production_branch) tuple\nthe dashboard's bind picker commits. `production_branch` is\noptional — when omitted, the GitHub integration uses the install's\n`default_branch` from `/installations/{id}`.\nBinding requires a `csrf_token` issued for `bind_app_to_repo`\nby `GET /v1/auth/csrf` and its matching HttpOnly cookie.\n",
        "type": "object",
        "required": [
          "installation_id",
          "repo_full_name"
        ],
        "properties": {
          "installation_id": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "repo_full_name": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$"
          },
          "csrf_token": {
            "type": "string",
            "description": "Action-bound CSRF token required by the browser bind mutation; not required for repository listing."
          },
          "production_branch": {
            "type": "string",
            "maxLength": 256
          },
          "deploy_branches": {
            "type": "object",
            "maxProperties": 32,
            "additionalProperties": {
              "type": "string",
              "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
            },
            "description": "GitHub branch names mapped to deployment environment scopes. An empty object clears existing rules."
          }
        }
      },
      "InstallBindResponse": {
        "description": "Successful bind. `binding_id` is the deterministic `bind-<appID>-<repo>` form used in audit log entries.",
        "type": "object",
        "required": [
          "binding_id",
          "repo_full_name",
          "production_branch"
        ],
        "properties": {
          "binding_id": {
            "type": "string"
          },
          "repo_full_name": {
            "type": "string"
          },
          "production_branch": {
            "type": "string"
          },
          "deploy_branches": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      },
      "GitHubDeploymentPolicy": {
        "description": "Customer-owned project-level GitHub deployment behaviour.",
        "type": "object",
        "required": [
          "project_id",
          "root_dir",
          "ignored_paths",
          "preview_enabled",
          "preview_ttl_hours",
          "preview_service_policy",
          "production_trigger"
        ],
        "properties": {
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "root_dir": {
            "type": "string",
            "maxLength": 255,
            "description": "Repository-relative root used when the project has a root workload."
          },
          "ignored_paths": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "description": "Exact paths, one-segment globs, or trailing /** directory patterns that do not trigger builds."
          },
          "preview_enabled": {
            "type": "boolean",
            "default": true
          },
          "preview_ttl_hours": {
            "type": "integer",
            "minimum": 1,
            "maximum": 720,
            "default": 168
          },
          "preview_bot_prs": {
            "type": "boolean",
            "default": false,
            "description": "Preview pull requests opened by bots such as Dependabot and Renovate. Off by default so they do not use up the preview allowance."
          },
          "preview_draft_prs": {
            "type": "boolean",
            "default": true,
            "description": "Preview draft pull requests. When off, a draft gets its preview once it is marked ready for review."
          },
          "preview_service_policy": {
            "type": "string",
            "enum": [
              "deny",
              "allow_marked"
            ],
            "default": "deny",
            "description": "Controls calls from project previews to production internal\nservices. `deny` rejects the call before discovery or wake-up;\n`allow_marked` permits it and marks the request as preview-origin\ntraffic. Legacy projects are migrated to `deny`; `allow_marked`\nrequires an explicit policy update.\n"
          },
          "production_trigger": {
            "type": "string",
            "enum": [
              "webhook",
              "actions"
            ],
            "default": "webhook",
            "description": "The single production deploy authority; GitHub App PR previews continue in either mode."
          }
        }
      },
      "GitHubDeploymentPolicyPatch": {
        "description": "Partial replacement for a project's GitHub deployment policy.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "root_dir": {
            "type": "string",
            "maxLength": 255
          },
          "ignored_paths": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          },
          "preview_enabled": {
            "type": "boolean"
          },
          "preview_ttl_hours": {
            "type": "integer",
            "minimum": 1,
            "maximum": 720
          },
          "preview_bot_prs": {
            "type": "boolean"
          },
          "preview_draft_prs": {
            "type": "boolean"
          },
          "preview_service_policy": {
            "type": "string",
            "enum": [
              "deny",
              "allow_marked"
            ]
          },
          "production_trigger": {
            "type": "string",
            "enum": [
              "webhook",
              "actions"
            ]
          }
        }
      },
      "GitHubInstallMutationRequest": {
        "description": "Double-submit CSRF envelope for customer-facing GitHub connection\nmutations. The token is returned by GET /v1/apps/{slug}/install or\nGET /v1/apps/{slug}/install/bind and must match the named\n`faas_csrf_github_install` cookie.\n",
        "type": "object",
        "required": [
          "csrf_token"
        ],
        "properties": {
          "csrf_token": {
            "type": "string"
          }
        }
      },
      "GitHubConnectionManageRequest": {
        "description": "Named CSRF token required to manage this account's GitHub deployment connections.",
        "type": "object",
        "required": [
          "csrf_token"
        ],
        "properties": {
          "csrf_token": {
            "type": "string"
          }
        }
      },
      "GitHubAccountConnection": {
        "description": "Credential-free health and access summary for one account-owned deployment authorization.",
        "type": "object",
        "required": [
          "installation_id",
          "github_login",
          "health",
          "repository_count"
        ],
        "properties": {
          "access": {
            "$ref": "#/components/schemas/GitHubConnectionVerification"
          },
          "installation_id": {
            "type": "integer",
            "format": "int64"
          },
          "github_login": {
            "type": "string"
          },
          "health": {
            "type": "string",
            "enum": [
              "unknown",
              "healthy",
              "degraded"
            ]
          },
          "repository_count": {
            "type": "integer"
          },
          "last_verified_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "GitHubAccountConnections": {
        "description": "This account's deployment connections and the CSRF token for subsequent management actions.",
        "type": "object",
        "required": [
          "connections",
          "csrf_token"
        ],
        "properties": {
          "csrf_token": {
            "type": "string"
          },
          "connections": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GitHubAccountConnection"
            }
          }
        }
      },
      "GitHubConnectionVerification": {
        "description": "Live GitHub installation permissions, repository selection and verification time.",
        "type": "object",
        "required": [
          "account_type",
          "repository_selection",
          "permissions",
          "verified_at",
          "repository_count"
        ],
        "properties": {
          "account_type": {
            "type": "string"
          },
          "repository_selection": {
            "type": "string"
          },
          "permissions": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "verified_at": {
            "type": "string",
            "format": "date-time"
          },
          "repository_count": {
            "type": "integer"
          }
        }
      },
      "GitHubInstallStatus": {
        "description": "Account-scoped GitHub installation and app binding health. Sealed\ninstallation credentials are never returned. `state` is\n`not_installed`, `installed`, or `bound`; `health` is\n`not_connected`, `unknown`, `healthy`, or `degraded`.\n",
        "type": "object",
        "required": [
          "state",
          "health",
          "connected",
          "last_reconcile_repository_count",
          "last_reconcile_detached_count"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "not_installed",
              "installed",
              "bound"
            ]
          },
          "health": {
            "type": "string",
            "enum": [
              "not_connected",
              "unknown",
              "healthy",
              "degraded"
            ]
          },
          "connected": {
            "type": "boolean"
          },
          "installation_id": {
            "type": "integer",
            "format": "int64"
          },
          "github_login": {
            "type": "string",
            "description": "The GitHub user or organization the App is installed on."
          },
          "default_branch": {
            "type": "string",
            "deprecated": true,
            "description": "Empty for newer connections: an installation has no default\nbranch, and a bind without a branch takes the repository's\ndefault branch. Older connections report the `main` they stored.\n"
          },
          "repo_full_name": {
            "type": "string"
          },
          "production_branch": {
            "type": "string"
          },
          "deploy_branches": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Configured GitHub branch-to-deployment-scope mappings for the project."
          },
          "binding_id": {
            "type": "string"
          },
          "linked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_reconciled_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_reconcile_error": {
            "type": "string"
          },
          "last_reconcile_repository_count": {
            "type": "integer",
            "minimum": 0
          },
          "last_reconcile_detached_count": {
            "type": "integer",
            "minimum": 0
          },
          "csrf_token": {
            "type": "string",
            "description": "CSRF token for sync and disconnect mutations."
          },
          "sync_result": {
            "type": "object",
            "properties": {
              "detached": {
                "type": "boolean"
              },
              "remote_repository_count": {
                "type": "integer",
                "minimum": 0
              },
              "synced_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "activity": {
            "$ref": "#/components/schemas/GitHubInstallActivity"
          },
          "installations": {
            "type": "array",
            "description": "The account's connected installations when it has more than\none. An unbound app then reports no `installation_id`; a bind or\nrepository listing names one of these.\n",
            "items": {
              "$ref": "#/components/schemas/GitHubInstallationSummary"
            }
          }
        }
      },
      "GitHubInstallationSummary": {
        "description": "One GitHub App installation connected to the account.",
        "type": "object",
        "required": [
          "installation_id"
        ],
        "properties": {
          "installation_id": {
            "type": "integer",
            "format": "int64"
          },
          "github_login": {
            "type": "string"
          }
        }
      },
      "GitHubInstallActivity": {
        "description": "Bounded, redacted activity for the currently bound app. Webhook\npayloads, GitHub delivery identifiers, retry controls, and worker\nerror text are never returned.\n",
        "type": "object",
        "required": [
          "webhook_deliveries",
          "check_updates"
        ],
        "properties": {
          "webhook_deliveries": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/GitHubWebhookActivity"
            }
          },
          "check_updates": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/GitHubCheckActivity"
            }
          }
        }
      },
      "GitHubWebhookActivity": {
        "description": "Redacted webhook processing activity for the bound GitHub app.",
        "type": "object",
        "required": [
          "event_type",
          "status",
          "received_at",
          "updated_at"
        ],
        "properties": {
          "event_type": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "processing",
              "succeeded",
              "dead"
            ]
          },
          "commit_sha": {
            "type": "string"
          },
          "received_at": {
            "type": "string",
            "format": "date-time"
          },
          "processed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "skip_reason": {
            "type": "string",
            "description": "Why a processed event deployed nothing: actions_trigger (production deploys come from a GitHub Actions workflow), branch_not_deployed, superseded (a newer commit reached the branch first), not_enabled, tag_not_branch_head, no_binding, skip_marker, invalid_release_tag, release_tag_moved or ignored. Absent when the event did its work."
          }
        }
      },
      "GitHubCheckActivity": {
        "description": "Redacted Check Run synchronization activity for the bound GitHub app.",
        "type": "object",
        "required": [
          "deployment_id",
          "status",
          "updated_at"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "processing",
              "succeeded",
              "dead"
            ]
          },
          "commit_sha": {
            "type": "string"
          },
          "processed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "GitHubActivityRetryResponse": {
        "description": "Customer-safe confirmation that recent failed GitHub activity was queued.",
        "type": "object",
        "required": [
          "ok",
          "retried_webhooks",
          "retried_checks",
          "status"
        ],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "retried_webhooks": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10
          },
          "retried_checks": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10
          },
          "status": {
            "type": "string",
            "const": "pending"
          }
        }
      },
      "RepoResponse": {
        "description": "Repo visible to the user's GitHub App installation, as\nreturned by the GitHub integration's `/user/installations/{id}/repositories`.\nCarries only the fields the dashboard bind picker renders —\nno nested owner object (the install URL already disambiguates).\n",
        "type": "object",
        "required": [
          "id",
          "full_name",
          "default_branch",
          "private"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "full_name": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$"
          },
          "default_branch": {
            "type": "string"
          },
          "private": {
            "type": "boolean"
          }
        }
      },
      "CapabilityStatus": {
        "description": "Customer-visible capability with account entitlement and existing runtime availability gates resolved. Internal capabilities are omitted.",
        "type": "object",
        "required": [
          "key",
          "name",
          "category",
          "description",
          "maturity",
          "plans",
          "docs_url",
          "acceptance",
          "enabled"
        ],
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
          },
          "name": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "maturity": {
            "type": "string",
            "enum": [
              "internal",
              "preview",
              "beta",
              "ga"
            ]
          },
          "plans": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "free",
                "hobby",
                "pro",
                "scale"
              ]
            }
          },
          "docs_url": {
            "type": "string",
            "format": "uri-reference"
          },
          "acceptance": {
            "type": "string",
            "description": "Stable acceptance-test handle for this capability."
          },
          "enabled": {
            "type": "boolean",
            "description": "Whether the calling account is entitled and the capability passes its existing runtime availability gate. This is not a fleet health guarantee."
          },
          "unavailable_reason": {
            "type": "string",
            "enum": [
              "plan_not_entitled",
              "runtime_unavailable"
            ],
            "description": "Stable reason when enabled is false. Plan restrictions take precedence when both gates deny access. Omitted when enabled; older servers may omit it."
          },
          "unavailable_detail": {
            "type": "string",
            "description": "Customer-safe explanation and next action when enabled is false. Display text only; use unavailable_reason for stored workflow. Omitted when enabled; older servers may omit it."
          }
        }
      },
      "CapabilitiesResponse": {
        "description": "Account-scoped capability registry with resolved entitlement and existing runtime availability gates.",
        "type": "object",
        "required": [
          "registry_version",
          "plan",
          "capabilities"
        ],
        "properties": {
          "conditional_parking": {
            "type": "boolean",
            "default": false,
            "description": "The serving control plane and state backend support atomic deployment-guarded parking. Older servers omit this field, which means unsupported. This is a preflight signal, not a cluster-wide health guarantee; always use the conditional parking endpoint, including in mixed-version fleets."
          },
          "registry_version": {
            "type": "integer",
            "minimum": 1,
            "description": "Version of the embedded product capability catalog."
          },
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "hobby",
              "pro",
              "scale"
            ]
          },
          "capabilities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CapabilityStatus"
            }
          },
          "hidden_capabilities": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Catalog capabilities, internal ones included, whose platform flag is off for this account. Clients hide their commands and links. Omitted when nothing is hidden and by servers without the capability gate."
          }
        }
      },
      "AccountResponse": {
        "description": "Account profile: id, email verification state, plan, status, limits snapshot, current-month usage, deployed-app count, and developer-environment count.",
        "type": "object",
        "required": [
          "id",
          "email",
          "email_verified",
          "plan",
          "status",
          "limits",
          "usage_gb_hours",
          "app_count",
          "developer_app_count"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "email_verified": {
            "type": "boolean"
          },
          "display_name": {
            "type": "string",
            "maxLength": 80,
            "description": "Optional display name; absent when unset."
          },
          "email_verification_grace_ends_at": {
            "type": "string",
            "format": "date-time",
            "description": "30-day verification deadline; present only while email_verified is false."
          },
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "hobby",
              "pro",
              "scale"
            ],
            "example": "hobby"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "past_due",
              "suspended",
              "deleted_pending"
            ],
            "example": "active"
          },
          "limits": {
            "$ref": "#/components/schemas/AccountLimits"
          },
          "usage_gb_hours": {
            "type": "number"
          },
          "app_count": {
            "type": "integer"
          },
          "developer_app_count": {
            "type": "integer",
            "description": "Live `gregale dev` environments; these do not consume deployed_apps slots."
          },
          "github_install_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "plan_change_status": {
            "type": "string"
          },
          "requested_plan": {
            "type": "string",
            "enum": [
              "free",
              "hobby",
              "pro",
              "scale"
            ]
          },
          "effective_at": {
            "type": "string",
            "format": "date-time"
          },
          "business_name": {
            "type": "string",
            "maxLength": 256,
            "description": "Legal business name used on future invoices."
          },
          "billing_address": {
            "type": "string",
            "maxLength": 1000,
            "description": "Free-form billing address used on future invoices."
          },
          "tax_id": {
            "type": "string",
            "maxLength": 128,
            "description": "Customer tax/VAT identifier used on future invoices."
          },
          "key_scopes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Scopes of the API key that authenticated this request; absent for a dashboard session. An agent key (scope agent) lists the tools the hosted MCP server offers it."
          },
          "key_app": {
            "$ref": "#/components/schemas/AppAgentBinding"
          },
          "key_org": {
            "$ref": "#/components/schemas/KeyOrg"
          },
          "key_projects": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Slugs of the projects the authenticating key is limited to; absent when the key reaches every project."
          },
          "abuse_hold": {
            "$ref": "#/components/schemas/AccountAbuseHold"
          }
        }
      },
      "AppAgentBinding": {
        "type": "object",
        "description": "Immutable app binding of an app-scoped headless agent credential; absent for account keys.",
        "required": [
          "id",
          "slug"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          }
        }
      },
      "AccountAbuseHold": {
        "description": "Present while the account is on an abuse hold: outbound traffic from its workloads matched a scanning or abuse pattern, so nothing runs or deploys until an operator releases it.",
        "type": "object",
        "required": [
          "reason",
          "held_at"
        ],
        "properties": {
          "reason": {
            "type": "string",
            "enum": [
              "egress_fanout",
              "egress_flood",
              "operator"
            ]
          },
          "held_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AccountAbuseHoldAction": {
        "description": "Operator note recorded in the audit log for an abuse-hold change.",
        "type": "object",
        "required": [
          "note"
        ],
        "properties": {
          "note": {
            "type": "string",
            "minLength": 3,
            "maxLength": 500
          }
        }
      },
      "AccountAbuseHoldActionResponse": {
        "description": "An account's abuse hold after an operator action.",
        "type": "object",
        "required": [
          "account_id",
          "abuse_hold",
          "changed"
        ],
        "properties": {
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "abuse_hold": {
            "description": "The hold after the action; null when the account is not held.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/AccountAbuseHold"
              },
              {
                "type": "null"
              }
            ]
          },
          "changed": {
            "type": "boolean"
          }
        }
      },
      "EgressFlowLogEntry": {
        "description": "A destination address and TCP port a tenant guest opened a new flow to.",
        "type": "object",
        "required": [
          "observed_at",
          "node",
          "account_id",
          "app_id",
          "instance_id",
          "remote_ip",
          "remote_port"
        ],
        "properties": {
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "node": {
            "type": "string"
          },
          "account_id": {
            "type": "string"
          },
          "app_id": {
            "type": "string"
          },
          "instance_id": {
            "type": "string"
          },
          "remote_ip": {
            "type": "string"
          },
          "remote_port": {
            "type": "integer",
            "minimum": 0,
            "maximum": 65535
          }
        }
      },
      "EgressFlowLogResponse": {
        "description": "Egress flow log rows, newest first. truncated means the page limit was reached.",
        "type": "object",
        "required": [
          "flows",
          "truncated"
        ],
        "properties": {
          "flows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EgressFlowLogEntry"
            }
          },
          "truncated": {
            "type": "boolean"
          }
        }
      },
      "AccountLimits": {
        "description": "Plan-driven quota, resource caps, and trigger capabilities returned by GET /v1/account.",
        "type": "object",
        "required": [
          "plan",
          "ram_mb",
          "vcpu",
          "max_concurrency",
          "deployed_apps",
          "preview_apps",
          "deploys_per_hour",
          "developer_apps",
          "included_gb_hours",
          "app_layer_max_mb",
          "ephemeral_disk_max_mb",
          "triggers_allowed",
          "trigger_kinds",
          "trigger_limit_per_app",
          "trigger_limit_per_account",
          "trigger_batch_size_max",
          "trigger_batch_window_max_ms",
          "trigger_max_attempts_max",
          "trigger_payload_max_bytes",
          "trigger_tls_skip_verify_allowed"
        ],
        "properties": {
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "hobby",
              "pro",
              "scale"
            ],
            "example": "hobby"
          },
          "ram_mb": {
            "type": "integer",
            "example": 256
          },
          "vcpu": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4,
            "description": "Plan-derived guest vCPU topology. Free/Hobby/Pro use 2; Scale uses 4. This is informational on account reads."
          },
          "max_concurrency": {
            "type": "integer"
          },
          "deployed_apps": {
            "type": "integer"
          },
          "preview_apps": {
            "type": "integer",
            "description": "Maximum open PR preview environments, separate from production apps."
          },
          "deploys_per_hour": {
            "type": "integer",
            "minimum": 1,
            "description": "Account-wide deployment admissions per fixed one-hour window."
          },
          "developer_apps": {
            "type": "integer",
            "description": "Maximum live `gregale dev` environments for this plan."
          },
          "included_gb_hours": {
            "type": "integer",
            "format": "int64"
          },
          "app_layer_max_mb": {
            "type": "integer"
          },
          "ephemeral_disk_max_mb": {
            "type": "integer",
            "description": "Total logical capacity of the writable ephemeral app filesystem per app, in MB, including application content and filesystem metadata. Free scratch space is this value minus deployed content and overhead. This is the same physical drive1 cap historically named app_layer_max_mb."
          },
          "triggers_allowed": {
            "type": "boolean",
            "description": "Whether the plan permits external event triggers."
          },
          "trigger_kinds": {
            "type": "array",
            "description": "External trigger kinds this plan may create. Cron schedules use the dedicated crons API and are not included.",
            "items": {
              "$ref": "#/components/schemas/TriggerKind"
            }
          },
          "trigger_limit_per_app": {
            "type": "integer",
            "minimum": 0
          },
          "trigger_limit_per_account": {
            "type": "integer",
            "minimum": 0
          },
          "trigger_batch_size_max": {
            "type": "integer",
            "minimum": 0
          },
          "trigger_batch_window_max_ms": {
            "type": "integer",
            "minimum": 0,
            "description": "Maximum batching window in milliseconds."
          },
          "trigger_max_attempts_max": {
            "type": "integer",
            "minimum": 0
          },
          "trigger_payload_max_bytes": {
            "type": "integer",
            "minimum": 0
          },
          "trigger_tls_skip_verify_allowed": {
            "type": "boolean",
            "description": "Whether Kafka tls.skip_verify=true is permitted."
          }
        }
      },
      "AccountDeployRateLimit": {
        "description": "Current fixed one-hour account deploy window.",
        "type": "object",
        "required": [
          "used",
          "limit",
          "remaining",
          "window_resets_at"
        ],
        "properties": {
          "used": {
            "type": "integer",
            "minimum": 0
          },
          "limit": {
            "type": "integer",
            "minimum": 1
          },
          "remaining": {
            "type": "integer",
            "minimum": 0
          },
          "window_resets_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AccountOverageCapResponse": {
        "description": "Saved monthly overage ceiling in integer cents; null means no ceiling and zero disallows overage.",
        "type": "object",
        "required": [
          "overage_cap_cents"
        ],
        "properties": {
          "overage_cap_cents": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "EgressOverageRequest": {
        "description": "Turns the egress overage election on or off.",
        "type": "object",
        "required": [
          "enabled"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          }
        }
      },
      "EgressOverageResponse": {
        "description": "The billing subject's election to pay for egress above its plan's monthly\nallowance instead of stopping at it.\n",
        "type": "object",
        "required": [
          "enabled",
          "electable",
          "included_gib",
          "billing"
        ],
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "Whether the election is on."
          },
          "electable": {
            "type": "boolean",
            "description": "Whether the plan allows the election; Free does not."
          },
          "enabled_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the election started; kept when it is turned off and on again."
          },
          "disabled_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the election was last turned off."
          },
          "included_gib": {
            "type": "integer",
            "format": "int64",
            "description": "The plan's monthly egress allowance in GiB."
          },
          "billing": {
            "type": "string",
            "enum": [
              "live",
              "off"
            ],
            "description": "live when egress above the allowance is billed while the election is on; off while egress is not billed, when the allowance still holds."
          },
          "price_millicents_per_gib": {
            "type": "integer",
            "format": "int64",
            "description": "Price of a GiB above the allowance while billing is live, in millicents."
          },
          "currency": {
            "type": "string",
            "description": "Currency of the price."
          }
        }
      },
      "OrgBillingEmailRequest": {
        "description": "The email an organization bills to; invoices and the billing portal sign-in go to it.",
        "type": "object",
        "required": [
          "billing_email"
        ],
        "properties": {
          "billing_email": {
            "type": "string",
            "format": "email",
            "maxLength": 254
          }
        }
      },
      "OrgBillingEmailResponse": {
        "description": "The email an organization bills to.",
        "type": "object",
        "required": [
          "billing_email"
        ],
        "properties": {
          "billing_email": {
            "type": "string",
            "format": "email"
          }
        }
      },
      "AccountRateLimitsResponse": {
        "description": "Account-wide operation rate limits.",
        "type": "object",
        "required": [
          "deploys"
        ],
        "properties": {
          "deploys": {
            "$ref": "#/components/schemas/AccountDeployRateLimit"
          }
        }
      },
      "ChangePlanRequest": {
        "description": "Target plan for the change.",
        "type": "object",
        "required": [
          "plan"
        ],
        "properties": {
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "hobby",
              "pro",
              "scale"
            ],
            "example": "hobby"
          },
          "salesperson_code": {
            "type": "string",
            "pattern": "^\\s*([A-Za-z0-9]{6})?\\s*$",
            "description": "Optional salesperson code for a personal account's first paid purchase.\nLetters are normalized to uppercase and surrounding spaces are removed.\nRequires a live verified session. Only active sales codes are accepted;\nexisting referrals and prior payments cannot be reassigned. The choice\nremains saved if checkout is retried or abandoned. Omit or leave empty\nto keep ordinary billing behavior. Organization purchases are excluded.\n"
          }
        }
      },
      "UpdateAccountBillingInfoRequest": {
        "description": "Partial legal billing identity update. Empty strings clear fields.",
        "type": "object",
        "minProperties": 1,
        "properties": {
          "business_name": {
            "type": "string",
            "maxLength": 256
          },
          "billing_address": {
            "type": "string",
            "maxLength": 1000
          },
          "tax_id": {
            "type": "string",
            "maxLength": 128
          }
        }
      },
      "AccountExportResponse": {
        "description": "Versioned GDPR export bundle: the account and organization identity graph, owned runtime resources, redacted key metadata, sealed-secret envelopes, and audit trail.",
        "type": "object",
        "required": [
          "schema_version",
          "exported_at",
          "account",
          "organizations",
          "org_memberships",
          "org_invitations",
          "org_api_keys",
          "apps",
          "deployments",
          "builds",
          "instances",
          "usage",
          "domains",
          "crons",
          "api_keys",
          "app_secrets"
        ],
        "properties": {
          "schema_version": {
            "type": "integer",
            "enum": [
              2
            ],
            "description": "Export schema version used by restore and portability tooling."
          },
          "exported_at": {
            "type": "string",
            "format": "date-time",
            "example": "2026-07-23T11:25:00Z"
          },
          "account": {
            "$ref": "#/components/schemas/AccountResponse"
          },
          "organizations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrgResponse"
            }
          },
          "org_memberships": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrgMembershipExportResponse"
            }
          },
          "org_invitations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrgInvitationResponse"
            }
          },
          "org_api_keys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/APIKeyResponse"
            },
            "description": "Org-bound API key metadata; plaintext and hashes are never exported."
          },
          "apps": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppResponse"
            }
          },
          "deployments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeploymentResponse"
            }
          },
          "builds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BuildExportResponse"
            }
          },
          "instances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InstanceResponse"
            }
          },
          "usage": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UsageExportResponse"
            }
          },
          "domains": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomDomainResponse"
            }
          },
          "crons": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CronResponse"
            }
          },
          "api_keys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/APIKeyExportResponse"
            }
          },
          "app_secrets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppSecretExportResponse"
            }
          },
          "edge_rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EdgeRuleResponse"
            },
            "description": "Edge rules on the exported apps."
          },
          "edge_rule_lists": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EdgeRuleListResponse"
            },
            "description": "The account's personal edge rule lists, with their items. An organization's lists are not part of a member's export."
          },
          "cors_presets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CorsPresetResponse"
            },
            "description": "The account's CORS presets: account-wide ones and those scoped to the exported apps."
          },
          "audit_trail": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GdprAuditExportResponse"
            }
          }
        }
      },
      "OrgMembershipExportResponse": {
        "description": "Organization membership lifecycle row included in export schema v2.",
        "type": "object",
        "required": [
          "org_id",
          "org_slug",
          "account_id",
          "email",
          "role",
          "joined_at"
        ],
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "org_slug": {
            "type": "string"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "developer",
              "billing",
              "viewer"
            ]
          },
          "invited_by_account_id": {
            "type": "string",
            "format": "uuid"
          },
          "joined_at": {
            "type": "string",
            "format": "date-time"
          },
          "removed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AccountDeletionResponse": {
        "description": "Result of staging account deletion: status flips to `deleted_pending` and `restore_until` marks the end of the 30-day grace window.",
        "type": "object",
        "required": [
          "status",
          "scheduled_at",
          "restore_until"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "deleted_pending"
            ],
            "example": "deleted_pending"
          },
          "scheduled_at": {
            "type": "string",
            "format": "date-time"
          },
          "restore_until": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "BuildExportResponse": {
        "description": "One build record: source artifact bytes, kind (app/function), status, and lifecycle timestamps.",
        "type": "object",
        "required": [
          "id",
          "deployment_id",
          "app_id",
          "kind",
          "status",
          "source_bytes"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "deployment_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "kind": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "example": "active"
          },
          "source_bytes": {
            "type": "integer",
            "format": "int64"
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "UsageExportResponse": {
        "description": "One usage record: app id, GB-hours consumed, started/finished timestamps for the export window. cpu_usec is the per-(app, month) cumulative host cgroup CPU-µs. Informational only — billing is on mb_seconds.",
        "type": "object",
        "required": [
          "app_id",
          "month",
          "mb_seconds",
          "requests"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "month": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}$"
          },
          "mb_seconds": {
            "type": "integer",
            "format": "int64"
          },
          "requests": {
            "type": "integer",
            "format": "int64"
          },
          "cpu_usec": {
            "type": "integer",
            "format": "int64",
            "description": "Cumulative host cgroup CPU-µs consumed by the app in the export window (informational; not billed).",
            "x-since": "2026-07",
            "x-issue": "279"
          },
          "tx_bytes": {
            "type": "integer",
            "format": "int64",
            "description": "Per-(app, month) HTTP response bytes (informational; not billed). It is not collected yet and stays 0.",
            "x-since": "2026-08",
            "x-issue": "415"
          },
          "net_tx_bytes": {
            "type": "integer",
            "format": "int64",
            "description": "Per-(app, month) byte delta on root-side vethHost.rx_bytes (informational; not billed). Sourced from the VM manager netstats.Cache via the scheduler ListInstanceStats. Includes Ethernet framing — same kernel counter the per-plan tc tbf qdisc reads.",
            "x-since": "2026-08",
            "x-issue": "415"
          },
          "net_rx_bytes": {
            "type": "integer",
            "format": "int64",
            "description": "Per-(app, month) byte delta on root-side vethHost.tx_bytes (root→guest = ingress; informational; not billed). Mirror of `net_tx_bytes` for the inbound direction.",
            "x-since": "2026-08",
            "x-issue": "436"
          },
          "cold_boots": {
            "type": "integer",
            "format": "int64",
            "description": "Per-(app, month) count of WAKE_RESTORE→WAKE_COLD_BOOT transitions observed (informational; not billed).",
            "x-since": "2026-08",
            "x-issue": "436"
          }
        }
      },
      "DailyUsageResponse": {
        "description": "Per-app rollup for one calendar day (informational; not billed). Mirrors the `usage_daily` table populated by the metering service rollup loop.",
        "type": "object",
        "required": [
          "app_id",
          "day",
          "mb_seconds",
          "requests",
          "cpu_usec",
          "tx_bytes",
          "net_tx_bytes",
          "net_rx_bytes",
          "cold_boots",
          "builder_seconds"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "day": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "example": "2026-07-29"
          },
          "mb_seconds": {
            "type": "integer",
            "format": "int64",
            "description": "Cumulative mb_seconds for the day (informational; not billed)."
          },
          "requests": {
            "type": "integer",
            "format": "int64",
            "description": "Cumulative request count for the day (informational; not billed)."
          },
          "cpu_usec": {
            "type": "integer",
            "format": "int64",
            "description": "Cumulative host cgroup CPU-µs for the day (informational; not billed)."
          },
          "tx_bytes": {
            "type": "integer",
            "format": "int64",
            "description": "HTTP response bytes for the day (informational; not billed)."
          },
          "net_tx_bytes": {
            "type": "integer",
            "format": "int64",
            "description": "Cumulative net_tx_bytes for the day (informational; not billed)."
          },
          "net_rx_bytes": {
            "type": "integer",
            "format": "int64",
            "description": "Cumulative ingress bytes for the day (informational; not billed)."
          },
          "cold_boots": {
            "type": "integer",
            "format": "int64",
            "description": "Per-day WAKE_RESTORE→WAKE_COLD_BOOT transition count (informational; not billed)."
          },
          "builder_seconds": {
            "type": "integer",
            "format": "int64",
            "description": "Builder VM seconds burned by this app on this day (informational; not billed)."
          }
        },
        "x-since": "2026-08",
        "x-issue": "436"
      },
      "DailyUsageListResponse": {
        "description": "Page shape for GET /v1/usage/daily — wraps an array of per-app daily rollup rows.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DailyUsageResponse"
            }
          }
        },
        "x-since": "2026-08",
        "x-issue": "436"
      },
      "StorageUsageResponse": {
        "description": "Per-app storage rollup for one calendar day (informational; not billed today). Mirrors the `snapshot_storage_daily` table populated by the metering service storage rollup loop.",
        "type": "object",
        "required": [
          "app_id",
          "day",
          "snapshot_bytes",
          "layer_bytes"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "day": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "example": "2026-07-29"
          },
          "snapshot_bytes": {
            "type": "integer",
            "format": "int64",
            "description": "Cumulative snapshot bytes (mem_bytes + disk_bytes) for the day (informational; not billed today)."
          },
          "layer_bytes": {
            "type": "integer",
            "format": "int64",
            "description": "Cumulative overlay-staging layer bytes for the day (informational; not billed today)."
          }
        },
        "x-since": "2026-08",
        "x-issue": "436"
      },
      "StorageUsageListResponse": {
        "description": "Page shape for GET /v1/usage/storage — wraps an array of per-app storage rollup rows.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StorageUsageResponse"
            }
          }
        },
        "x-since": "2026-08",
        "x-issue": "436"
      },
      "RekeyProgress": {
        "description": "Cumulative rekey walk snapshot. Returned by\nGET /v1/admin/secrets/rekey-progress and persisted to\nFAAS_REKEY_PROGRESS_FILE (default\n/var/lib/faas/rekey-progress.json) on every batch tick.\n`last_id` is the (account_id, app_id, key) cursor the walk\nwill resume from on daemon restart.\n",
        "type": "object",
        "required": [
          "total",
          "rekeyed",
          "skipped",
          "failed"
        ],
        "properties": {
          "total": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Running count of rows observed so far. Grows as the walk paginates through (account_id, app_id, key) order."
          },
          "rekeyed": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Rows successfully unsealed under the previous identity and re-sealed under the current one."
          },
          "skipped": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Rows already sealed under the current identity (no-op). Seen-set dedupe — does NOT mean the row is unreadable."
          },
          "failed": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Rows where the unseal step threw. A non-zero value warrants operator action (toggle FAAS_REKEY_ENABLED and restart the API to retry)."
          },
          "last_id": {
            "type": "string",
            "description": "Resume cursor in (account_id|app_id|key) form. Empty when the walk has just started or finished a clean sweep."
          }
        },
        "x-since": "2026-08",
        "x-adr": "089",
        "x-pr-cluster": "PR-C"
      },
      "OperatorIntentAcceptedResponse": {
        "description": "Wire shape for the 202 Accepted response of POST\n/v1/admin/instances/{id}/force-park, POST\n/v1/admin/instances/{id}/force-restart, and POST\n/v1/admin/apps/{slug}/force-cold-boot (admin scope +\nFAAS_ADMIN_EMAILS allowlist). The audit row is emitted\nunder operator.action.{park_instance, restart_instance,\nforce_cold_boot} with target_account_id = the instance's /\napp's owning account. StatusURL is the relative path;\nclients prepend the API base URL. The exact response is retained for\nmatching request-key retries independently of target state and audit\nqueue retention.\n",
        "type": "object",
        "required": [
          "ok",
          "intent_id",
          "status_url",
          "expires_at",
          "kind",
          "reason"
        ],
        "properties": {
          "ok": {
            "type": "boolean",
            "example": true
          },
          "intent_id": {
            "type": "string",
            "format": "uuid",
            "description": "Operator intent UUID. Used to poll status_url."
          },
          "status_url": {
            "type": "string",
            "description": "Relative path to GET /v1/admin/operator-intents/{intent_id}.",
            "example": "/v1/admin/operator-intents/11111111-1111-1111-1111-111111111111"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "Advisory horizon for one polling session (UTC, RFC 3339), retained unchanged on replay. This is not receipt expiry."
          },
          "kind": {
            "type": "string",
            "enum": [
              "force_park",
              "force_cold_boot",
              "force_restart"
            ]
          },
          "instance_id": {
            "type": "string",
            "format": "uuid",
            "description": "Populated for force_park and force_restart. The instance the operator targeted."
          },
          "previous_state": {
            "type": "string",
            "enum": [
              "running",
              "waking",
              "cold_booting"
            ],
            "description": "Populated for force_park and force_restart. Gate-time read of `instances.state`."
          },
          "app_id": {
            "type": "string",
            "format": "uuid",
            "description": "Populated for force_cold_boot. The app whose deployment was targeted."
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Populated for force_cold_boot. The latest deployment of the app."
          },
          "reason": {
            "type": "string",
            "pattern": "^[a-z0-9_]{1,64}$",
            "example": "operator_force_park"
          },
          "trace_id": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[0-9a-f]{32}$",
            "description": "Obs-Meta + Trace-IDs Mega-PR / C4. OTel W3C 32-char\nhex identifier shared with the inbound HTTP request\nand the scheduler dispatch context. Always populated for\nthe inbound force-action route (the middleware\ngenerates one when absent); surfaced here so the\ncaller can correlate the 202 response with the\nterminal outcome row.\n"
          }
        },
        "x-since": "2026-08",
        "x-pr-cluster": "operator-obs-mega"
      },
      "ObsNodeOperationPreflight": {
        "description": "Bounded impact summary captured before a provider compute-node lifecycle intent is enqueued.",
        "type": "object",
        "required": [
          "affected_apps",
          "affected_tenants",
          "total_instances",
          "live_instances",
          "live_ram_mb",
          "capacity_change_mb",
          "reversible",
          "disruption_warning"
        ],
        "properties": {
          "affected_apps": {
            "type": "integer",
            "minimum": 0
          },
          "affected_tenants": {
            "type": "integer",
            "minimum": 0
          },
          "total_instances": {
            "type": "integer",
            "minimum": 0
          },
          "live_instances": {
            "type": "integer",
            "minimum": 0
          },
          "live_ram_mb": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "capacity_change_mb": {
            "type": "integer",
            "description": "Signed admission-capacity delta if the requested lifecycle transition lands; zero for an idempotent request."
          },
          "reversible": {
            "type": "boolean"
          },
          "disruption_warning": {
            "type": "boolean",
            "description": "True when a force-drain targets a node that still has live instances."
          }
        },
        "x-since": "2026-09"
      },
      "OperatorParkExecutionResponse": {
        "type": "object",
        "description": "Verified force-park execution evidence for the original VM generation.",
        "required": [
          "phase",
          "node_id",
          "wake_id",
          "generation",
          "action",
          "capture_completed",
          "cold_boot_required",
          "updated_at"
        ],
        "properties": {
          "phase": {
            "type": "string",
            "enum": [
              "prepared",
              "started",
              "acknowledged",
              "outcome_unknown",
              "completed",
              "failed",
              "cancelled"
            ]
          },
          "node_id": {
            "type": "string"
          },
          "wake_id": {
            "type": "string"
          },
          "generation": {
            "type": "string"
          },
          "action": {
            "type": "string",
            "enum": [
              "capture",
              "stop"
            ]
          },
          "capture_completed": {
            "type": "boolean",
            "description": "Capture and original VM cleanup were durably acknowledged."
          },
          "stopped_at": {
            "type": "string",
            "format": "date-time"
          },
          "terminal_state": {
            "type": "string",
            "enum": [
              "parked",
              "stopped"
            ]
          },
          "cold_boot_required": {
            "type": "boolean",
            "description": "The verified result is stopped and requires a cold boot."
          },
          "reason": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperatorRestartExecutionResponse": {
        "type": "object",
        "description": "Durable restart evidence. An uncertain teardown is never automatically repeated. A later durable acknowledgement can resume database completion against the original target.",
        "required": [
          "phase",
          "node_id",
          "wake_id",
          "generation",
          "snapshot_ids",
          "updated_at"
        ],
        "properties": {
          "phase": {
            "type": "string",
            "enum": [
              "prepared",
              "started",
              "destroyed",
              "outcome_unknown",
              "completed",
              "failed"
            ]
          },
          "node_id": {
            "type": "string",
            "format": "uuid"
          },
          "wake_id": {
            "type": "string",
            "format": "uuid"
          },
          "generation": {
            "type": "string",
            "maxLength": 128
          },
          "snapshot_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "destroyed_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperatorIntentResponse": {
        "description": "Wire shape for GET /v1/admin/operator-intents/{id}\n(admin scope + FAAS_ADMIN_EMAILS allowlist; NO MFA —\nmirrors getFireCronRequest). IDOR closure: 404 (not 403)\non wrong-owner so an admin cannot distinguish \"wrong id\"\nfrom \"wrong owner\".\n",
        "type": "object",
        "required": [
          "intent_id",
          "kind",
          "status",
          "target_id",
          "actor_id",
          "reason",
          "metadata",
          "requested_at"
        ],
        "properties": {
          "cold_boot_generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Durable recovery generation committed by a successful force_cold_boot intent. Retries retain the original value."
          },
          "park_execution": {
            "$ref": "#/components/schemas/OperatorParkExecutionResponse"
          },
          "restart_execution": {
            "$ref": "#/components/schemas/OperatorRestartExecutionResponse"
          },
          "intent_id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "force_park",
              "force_cold_boot",
              "force_restart",
              "node_drain",
              "node_force_drain",
              "node_activate"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "running",
              "succeeded",
              "failed",
              "cancelled",
              "outcome_unknown"
            ]
          },
          "target_id": {
            "type": "string",
            "description": "Instance UUID (force_park or force_restart), deployment UUID (force_cold_boot), or compute-node UUID (node lifecycle intents)."
          },
          "account_id": {
            "type": "string",
            "format": "uuid",
            "description": "Owning account. Omitted for fleet-level node lifecycle intents."
          },
          "actor_id": {
            "type": "string",
            "format": "uuid",
            "description": "Admin account that requested the operation."
          },
          "reason": {
            "type": "string",
            "description": "Bounded operator-supplied reason recorded with the intent."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "description": "Kind-specific preflight and desired-state metadata captured before dispatch."
          },
          "requested_at": {
            "type": "string",
            "format": "date-time"
          },
          "started_at": {
            "type": "string",
            "format": "date-time",
            "description": "Set when the scheduler claims the intent (pending → running)."
          },
          "finished_at": {
            "type": "string",
            "format": "date-time",
            "description": "Set on terminal status (succeeded/failed/cancelled)."
          },
          "error": {
            "type": "string",
            "description": "Bounded dispatch error message (1 KB cap) on failed or outcome_unknown status."
          },
          "snap_ids_marked_stale": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Populated for force_cold_boot and force_restart on succeeded status. Empty when no snapshots existed."
          },
          "trace_id": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[0-9a-f]{32}$",
            "description": "Obs-Meta + Trace-IDs Mega-PR / C4. OTel W3C 32-char\nhex identifier shared with the inbound HTTP request\nand the scheduler dispatch context. NULL when the row\npredates C4 or when the inbound request carried no\ntrace_id (e.g. cron-fired reaper paths). Joins\n\"this alert\" ↔ \"this operator action\" ↔ \"this\nscheduler dispatch\" on one column.\n"
          }
        },
        "x-since": "2026-08",
        "x-pr-cluster": "operator-obs-mega"
      },
      "ObsRuleHealthResponse": {
        "type": "object",
        "description": "Point-in-time loaded-rule diagnostics with complete source totals and a bounded unhealthy-first preview.",
        "required": [
          "generated_at",
          "scope",
          "state",
          "max_age_seconds",
          "clock_skew_tolerance_seconds",
          "totals",
          "items",
          "total_items",
          "limit",
          "truncated",
          "limitations"
        ],
        "properties": {
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "scope": {
            "type": "string",
            "const": "currently_loaded_alert_rules"
          },
          "state": {
            "type": "string",
            "enum": [
              "healthy",
              "degraded",
              "disabled",
              "unavailable"
            ]
          },
          "reason": {
            "type": "string"
          },
          "max_age_seconds": {
            "type": "integer",
            "const": 120
          },
          "clock_skew_tolerance_seconds": {
            "type": "integer",
            "const": 30
          },
          "totals": {
            "description": "Null for unconfigured or failed source reads; a complete empty source has known zero rules and unavailable state.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ObsRuleHealthTotals"
              },
              {
                "type": "null"
              }
            ]
          },
          "items": {
            "type": "array",
            "maxItems": 200,
            "description": "Invalid items precede invalid clocks then failures then stale then unavailable then healthy; group and rule hashes break ties.",
            "items": {
              "$ref": "#/components/schemas/ObsRuleHealthItem"
            }
          },
          "total_items": {
            "type": "integer",
            "minimum": 0
          },
          "limit": {
            "type": "integer",
            "const": 200
          },
          "truncated": {
            "type": "boolean"
          },
          "limitations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "ObsRuleHealthTotals": {
        "type": "object",
        "description": "Complete bounded source counts. Rule health categories partition rules; invalid groups include empty groups with missing or duplicate identity.",
        "required": [
          "groups",
          "rules",
          "healthy",
          "failed",
          "stale",
          "invalid_clock",
          "unavailable",
          "invalid",
          "invalid_groups"
        ],
        "properties": {
          "groups": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4096
          },
          "rules": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4096
          },
          "healthy": {
            "type": "integer",
            "minimum": 0
          },
          "failed": {
            "type": "integer",
            "minimum": 0
          },
          "stale": {
            "type": "integer",
            "minimum": 0
          },
          "invalid_clock": {
            "type": "integer",
            "minimum": 0
          },
          "unavailable": {
            "type": "integer",
            "minimum": 0
          },
          "invalid": {
            "type": "integer",
            "minimum": 0
          },
          "invalid_groups": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "ObsRuleHealthItem": {
        "type": "object",
        "description": "Safe identity and closed diagnostics for a loaded rule or an invalid empty group. Counts are null unless healthy; age is null for absent or future evaluation clocks within the accepted skew tolerance.",
        "required": [
          "kind",
          "id",
          "group_id",
          "state",
          "issues",
          "reported_state",
          "evaluation_age_seconds",
          "has_evaluation_error",
          "pending",
          "firing"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "rule",
              "group"
            ]
          },
          "id": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "group_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "group_name": {
            "type": "string",
            "maxLength": 128,
            "pattern": "^[a-zA-Z0-9_.:-]+$"
          },
          "file_name": {
            "type": "string",
            "maxLength": 128,
            "pattern": "^[a-zA-Z0-9_.:-]+$"
          },
          "rule_name": {
            "type": "string",
            "maxLength": 128,
            "pattern": "^[a-zA-Z_:][a-zA-Z0-9_:]*$"
          },
          "state": {
            "type": "string",
            "enum": [
              "healthy",
              "failed",
              "stale",
              "invalid_clock",
              "unavailable",
              "invalid"
            ]
          },
          "issues": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "invalid_group_identity",
                "duplicate_group_identity",
                "duplicate_rule_identity",
                "unexpected_rule_type",
                "invalid_rule_definition",
                "evaluation_failed",
                "evaluation_unavailable",
                "missing_evaluation",
                "evaluation_clock_in_future",
                "evaluation_stale",
                "invalid_alert_observation",
                "inconsistent_rule_state"
              ]
            }
          },
          "reported_state": {
            "type": "string",
            "enum": [
              "inactive",
              "pending",
              "firing",
              "unknown"
            ]
          },
          "last_evaluated_at": {
            "type": "string",
            "format": "date-time"
          },
          "evaluation_age_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          },
          "has_evaluation_error": {
            "type": "boolean"
          },
          "pending": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "firing": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "runbook_url": {
            "type": "string",
            "maxLength": 512
          }
        }
      },
      "ObsRuleCoverage": {
        "type": "object",
        "description": "Selected expected alert definitions compared with a complete current source; covered does not imply healthy evaluations or inputs.",
        "required": [
          "generated_at",
          "scope",
          "fingerprint_algorithm",
          "selection_source",
          "state",
          "expected_set",
          "available_sets",
          "totals",
          "items",
          "total_items",
          "limit",
          "truncated",
          "limitations"
        ],
        "properties": {
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "scope": {
            "type": "string",
            "const": "selected_expected_alert_rules"
          },
          "fingerprint_algorithm": {
            "type": "string",
            "const": "promql_ast_v1"
          },
          "selection_source": {
            "type": "string",
            "enum": [
              "none",
              "explicit_request"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "covered",
              "degraded",
              "partial",
              "unknown"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "expected_set_not_selected",
              "expected_catalog_unavailable",
              "expected_set_unavailable",
              "prometheus_not_configured",
              "source_unavailable",
              "deadline_exceeded",
              "expected_rules_differ",
              "comparison_incomplete"
            ]
          },
          "expected_set": {
            "description": "Selected versioned set metadata; null when no selection or its catalog is unavailable.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ObsRuleCoverageSet"
              },
              {
                "type": "null"
              }
            ]
          },
          "available_sets": {
            "type": "array",
            "maxItems": 8,
            "description": "Built-in choices from this binary; their presence is not deployment intent.",
            "items": {
              "$ref": "#/components/schemas/ObsRuleCoverageSet"
            }
          },
          "totals": {
            "description": "Null for unselected or unreadable evidence; a complete empty source instead has known missing definitions.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ObsRuleCoverageTotals"
              },
              {
                "type": "null"
              }
            ]
          },
          "items": {
            "type": "array",
            "maxItems": 200,
            "description": "Expected definitions ordered by ambiguity then change then absence then unknown then match; identity hashes break ties.",
            "items": {
              "$ref": "#/components/schemas/ObsRuleCoverageItem"
            }
          },
          "total_items": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4096
          },
          "limit": {
            "type": "integer",
            "const": 200
          },
          "truncated": {
            "type": "boolean"
          },
          "limitations": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "expectation_selected_per_request_not_deployment_evidence",
                "selected_set_is_a_minimum_not_an_exclusive_inventory",
                "alert_rules_only_recording_rules_not_checked",
                "coverage_not_evaluation_metric_or_notification_health",
                "canonical_syntax_not_semantic_equivalence",
                "group_intervals_offsets_annotations_and_source_paths_not_compared",
                "raw_queries_labels_and_errors_excluded",
                "preview_bounded_totals_cover_complete_source"
              ]
            }
          }
        }
      },
      "ObsRuleCoverageSet": {
        "type": "object",
        "description": "Versioned minimum expectation set with a digest of its exact canonical definitions and safe source basenames.",
        "required": [
          "id",
          "revision",
          "files",
          "expected_rules"
        ],
        "properties": {
          "id": {
            "type": "string",
            "enum": [
              "gregale-core-v1",
              "gregale-full-v1"
            ]
          },
          "revision": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "files": {
            "type": "array",
            "minItems": 1,
            "maxItems": 8,
            "uniqueItems": true,
            "description": "Sorted safe source basenames selected by the expectation set.",
            "items": {
              "type": "string",
              "maxLength": 128,
              "pattern": "^[a-zA-Z0-9_.:-]+$"
            }
          },
          "expected_rules": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4096
          }
        }
      },
      "ObsRuleCoverageTotals": {
        "type": "object",
        "description": "Full counts before preview truncation. Expected categories partition expected_rules; additional valid identities are allowed by the minimum set.",
        "required": [
          "expected_rules",
          "observed_rules",
          "additional_rules",
          "invalid_observed_rules",
          "invalid_observed_groups",
          "matching",
          "missing",
          "changed",
          "ambiguous",
          "unknown"
        ],
        "properties": {
          "expected_rules": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4096
          },
          "observed_rules": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4096
          },
          "additional_rules": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4096
          },
          "invalid_observed_rules": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4096
          },
          "invalid_observed_groups": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4096
          },
          "matching": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4096
          },
          "missing": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4096
          },
          "changed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4096
          },
          "ambiguous": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4096
          },
          "unknown": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4096
          }
        }
      },
      "ObsRuleCoverageItem": {
        "type": "object",
        "description": "One expected identity with safe catalog metadata and closed comparison evidence; these IDs are independent of historical episode rule keys.",
        "required": [
          "id",
          "file_name",
          "group_name",
          "rule_name",
          "state",
          "expected_fingerprint",
          "observed_candidates",
          "changed_fields"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "file_name": {
            "type": "string",
            "maxLength": 128,
            "pattern": "^[a-zA-Z0-9_.:-]+$"
          },
          "group_name": {
            "type": "string",
            "maxLength": 128,
            "pattern": "^[a-zA-Z0-9_.:-]+$"
          },
          "rule_name": {
            "type": "string",
            "maxLength": 128,
            "pattern": "^[a-zA-Z_:][a-zA-Z0-9_:]*$"
          },
          "state": {
            "type": "string",
            "enum": [
              "matching",
              "missing",
              "changed",
              "ambiguous",
              "unknown"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "rule_missing",
              "definition_changed",
              "ambiguous_identity",
              "source_identity_unavailable",
              "definition_unavailable"
            ]
          },
          "expected_fingerprint": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "observed_fingerprint": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "observed_candidates": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4096
          },
          "changed_fields": {
            "type": "array",
            "maxItems": 4,
            "uniqueItems": true,
            "description": "Changed fields in expression then for then keep_firing_for then labels order; empty unless comparison is known changed.",
            "items": {
              "type": "string",
              "enum": [
                "expression",
                "for",
                "keep_firing_for",
                "labels"
              ]
            }
          }
        }
      },
      "ObsInputHealth": {
        "type": "object",
        "description": "Critical telemetry sample evidence for a selected minimum deployment role expectation.",
        "required": [
          "generated_at",
          "scope",
          "expected_role",
          "available_roles",
          "state",
          "max_age_seconds",
          "lookback_seconds",
          "jobs",
          "limitations"
        ],
        "properties": {
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "scope": {
            "type": "string",
            "const": "selected_critical_telemetry_inputs"
          },
          "expected_role": {
            "type": "string",
            "enum": [
              "",
              "single-box-v1",
              "control-plane-v1"
            ]
          },
          "available_roles": {
            "type": "array",
            "minItems": 2,
            "maxItems": 2,
            "items": {
              "type": "string",
              "enum": [
                "single-box-v1",
                "control-plane-v1"
              ]
            }
          },
          "state": {
            "type": "string",
            "enum": [
              "healthy",
              "degraded",
              "partial",
              "unknown"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "expected_role_not_selected",
              "expected_role_unavailable"
            ]
          },
          "max_age_seconds": {
            "type": "integer",
            "const": 120
          },
          "lookback_seconds": {
            "type": "integer",
            "const": 600
          },
          "jobs": {
            "type": "array",
            "maxItems": 6,
            "description": "Fixed selected job inventory; empty before role selection, with full aggregate counts and no target preview.",
            "items": {
              "$ref": "#/components/schemas/ObsInputJob"
            }
          },
          "limitations": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "role_selected_per_request_not_deployment_evidence",
                "static_expectations_are_minimum_one_not_full_inventory",
                "discovery_counts_not_target_identity_membership",
                "default_scrape_job_collision_uses_exported_job",
                "readiness_sample_presence_not_readiness_value",
                "metric_checks_cover_fresh_up_targets_only",
                "one_vetted_idle_safe_gauge_per_selected_job_not_all_rule_inputs",
                "historical_samples_bounded_by_lookback",
                "raw_labels_queries_urls_and_errors_excluded"
              ]
            }
          }
        }
      },
      "ObsInputJob": {
        "type": "object",
        "description": "One selected job's independent expectation, scrape and gauge evidence.",
        "required": [
          "job",
          "state",
          "expectation",
          "targets",
          "metrics"
        ],
        "properties": {
          "job": {
            "type": "string",
            "enum": [
              "apid",
              "gatewayd",
              "schedd",
              "gatewayd-internal",
              "schedd-compute",
              "vmmd"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "healthy",
              "degraded",
              "partial",
              "unknown"
            ]
          },
          "expectation": {
            "$ref": "#/components/schemas/ObsInputExpectation"
          },
          "targets": {
            "$ref": "#/components/schemas/ObsInputTargets"
          },
          "metrics": {
            "type": "array",
            "minItems": 1,
            "maxItems": 1,
            "items": {
              "$ref": "#/components/schemas/ObsInputMetric"
            }
          }
        }
      },
      "ObsInputExpectation": {
        "type": "object",
        "description": "Explicit static minimum or validated fresh compute discovery count; unknown counts remain null.",
        "required": [
          "source",
          "state",
          "minimum_targets",
          "invalid_targets",
          "observed_at"
        ],
        "properties": {
          "source": {
            "type": "string",
            "enum": [
              "explicit_minimum",
              "compute_discovery"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "healthy",
              "degraded",
              "unknown"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "discovery_unavailable",
              "discovery_missing",
              "discovery_invalid",
              "discovery_stale",
              "discovery_invalid_targets"
            ]
          },
          "minimum_targets": {
            "description": "Minimum expected returned scrape targets; null when fresh discovery cannot establish a count.",
            "oneOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 4096
              },
              {
                "type": "null"
              }
            ]
          },
          "invalid_targets": {
            "description": "Omitted invalid compute registry rows; null for static minimums or unavailable discovery.",
            "oneOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 4096
              },
              {
                "type": "null"
              }
            ]
          },
          "observed_at": {
            "description": "Oldest original discovery sample or successful refresh time; null without validated discovery.",
            "oneOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "ObsInputTargets": {
        "type": "object",
        "description": "Configured scrape coverage with known failures retained independently of unknown expectations.",
        "required": [
          "state",
          "counts"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "healthy",
              "degraded",
              "partial",
              "unknown"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "source_unavailable",
              "invalid_evidence",
              "scrape_coverage_gap",
              "inventory_count_mismatch",
              "expectation_unavailable"
            ]
          },
          "counts": {
            "description": "Complete strict scrape vector counts; null when source evidence is unavailable or invalid.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ObsInputTargetCounts"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "ObsInputTargetCounts": {
        "type": "object",
        "description": "Original scrape freshness partition; missing minimum is separate from observed target failures.",
        "required": [
          "observed",
          "fresh_up",
          "down",
          "stale",
          "missing_minimum",
          "extra"
        ],
        "properties": {
          "observed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4096
          },
          "fresh_up": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4096
          },
          "down": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4096
          },
          "stale": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4096
          },
          "missing_minimum": {
            "description": "Expected minimum less observed count, clamped at zero; null if the expectation is unknown.",
            "oneOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 4096
              },
              {
                "type": "null"
              }
            ]
          },
          "extra": {
            "description": "Observed count above fresh discovery count; null for static minimums or unknown expectations.",
            "oneOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 4096
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "ObsInputMetric": {
        "type": "object",
        "description": "Presence and freshness of one idle-safe readiness gauge on each fresh successful scrape target.",
        "required": [
          "metric",
          "state",
          "counts"
        ],
        "properties": {
          "metric": {
            "type": "string",
            "enum": [
              "apid_daemon_ready",
              "gatewayd_public_daemon_ready",
              "gatewayd_daemon_ready",
              "schedd_daemon_ready",
              "vmmd_daemon_ready"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "healthy",
              "degraded",
              "unknown",
              "not_applicable"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "target_evidence_unavailable",
              "no_fresh_up_targets",
              "zero_expected_targets",
              "source_unavailable",
              "invalid_evidence",
              "metric_sample_gap"
            ]
          },
          "counts": {
            "description": "Gauge sample partition over all fresh up targets; null if this metric assessment is unknown.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ObsInputMetricCounts"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "ObsInputMetricCounts": {
        "type": "object",
        "description": "Per-target sample coverage before aggregation; freshness uses original sample times in bounded history.",
        "required": [
          "expected",
          "fresh",
          "missing",
          "stale"
        ],
        "properties": {
          "expected": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4096
          },
          "fresh": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4096
          },
          "missing": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4096
          },
          "stale": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4096
          }
        }
      },
      "ObsRecordingCoverage": {
        "type": "object",
        "description": "Recording definition coverage with separately scoped expected syntactic alert dependencies.",
        "required": [
          "generated_at",
          "scope",
          "fingerprint_algorithm",
          "selection_source",
          "state",
          "expected_set",
          "available_sets",
          "totals",
          "items",
          "total_items",
          "limit",
          "truncated",
          "dependencies",
          "limitations"
        ],
        "properties": {
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "scope": {
            "type": "string",
            "const": "selected_expected_recording_rules"
          },
          "fingerprint_algorithm": {
            "type": "string",
            "const": "promql_ast_v1"
          },
          "selection_source": {
            "type": "string",
            "enum": [
              "none",
              "explicit_request"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "covered",
              "degraded",
              "partial",
              "unknown"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "expected_set_not_selected",
              "expected_catalog_unavailable",
              "expected_set_unavailable",
              "prometheus_not_configured",
              "source_unavailable",
              "deadline_exceeded",
              "expected_rules_differ",
              "comparison_incomplete"
            ]
          },
          "expected_set": {
            "description": "Recording expectation profile metadata; null before selection or when its catalog cannot be loaded.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ObsRuleCoverageSet"
              },
              {
                "type": "null"
              }
            ]
          },
          "available_sets": {
            "type": "array",
            "maxItems": 8,
            "description": "Recording profile choices embedded in this binary; choices do not establish installed inventory.",
            "items": {
              "$ref": "#/components/schemas/ObsRuleCoverageSet"
            }
          },
          "totals": {
            "description": "Unknown without a comparable selected recording source; a complete source with zero rows has known missing rules.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ObsRuleCoverageTotals"
              },
              {
                "type": "null"
              }
            ]
          },
          "items": {
            "type": "array",
            "maxItems": 200,
            "description": "Recording comparisons sorted by ambiguity then change then absence then unknown then match and finally identity hash.",
            "items": {
              "$ref": "#/components/schemas/ObsRecordingCoverageItem"
            }
          },
          "total_items": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4096
          },
          "limit": {
            "type": "integer",
            "const": 200
          },
          "truncated": {
            "type": "boolean"
          },
          "dependencies": {
            "description": "Independent expected syntax mapping available once a valid catalog set is selected; null without a usable selection.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ObsRecordingDependencyMapping"
              },
              {
                "type": "null"
              }
            ]
          },
          "limitations": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "expectation_selected_per_request_not_deployment_evidence",
                "selected_set_is_a_minimum_not_an_exclusive_inventory",
                "recording_definitions_not_evaluation_or_metric_health",
                "dependencies_are_expected_catalog_syntax_not_proven_impact",
                "nonexact_selectors_duplicate_names_and_cycles_leave_uncertainty",
                "missing_recording_labels_are_empty_per_prometheus_wire_contract",
                "group_intervals_offsets_annotations_and_source_paths_not_compared",
                "raw_queries_labels_and_errors_excluded",
                "previews_bounded_totals_cover_complete_inputs"
              ]
            }
          }
        }
      },
      "ObsRecordingCoverageItem": {
        "type": "object",
        "description": "One expected recording definition and its bounded direct or transitive expected alert references; references do not prove runtime impact.",
        "required": [
          "comparison",
          "dependent_alerts"
        ],
        "properties": {
          "comparison": {
            "$ref": "#/components/schemas/ObsRuleCoverageItem"
          },
          "dependent_alerts": {
            "description": "Known expected syntactic references; partial mapping can leave additional unresolved dependencies.",
            "$ref": "#/components/schemas/ObsRecordingAlertReferences"
          }
        }
      },
      "ObsRecordingAlertReference": {
        "type": "object",
        "description": "Safe expected alert identity from the selected catalog; independent of historical episode keys.",
        "required": [
          "id",
          "file_name",
          "group_name",
          "rule_name"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "file_name": {
            "type": "string",
            "maxLength": 128,
            "pattern": "^[a-zA-Z0-9_.:-]+$"
          },
          "group_name": {
            "type": "string",
            "maxLength": 128,
            "pattern": "^[a-zA-Z0-9_.:-]+$"
          },
          "rule_name": {
            "type": "string",
            "maxLength": 128,
            "pattern": "^[a-zA-Z_:][a-zA-Z0-9_:]*$"
          }
        }
      },
      "ObsRecordingAlertReferences": {
        "type": "object",
        "description": "Complete count of this known catalog reference list before its five-item preview; unresolved dependencies can remain outside a dependent-alert list.",
        "required": [
          "items",
          "total_items",
          "limit",
          "truncated"
        ],
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/ObsRecordingAlertReference"
            }
          },
          "total_items": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4096
          },
          "limit": {
            "type": "integer",
            "const": 5
          },
          "truncated": {
            "type": "boolean"
          }
        }
      },
      "ObsRecordingDependencyMapping": {
        "type": "object",
        "description": "Expected catalog reference completeness; partial means some selected alerts have unresolved syntactic recording dependencies.",
        "required": [
          "scope",
          "state",
          "alert_set_revision",
          "total_alerts",
          "uncertain_alerts"
        ],
        "properties": {
          "scope": {
            "type": "string",
            "const": "selected_expected_catalog_syntax"
          },
          "state": {
            "type": "string",
            "enum": [
              "complete",
              "partial"
            ]
          },
          "alert_set_revision": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "total_alerts": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4096
          },
          "uncertain_alerts": {
            "$ref": "#/components/schemas/ObsRecordingAlertReferences"
          }
        }
      },
      "ObsNotificationHealth": {
        "type": "object",
        "description": "Current pipeline evidence without per-episode delivery or human receipt claims.",
        "required": [
          "generated_at",
          "state",
          "window_seconds",
          "alertmanager_api",
          "signals",
          "integrations",
          "limitations"
        ],
        "properties": {
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "state": {
            "type": "string",
            "enum": [
              "healthy",
              "partial",
              "degraded"
            ]
          },
          "window_seconds": {
            "type": "integer",
            "const": 600
          },
          "alertmanager_api": {
            "$ref": "#/components/schemas/ObsNotificationAPIStatus"
          },
          "signals": {
            "type": "object",
            "description": "Fixed signals for target availability, config reload, queue length and capacity, dropped alerts, notification attempts and failures.",
            "additionalProperties": {
              "$ref": "#/components/schemas/ObsNotificationSignal"
            }
          },
          "integrations": {
            "type": "array",
            "maxItems": 32,
            "description": "Observed integration types ordered by name; missing counters remain unknown.",
            "items": {
              "$ref": "#/components/schemas/ObsNotificationIntegration"
            }
          },
          "limitations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "ObsNotificationAPIStatus": {
        "type": "object",
        "description": "Reachability and bounded validity of the local alert-status API; does not establish notification receiver readiness.",
        "required": [
          "state"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "healthy",
              "disabled",
              "unavailable"
            ]
          },
          "reason": {
            "type": "string"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ObsNotificationSignal": {
        "type": "object",
        "description": "A usable value requires healthy evidence; null distinguishes missing or stale evidence from a fresh zero. Observed time comes from the oldest underlying last-observed sample across matching series.",
        "required": [
          "state",
          "value",
          "window_seconds",
          "max_age_seconds"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "healthy",
              "no_samples",
              "stale",
              "unavailable"
            ]
          },
          "reason": {
            "type": "string"
          },
          "value": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "window_seconds": {
            "type": "integer",
            "enum": [
              0,
              600
            ]
          },
          "max_age_seconds": {
            "type": "integer",
            "const": 120
          }
        }
      },
      "ObsNotificationIntegration": {
        "type": "object",
        "description": "Attempts and failures for a reviewed integration type across all receivers. Counter presence does not establish configuration; receiver names and addresses are omitted.",
        "required": [
          "integration",
          "attempts",
          "failures"
        ],
        "properties": {
          "integration": {
            "type": "string",
            "enum": [
              "email",
              "pushover",
              "slack",
              "webhook",
              "pagerduty",
              "opsgenie",
              "victorops",
              "wechat",
              "telegram",
              "discord",
              "webex",
              "sns",
              "msteams",
              "msteamsv2",
              "rocketchat",
              "jira"
            ]
          },
          "attempts": {
            "$ref": "#/components/schemas/ObsNotificationSignal"
          },
          "failures": {
            "$ref": "#/components/schemas/ObsNotificationSignal"
          }
        }
      },
      "ObsAlertSuppression": {
        "type": "object",
        "description": "Optional suppression field of private platform-alert incident evidence.\nCurrent suppression requires exact verification of the immutable episode\nagainst fresh Prometheus rules plus an unambiguous exact-label match in\nAlertmanager. Changed or external labels remain unmatched. StartsAt must\nfall within the current activation at millisecond wire precision and now;\nupdatedAt must be fresh and\nendsAt in the future. Resolved episodes are historical and not applicable.\nSilenced and inhibited booleans are null unless current state is verified.\nSuppression is independent of operator triage snooze and delivery receipt.\n",
        "required": [
          "state",
          "checked_at",
          "silenced",
          "inhibited"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "active",
              "suppressed",
              "unprocessed",
              "unmatched",
              "stale",
              "unavailable",
              "disabled",
              "not_applicable",
              "unknown"
            ]
          },
          "reason": {
            "type": "string"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "silenced": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "inhibited": {
            "type": [
              "boolean",
              "null"
            ]
          }
        }
      },
      "ObsHealthSignal": {
        "type": "object",
        "description": "Evidence for one Prometheus-derived health value. Freshness uses the\noldest last-observed counter sample or faas.rules.yml rule-group\nevaluation across series, never the aggregate query's output timestamp.\nHistorical observations are searched with a bounded 15-minute range.\nRemoved series/groups can conservatively hold a signal stale until\nthat history expires. A healthy state describes fresh query evidence,\nnot whether the metric's value indicates an operational problem.\n",
        "required": [
          "state",
          "window_seconds",
          "max_age_seconds"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "healthy",
              "no_samples",
              "stale",
              "unavailable"
            ],
            "description": "Healthy means a valid value and an observation no older than\nmax_age_seconds. No_samples means a missing observation or too\nfew range samples. Stale means a known observation is too old.\nUnavailable means missing configuration, a failed query, or invalid\nupstream values. No last-good values are cached across requests.\n"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Underlying observation time (UTC), when known; retained for stale evidence."
          },
          "window_seconds": {
            "type": "integer",
            "minimum": 0,
            "description": "Aggregation window; 300 for audit counters, 0 for the instantaneous alert count."
          },
          "max_age_seconds": {
            "type": "integer",
            "minimum": 1,
            "description": "Freshness threshold; currently 120 seconds."
          },
          "reason": {
            "type": "string",
            "description": "Closed reason code for non-healthy signals; never raw upstream errors.",
            "enum": [
              "not_configured",
              "query_failed",
              "missing_observation",
              "insufficient_samples",
              "observation_stale",
              "invalid_observation",
              "observation_in_future",
              "invalid_value"
            ]
          }
        }
      },
      "ObsAlertTriage": {
        "type": "object",
        "description": "Human workflow on one retained alert episode, independent of observed alert status.",
        "required": [
          "revision",
          "acknowledged",
          "owned",
          "snoozed",
          "as_of"
        ],
        "properties": {
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "acknowledged": {
            "type": "boolean"
          },
          "owned": {
            "type": "boolean"
          },
          "owner_account_id": {
            "type": "string",
            "format": "uuid"
          },
          "snoozed_until": {
            "type": "string",
            "format": "date-time"
          },
          "snoozed": {
            "type": "boolean"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ObsAlertTriageRequest": {
        "type": "object",
        "description": "One revision-checked triage action on an exact retained episode ID.",
        "additionalProperties": false,
        "required": [
          "action",
          "expected_revision"
        ],
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "acknowledge",
              "unacknowledge",
              "claim",
              "release",
              "snooze",
              "unsnooze"
            ]
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740990
          },
          "snoozed_until": {
            "type": "string",
            "format": "date-time",
            "description": "Required only for snooze; strictly future and at most 24 hours ahead."
          }
        }
      },
      "ObsAlertTriageResponse": {
        "type": "object",
        "description": "Committed triage revision and workflow snapshot returned to an operator.",
        "required": [
          "incident_id",
          "triage"
        ],
        "properties": {
          "incident_id": {
            "type": "string"
          },
          "triage": {
            "$ref": "#/components/schemas/ObsAlertTriage"
          }
        }
      },
      "ObsAlertCollectionCoverage": {
        "type": "object",
        "description": "Exact prospective cadence-evidence partition of a requested retained window; no continuous-availability claim.",
        "required": [
          "since",
          "as_of",
          "scope",
          "state",
          "max_age_seconds",
          "retention_seconds",
          "window_microseconds",
          "successful_observation_microseconds",
          "failed_observation_microseconds",
          "unknown_microseconds",
          "successes",
          "failures",
          "limitations"
        ],
        "properties": {
          "since": {
            "type": "string",
            "format": "date-time"
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "scope": {
            "type": "string",
            "enum": [
              "recorded_collection_cadence"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "observed",
              "partial",
              "unknown"
            ],
            "description": "Observed means every interval has recent successful outcome evidence; partial includes failed or missing intervals; unknown has no fresh duration evidence."
          },
          "max_age_seconds": {
            "type": "integer",
            "format": "int64",
            "const": 60
          },
          "retention_seconds": {
            "type": "integer",
            "format": "int64",
            "const": 2592000
          },
          "window_microseconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 2592000000000
          },
          "successful_observation_microseconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 2592000000000
          },
          "failed_observation_microseconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 2592000000000
          },
          "unknown_microseconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 2592000000000
          },
          "successes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 100000
          },
          "failures": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 100000
          },
          "limitations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "ObsAlertCollectionHistoryInterval": {
        "type": "object",
        "description": "Half-open coalesced interval of fresh outcome evidence or unknown observation coverage.",
        "required": [
          "from",
          "until",
          "state",
          "reason"
        ],
        "properties": {
          "from": {
            "type": "string",
            "format": "date-time"
          },
          "until": {
            "type": "string",
            "format": "date-time"
          },
          "state": {
            "type": "string",
            "enum": [
              "success",
              "failure",
              "unknown"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "",
              "collection_failed",
              "source_read_failed",
              "snapshot_rejected",
              "timeout",
              "persistence_failed",
              "no_recent_outcome"
            ],
            "description": "Empty on successful observations; failures retain only closed codes; unknown intervals have no_recent_outcome without an inferred cause."
          }
        }
      },
      "ObsAlertCollectionHistory": {
        "type": "object",
        "description": "Complete bounded collection cadence totals with a newest-first interval preview and current collection metadata.",
        "required": [
          "coverage",
          "collection",
          "items",
          "total_intervals",
          "limit",
          "truncated"
        ],
        "properties": {
          "failure_details": {
            "description": "Opt-in failed-attempt evidence from the same read snapshot; omitted unless details=true and absent on older servers.",
            "$ref": "#/components/schemas/ObsAlertCollectionFailureDetails"
          },
          "coverage": {
            "$ref": "#/components/schemas/ObsAlertCollectionCoverage"
          },
          "collection": {
            "$ref": "#/components/schemas/ObsAlertCollectionHealth"
          },
          "items": {
            "type": "array",
            "minItems": 1,
            "maxItems": 200,
            "items": {
              "$ref": "#/components/schemas/ObsAlertCollectionHistoryInterval"
            }
          },
          "total_intervals": {
            "type": "integer",
            "minimum": 1,
            "maximum": 200001
          },
          "limit": {
            "type": "integer",
            "const": 200
          },
          "truncated": {
            "type": "boolean",
            "description": "Whether older coalesced intervals are omitted from this preview while coverage totals remain complete."
          }
        }
      },
      "ObsAlertCollectionFailureDetails": {
        "type": "object",
        "description": "Failed attempts within the inclusive requested window, independent of cadence carry-in and coalesced intervals.",
        "required": [
          "items",
          "total_failures",
          "limit",
          "truncated",
          "limitations"
        ],
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 20,
            "description": "Newest failed attempts first; diagnostics may be unknown on any item.",
            "items": {
              "$ref": "#/components/schemas/ObsAlertCollectionFailure"
            }
          },
          "total_failures": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 100000,
            "description": "Complete failed-attempt count matching coverage.failures before preview truncation."
          },
          "limit": {
            "type": "integer",
            "const": 20
          },
          "truncated": {
            "type": "boolean",
            "description": "Whether older failed attempts are omitted from the details preview."
          },
          "limitations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "ObsAlertCollectionFailure": {
        "type": "object",
        "description": "One immutable failed-attempt receipt with optional sanitized evidence captured from its rejected source snapshot.",
        "required": [
          "attempted_at",
          "reason",
          "diagnostics_state",
          "diagnostics"
        ],
        "properties": {
          "attempted_at": {
            "type": "string",
            "format": "date-time"
          },
          "reason": {
            "type": "string",
            "enum": [
              "collection_failed",
              "source_read_failed",
              "snapshot_rejected",
              "timeout",
              "persistence_failed"
            ]
          },
          "diagnostics_state": {
            "type": "string",
            "enum": [
              "recorded",
              "unknown"
            ],
            "description": "Recorded only when typed historical rejection evidence is present; unknown never implies healthy rules."
          },
          "diagnostics": {
            "description": "Null for old receipts or failures without a rejected readable source; present only for snapshot_rejected.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ObsAlertCollectionRejection"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "ObsAlertCollectionRejection": {
        "type": "object",
        "description": "Sanitized observations from the exact rejected source; complete counts and an unhealthy-first preview, bounded to 16 KiB of compact JSON.",
        "required": [
          "scope",
          "reason",
          "totals",
          "items",
          "total_items",
          "limit",
          "truncated"
        ],
        "properties": {
          "scope": {
            "type": "string",
            "enum": [
              "rejected_snapshot"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "rule_diagnostics_present",
              "no_alert_rules_observed",
              "collector_validation_failed"
            ],
            "description": "Distinguishes observed rule issues, a known empty loaded inventory, and rejection without a matching rule-level diagnostic."
          },
          "totals": {
            "$ref": "#/components/schemas/ObsRuleHealthTotals"
          },
          "items": {
            "type": "array",
            "maxItems": 10,
            "description": "Unhealthy rules and invalid empty groups, ordered by issue priority then hashed group and item identity; ages refer to attempted_at.",
            "items": {
              "$ref": "#/components/schemas/ObsRuleHealthItem"
            }
          },
          "total_items": {
            "type": "integer",
            "minimum": 0,
            "maximum": 8192,
            "description": "Complete count of unhealthy diagnostic items before the persisted preview is bounded."
          },
          "limit": {
            "type": "integer",
            "const": 10
          },
          "truncated": {
            "type": "boolean",
            "description": "Whether the item or byte bound omitted diagnostic items included in complete totals."
          }
        }
      },
      "ObsAlertRecurrence": {
        "type": "object",
        "description": "Retained activation-cohort recurrence evidence with complete totals and a ranked preview.",
        "required": [
          "as_of",
          "since",
          "scope",
          "percentile_method",
          "limitations",
          "collection",
          "retention",
          "totals",
          "items",
          "truncated"
        ],
        "properties": {
          "coverage": {
            "description": "Prospective collection cadence evidence from the same snapshot; absent on older servers and never proof of complete alert history.",
            "$ref": "#/components/schemas/ObsAlertCollectionCoverage"
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "since": {
            "type": "string",
            "format": "date-time"
          },
          "scope": {
            "type": "string",
            "enum": [
              "retained_activation_cohort"
            ]
          },
          "percentile_method": {
            "type": "string",
            "enum": [
              "nearest_rank_whole_seconds"
            ]
          },
          "limitations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "collection": {
            "$ref": "#/components/schemas/ObsAlertCollectionHealth"
          },
          "retention": {
            "$ref": "#/components/schemas/ObsAlertRetentionHealth"
          },
          "totals": {
            "description": "Null before the first successful collection; a known quiet retained cohort has zero counts and null statistics.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ObsAlertRecurrenceTotals"
              },
              {
                "type": "null"
              }
            ]
          },
          "items": {
            "type": "array",
            "maxItems": 200,
            "items": {
              "$ref": "#/components/schemas/ObsAlertRecurrenceSeries"
            }
          },
          "truncated": {
            "type": "boolean",
            "description": "Whether the ranked preview omits series included in complete totals."
          }
        }
      },
      "ObsAlertRecurrenceTotals": {
        "type": "object",
        "description": "Complete cohort counts across distinct rule-definition and exact-series groups.",
        "required": [
          "series",
          "repeated_series",
          "metrics"
        ],
        "properties": {
          "series": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000
          },
          "repeated_series": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000
          },
          "metrics": {
            "$ref": "#/components/schemas/ObsAlertRecurrenceMetrics"
          }
        }
      },
      "ObsAlertRecurrenceMetrics": {
        "type": "object",
        "description": "Episode denominator and adjacent-repeat denominator with independent evidence partitions.",
        "required": [
          "episodes",
          "repeat_activations",
          "unresolved",
          "unknown_observation",
          "duration",
          "recovery_gap"
        ],
        "properties": {
          "episodes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000
          },
          "repeat_activations": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000
          },
          "unresolved": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000
          },
          "unknown_observation": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000
          },
          "duration": {
            "$ref": "#/components/schemas/ObsAlertRecurrenceDuration"
          },
          "recovery_gap": {
            "$ref": "#/components/schemas/ObsAlertRecurrenceGap"
          }
        }
      },
      "ObsAlertRecurrenceDuration": {
        "type": "object",
        "description": "Episode partition and valid activation-to-resolution observation statistics.",
        "required": [
          "samples",
          "not_observed",
          "invalid_clock",
          "min_seconds",
          "p50_seconds"
        ],
        "properties": {
          "samples": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000
          },
          "not_observed": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000
          },
          "invalid_clock": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000
          },
          "min_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          },
          "p50_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ObsAlertRecurrenceGap": {
        "type": "object",
        "description": "Adjacent-repeat partition; valid samples measure confirmed resolution observation to next activation.",
        "required": [
          "samples",
          "unconfirmed_recovery",
          "resolution_overlap",
          "invalid_clock",
          "min_seconds",
          "p50_seconds"
        ],
        "properties": {
          "samples": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000
          },
          "unconfirmed_recovery": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000
          },
          "resolution_overlap": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000
          },
          "invalid_clock": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000
          },
          "min_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          },
          "p50_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ObsAlertRecurrenceSeries": {
        "type": "object",
        "description": "Exact rule/series recurrence group with safe resource identity and a bounded newest-first episode preview.",
        "required": [
          "rule_key",
          "series_id",
          "name",
          "severity",
          "component",
          "first_activation_at",
          "last_activation_at",
          "metrics",
          "recent_episodes",
          "recent_episodes_truncated"
        ],
        "properties": {
          "rule_key": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "series_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "name": {
            "type": "string",
            "maxLength": 128
          },
          "severity": {
            "type": "string",
            "enum": [
              "critical",
              "error",
              "warning"
            ]
          },
          "component": {
            "type": "string",
            "maxLength": 64
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "node_id": {
            "type": "string",
            "format": "uuid"
          },
          "first_activation_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_activation_at": {
            "type": "string",
            "format": "date-time"
          },
          "metrics": {
            "$ref": "#/components/schemas/ObsAlertRecurrenceMetrics"
          },
          "recent_episodes": {
            "type": "array",
            "minItems": 1,
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/ObsAlertRecurrenceEpisode"
            }
          },
          "recent_episodes_truncated": {
            "type": "boolean",
            "description": "Whether older cohort episodes of this series were omitted from the preview."
          }
        }
      },
      "ObsAlertRecurrenceEpisode": {
        "type": "object",
        "description": "Immutable retained episode reference for recurrence investigation without raw source payloads or workflow identities.",
        "required": [
          "episode_id",
          "status",
          "started_at",
          "resolved_at",
          "evidence_path"
        ],
        "properties": {
          "episode_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "firing",
              "resolved",
              "unknown"
            ]
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "resolved_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "evidence_path": {
            "type": "string"
          }
        }
      },
      "ObsWakeTimeline": {
        "type": "object",
        "description": "Every platform event recorded for one wake, oldest first.",
        "required": [
          "wake_id",
          "events",
          "truncated"
        ],
        "properties": {
          "wake_id": {
            "type": "string"
          },
          "subject": {
            "type": "string",
            "description": "The first subject the events name (the app)",
            "when any does.": null
          },
          "events": {
            "type": "array",
            "maxItems": 1000,
            "items": {
              "$ref": "#/components/schemas/ObsWakeEvent"
            }
          },
          "truncated": {
            "type": "boolean",
            "description": "True when the wake recorded more than 1000 events."
          }
        }
      },
      "ObsWakeEvent": {
        "type": "object",
        "description": "One events row of a wake.",
        "required": [
          "at",
          "kind"
        ],
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "kind": {
            "type": "string"
          },
          "actor": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "trace_id": {
            "type": "string"
          },
          "data": {
            "type": "object",
            "additionalProperties": true,
            "description": "The event's payload as recorded."
          }
        }
      },
      "ObsAlertResponseTimes": {
        "type": "object",
        "description": "Atomic retained activation-cohort timing with explicit evidence and sample limitations.",
        "required": [
          "as_of",
          "since",
          "scope",
          "duration_basis",
          "percentile_method",
          "limitations",
          "collection",
          "retention",
          "totals",
          "groups"
        ],
        "properties": {
          "coverage": {
            "description": "Collection cadence evidence captured with this timing cohort; older servers omit it and retained timing samples do not imply complete monitoring.",
            "$ref": "#/components/schemas/ObsAlertCollectionCoverage"
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "since": {
            "type": "string",
            "format": "date-time"
          },
          "scope": {
            "type": "string",
            "enum": [
              "retained_activation_cohort"
            ]
          },
          "duration_basis": {
            "type": "string",
            "enum": [
              "episode_activation"
            ]
          },
          "percentile_method": {
            "type": "string",
            "enum": [
              "nearest_rank_whole_seconds"
            ]
          },
          "limitations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "collection": {
            "$ref": "#/components/schemas/ObsAlertCollectionHealth"
          },
          "retention": {
            "$ref": "#/components/schemas/ObsAlertRetentionHealth"
          },
          "totals": {
            "description": "Null before any successful collection; a known quiet retained cohort has zero counts and null percentiles.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ObsAlertResponseAggregate"
              },
              {
                "type": "null"
              }
            ]
          },
          "groups": {
            "type": "array",
            "maxItems": 1000,
            "items": {
              "$ref": "#/components/schemas/ObsAlertResponseGroup"
            }
          }
        }
      },
      "ObsAlertResponseAggregate": {
        "type": "object",
        "description": "One cohort denominator shared by independent acknowledgment and observed recovery classifications.",
        "required": [
          "episodes",
          "unresolved",
          "unknown_observation",
          "acknowledgment",
          "resolution",
          "receipt_coverage"
        ],
        "properties": {
          "episodes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000
          },
          "unresolved": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000
          },
          "unknown_observation": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000
          },
          "acknowledgment": {
            "$ref": "#/components/schemas/ObsAlertResponseMetric"
          },
          "resolution": {
            "$ref": "#/components/schemas/ObsAlertResponseMetric"
          },
          "receipt_coverage": {
            "$ref": "#/components/schemas/ObsAlertResponseCoverage"
          }
        }
      },
      "ObsAlertResponseMetric": {
        "type": "object",
        "description": "Complete cohort partition and valid-sample percentiles without substituting zeros for missing evidence.",
        "required": [
          "samples",
          "not_observed",
          "unknown",
          "invalid_clock",
          "p50_seconds",
          "p95_seconds"
        ],
        "properties": {
          "samples": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000
          },
          "not_observed": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000
          },
          "unknown": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000
          },
          "invalid_clock": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000
          },
          "p50_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          },
          "p95_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ObsAlertResponseCoverage": {
        "type": "object",
        "description": "Disjoint receipt-evidence classifications against each episode's saved workflow revision.",
        "required": [
          "complete_episodes",
          "gapped_episodes",
          "invalid_receipt_episodes",
          "missing_revisions"
        ],
        "properties": {
          "complete_episodes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000
          },
          "gapped_episodes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000
          },
          "invalid_receipt_episodes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000
          },
          "missing_revisions": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ObsAlertResponseGroup": {
        "type": "object",
        "description": "One nonempty severity/component timing group with no actor identities or raw audit data.",
        "required": [
          "severity",
          "component",
          "metrics"
        ],
        "properties": {
          "severity": {
            "type": "string",
            "enum": [
              "critical",
              "error",
              "warning"
            ]
          },
          "component": {
            "type": "string",
            "maxLength": 64
          },
          "metrics": {
            "$ref": "#/components/schemas/ObsAlertResponseAggregate"
          }
        }
      },
      "ObsAlertWorkloadSummary": {
        "type": "object",
        "description": "Atomic retained-alert workload snapshot with explicit collection and cleanup coverage.",
        "required": [
          "as_of",
          "scope",
          "age_basis",
          "collection",
          "retention",
          "counts",
          "groups",
          "oldest_unacknowledged",
          "oldest_unowned"
        ],
        "properties": {
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "scope": {
            "type": "string",
            "enum": [
              "retained_platform_alert_episodes"
            ]
          },
          "age_basis": {
            "type": "string",
            "enum": [
              "episode_started_at"
            ]
          },
          "collection": {
            "$ref": "#/components/schemas/ObsAlertCollectionHealth"
          },
          "retention": {
            "$ref": "#/components/schemas/ObsAlertRetentionHealth"
          },
          "counts": {
            "description": "Null until a successful collection has established a retained observation scope.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ObsAlertWorkloadCounts"
              },
              {
                "type": "null"
              }
            ]
          },
          "groups": {
            "type": "array",
            "maxItems": 72,
            "items": {
              "$ref": "#/components/schemas/ObsAlertWorkloadGroup"
            }
          },
          "oldest_unacknowledged": {
            "description": "Oldest unsnoozed unresolved unacknowledged episode; null when absent or scope is unknown.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ObsAlertWorkloadOldest"
              },
              {
                "type": "null"
              }
            ]
          },
          "oldest_unowned": {
            "description": "Oldest unsnoozed unresolved unowned episode; null when absent or scope is unknown.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ObsAlertWorkloadOldest"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "ObsAlertWorkloadCounts": {
        "type": "object",
        "description": "Whole-retention episode totals and an attention union that counts each episode once.",
        "required": [
          "total",
          "firing",
          "unknown",
          "resolved",
          "needs_attention"
        ],
        "properties": {
          "total": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "firing": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unknown": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "resolved": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "needs_attention": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Unsnoozed unresolved episodes that are unacknowledged or unowned; unknown status is included."
          }
        }
      },
      "ObsAlertWorkloadGroup": {
        "type": "object",
        "description": "Nonempty retained-alert bucket for one exact status and workflow combination.",
        "required": [
          "status",
          "severity",
          "acknowledged",
          "owned",
          "snoozed",
          "count"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "firing",
              "resolved",
              "unknown"
            ]
          },
          "severity": {
            "type": "string",
            "enum": [
              "critical",
              "error",
              "warning"
            ]
          },
          "acknowledged": {
            "type": "boolean"
          },
          "owned": {
            "type": "boolean"
          },
          "snoozed": {
            "type": "boolean"
          },
          "count": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        }
      },
      "ObsAlertWorkloadOldest": {
        "type": "object",
        "description": "Sanitized oldest eligible episode reference ordered by activation time then immutable ID.",
        "required": [
          "incident_id",
          "status",
          "severity",
          "started_at",
          "age_seconds",
          "evidence_path"
        ],
        "properties": {
          "incident_id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "firing",
              "unknown"
            ]
          },
          "severity": {
            "type": "string",
            "enum": [
              "critical",
              "error",
              "warning"
            ]
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "age_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "evidence_path": {
            "type": "string"
          }
        }
      },
      "ObsAlertTriageHistory": {
        "type": "object",
        "description": "One episode-bound page of workflow receipts with a fixed upper revision and explicit retention gaps.",
        "required": [
          "incident_id",
          "generated_at",
          "snapshot_at",
          "snapshot_revision",
          "current_revision",
          "items",
          "limit",
          "truncated",
          "next_cursor",
          "history_path",
          "coverage"
        ],
        "properties": {
          "incident_id": {
            "type": "string"
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "snapshot_at": {
            "type": "string",
            "format": "date-time",
            "description": "First page clock retained across cursor requests; it is not a persistent database snapshot."
          },
          "snapshot_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "current_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Current episode revision in this page read; can exceed snapshot_revision on subsequent pages."
          },
          "items": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/ObsAlertTriageHistoryEntry"
            }
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "truncated": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": "string"
          },
          "history_path": {
            "type": "string"
          },
          "coverage": {
            "$ref": "#/components/schemas/ObsAlertTriageHistoryCoverage"
          }
        }
      },
      "ObsAlertTriageHistoryEntry": {
        "type": "object",
        "description": "Sanitized post-action workflow flags from a durable receipt without actor or owner identities.",
        "required": [
          "id",
          "revision",
          "action",
          "at",
          "acknowledged",
          "owned"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "action": {
            "type": "string",
            "enum": [
              "acknowledge",
              "unacknowledge",
              "claim",
              "release",
              "snooze",
              "unsnooze"
            ]
          },
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "acknowledged": {
            "type": "boolean"
          },
          "owned": {
            "type": "boolean"
          },
          "snoozed_until": {
            "type": "string",
            "format": "date-time"
          },
          "trace_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          },
          "trace_path": {
            "type": "string"
          }
        }
      },
      "ObsAlertTriageHistoryCoverage": {
        "type": "object",
        "description": "Retained receipt counts across revisions one through snapshot_revision independent of page truncation.",
        "required": [
          "state",
          "available_entries",
          "missing_entries"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "complete",
              "gaps"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "missing_receipts"
            ]
          },
          "available_entries": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "missing_entries": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "oldest_available_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "newest_available_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991
          }
        }
      },
      "ObsAlertEpisode": {
        "type": "object",
        "description": "Immutable recurrence identity and retained observation clocks on a private operator incident.",
        "required": [
          "series_id",
          "started_at",
          "first_seen_at",
          "last_seen_at",
          "last_evaluated_at",
          "observation_state"
        ],
        "properties": {
          "series_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "first_seen_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_seen_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_evaluated_at": {
            "type": "string",
            "format": "date-time"
          },
          "resolved_at": {
            "type": "string",
            "format": "date-time"
          },
          "observation_state": {
            "type": "string",
            "enum": [
              "current",
              "unknown",
              "historical"
            ]
          }
        }
      },
      "ObsAlertCollectionHealth": {
        "type": "object",
        "description": "Durable collection receipt and explicit producer configuration or health state.",
        "required": [
          "state"
        ],
        "properties": {
          "diagnostics_path": {
            "type": "string",
            "const": "/v1/admin/obs/rule-health",
            "description": "Known private diagnostics route advertised as an optional bundle feature marker; reads do not establish past failure causation."
          },
          "state": {
            "type": "string",
            "enum": [
              "current",
              "unknown"
            ]
          },
          "collection_state": {
            "type": "string",
            "enum": [
              "disabled",
              "never_collected",
              "current",
              "failed",
              "stale",
              "unknown"
            ]
          },
          "reason": {
            "type": "string"
          },
          "last_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_success_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ObsAlertRetentionHealth": {
        "type": "object",
        "description": "Independent retention receipt and exact expired-episode backlog at the snapshot cutoff.",
        "required": [
          "state",
          "as_of",
          "cutoff",
          "last_pruned_episodes",
          "expired_episodes"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "never_run",
              "current",
              "failed",
              "stale",
              "unknown"
            ]
          },
          "reason": {
            "type": "string"
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "cutoff": {
            "type": "string",
            "format": "date-time"
          },
          "last_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_success_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_pruned_episodes": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          },
          "expired_episodes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "oldest_expired_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ObsHealthResponse": {
        "description": "Wire shape for GET /v1/admin/obs/health (admin scope +\nFAAS_ADMIN_EMAILS allowlist + MFA). Composed from\nthe API's own Prometheus counters (apid_audit_log_write_total /\napid_audit_log_write_failures_total), a SQL audit-log coverage ratio,\na single SQL aggregate over operator_intents (stuck-running\nrows), a single SQL aggregate over events (trace_id\ncoverage), and a PromQL count of firing alerts. Kinds\nwith zero rows in the SQL-derived fields are seeded to\n0 (counts) or 1.0 (ratios, vacuous truth) so the JSON\nshape stays stable on a fresh deploy.\n",
        "type": "object",
        "required": [
          "generated_at",
          "prometheus_available",
          "audit_log_write_total_5m",
          "audit_log_write_failures_5m",
          "audit_log_coverage_ratio_5m",
          "operator_intent_outcome_missing_total",
          "trace_id_completeness_ratio",
          "alerts_firing"
        ],
        "properties": {
          "generated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Response generation timestamp (UTC, RFC 3339); not a telemetry observation time."
          },
          "prometheus_available": {
            "type": "boolean",
            "description": "True only when all three Prometheus signals are healthy with\nfresh underlying observations. When false, consult each signal:\nhealthy values remain usable and other numeric values are zero\ncompatibility fallbacks. On legacy responses without signals,\nfalse makes all Prometheus-derived values unavailable.\n"
          },
          "audit_log_write_total_5m": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Increase of apid_audit_log_write_total over the trailing 5m\nwindow. Zero activity is a healthy zero only when the matching\nsignals entry is healthy; otherwise zero is a compatibility fallback.\n"
          },
          "audit_log_write_failures_5m": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Increase of apid_audit_log_write_failures_total over the trailing\n5m window. Interpret only when the matching signals entry is\nhealthy, or prometheus_available is true on a legacy response.\n"
          },
          "audit_log_coverage_ratio_5m": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 1,
            "description": "Ratio of durable audit_log rows with a valid W3C trace_id\nin their JSON payload over all audit rows in the window. 1.0\n(vacuous truth) when no durable audit rows exist in the window.\nThis ratio comes from SQL, independently of Prometheus availability.\n"
          },
          "operator_intent_outcome_missing_total": {
            "type": "object",
            "description": "Per-kind count of operator_intents rows stuck in\n`running` past the 5m threshold. The handler seeds\nevery kind in the operator-action vocabulary\n(force_park, force_cold_boot, force_restart) with\n0 so the JSON shape stays stable.\n",
            "additionalProperties": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            },
            "example": {
              "force_park": 0,
              "force_cold_boot": 0,
              "force_restart": 0
            }
          },
          "trace_id_completeness_ratio": {
            "type": "object",
            "description": "Per-kind ratio of operator.action.* events with a\nnon-NULL trace_id over all operator.action.* events\nin the window. Kinds with zero rows are seeded to\n1.0 (vacuous truth — see Store interface comment).\nReads events (live), NOT audit_log (FK-free\npost-deletion copy).\n",
            "additionalProperties": {
              "type": "number",
              "format": "double",
              "minimum": 0,
              "maximum": 1
            },
            "example": {
              "force_park": 1,
              "force_cold_boot": 1,
              "force_restart": 1
            }
          },
          "alerts_firing": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Count of Prometheus alert rules in the firing state\nvia PromQL ALERTS{alertstate=\"firing\"}, excluding watchdog and\ninfo-only rules. A fresh faas.rules.yml evaluation heartbeat is\nrequired for the matching signal to be healthy, including when\nno alerts fire. This describes source freshness, not alert severity.\n"
          },
          "alert_history": {
            "$ref": "#/components/schemas/ObsAlertCollectionHealth"
          },
          "alert_retention": {
            "$ref": "#/components/schemas/ObsAlertRetentionHealth"
          },
          "signals": {
            "type": "object",
            "description": "Independent evidence for audit_log_write_total_5m,\naudit_log_write_failures_5m, and alerts_firing. Present on new\nservers; optional for compatibility with older responses.\nOnly healthy signal values are usable. SQL-derived fields remain\nindependent; a database read failure returns 503.\n",
            "additionalProperties": {
              "$ref": "#/components/schemas/ObsHealthSignal"
            }
          }
        },
        "x-since": "2026-08",
        "x-pr-cluster": "obs-meta-trace-ids"
      },
      "SweepStuckBuildsResponse": {
        "description": "Wire shape for POST /v1/admin/builds/sweep-stuck\n(admin scope + FAAS_ADMIN_EMAILS allowlist). The audit\nrow is emitted under operator.action.reclaim_build with\naccount_id=NULL (fleet-level sweep, not tenant-scoped).\n",
        "type": "object",
        "required": [
          "ok",
          "swept_count",
          "older_than_seconds",
          "threshold_iso"
        ],
        "properties": {
          "ok": {
            "type": "boolean",
            "example": true
          },
          "swept_count": {
            "type": "integer",
            "minimum": 0,
            "description": "Rows flipped from 'running' to 'failed' with failure_class='timeout'. 0 when none match."
          },
          "older_than_seconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 3600,
            "description": "Effective threshold after parsing ?older_than=. Clamped to [60, 3600]."
          },
          "threshold_iso": {
            "type": "string",
            "format": "date-time",
            "description": "RFC 3339 cutoff timestamp (now - older_than)."
          }
        },
        "x-since": "2026-08",
        "x-pr-cluster": "operator-obs-mega"
      },
      "OperationDataRepair": {
        "type": "object",
        "description": "Repair plan metadata in Operation history; captured row values remain in the application executor.",
        "required": [
          "source_operation_id",
          "plan_id",
          "plan_digest",
          "phase",
          "candidates",
          "conflicts",
          "unavailable",
          "plan_expires_at"
        ],
        "properties": {
          "source_operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "plan_id": {
            "type": "string",
            "format": "uuid"
          },
          "plan_digest": {
            "type": "string"
          },
          "phase": {
            "type": "string",
            "enum": [
              "prepared",
              "rehearsing",
              "awaiting_approval",
              "approved",
              "applying",
              "outcome_unknown",
              "succeeded",
              "failed",
              "rejected",
              "replacing",
              "replaced",
              "resolving",
              "closed"
            ]
          },
          "phase_started_at": {
            "type": "string",
            "format": "date-time",
            "description": "Omitted on legacy records; health observations conservatively use creation time."
          },
          "candidates": {
            "type": "integer",
            "minimum": 0
          },
          "conflicts": {
            "type": "integer",
            "minimum": 0
          },
          "unavailable": {
            "type": "integer",
            "minimum": 0
          },
          "plan_expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "approval": {
            "type": "object",
            "required": [
              "step",
              "decision",
              "actor"
            ],
            "properties": {
              "step": {
                "type": "string"
              },
              "decision": {
                "type": "string",
                "enum": [
                  "approved",
                  "rejected"
                ]
              },
              "actor": {
                "type": "object",
                "required": [
                  "kind",
                  "id"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "account"
                    ]
                  },
                  "id": {
                    "type": "string"
                  }
                }
              },
              "comment": {
                "type": "string"
              }
            }
          },
          "applied_at": {
            "type": "string",
            "format": "date-time"
          },
          "rehearsal_task_id": {
            "type": "string",
            "format": "uuid"
          },
          "rehearsal_status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "cleanup",
              "publishing",
              "succeeded",
              "failed",
              "cancelled"
            ]
          },
          "rehearsal_cancel_requested": {
            "type": "boolean"
          },
          "replaces_plan_id": {
            "type": "string",
            "format": "uuid",
            "description": "Original parent plan for a linked replacement; omitted on root plans."
          },
          "replaces_plan_digest": {
            "type": "string",
            "description": "Exact frozen parent digest; approval authority is never inherited."
          },
          "apply_closed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Source-confirmed permanent closure without an apply commit. Replacement requires fresh rehearsal and approval."
          },
          "replacement_operation_id": {
            "type": "string",
            "format": "uuid",
            "description": "Reserved replacement UUID. Resume the same identity after response loss."
          }
        }
      },
      "DataRepairHealth": {
        "type": "object",
        "description": "Durable repair reservations and phase clocks; capacity is not measured host usage.",
        "required": [
          "observed_at",
          "phases",
          "held_slots",
          "held_memory_mb",
          "held_vcpus",
          "held_cpu_millicores",
          "unavailable_tasks",
          "items",
          "limit"
        ],
        "properties": {
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "phases": {
            "type": "array",
            "description": "All eight monitored phases, including zero counts.",
            "items": {
              "$ref": "#/components/schemas/DataRepairPhaseHealth"
            }
          },
          "held_slots": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "held_memory_mb": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "held_vcpus": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "held_cpu_millicores": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unavailable_tasks": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DataRepairHealthItem"
            }
          },
          "next_cursor": {
            "type": "string",
            "description": "Omitted on the last page."
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          }
        }
      },
      "DataRepairPhaseHealth": {
        "type": "object",
        "description": "Global count and oldest durable phase clock, independent of detail pagination.",
        "required": [
          "phase",
          "count",
          "oldest_age_seconds",
          "warn_after_seconds"
        ],
        "properties": {
          "phase": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "cleanup",
              "publishing",
              "applying",
              "outcome_unknown",
              "replacing",
              "resolving"
            ]
          },
          "count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "oldest_phase_started_at": {
            "type": "string",
            "format": "date-time"
          },
          "oldest_age_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "warn_after_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Unknown apply outcomes require attention immediately."
          }
        }
      },
      "DataRepairHealthItem": {
        "type": "object",
        "description": "Operator recovery metadata for an original rehearsal task, apply operation or pending replacement.",
        "required": [
          "cursor_key",
          "operation_id",
          "account_id",
          "app_id",
          "phase",
          "phase_started_at",
          "age_seconds",
          "node_status",
          "capacity_held",
          "held_memory_mb",
          "held_vcpus",
          "cancel_requested",
          "needs_attention",
          "recovery_guidance",
          "runbook_url"
        ],
        "properties": {
          "cursor_key": {
            "type": "string"
          },
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "task_id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "node_id": {
            "type": "string",
            "format": "uuid"
          },
          "phase": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "cleanup",
              "publishing",
              "applying",
              "outcome_unknown",
              "replacing",
              "resolving"
            ]
          },
          "phase_started_at": {
            "type": "string",
            "format": "date-time"
          },
          "age_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "node_status": {
            "type": "string",
            "enum": [
              "unassigned",
              "available",
              "unavailable",
              "missing",
              "retired",
              "heartbeat_stale"
            ]
          },
          "capacity_held": {
            "type": "boolean"
          },
          "held_memory_mb": {
            "type": "integer",
            "minimum": 0
          },
          "held_vcpus": {
            "type": "integer",
            "minimum": 0
          },
          "cancel_requested": {
            "type": "boolean"
          },
          "failure_code": {
            "type": "string"
          },
          "needs_attention": {
            "type": "boolean"
          },
          "recovery_guidance": {
            "type": "string"
          },
          "runbook_url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "GithubRecoveryStatusResponse": {
        "description": "Operator-safe projections of the GitHub integration's durable recovery queues. Webhook payloads are never included.",
        "type": "object",
        "required": [
          "deliveries",
          "check_updates"
        ],
        "properties": {
          "deliveries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GithubWebhookDeliveryRecord"
            }
          },
          "check_updates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GithubCheckUpdateRecord"
            }
          }
        }
      },
      "GithubWebhookDeliveryRecord": {
        "description": "Payload-free queue metadata for one inbound GitHub webhook delivery.",
        "type": "object",
        "required": [
          "delivery_id",
          "event_type",
          "status",
          "attempts",
          "next_attempt_at",
          "received_at",
          "updated_at"
        ],
        "properties": {
          "delivery_id": {
            "type": "string",
            "format": "uuid"
          },
          "event_type": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "processing",
              "succeeded",
              "dead"
            ]
          },
          "attempts": {
            "type": "integer",
            "minimum": 0
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_error": {
            "type": "string",
            "maxLength": 2048
          },
          "received_at": {
            "type": "string",
            "format": "date-time"
          },
          "processed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "GithubCheckUpdateRecord": {
        "description": "Queue metadata for one outbound GitHub Check Run update.",
        "type": "object",
        "required": [
          "deployment_id",
          "generation",
          "status",
          "attempts",
          "next_attempt_at",
          "updated_at"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "processing",
              "succeeded",
              "dead"
            ]
          },
          "attempts": {
            "type": "integer",
            "minimum": 0
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_error": {
            "type": "string",
            "maxLength": 2048
          },
          "processed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "GithubRecoveryRetryResponse": {
        "description": "Confirmation that one recovery item moved from dead back to pending.",
        "type": "object",
        "required": [
          "ok",
          "kind",
          "target_id",
          "status"
        ],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "kind": {
            "type": "string",
            "enum": [
              "delivery",
              "check_update"
            ]
          },
          "target_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "const": "pending"
          }
        }
      },
      "APIKeyExportResponse": {
        "description": "One API key in export form: id, prefix (first 8 chars), label, scopes, created/last-used timestamps, and request count. Scopes is the permission set attached to the key at the moment of export (audit trail, rev2).",
        "type": "object",
        "required": [
          "id",
          "prefix",
          "scopes",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "prefix": {
            "type": "string"
          },
          "label": {
            "type": [
              "string",
              "null"
            ],
            "example": "ci-deploy"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "admin",
                "apps:read",
                "deploy:write",
                "secrets:read",
                "secrets:write",
                "usage:read",
                "runs:read",
                "runs:write",
                "env:read",
                "env:write",
                "registry_credentials:read",
                "registry_credentials:write",
                "upstreams:write",
                "metrics:write",
                "delayed_tasks:read",
                "delayed_tasks:write",
                "events:publish",
                "queues:send",
                "queues:consume",
                "storage:manage",
                "storage:read",
                "storage:write",
                "postgres:manage",
                "postgres:read",
                "project_environments:read",
                "project_environments:qualify",
                "github:manage"
              ]
            },
            "description": "Permission set attached to the exported key. github:manage controls customer GitHub connection stored workflow; object-storage data scopes additionally require an explicit per-bucket grant; admin remains full access.",
            "example": [
              "admin"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_used_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "example": {
          "id": "0123456789abcdef0123456789abcdef",
          "prefix": "fp_live_ab12cd34",
          "label": "ci-deploy",
          "scopes": [
            "apps:read",
            "deploy:write"
          ],
          "created_at": "2026-07-25T13:25:00Z",
          "last_used_at": "2026-07-25T13:25:00Z"
        }
      },
      "GdprAuditExportResponse": {
        "description": "One row of the customer's audit trail in the GDPR export bundle. Two row kinds live here: source=`gdpr` carries a self-service action (`export`, `delete`, `restore`); source=`event` carries a security event from the events table with a `kind` and JSON `data` payload. The two are interleaved by timestamp descending.",
        "type": "object",
        "required": [
          "source",
          "requested_at"
        ],
        "properties": {
          "source": {
            "type": "string",
            "enum": [
              "gdpr",
              "event"
            ]
          },
          "action": {
            "type": "string",
            "enum": [
              "export",
              "delete",
              "restore"
            ]
          },
          "requested_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "kind": {
            "type": "string",
            "description": "Security event kind. Populated only when `source` = `event`. Examples: `auth.login`, `key.created`, `secret.set`, `env.set`, `account.deletion_scheduled`."
          },
          "data": {
            "type": "object",
            "additionalProperties": true,
            "description": "Kind-specific JSON payload from the events row. Populated only when `source` = `event`. Plaintext values (e.g. secret VALUE) are NEVER carried in `data`."
          }
        }
      },
      "AppSecretExportResponse": {
        "description": "One sealed secret in export form: key name, sealed ciphertext (sealed at rest), version, and timestamps. Plaintext is never exported.",
        "type": "object",
        "required": [
          "app_id",
          "key",
          "scope",
          "ciphertext",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "key": {
            "type": "string",
            "pattern": "^[A-Z][A-Z0-9_]*$",
            "maxLength": 128,
            "example": "DATABASE_URL"
          },
          "scope": {
            "type": "string",
            "pattern": "^([a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?|__all__)$",
            "maxLength": 40,
            "x-since": "2026-08",
            "x-issue": "adr-92"
          },
          "ciphertext": {
            "type": "string",
            "description": "base64-encoded age-sealed envelope"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AppEffectiveLimits": {
        "description": "The resource, scaling, rate, and timeout envelope currently applied to an app. Values are resolved from the app configuration and current plan; they describe enforcement rather than guest hardware alone.",
        "type": "object",
        "required": [
          "memory_limit_mb",
          "plan_memory_max_mb",
          "ephemeral_disk_max_mb",
          "guest_vcpus",
          "cpu_limit_millicores",
          "plan_cpu_max_millicores",
          "cpu_weight",
          "max_instances",
          "concurrency_per_instance",
          "concurrency_queue_depth",
          "concurrency_queue_wait_ms",
          "app_request_rate_rps",
          "app_request_burst",
          "account_request_rate_rpm",
          "request_budget_ms",
          "request_budget_max_ms",
          "response_write_timeout_s",
          "request_body_max_bytes"
        ],
        "properties": {
          "memory_limit_mb": {
            "type": "integer",
            "description": "Memory limit configured for this app instance, in MB."
          },
          "plan_memory_max_mb": {
            "type": "integer",
            "description": "Largest memory limit the current plan permits for an app instance, in MB."
          },
          "ephemeral_disk_max_mb": {
            "type": "integer",
            "description": "Total logical capacity of this app's writable ephemeral filesystem, in MB, including application content and filesystem metadata. Free scratch space is this value minus deployed content and overhead. This is the same physical drive1 cap historically named app_layer_max_mb."
          },
          "guest_vcpus": {
            "type": "integer",
            "description": "Number of processors visible inside the guest. This is distinct from the sustained CPU cgroup limit."
          },
          "cpu_limit_millicores": {
            "type": "integer",
            "description": "Sustained per-instance CPU allowance derived from cpu.max, expressed in millicores."
          },
          "plan_cpu_max_millicores": {
            "type": "integer",
            "description": "Largest sustained CPU allowance the current plan permits, in millicores."
          },
          "cpu_weight": {
            "type": "integer",
            "description": "Relative cgroup CPU scheduling weight applied when the host is contended."
          },
          "max_instances": {
            "type": "integer",
            "description": "Effective per-app live-instance ceiling after applying the scaling policy."
          },
          "concurrency_per_instance": {
            "type": "integer",
            "description": "Maximum in-flight requests accepted by one instance: the app's scaling_policy.per_instance_concurrency when set, otherwise the plan's concurrency_per_vm."
          },
          "concurrency_queue_depth": {
            "type": "integer",
            "description": "Effective maximum number of requests allowed to wait for warm instance capacity."
          },
          "concurrency_queue_wait_ms": {
            "type": "integer",
            "format": "int64",
            "description": "Effective maximum warm saturation wait in milliseconds."
          },
          "app_request_rate_rps": {
            "type": "integer",
            "description": "Effective per-app edge token-bucket refill rate, in requests per second, after any app-level runtime override."
          },
          "app_request_burst": {
            "type": "integer",
            "description": "Effective per-app edge token-bucket burst capacity after any app-level runtime override."
          },
          "account_request_rate_rpm": {
            "type": "integer",
            "description": "Account-wide edge token-bucket refill rate across all apps, in requests per minute."
          },
          "request_budget_ms": {
            "type": "integer",
            "format": "int64",
            "description": "Default execution budget after upload, wake and admission, before a route override, in milliseconds."
          },
          "request_budget_max_ms": {
            "type": "integer",
            "format": "int64",
            "description": "Maximum end-to-end request budget allowed through route overrides, in milliseconds."
          },
          "response_write_timeout_s": {
            "type": "integer",
            "format": "int64",
            "description": "Maximum response write window for the plan, in seconds."
          },
          "request_body_max_bytes": {
            "type": "integer",
            "format": "int64",
            "description": "Maximum inbound request body accepted for this app's plan, in bytes."
          },
          "idle_timeout_s": {
            "type": "integer",
            "description": "Idle timeout the platform applies: the app's own setting or its type's default, within the plan bounds (seconds)."
          },
          "pause": {
            "type": "string",
            "enum": [
              "between_requests",
              "when_idle",
              "never"
            ],
            "description": "When the platform may pause the VM: the declared value or the default for the app's type. Apps on a private network are never paused."
          }
        }
      },
      "AppConfiguredResources": {
        "description": "The memory and sustained CPU shape selected for each instance of this app.",
        "type": "object",
        "required": [
          "memory_mb",
          "cpu_millicores"
        ],
        "properties": {
          "memory_mb": {
            "type": "integer",
            "minimum": 1,
            "description": "Configured instance memory in MB."
          },
          "cpu_millicores": {
            "type": "integer",
            "enum": [
              250,
              500,
              1000
            ],
            "description": "Configured sustained CPU allowance in millicores."
          }
        }
      },
      "ResourceProfile": {
        "description": "Named resource profile resolved to a stable memory and sustained CPU shape. Profiles use the existing cgroup and placement controls.",
        "type": "string",
        "enum": [
          "micro",
          "small",
          "medium",
          "large",
          "xlarge"
        ]
      },
      "DeclaredRoute": {
        "description": "One gateway route declaration. Path parameters use OpenAPI {name} segments.",
        "type": "object",
        "required": [
          "path",
          "methods"
        ],
        "properties": {
          "path": {
            "type": "string",
            "pattern": "^/[^?#]*$"
          },
          "methods": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "enum": [
                "GET",
                "POST",
                "PUT",
                "PATCH",
                "DELETE",
                "OPTIONS",
                "HEAD",
                "CONNECT",
                "TRACE"
              ]
            }
          }
        }
      },
      "AppServiceBinding": {
        "description": "A repository-declared dependency on another same-account app. The binding is injected for discovery and becomes an authorization capability when the caller selects the `declared` service binding policy.",
        "type": "object",
        "required": [
          "binding",
          "service"
        ],
        "properties": {
          "binding": {
            "type": "string",
            "pattern": "^GREGALE_SERVICE_[A-Z0-9_]+_URL$",
            "description": "Platform-owned canonical service URL environment key. Its scheme follows service_binding_transport; bound workloads also receive a companion key with `_HTTPS_URL` in place of `_URL`."
          },
          "service": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{1,61})[a-z0-9]$",
            "description": "Stable target app name used by private service discovery."
          }
        }
      },
      "ServiceBindingPolicy": {
        "description": "Caller-side authorization policy for internal service requests. `account` preserves same-account reachability; `declared` permits only targets present in the caller's service bindings; `project` also permits every service in the caller's own project.",
        "type": "string",
        "enum": [
          "account",
          "declared",
          "project"
        ]
      },
      "ServiceBindingTransport": {
        "description": "Scheme used by the canonical GREGALE_SERVICE_<NAME>_URL environment variable. `https` selects the private `.internal` alias; `http` preserves the legacy `.svc.gregale` endpoint.",
        "type": "string",
        "enum": [
          "http",
          "https"
        ]
      },
      "ServiceMapResponse": {
        "description": "Account service map for `GET /v1/service-map`. `nodes` are\nthe apps on at least one returned edge, sorted by slug; `edges` are\nsorted by `calls` descending. Degraded responses carry null `nodes`\nand `edges`.\n",
        "type": "object",
        "required": [
          "range",
          "source",
          "as_of",
          "nodes",
          "edges",
          "truncated"
        ],
        "properties": {
          "range": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "description": "\"prometheus\" or \"degraded: <reason>\"."
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "truncated": {
            "type": "boolean"
          },
          "nodes": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/ServiceMapNode"
            }
          },
          "edges": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/ServiceMapEdge"
            }
          }
        }
      },
      "ServiceMapNode": {
        "description": "One app that appears on at least one service map edge.",
        "type": "object",
        "required": [
          "app_id",
          "app_slug",
          "wake_ahead_enabled"
        ],
        "properties": {
          "app_id": {
            "type": "string"
          },
          "app_slug": {
            "type": "string"
          },
          "wake_ahead_enabled": {
            "type": "boolean",
            "description": "The app's opt-in to restore the services it calls while it wakes."
          }
        }
      },
      "ServiceMapEdge": {
        "description": "Unsampled calls for one caller → target pair. `errors` are final 5xx\nresponses after proxy retries; identity and authorization failures\nare excluded. Latency covers successful calls, including routing,\nwake, and forwarding time. Private TCP sessions on the same pair are\nreported in the `tcp_*` fields; a pair with only TCP traffic has zero\n`calls` and zero latency.\n",
        "type": "object",
        "required": [
          "caller_app_id",
          "caller_app_slug",
          "target_app_id",
          "target_app_slug",
          "calls",
          "errors",
          "error_rate_pct",
          "latency_p50_ms",
          "latency_p95_ms",
          "cold_calls",
          "cold_call_pct",
          "suggest_wake_ahead",
          "wake_ahead_started",
          "wake_ahead_used",
          "tcp_sessions",
          "tcp_errors",
          "tcp_cold_sessions"
        ],
        "properties": {
          "caller_app_id": {
            "type": "string"
          },
          "caller_app_slug": {
            "type": "string"
          },
          "target_app_id": {
            "type": "string"
          },
          "target_app_slug": {
            "type": "string"
          },
          "calls": {
            "type": "integer",
            "format": "int64"
          },
          "errors": {
            "type": "integer",
            "format": "int64"
          },
          "error_rate_pct": {
            "type": "number"
          },
          "latency_p50_ms": {
            "type": "number"
          },
          "latency_p95_ms": {
            "type": "number"
          },
          "cold_calls": {
            "type": "integer",
            "format": "int64",
            "description": "Calls that found the target parked and waited for it to restore."
          },
          "cold_call_pct": {
            "type": "number",
            "description": "`cold_calls` as a percentage of `calls`."
          },
          "suggest_wake_ahead": {
            "type": "boolean",
            "description": "The caller has not opted into wake-ahead and its calls\nmostly wake the target: at least 20 cold calls in the window,\nmaking up at least half of the edge's calls. Private TCP sessions\ncount as calls.\n"
          },
          "wake_ahead_started": {
            "type": "integer",
            "format": "int64",
            "description": "Wake-aheads the caller's wakes started for this target in the window."
          },
          "wake_ahead_used": {
            "type": "integer",
            "format": "int64",
            "description": "Of those, the wake-aheads whose target was called while they were fresh."
          },
          "tcp_sessions": {
            "type": "integer",
            "format": "int64",
            "description": "Private TCP sessions from the caller to the target in the window, excluding identity, authorization and plan session-limit refusals."
          },
          "tcp_errors": {
            "type": "integer",
            "format": "int64",
            "description": "Of those, the sessions that failed after authorization (no replica, wake failure, unreachable guest, or an error while connected)."
          },
          "tcp_cold_sessions": {
            "type": "integer",
            "format": "int64",
            "description": "Of those, the sessions that found the target parked and waited for it to restore."
          }
        }
      },
      "ServiceReliabilityPolicy": {
        "description": "Caller-owned timeout and retry settings for one declared internal dependency. Omitted numeric fields inherit gateway defaults; max_attempts=1 disables retry. POST/PATCH replay also requires an Idempotency-Key honored by the target.",
        "type": "object",
        "properties": {
          "timeout_ms": {
            "type": "integer",
            "minimum": 0,
            "maximum": 300000
          },
          "max_attempts": {
            "type": "integer",
            "minimum": 0,
            "maximum": 3
          },
          "min_remaining_ms": {
            "type": "integer",
            "minimum": 0,
            "maximum": 30000
          },
          "retry_budget_percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "allow_non_idempotent": {
            "type": "boolean"
          }
        }
      },
      "ServiceReliabilityPolicies": {
        "description": "Map of declared target service names to caller-owned reliability policies. Only names in this app's service bindings may appear.",
        "type": "object",
        "maxProperties": 100,
        "additionalProperties": {
          "$ref": "#/components/schemas/ServiceReliabilityPolicy"
        }
      },
      "ServiceCallScope": {
        "description": "Target-owned HTTP request grant for one logical service caller. A path prefix matches itself and slash-delimited descendants; ambiguous request paths fail closed.",
        "type": "object",
        "required": [
          "methods",
          "path_prefixes"
        ],
        "properties": {
          "methods": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "items": {
              "type": "string",
              "description": "HTTP method in uppercase, or * to explicitly allow every method."
            }
          },
          "path_prefixes": {
            "type": "array",
            "minItems": 1,
            "maxItems": 64,
            "items": {
              "type": "string",
              "maxLength": 1024,
              "pattern": "^/[^?#]*$",
              "description": "Decoded URL path prefix; for example /v1/orders allows /v1/orders and /v1/orders/42, but not /v1/orders-archive."
            }
          }
        }
      },
      "ServiceCallerScopes": {
        "description": "Target-owned service authorization map from logical caller app name to allowed HTTP methods and path prefixes. When present, callers missing from the map are denied.",
        "type": "object",
        "maxProperties": 100,
        "additionalProperties": {
          "$ref": "#/components/schemas/ServiceCallScope"
        }
      },
      "ServiceCallerJWK": {
        "description": "Public Ed25519 key used to verify a signed service-caller assertion.",
        "type": "object",
        "required": [
          "kty",
          "crv",
          "kid",
          "x",
          "alg",
          "use"
        ],
        "properties": {
          "kty": {
            "type": "string",
            "enum": [
              "OKP"
            ]
          },
          "crv": {
            "type": "string",
            "enum": [
              "Ed25519"
            ]
          },
          "kid": {
            "type": "string",
            "minLength": 16,
            "maxLength": 64
          },
          "x": {
            "type": "string",
            "minLength": 43,
            "maxLength": 43,
            "pattern": "^[A-Za-z0-9_-]{43}$"
          },
          "alg": {
            "type": "string",
            "enum": [
              "EdDSA"
            ]
          },
          "use": {
            "type": "string",
            "enum": [
              "sig"
            ]
          }
        }
      },
      "ServiceCallerJWKSet": {
        "description": "Public-only JWKS for verifying Gregale service-caller assertions.",
        "type": "object",
        "required": [
          "keys"
        ],
        "properties": {
          "keys": {
            "type": "array",
            "maxItems": 20000,
            "items": {
              "$ref": "#/components/schemas/ServiceCallerJWK"
            }
          }
        }
      },
      "PreviewServiceCallsPolicy": {
        "description": "Production target policy for internal service calls from preview apps. `allow` preserves existing behavior; `deny` rejects preview callers before waking the target.",
        "type": "string",
        "enum": [
          "allow",
          "deny"
        ]
      },
      "RuntimePolicyStatusResponse": {
        "description": "Runtime policy status across gateway replicas, the owning scheduler, and live VM consumers. Each component reports its scoped desired revision. Gateway request policy filters app-row changes from the combined app-cache and traffic projection. Gateway acknowledgements require the current process generation and a fresh serving report. Traffic runtime reports wiring independently of convergence and enforcement; older API servers may omit it.",
        "type": "object",
        "required": [
          "app_id",
          "desired_revision",
          "state",
          "coverage",
          "serving_gateways",
          "applied_gateways",
          "pending_gateways",
          "stale_gateways",
          "request_policy",
          "edge_rules",
          "cors_presets",
          "response_cache",
          "egress_allowlist",
          "cpu_limit",
          "scheduler_scaling"
        ],
        "properties": {
          "mcp_convergence": {
            "$ref": "#/components/schemas/MCPPolicyConvergenceSnapshot"
          },
          "app_id": {
            "type": "string"
          },
          "desired_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Latest desired control-plane revision for app-cache and deployment traffic policy."
          },
          "state": {
            "type": "string",
            "enum": [
              "active",
              "pending",
              "unverified"
            ]
          },
          "coverage": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "gateway_app_cache",
              "gateway_request_policy",
              "deployment_traffic",
              "response_cache_purge",
              "app_egress_allowlist",
              "app_cpu_limit",
              "scheduler_scaling"
            ]
          },
          "serving_gateways": {
            "type": "integer",
            "minimum": 0
          },
          "applied_gateways": {
            "type": "integer",
            "minimum": 0
          },
          "pending_gateways": {
            "type": "integer",
            "minimum": 0
          },
          "stale_gateways": {
            "type": "integer",
            "minimum": 0
          },
          "request_policy": {
            "$ref": "#/components/schemas/RuntimePolicyComponentStatus"
          },
          "edge_rules": {
            "$ref": "#/components/schemas/RuntimePolicyComponentStatus"
          },
          "cors_presets": {
            "$ref": "#/components/schemas/RuntimePolicyComponentStatus"
          },
          "response_cache": {
            "$ref": "#/components/schemas/RuntimePolicyComponentStatus"
          },
          "egress_allowlist": {
            "$ref": "#/components/schemas/RuntimePolicyNodeStatus"
          },
          "cpu_limit": {
            "$ref": "#/components/schemas/RuntimePolicyNodeStatus"
          },
          "scheduler_scaling": {
            "$ref": "#/components/schemas/RuntimePolicySchedulerStatus"
          },
          "traffic_runtime": {
            "$ref": "#/components/schemas/TrafficRuntimeStatus"
          }
        }
      },
      "TrafficRuntimeStatus": {
        "description": "Fresh compute gateway wiring observations for the active serving roster. Reports expire after 10 seconds; replacement, missing reports and readiness failure remove observations. Wiring does not prove backend health or request enforcement. Node identities and process tokens are not exposed.",
        "type": "object",
        "required": [
          "scope",
          "state",
          "enforcement_status",
          "serving_gateways",
          "fresh_gateways",
          "stale_gateways",
          "missing_gateways",
          "public_retry",
          "rate_counter",
          "retry_counter",
          "deadline_signing",
          "policy_snapshot",
          "security_revocation",
          "managed_http",
          "managed_circuit"
        ],
        "properties": {
          "scope": {
            "type": "string",
            "enum": [
              "compute_gateway_wiring"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "observed",
              "partial",
              "unverified"
            ]
          },
          "enforcement_status": {
            "type": "string",
            "enum": [
              "unverified"
            ]
          },
          "serving_gateways": {
            "type": "integer",
            "minimum": 0
          },
          "fresh_gateways": {
            "type": "integer",
            "minimum": 0
          },
          "stale_gateways": {
            "type": "integer",
            "minimum": 0
          },
          "missing_gateways": {
            "type": "integer",
            "minimum": 0
          },
          "public_retry": {
            "$ref": "#/components/schemas/TrafficRuntimeFeatureStatus"
          },
          "rate_counter": {
            "$ref": "#/components/schemas/TrafficRuntimeFeatureStatus"
          },
          "retry_counter": {
            "$ref": "#/components/schemas/TrafficRuntimeFeatureStatus"
          },
          "deadline_signing": {
            "$ref": "#/components/schemas/TrafficRuntimeFeatureStatus"
          },
          "policy_snapshot": {
            "$ref": "#/components/schemas/TrafficRuntimeFeatureStatus"
          },
          "security_revocation": {
            "$ref": "#/components/schemas/TrafficRuntimeFeatureStatus"
          },
          "managed_http": {
            "$ref": "#/components/schemas/TrafficRuntimeFeatureStatus"
          },
          "managed_circuit": {
            "$ref": "#/components/schemas/TrafficRuntimeFeatureStatus"
          },
          "edge_header_secrets": {
            "description": "Gateways open sealed edge-rule request header values; until every serving gateway does, new credential values are stored as written. Omitted by older releases.",
            "allOf": [
              {
                "$ref": "#/components/schemas/TrafficRuntimeFeatureStatus"
              }
            ]
          }
        }
      },
      "TrafficRuntimeFeatureStatus": {
        "description": "Observed wiring mode when every serving member has a fresh report. Disagreement reports mixed, including shared retry backend endpoint disagreement. Missing or stale members leave the feature unverified.",
        "type": "object",
        "required": [
          "state",
          "mode"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "observed",
              "mixed",
              "unverified"
            ]
          },
          "mode": {
            "type": "string",
            "enum": [
              "enabled",
              "disabled",
              "central",
              "local",
              "shared",
              "redis",
              "mixed",
              "unwired"
            ]
          }
        }
      },
      "RuntimePolicyComponentStatus": {
        "description": "Fresh serving-gateway status for a policy component with explicit scope. Its desired revision is meaningful within that component's ledger or filtered projection.",
        "type": "object",
        "required": [
          "desired_revision",
          "state",
          "serving_gateways",
          "applied_gateways",
          "pending_gateways",
          "stale_gateways"
        ],
        "properties": {
          "legacy_fleet_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Unknown historical ownership requires replay through this fleet-wide position; later known unrelated mutations do not raise it."
          },
          "scope": {
            "type": "string",
            "enum": [
              "app",
              "account",
              "fleet"
            ]
          },
          "desired_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "state": {
            "type": "string",
            "enum": [
              "active",
              "pending",
              "unverified"
            ]
          },
          "serving_gateways": {
            "type": "integer",
            "minimum": 0
          },
          "applied_gateways": {
            "type": "integer",
            "minimum": 0
          },
          "pending_gateways": {
            "type": "integer",
            "minimum": 0
          },
          "stale_gateways": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "RuntimePolicyNodeStatus": {
        "description": "Fresh app-level host policy status for compute nodes currently hosting live instances of this app. This shape is used by the egress_allowlist and cpu_limit components.",
        "type": "object",
        "required": [
          "desired_revision",
          "state",
          "serving_nodes",
          "applied_nodes",
          "pending_nodes",
          "stale_nodes"
        ],
        "properties": {
          "scope": {
            "type": "string",
            "enum": [
              "app"
            ]
          },
          "desired_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "state": {
            "type": "string",
            "enum": [
              "active",
              "pending",
              "unverified"
            ]
          },
          "serving_nodes": {
            "type": "integer",
            "minimum": 0
          },
          "applied_nodes": {
            "type": "integer",
            "minimum": 0
          },
          "pending_nodes": {
            "type": "integer",
            "minimum": 0
          },
          "stale_nodes": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "RuntimePolicySchedulerStatus": {
        "description": "Fresh observation of the desired scaling policy by the owning scheduler. Active means the policy was loaded, not that a metric-driven replica target has been reached.",
        "type": "object",
        "required": [
          "scope",
          "desired_revision",
          "observed_revision",
          "state",
          "stale"
        ],
        "properties": {
          "scope": {
            "type": "string",
            "enum": [
              "app"
            ]
          },
          "desired_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "observed_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "state": {
            "type": "string",
            "enum": [
              "active",
              "pending",
              "unverified"
            ]
          },
          "scheduler_node_id": {
            "type": "string",
            "description": "Scheduler owner node when this app is sharded."
          },
          "observed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "stale": {
            "type": "boolean"
          }
        }
      },
      "DeletedAppSummary": {
        "type": "object",
        "description": "Account-owned retained lifecycle metadata. Eligibility never reserves quota or proves execution health.",
        "required": [
          "account_id",
          "id",
          "slug",
          "deleted_at",
          "delete_grace_until",
          "restore_eligible",
          "restore_blocker",
          "evaluated_at"
        ],
        "properties": {
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string"
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "delete_grace_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "restore_eligible": {
            "type": "boolean"
          },
          "restore_blocker": {
            "type": "string",
            "enum": [
              "",
              "grace_expired",
              "purge_started",
              "metadata_unavailable"
            ]
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DeletedAppListResponse": {
        "type": "object",
        "description": "Bounded account-owned tombstone inventory and its opaque cursor.",
        "required": [
          "account_id",
          "apps",
          "evaluated_at"
        ],
        "properties": {
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "apps": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/DeletedAppSummary"
            }
          },
          "next_cursor": {
            "type": "string",
            "maxLength": 1024
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AppScalingSettings": {
        "description": "Stored RAM, CPU, concurrency and instance-floor settings.",
        "type": "object",
        "required": [
          "ram_mb",
          "cpu_millicores",
          "max_concurrency",
          "min_instances"
        ],
        "properties": {
          "ram_mb": {
            "type": "integer"
          },
          "cpu_millicores": {
            "type": "integer",
            "description": "Stored CPU allowance; zero uses the plan default."
          },
          "max_concurrency": {
            "type": "integer"
          },
          "min_instances": {
            "type": "integer"
          }
        }
      },
      "AppScalingSnapshot": {
        "description": "Current desired scaling configuration and its compare-and-swap revision.",
        "type": "object",
        "required": [
          "app_id",
          "scope",
          "revision",
          "settings"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "environment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Immutable identity for a named environment."
          },
          "revision": {
            "type": "integer",
            "format": "int64"
          },
          "settings": {
            "$ref": "#/components/schemas/AppScalingSettings"
          }
        }
      },
      "ApplyAppScalingRequest": {
        "description": "A reviewed partial scaling change with a durable request identity.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "request_id",
          "expected_app_id",
          "expected_revision"
        ],
        "properties": {
          "expected_app_id": {
            "type": "string",
            "format": "uuid",
            "description": "Immutable app UUID from the reviewed scaling snapshot."
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_environment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Required for a named environment; must match its immutable identity."
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "ram_mb": {
            "type": "integer",
            "minimum": 1
          },
          "cpu_millicores": {
            "type": "integer",
            "minimum": 1
          },
          "max_concurrency": {
            "type": "integer",
            "minimum": 1
          },
          "min_instances": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "AppScalingReceipt": {
        "description": "Original atomic scaling configuration commit; does not establish runtime readiness.",
        "allOf": [
          {
            "$ref": "#/components/schemas/AppScalingSnapshot"
          },
          {
            "type": "object",
            "required": [
              "request_id",
              "previous_revision",
              "committed_at"
            ],
            "properties": {
              "request_id": {
                "type": "string",
                "format": "uuid"
              },
              "previous_revision": {
                "type": "integer",
                "format": "int64"
              },
              "committed_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        ]
      },
      "AppResponse": {
        "description": "An app: slug, type, runtime (for functions), RAM/cpu/idle-timeout config, current state, last-deploy pointer, per-app outbound CIDR allowlist, and reactive scale-up trigger targets.",
        "type": "object",
        "required": [
          "id",
          "slug",
          "type",
          "ram_mb",
          "vcpu",
          "cpu_millicores",
          "configured_resources",
          "max_concurrency",
          "concurrency_per_vm",
          "effective_limits",
          "min_instances",
          "status",
          "build_cache_hit_rate_pct",
          "url",
          "manifest",
          "autoscale_target_rps",
          "autoscale_target_cpu_pct"
        ],
        "properties": {
          "service_binding_fingerprint": {
            "type": "string",
            "minLength": 64,
            "maxLength": 64,
            "pattern": "^[a-f0-9]{64}$",
            "description": "Opaque fingerprint of app identity, source ownership and service binding settings. Use as the atomic precondition for a reviewed service-only update."
          },
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "slug": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{1,38})[a-z0-9]$",
            "example": "hello-world"
          },
          "type": {
            "type": "string",
            "enum": [
              "app",
              "function"
            ],
            "example": "app"
          },
          "project_id": {
            "type": "string",
            "format": "uuid",
            "description": "Parent project as a canonical hyphenated UUID. Omitted when the app is standalone. Read-only: app create and update requests do not accept it.",
            "example": "3f2b8c1e-6a4d-4e5f-9b7a-1c2d3e4f5a6b"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal"
            ],
            "default": "public",
            "description": "Public exposes the app through the edge; internal keeps it available only to authenticated service-to-service routing. Available on every plan."
          },
          "workload_class": {
            "type": "string",
            "enum": [
              "http",
              "graphql",
              "grpc",
              "job",
              "worker"
            ],
            "description": "Runtime-observed application shape. Repository scanning seeds the value and the first characterization boot may replace it. Distinct from type, which selects the app-vs-function execution contract.",
            "example": "http"
          },
          "runtime": {
            "type": "string",
            "enum": [
              "node22",
              "python312",
              "go124",
              "go124-alpine",
              "node24",
              "python313",
              "binary"
            ],
            "description": "Runtime for `type: function` apps. Omit for `type: app` (the default)."
          },
          "ram_mb": {
            "type": "integer",
            "example": 256
          },
          "vcpu": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4,
            "description": "Plan-derived guest vCPU count. Present on read responses; explicit create-time values must match the canonical plan RAM/vCPU pair."
          },
          "cpu_millicores": {
            "type": "integer",
            "enum": [
              250,
              500,
              1000
            ],
            "example": 500
          },
          "resource_profile": {
            "$ref": "#/components/schemas/ResourceProfile",
            "description": "Named profile when the configured memory and CPU exactly match one of the platform profiles; omitted for custom shapes."
          },
          "configured_resources": {
            "$ref": "#/components/schemas/AppConfiguredResources"
          },
          "max_concurrency": {
            "type": "integer"
          },
          "concurrency_per_vm": {
            "type": "integer",
            "example": 80
          },
          "effective_limits": {
            "$ref": "#/components/schemas/AppEffectiveLimits"
          },
          "idle_timeout_s": {
            "type": [
              "integer",
              "null"
            ]
          },
          "request_timeout_s": {
            "type": "integer",
            "minimum": 0,
            "maximum": 30,
            "description": "Configured per-app request wall-clock timeout in seconds; 0 means the plan/type default."
          },
          "function_concurrency": {
            "type": "integer",
            "minimum": 0,
            "maximum": 80,
            "description": "Requests one Node or Python function worker serves at once. 0 or 1 keeps one request per worker; the plan's concurrency_per_vm bound caps it. Python runs sync handlers on threads. Takes effect on the next deploy."
          },
          "function_callables": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Names this function's typed client may call and their app slugs, set by functions-project deploys. Stamped into the guest as GREGALE_FUNCTIONS on the next deploy."
          },
          "function_input_schema": {
            "type": "object",
            "additionalProperties": true,
            "description": "JSON Schema an SDK functions client's calls to this function are checked against; a call whose body does not match is refused with 422 function_input_invalid. Set from the function's input in gregale.yaml by CLI deploys."
          },
          "min_instances": {
            "type": "integer"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "evicted_cold",
              "deleted",
              "undeployed"
            ],
            "description": "Customer-visible app state. `undeployed` is projected when the app has no deployment rows; its persisted lifecycle remains active until the first deploy.",
            "example": "active"
          },
          "deployment_availability": {
            "type": "string",
            "enum": [
              "live",
              "no_live_deployment"
            ],
            "description": "Present on app list/detail reads. Reports whether any deployment is currently live; this is independent from the app lifecycle status and does not assert that a historical artifact is safe to restore."
          },
          "build_cache_hit_rate_pct": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 100,
            "description": "Trailing 30-day percentage of cache-eligible deployments served from the builder cache. Zero means no cache decision was recorded in the window."
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "delete_grace_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Stable platform hostname for the app (for example, https://my-app.gregale.dev)."
          },
          "canonical_url": {
            "type": "string",
            "format": "uri",
            "description": "Customer-facing URL to share. Uses the verified default custom domain when configured, otherwise the platform URL."
          },
          "default_domain": {
            "type": "string",
            "description": "Verified custom domain selected as the app's canonical host, when configured."
          },
          "preview_of_slug": {
            "type": "string",
            "description": "Parent app slug for a pull-request or developer preview. Absent for production apps."
          },
          "preview_pr_number": {
            "type": "integer",
            "minimum": 0,
            "description": "Pull-request number for a GitHub preview. Zero identifies a developer preview; absent for production apps."
          },
          "preview_pr_state": {
            "type": "string",
            "enum": [
              "open",
              "closed",
              "stale",
              "torn_down"
            ],
            "description": "Preview lifecycle state. Absent for production apps."
          },
          "preview_expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Automatic teardown deadline for a preview, when one is configured."
          },
          "manifest": {
            "$ref": "#/components/schemas/AppManifest"
          },
          "service_bindings": {
            "description": "Declared same-account service dependencies injected into this workload as legacy `_URL` environment variables plus additive `_HTTPS_URL` canary companions. Project workloads derive these from Compose; standalone apps derive them from service_binding_targets. They are discovery metadata under the `account` policy and the outbound authorization allowlist under the `declared` policy.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppServiceBinding"
            }
          },
          "service_reliability": {
            "$ref": "#/components/schemas/ServiceReliabilityPolicies"
          },
          "service_binding_policy": {
            "$ref": "#/components/schemas/ServiceBindingPolicy",
            "description": "Effective internal-service authorization policy. Legacy apps without a stored value return `account`."
          },
          "service_binding_transport": {
            "$ref": "#/components/schemas/ServiceBindingTransport",
            "description": "Effective canonical service URL transport. Legacy apps without a stored value return `http`."
          },
          "preview_service_calls_policy": {
            "$ref": "#/components/schemas/PreviewServiceCallsPolicy",
            "description": "Effective policy for preview callers reaching this app as a production service. Legacy apps return `allow`."
          },
          "allowed_service_callers": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "string"
            },
            "description": "Target-side service allowlist of logical app slugs. Omitted means any same-account caller; an explicit empty array denies all. Compose owns project policies; the app API owns standalone policies."
          },
          "allowed_service_call_scopes": {
            "$ref": "#/components/schemas/ServiceCallerScopes",
            "description": "Per-caller HTTP grants for requests reaching this app through a service binding. A missing caller entry denies that caller; any allowed_service_callers entry must also match."
          },
          "egress_allowlist": {
            "description": "Per-app outbound CIDR allowlist. Each entry is a CIDR string — v4 (`1.2.3.0/24`) or v6 (`2001:db8::/32`). v4-mapped v6 form (`::ffff:1.2.3.0/120`) is silently canonicalised to its v4 form at write time. Empty array means no allowlist rule; the per-netns chain's default-accept policy applies.",
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[0-9a-fA-F:./]+$",
              "example": "1.2.3.0/24"
            }
          },
          "egress_ports": {
            "description": "Extra TCP destination ports the app's guests may reach on top of 80 and 443. All other guest-originated traffic except DNS (pinned to the platform resolver) is dropped. Sorted; empty array when none are declared.",
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 65535,
              "example": 5432
            }
          },
          "autoscale_target_rps": {
            "description": "Per-instance RPS target for the reactive scale-up trigger. 0 = disabled. Hobby/Pro/Scale only. When measured per-instance RPS exceeds this value, the scheduler admits another instance (up to max_concurrency).",
            "type": "integer",
            "minimum": 0,
            "example": 50
          },
          "autoscale_target_cpu_pct": {
            "description": "Per-instance CPU% target (1..100) for the reactive scale-up trigger. 0 = disabled. Pro/Scale only. When measured per-instance CPU% exceeds this value, the scheduler admits another instance (up to max_concurrency).",
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "example": 70
          },
          "streaming_enabled": {
            "description": "Per-app streaming flag. Free customers always see this as false; Hobby/Pro/Scale can PATCH it. activates the streamed response path; only persists the flag.",
            "type": "boolean",
            "example": false
          },
          "websocket_enabled": {
            "description": "Per-app raw-bytes Upgrade bridge flag. Default-on for Hobby/Pro/Scale; Free customers always see this as false. PATCH-true on Free is rejected by the API with 403 plan_websocket_not_allowed.",
            "type": "boolean",
            "example": false
          },
          "session_affinity": {
            "description": "Whether the edge should prefer the same running instance for this app. Best effort only; stale or unhealthy instances are bypassed automatically.",
            "type": "boolean",
            "example": false
          },
          "version_affinity_cookie": {
            "description": "Optional browser cookie name used for rollout affinity when Gregale-Version-Key is absent. The edge hashes the value before forwarding it as a key.",
            "type": "string",
            "pattern": "^[A-Za-z0-9_][A-Za-z0-9_.-]{0,63}$"
          },
          "version_affinity_managed_cookie": {
            "description": "Whether the edge issues an opaque, host-only browser cookie before the first rollout pick. Mutually exclusive with version_affinity_cookie.",
            "type": "boolean",
            "default": false
          },
          "revision_pin_ttl_seconds": {
            "description": "Retain superseded live deployments for revision-pinned requests for up to this many seconds. Zero disables revision pinning.",
            "type": "integer",
            "minimum": 0,
            "maximum": 604800,
            "default": 0
          },
          "release_policy": {
            "description": "Default rollout for production releases that name no rollout policy. safe (or unset) uses the adaptive health-gated canary (each stage advances on clean evidence after a minute) with first-wake 5xx rollback; fast uses the aggressive ladder with the same rollback; immediate moves all traffic at once.",
            "type": "string",
            "enum": [
              "safe",
              "fast",
              "immediate"
            ]
          },
          "release_probe_paths": {
            "description": "Up to 3 concrete GET paths the default rollout probe checks instead of /. No queries, fragments, wildcards or parameters.",
            "type": "array",
            "maxItems": 3,
            "items": {
              "type": "string",
              "maxLength": 240,
              "pattern": "^/"
            }
          },
          "route_metrics_enabled": {
            "description": "Per-app per-route observability flag. When true, the gateway emits gateway_request_duration_seconds{app,route,class} and serves the bounded reader at GET /v1/apps/{slug}/routes. Default-on for Hobby/Pro/Scale; Free customers always see this as false. PATCH-true on Free is rejected by the API with 403 plan_route_metrics_not_allowed.",
            "type": "boolean",
            "example": false
          },
          "only_allow_declared_routes": {
            "description": "When true, the gateway rejects paths not present in declared_routes or the imported OpenAPI document before waking an app.",
            "type": "boolean",
            "example": false
          },
          "declared_routes": {
            "description": "Optional explicit route contract. When non-empty it takes precedence over the imported OpenAPI document.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeclaredRoute"
            }
          },
          "maintenance_mode": {
            "description": "Coarse per-app maintenance toggle. When true the gateway hot-path short-circuits every request to this app with 503 + Retry-After (default 60 s) BEFORE auth, BEFORE wake, BEFORE any kind=maintenance edge rule. Free-tier allowed. Surfaced in the GET /v1/apps/{slug} response so dashboards can show 'maintenance on / off' alongside the streaming/WS pills.",
            "type": "boolean",
            "example": false
          },
          "scaling_policy": {
            "description": "Per-app scaling policy. null = legacy row, project the empty-policy shape from min_instances / max_concurrency. Non-null = customer-authored policy persisted to the jsonb column `apps.scaling_policy`.",
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ScalingPolicy"
              }
            ]
          },
          "retry_policy": {
            "description": "App-level default for invocation retries. Queue binding and per-invocation policies override this value.",
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/RetryPolicyDTO"
              }
            ]
          },
          "last_scale_out_at": {
            "description": "RFC 3339 timestamp of the most recent scale-out event the scheduler admitted for this app, or null if the app has never scaled out.",
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "example": "2026-07-31T12:00:00Z"
          },
          "last_scale_in_at": {
            "description": "RFC 3339 timestamp of the most recent scale-in event the scheduler reaped for this app, or null if the app has never scaled in.",
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "example": "2026-07-31T12:00:00Z"
          },
          "require_signed": {
            "description": "Per-app cosign signature-enforcement flag. When true, OCI image deploys must carry a valid signature from a publisher in the per-app trusted_signers list. Default false.",
            "type": "boolean",
            "example": false
          },
          "warm_snapshot_enabled": {
            "description": "Per-app two-tier snapshot flag. False by default; Pro/Scale may opt in, Free/Hobby always false.",
            "type": "boolean",
            "example": true
          },
          "warm_snapshot_min_requests": {
            "description": "Effective per-app request-count threshold for warm-tier capture on this app. Range [1, 100].",
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "example": 5
          },
          "warm_snapshot_min_ms": {
            "description": "Per-app time-since-first-ready threshold for warm-tier capture, milliseconds. Range [100, 60000].",
            "type": "integer",
            "minimum": 100,
            "maximum": 60000,
            "example": 2000
          },
          "warm_pool_size": {
            "description": "Desired paused warm-pool size. Zero disables the pool; bounded by max_concurrency and available on Hobby+ plans.",
            "type": "integer",
            "minimum": 0,
            "example": 0
          },
          "eviction_priority": {
            "description": "Per-app eviction tier. 'best_effort' (default) keeps the pre-#475 LRU-by-last_request_at reaper behaviour; 'reserved' protects the app from cross-account RAM-pressure eviction.",
            "type": "string",
            "enum": [
              "best_effort",
              "reserved"
            ],
            "example": "best_effort"
          },
          "require_authn": {
            "description": "Per-deployment token-gate flag. When true, the gateway demands `Authorization: Bearer <token>` on every request; cross-account tokens receive 403 insufficient_scope. Pro/Scale only — Free/Hobby PATCH-true is rejected with 403 plan_require_authn_not_allowed.",
            "type": "boolean",
            "example": false
          },
          "consumer_auth_mode": {
            "description": "End-customer credential policy. optional accepts anonymous requests and attributes valid consumer keys; required mandates a valid consumer key.",
            "type": "string",
            "enum": [
              "optional",
              "required"
            ],
            "default": "optional",
            "example": "optional"
          },
          "platform_tenant_required": {
            "description": "Require a verified platform tenant from a linked consumer key, verified tenant surface, or opted-in JWT authorization rule before app traffic is served. Default false.",
            "type": "boolean",
            "default": false,
            "example": false
          },
          "parked_deployment": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ParkedDeploymentRef"
              },
              {
                "type": "null"
              }
            ],
            "description": "Most-recently parked deployment for this app, or null if never parked. The reference surfaces the closed-set parking reason + timestamp on GET /v1/apps/{slug} so operators can answer 'why is my app evicted_cold?' without grepping the audit log."
          },
          "overflow_node": {
            "description": "Per-app preferred spill target for cross-node pressure rebalance. Resolved UUID from the customer's named compute_nodes.name preference (null when unset). Consulted by Engine.RebalancePressuredApps before the A9 fallback; falls through to A9 when the target is inactive or full.",
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "example": "00000000-0000-0000-0000-000000000000"
          },
          "cors_default_enabled": {
            "type": [
              "boolean",
              "null"
            ],
            "example": true
          },
          "cors_default_origins": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "https://*.example.com"
            ]
          },
          "public_auth": {
            "$ref": "#/components/schemas/PublicAuthStatus"
          },
          "auth_default_flipped_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "app_protocol": {
            "description": "Per-app wire-protocol selector. Closed set {http1, http2, grpc}. Default 'http1' (universal). Setting 'grpc' is plan-gated to Hobby+/Pro/Scale; Free customers see this as 'http1'.",
            "type": "string",
            "enum": [
              "http1",
              "http2",
              "grpc"
            ],
            "example": "http1"
          }
        }
      },
      "CreatePlatformTenantRequest": {
        "description": "Register a stable external customer reference under this account.",
        "type": "object",
        "required": [
          "external_ref",
          "name"
        ],
        "properties": {
          "external_ref": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      },
      "ApplyPlatformTenantConsumerRequest": {
        "description": "App-local customer identity to create or link by stable external reference.",
        "type": "object",
        "required": [
          "app_id",
          "external_ref",
          "name"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_ref": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      },
      "ApplyPlatformTenantRequest": {
        "description": "Additive, retry-safe onboarding of consumers and declarative hostname surfaces; dry_run validates and previews without writes.",
        "type": "object",
        "required": [
          "external_ref",
          "name"
        ],
        "properties": {
          "external_ref": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "dry_run": {
            "type": "boolean",
            "default": false
          },
          "consumers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApplyPlatformTenantConsumerRequest"
            }
          },
          "surface_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "surfaces": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApplyPlatformTenantSurfaceRequest"
            }
          }
        }
      },
      "PlanPlatformTenantReconciliationRequest": {
        "description": "Complete desired consumer and surface bundle for one existing platform tenant. Omitted managed resources appear as removal candidates; omitted unmanaged resources are explicitly retained.",
        "type": "object",
        "properties": {
          "consumers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApplyPlatformTenantConsumerRequest"
            }
          },
          "surface_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "surfaces": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApplyPlatformTenantSurfaceRequest"
            }
          }
        }
      },
      "PlatformTenantReconciliationPlanChange": {
        "description": "One deterministic planned or applied entry. remove_candidate is advisory in a plan; a confirmed apply reports detached or removed.",
        "type": "object",
        "required": [
          "resource_type",
          "action"
        ],
        "properties": {
          "resource_type": {
            "type": "string",
            "enum": [
              "consumer",
              "surface",
              "hostname"
            ]
          },
          "action": {
            "type": "string",
            "enum": [
              "create",
              "link",
              "keep",
              "remove_candidate",
              "retain_unmanaged",
              "created",
              "linked",
              "detached",
              "removed"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Existing resource ID; absent for a resource that would be created."
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_ref": {
            "type": "string",
            "description": "Present for consumer entries."
          },
          "name": {
            "type": "string",
            "description": "Present for consumer and surface entries."
          },
          "surface_id": {
            "type": "string",
            "format": "uuid",
            "description": "Present for hostname entries on an existing surface."
          },
          "hostname": {
            "type": "string",
            "description": "Present for hostname entries."
          },
          "managed_by_platform_tenant": {
            "type": "boolean",
            "description": "Existing provenance flag; omitted when the plan describes a resource that does not exist yet."
          }
        }
      },
      "PlatformTenantReconciliationPlanResponse": {
        "description": "A deterministic, read-only plan and digest. The digest confirms this desired bundle and current ownership-aware state at apply time.",
        "type": "object",
        "required": [
          "tenant_id",
          "plan_hash",
          "changes"
        ],
        "properties": {
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "plan_hash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "SHA-256 confirmation token for this desired bundle and current plan."
          },
          "changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantReconciliationPlanChange"
            }
          }
        }
      },
      "PlatformTenantOffboardingPlanResponse": {
        "description": "Read-only preview of the status, confirmation digest, and planned offboarding actions for a platform tenant.",
        "type": "object",
        "required": [
          "tenant_id",
          "status",
          "plan_hash",
          "actions"
        ],
        "properties": {
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "suspended"
            ]
          },
          "plan_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "actions": {
            "$ref": "#/components/schemas/PlatformTenantOffboardingPlanActions"
          }
        }
      },
      "PlatformTenantOffboardingPlanActions": {
        "description": "Counts and ownership-scoped changes that would be applied if the offboarding plan is confirmed.",
        "type": "object",
        "required": [
          "suspend_tenant",
          "revoke_consumer_keys",
          "revoke_access_tokens",
          "detach_managed_consumers",
          "retain_unmanaged_consumers",
          "detach_managed_surfaces",
          "retain_unmanaged_surfaces",
          "remove_managed_hostnames",
          "retain_unmanaged_hostnames",
          "disable_credential_delegation",
          "disable_customer_provisioning",
          "disable_hostname_delegation",
          "preserve_usage_history",
          "preserve_billing_statements",
          "preserve_reconciliation_history",
          "preserve_webhook_subscriptions"
        ],
        "properties": {
          "suspend_tenant": {
            "type": "boolean"
          },
          "revoke_consumer_keys": {
            "type": "integer",
            "minimum": 0
          },
          "revoke_access_tokens": {
            "type": "integer",
            "minimum": 0
          },
          "detach_managed_consumers": {
            "type": "integer",
            "minimum": 0
          },
          "retain_unmanaged_consumers": {
            "type": "integer",
            "minimum": 0
          },
          "detach_managed_surfaces": {
            "type": "integer",
            "minimum": 0
          },
          "retain_unmanaged_surfaces": {
            "type": "integer",
            "minimum": 0
          },
          "remove_managed_hostnames": {
            "type": "integer",
            "minimum": 0
          },
          "retain_unmanaged_hostnames": {
            "type": "integer",
            "minimum": 0
          },
          "disable_credential_delegation": {
            "type": "boolean"
          },
          "disable_customer_provisioning": {
            "type": "boolean"
          },
          "disable_hostname_delegation": {
            "type": "boolean"
          },
          "preserve_usage_history": {
            "type": "boolean"
          },
          "preserve_billing_statements": {
            "type": "boolean"
          },
          "preserve_reconciliation_history": {
            "type": "boolean"
          },
          "preserve_webhook_subscriptions": {
            "type": "boolean"
          }
        }
      },
      "ApplyPlatformTenantOffboardingRequest": {
        "description": "Confirmation digest returned by the preview for the exact offboarding plan being applied.",
        "type": "object",
        "required": [
          "expected_plan_hash"
        ],
        "properties": {
          "expected_plan_hash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          }
        }
      },
      "PlatformTenantOffboardingApplyResponse": {
        "description": "Confirmed offboarding actions and durable receipt created in the same transaction.",
        "type": "object",
        "required": [
          "tenant_id",
          "receipt_id",
          "plan_hash",
          "applied_at",
          "applied",
          "actions"
        ],
        "properties": {
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "receipt_id": {
            "type": "string",
            "format": "uuid"
          },
          "plan_hash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "applied_at": {
            "type": "string",
            "format": "date-time"
          },
          "applied": {
            "type": "boolean"
          },
          "actions": {
            "$ref": "#/components/schemas/PlatformTenantOffboardingPlanActions"
          }
        }
      },
      "PlatformTenantOffboardingReceiptSummary": {
        "description": "Compact immutable entry in the tenant's offboarding receipt history.",
        "type": "object",
        "required": [
          "receipt_id",
          "plan_hash",
          "applied_at"
        ],
        "properties": {
          "receipt_id": {
            "type": "string",
            "format": "uuid"
          },
          "plan_hash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "applied_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformTenantOffboardingReceiptListResponse": {
        "description": "One page of offboarding receipt summaries and an optional cursor for older entries.",
        "type": "object",
        "required": [
          "receipts"
        ],
        "properties": {
          "receipts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantOffboardingReceiptSummary"
            }
          },
          "next_page_token": {
            "type": "string"
          }
        }
      },
      "PlatformTenantOffboardingReceiptResponse": {
        "description": "Immutable secret-free result of one successful confirmed offboarding.",
        "type": "object",
        "required": [
          "tenant_id",
          "receipt_id",
          "plan_hash",
          "applied_at",
          "actions"
        ],
        "properties": {
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "receipt_id": {
            "type": "string",
            "format": "uuid"
          },
          "plan_hash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "applied_at": {
            "type": "string",
            "format": "date-time"
          },
          "actions": {
            "$ref": "#/components/schemas/PlatformTenantOffboardingPlanActions"
          }
        }
      },
      "ApplyPlatformTenantReconciliationRequest": {
        "description": "Desired bundle and plan digest returned by the read-only reconciliation-plan endpoint.",
        "type": "object",
        "required": [
          "expected_plan_hash"
        ],
        "properties": {
          "consumers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApplyPlatformTenantConsumerRequest"
            }
          },
          "surface_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "surfaces": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApplyPlatformTenantSurfaceRequest"
            }
          },
          "expected_plan_hash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          }
        }
      },
      "PlatformTenantReconciliationApplyResponse": {
        "description": "The confirmed changes applied in one transaction. Consumers and surfaces are detached, not deleted. receipt_id can be used to recover the result later.",
        "type": "object",
        "required": [
          "tenant_id",
          "receipt_id",
          "plan_hash",
          "applied_at",
          "applied",
          "changes"
        ],
        "properties": {
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "receipt_id": {
            "type": "string",
            "format": "uuid",
            "description": "Durable identifier for this successful apply."
          },
          "plan_hash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "applied_at": {
            "type": "string",
            "format": "date-time"
          },
          "applied": {
            "type": "boolean",
            "description": "True when the confirmed plan completed, including an already-converged no-op."
          },
          "changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantReconciliationPlanChange"
            }
          }
        }
      },
      "PlatformTenantReconciliationReceiptSummary": {
        "description": "Compact entry in a tenant's immutable reconciliation history.",
        "type": "object",
        "required": [
          "receipt_id",
          "plan_hash",
          "applied_at",
          "change_count"
        ],
        "properties": {
          "receipt_id": {
            "type": "string",
            "format": "uuid"
          },
          "plan_hash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "applied_at": {
            "type": "string",
            "format": "date-time"
          },
          "change_count": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "PlatformTenantReconciliationReceiptListResponse": {
        "description": "One page of reconciliation receipt summaries and an optional cursor for older receipts.",
        "type": "object",
        "required": [
          "receipts"
        ],
        "properties": {
          "receipts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantReconciliationReceiptSummary"
            }
          },
          "next_page_token": {
            "type": "string",
            "description": "Opaque cursor for the next page."
          }
        }
      },
      "PlatformTenantReconciliationReceiptResponse": {
        "description": "Immutable, secret-free result of one successfully applied reconciliation plan.",
        "type": "object",
        "required": [
          "tenant_id",
          "receipt_id",
          "plan_hash",
          "applied_at",
          "changes"
        ],
        "properties": {
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "receipt_id": {
            "type": "string",
            "format": "uuid"
          },
          "plan_hash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "applied_at": {
            "type": "string",
            "format": "date-time"
          },
          "changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantReconciliationPlanChange"
            }
          }
        }
      },
      "ApplyPlatformTenantSurfaceRequest": {
        "description": "App-local surface to create or reuse by account-level name, with an additive set of hostnames.",
        "type": "object",
        "required": [
          "app_id",
          "name",
          "hostnames"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "cert_kind": {
            "type": "string",
            "enum": [
              "per_host_san"
            ],
            "default": "per_host_san"
          },
          "hostnames": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "maxLength": 253
            }
          }
        }
      },
      "ApplyPlatformTenantConsumerResponse": {
        "description": "Planned or applied app consumer with its reconciliation action.",
        "type": "object",
        "required": [
          "app_id",
          "external_ref",
          "name",
          "status",
          "action"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Absent when a dry run would create this consumer."
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_ref": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active"
            ]
          },
          "action": {
            "type": "string",
            "enum": [
              "create",
              "link",
              "unchanged"
            ]
          },
          "managed_by_platform_tenant": {
            "type": "boolean",
            "description": "True only after the tenant bundle created this consumer; omitted for unmanaged resources and dry-run creates. Linking an existing consumer does not adopt it."
          }
        }
      },
      "ApplyPlatformTenantSurfaceResponse": {
        "description": "Planned or applied tenant surface, hostname challenges, and current certificate state.",
        "type": "object",
        "required": [
          "app_id",
          "name",
          "status",
          "cert_state",
          "action"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Absent when a dry run would create the surface."
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "active",
              "suspended"
            ]
          },
          "cert_state": {
            "type": "string",
            "enum": [
              "none",
              "pending",
              "issued",
              "failed"
            ]
          },
          "action": {
            "type": "string",
            "enum": [
              "create",
              "link",
              "unchanged"
            ]
          },
          "managed_by_platform_tenant": {
            "type": "boolean",
            "description": "True only after the tenant bundle created this surface; omitted for unmanaged resources and dry-run creates. Linking an existing surface does not adopt it."
          },
          "hostnames": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApplyPlatformTenantHostnameResponse"
            }
          }
        }
      },
      "ApplyPlatformTenantHostnameResponse": {
        "description": "Hostname reconciliation action and TXT challenge; new dry-run hostnames have no usable challenge token.",
        "type": "object",
        "required": [
          "hostname",
          "verified",
          "action"
        ],
        "properties": {
          "hostname": {
            "type": "string"
          },
          "challenge_token": {
            "type": "string"
          },
          "verified": {
            "type": "boolean"
          },
          "verified_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_error": {
            "type": "string"
          },
          "txt_record": {
            "type": "string"
          },
          "action": {
            "type": "string",
            "enum": [
              "create",
              "unchanged"
            ]
          },
          "managed_by_platform_tenant": {
            "type": "boolean",
            "description": "True only after the tenant bundle created this hostname; omitted for unmanaged resources and dry-run creates."
          }
        }
      },
      "PlatformTenantActivationSurfaceResponse": {
        "description": "Observed routing and certificate readiness for one linked customer surface.",
        "type": "object",
        "required": [
          "id",
          "app_id",
          "name",
          "status",
          "cert_state",
          "ready",
          "hostnames"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "cert_state": {
            "type": "string"
          },
          "cert_not_after": {
            "type": "string",
            "format": "date-time"
          },
          "cert_last_error": {
            "type": "string"
          },
          "ready": {
            "type": "boolean"
          },
          "hostnames": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TenantHostnameResponse"
            }
          }
        }
      },
      "PlatformTenantActivationResponse": {
        "description": "Account customer activation snapshot; ready is false until all linked hostname surfaces are serving.",
        "type": "object",
        "required": [
          "tenant_id",
          "status",
          "enabled",
          "ready",
          "surfaces"
        ],
        "properties": {
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "suspended"
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "ready": {
            "type": "boolean"
          },
          "surfaces": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantActivationSurfaceResponse"
            }
          }
        }
      },
      "PlatformTenantSelfActivationHostnameResponse": {
        "description": "Hostname verification status for the tenant-bound downstream activation view; challenge material and raw errors are omitted.",
        "type": "object",
        "required": [
          "hostname",
          "verified"
        ],
        "properties": {
          "hostname": {
            "type": "string"
          },
          "verified": {
            "type": "boolean"
          },
          "verified_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreatePlatformTenantSelfHostnameRequest": {
        "description": "Add a DNS hostname to an existing surface already linked to the authenticated platform tenant.",
        "type": "object",
        "required": [
          "surface_id",
          "hostname"
        ],
        "properties": {
          "surface_id": {
            "type": "string",
            "format": "uuid"
          },
          "hostname": {
            "type": "string",
            "maxLength": 253,
            "pattern": "^[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?(?:\\.[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)+$"
          }
        }
      },
      "PlatformTenantSelfHostnameResponse": {
        "description": "A redacted hostname intent and DNS TXT challenge. DNS and certificate status remain asynchronous.",
        "type": "object",
        "required": [
          "surface_id",
          "hostname",
          "action",
          "verified",
          "txt_record"
        ],
        "properties": {
          "surface_id": {
            "type": "string",
            "format": "uuid"
          },
          "hostname": {
            "type": "string"
          },
          "action": {
            "type": "string",
            "enum": [
              "created",
              "unchanged"
            ]
          },
          "verified": {
            "type": "boolean"
          },
          "verified_at": {
            "type": "string",
            "format": "date-time"
          },
          "txt_record": {
            "type": "string",
            "description": "DNS TXT record name to publish for ownership proof."
          },
          "challenge_token": {
            "type": "string",
            "description": "Returned only while DNS ownership remains unverified; store securely and publish as the TXT value."
          }
        }
      },
      "PlatformTenantSelfActivationSurfaceResponse": {
        "description": "Redacted state for one surface linked to the caller's platform tenant.",
        "type": "object",
        "required": [
          "id",
          "name",
          "status",
          "cert_state",
          "ready",
          "hostnames"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "active",
              "suspended"
            ]
          },
          "cert_state": {
            "type": "string",
            "enum": [
              "none",
              "pending",
              "issued",
              "failed"
            ]
          },
          "cert_not_after": {
            "type": "string",
            "format": "date-time"
          },
          "ready": {
            "type": "boolean"
          },
          "latest_deployment": {
            "$ref": "#/components/schemas/PlatformTenantSelfDeploymentResponse"
          },
          "hostnames": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantSelfActivationHostnameResponse"
            }
          }
        }
      },
      "PlatformTenantSelfDeploymentResponse": {
        "description": "Safe status of the latest deployment attempt for the surface's app. This is not a claim that the attempt is currently serving; IDs, source metadata, logs, and errors are omitted.",
        "type": "object",
        "required": [
          "status",
          "started_at"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "building",
              "imaging",
              "snapshotting",
              "live",
              "failed",
              "superseded",
              "cancelled"
            ]
          },
          "revision": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "description": "Positive app revision when assigned."
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformTenantSelfActivationResponse": {
        "description": "Current read-only activation snapshot for the tenant bound to the bearer; ready requires every linked surface to be ready.",
        "type": "object",
        "required": [
          "status",
          "enabled",
          "ready",
          "surfaces"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "active",
              "suspended"
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "ready": {
            "type": "boolean"
          },
          "surfaces": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantSelfActivationSurfaceResponse"
            }
          }
        }
      },
      "PlatformTenantSelfConsumerResponse": {
        "description": "Minimal linked-consumer identity used to target tenant-managed credentials; app IDs and account metadata are omitted.",
        "type": "object",
        "required": [
          "consumer_id",
          "external_ref",
          "name",
          "status"
        ],
        "properties": {
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_ref": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "revoked"
            ]
          }
        }
      },
      "CreatePlatformTenantSelfConsumerRequest": {
        "description": "Create a customer identity on an active surface already linked to the token's tenant.",
        "type": "object",
        "required": [
          "surface_id",
          "external_ref",
          "name"
        ],
        "properties": {
          "surface_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_ref": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      },
      "ApplyPlatformTenantSelfConsumersRequest": {
        "description": "All-or-nothing customer onboarding bundle across surfaces already linked to the token's tenant; no app or tenant identifier is accepted.",
        "type": "object",
        "required": [
          "external_ref",
          "name",
          "surface_ids"
        ],
        "properties": {
          "external_ref": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "surface_ids": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "dry_run": {
            "type": "boolean",
            "default": false
          }
        }
      },
      "PlatformTenantSelfConsumerApplyItemResponse": {
        "description": "Result for one surface; a planned create omits consumer_id until the real apply runs.",
        "type": "object",
        "required": [
          "surface_id",
          "external_ref",
          "name",
          "status",
          "action"
        ],
        "properties": {
          "surface_id": {
            "type": "string",
            "format": "uuid"
          },
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_ref": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active"
            ]
          },
          "action": {
            "type": "string",
            "enum": [
              "create",
              "unchanged"
            ]
          }
        }
      },
      "ApplyPlatformTenantSelfConsumersResponse": {
        "description": "Redacted per-surface onboarding results. App and account identifiers are not returned.",
        "type": "object",
        "required": [
          "dry_run",
          "consumers"
        ],
        "properties": {
          "dry_run": {
            "type": "boolean"
          },
          "consumers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantSelfConsumerApplyItemResponse"
            }
          }
        }
      },
      "PlatformTenantSelfConsumersResponse": {
        "description": "The linked consumer identities for the caller's tenant only.",
        "type": "object",
        "required": [
          "consumers"
        ],
        "properties": {
          "consumers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantSelfConsumerResponse"
            }
          }
        }
      },
      "RevokePlatformTenantSelfConsumersRequest": {
        "description": "All-or-nothing batch of customer IDs from this tenant's linked-consumer inventory.",
        "type": "object",
        "required": [
          "consumer_ids"
        ],
        "properties": {
          "consumer_ids": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      },
      "PlatformTenantSelfConsumerRevocationResponse": {
        "description": "Revoked identities with the number of active keys newly revoked by this operation; exact retries return zero.",
        "type": "object",
        "required": [
          "consumers",
          "revoked_keys"
        ],
        "properties": {
          "consumers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantSelfConsumerResponse"
            }
          },
          "revoked_keys": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "ApplyPlatformTenantResponse": {
        "description": "Tenant onboarding plan or applied result; omitted IDs in a dry run would be created.",
        "type": "object",
        "required": [
          "external_ref",
          "name",
          "status",
          "action",
          "dry_run",
          "consumers",
          "surfaces"
        ],
        "properties": {
          "tenant_id": {
            "type": "string",
            "format": "uuid",
            "description": "Absent when a dry run would create this tenant."
          },
          "external_ref": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "suspended"
            ]
          },
          "action": {
            "type": "string",
            "enum": [
              "create",
              "unchanged"
            ]
          },
          "dry_run": {
            "type": "boolean"
          },
          "consumers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApplyPlatformTenantConsumerResponse"
            }
          },
          "surfaces": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApplyPlatformTenantSurfaceResponse"
            }
          }
        }
      },
      "PlatformTenantCredentialIntent": {
        "description": "Metadata and SHA-256 digest of a locally generated ck_ credential; never submit plaintext.",
        "type": "object",
        "required": [
          "consumer_id",
          "name",
          "prefix",
          "hash",
          "scopes"
        ],
        "properties": {
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "prefix": {
            "type": "string",
            "pattern": "^[0-9a-f]{8}$"
          },
          "hash": {
            "type": "string",
            "pattern": "^[0-9a-fA-F]{64}$",
            "description": "Hex-encoded SHA-256 of the entire plaintext key."
          },
          "scopes": {
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "read",
                "write",
                "admin"
              ]
            }
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SetPlatformTenantCredentialPolicyRequest": {
        "description": "Explicit scopes and per-consumer key ceiling for tenant-bound credential self-service; empty scopes and zero disable it.",
        "type": "object",
        "required": [
          "allowed_scopes",
          "max_keys_per_consumer"
        ],
        "properties": {
          "allowed_scopes": {
            "type": "array",
            "uniqueItems": true,
            "maxItems": 3,
            "items": {
              "type": "string",
              "enum": [
                "read",
                "write",
                "admin"
              ]
            }
          },
          "max_keys_per_consumer": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          }
        }
      },
      "PlatformTenantCredentialPolicyResponse": {
        "description": "Owner-configured scope allowlist and active-key ceiling for delegated credential management.",
        "type": "object",
        "required": [
          "tenant_id",
          "enabled",
          "allowed_scopes",
          "max_keys_per_consumer"
        ],
        "properties": {
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "enabled": {
            "type": "boolean"
          },
          "allowed_scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "read",
                "write",
                "admin"
              ]
            }
          },
          "max_keys_per_consumer": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SetPlatformTenantConsumerProvisioningPolicyRequest": {
        "description": "Owner-controlled enablement and total active-customer ceiling for a downstream tenant.",
        "type": "object",
        "required": [
          "enabled",
          "max_consumers"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "max_consumers": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100000
          }
        }
      },
      "PlatformTenantConsumerProvisioningPolicyResponse": {
        "description": "Owner-controlled self-service customer creation policy; an absent policy is disabled.",
        "type": "object",
        "required": [
          "tenant_id",
          "enabled",
          "max_consumers"
        ],
        "properties": {
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "enabled": {
            "type": "boolean"
          },
          "max_consumers": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100000
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ApplyPlatformTenantCredentialsRequest": {
        "description": "Additive key reconciliation and revocation in one transaction; provide at least one key or revocation.",
        "type": "object",
        "properties": {
          "dry_run": {
            "type": "boolean",
            "default": false
          },
          "keys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantCredentialIntent"
            }
          },
          "revoke_key_ids": {
            "type": "array",
            "uniqueItems": true,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      },
      "PlatformTenantCredentialResult": {
        "description": "Credential metadata only; no plaintext key, including on creation.",
        "allOf": [
          {
            "$ref": "#/components/schemas/PlatformTenantCredentialMetadata"
          },
          {
            "type": "object",
            "required": [
              "action"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "create",
                  "revoke",
                  "unchanged"
                ]
              }
            }
          }
        ]
      },
      "ApplyPlatformTenantCredentialsResponse": {
        "description": "Atomic credential plan or applied result for one platform tenant.",
        "type": "object",
        "required": [
          "tenant_id",
          "dry_run",
          "keys"
        ],
        "properties": {
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "dry_run": {
            "type": "boolean"
          },
          "keys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantCredentialResult"
            }
          }
        }
      },
      "PlatformTenantCredentialsResponse": {
        "description": "A bounded page of credential metadata without plaintext keys.",
        "type": "object",
        "required": [
          "keys"
        ],
        "properties": {
          "keys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantCredentialMetadata"
            }
          }
        }
      },
      "PlatformTenantCredentialMetadata": {
        "description": "Metadata for a linked consumer key; plaintext and hash are excluded. ID and creation time are omitted for planned keys in a dry run.",
        "type": "object",
        "required": [
          "consumer_id",
          "name",
          "prefix",
          "scopes"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "read",
                "write",
                "admin"
              ]
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_used_at": {
            "type": "string",
            "format": "date-time"
          },
          "revoked_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SetPlatformTenantStatusRequest": {
        "description": "Suspend or resume linked credential and hostname paths.",
        "type": "object",
        "required": [
          "status"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "active",
              "suspended"
            ]
          }
        }
      },
      "SetPlatformTenantRequestBudgetRequest": {
        "description": "Both optional admission ceilings must be supplied; zero disables a dimension.",
        "type": "object",
        "required": [
          "max_requests_per_minute",
          "max_requests_per_day"
        ],
        "properties": {
          "max_requests_per_minute": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000000
          },
          "max_requests_per_day": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 100000000
          }
        }
      },
      "SetPlatformTenantHostnamePolicyRequest": {
        "description": "Replace the tenant's domain delegation. Empty suffixes and zero max_hostnames disable tenant self-service.",
        "type": "object",
        "required": [
          "allowed_suffixes",
          "max_hostnames"
        ],
        "properties": {
          "allowed_suffixes": {
            "type": "array",
            "maxItems": 32,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "maxLength": 253,
              "pattern": "^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+$"
            }
          },
          "max_hostnames": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          }
        }
      },
      "PlatformTenantHostnamePolicyResponse": {
        "description": "Owner-managed allowlist and total hostname cap for downstream self-service. An absent policy is disabled.",
        "type": "object",
        "required": [
          "tenant_id",
          "enabled",
          "allowed_suffixes",
          "max_hostnames"
        ],
        "properties": {
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "enabled": {
            "type": "boolean"
          },
          "allowed_suffixes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "max_hostnames": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformTenantRequestBudgetResponse": {
        "description": "One customer's authoritative cross-app admitted-request budget and current UTC counters. Absent policy has configured=false and zero ceilings.",
        "type": "object",
        "required": [
          "tenant_id",
          "configured",
          "max_requests_per_minute",
          "max_requests_per_day",
          "minute_used",
          "day_used",
          "minute_resets_at",
          "day_resets_at"
        ],
        "properties": {
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "configured": {
            "type": "boolean"
          },
          "max_requests_per_minute": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "max_requests_per_day": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "minute_used": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "day_used": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "minute_resets_at": {
            "type": "string",
            "format": "date-time"
          },
          "day_resets_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreatePlatformTenantRateCardRequest": {
        "description": "Immutable tenant-wide price per attributed request unit. Currency defaults to EUR and effective_from defaults to the next UTC minute.",
        "type": "object",
        "required": [
          "price_millicents_per_unit"
        ],
        "properties": {
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$",
            "default": "EUR",
            "example": "EUR"
          },
          "price_millicents_per_unit": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "example": 1500
          },
          "included_units_per_month": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Free request units per tenant per UTC calendar month across every attributed app, consumed in minute order. Statements for periods it prices must cover one calendar month."
          },
          "tiers": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/APIConsumerRateCardTier"
            },
            "description": "Optional graduated ladder counted per tenant per UTC calendar month across every attributed app. Replaces price_millicents_per_unit and included_units_per_month; the last step's up_to is null."
          },
          "route_weights": {
            "type": "object",
            "maxProperties": 50,
            "description": "Counts each request on a listed \"METHOD /template\" route as that many units (1..1000, at most 50 routes), including surface and JWT-rule requests. Unlisted routes count 1. Statements for periods it prices must cover one calendar month.",
            "additionalProperties": {
              "type": "integer",
              "format": "int64",
              "minimum": 1,
              "maximum": 1000
            }
          },
          "effective_from": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "UTC minute at which the version starts; omitted means the next UTC minute. Cannot be in the past once any tenant card has included units, tiers, route weights, monthly fees, or a unit other than requests."
          },
          "unit": {
            "type": "string",
            "pattern": "^(request|compute_second|response_megabyte|app:[a-z][a-z0-9_]{0,31})$",
            "default": "request",
            "description": "What the card prices: requests; the compute seconds or response megabytes of billable requests, rounded per subject minute; or app:<meter>, the units the app reports in its Gregale-Usage header. Cards of different units price side by side; non-request cards take no route weights, are month-priced and cannot be backdated."
          },
          "tier_mode": {
            "type": "string",
            "enum": [
              "graduated",
              "volume"
            ],
            "default": "graduated",
            "description": "How the tenant ladder prices a month: graduated by each unit's position, or volume, every unit of the month at the step the tenant's total reaches. volume needs tiers."
          },
          "base_fee_millicents_per_month": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Fixed charge per tenant per UTC month while this card is in force when the tenant's month starts. Statements for periods it prices must cover one calendar month."
          },
          "minimum_millicents_per_month": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Minimum usage charge per tenant per UTC month for this card's unit; statements top up the difference."
          },
          "prorate_monthly_fees": {
            "type": "boolean",
            "default": false,
            "description": "Scale the base fee and minimum in the tenant's first month to the share of it left after the tenant was created."
          }
        }
      },
      "PlatformTenantRateCardResponse": {
        "description": "Immutable, versioned customer price shared across every app attributed to one platform tenant.",
        "type": "object",
        "required": [
          "id",
          "tenant_id",
          "currency",
          "unit",
          "price_millicents_per_unit",
          "included_units_per_month",
          "effective_from",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "unit": {
            "type": "string",
            "pattern": "^(request|compute_second|response_megabyte|app:[a-z][a-z0-9_]{0,31})$",
            "description": "What the tenant card prices."
          },
          "base_fee_millicents_per_month": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "The card's fixed monthly charge per tenant."
          },
          "minimum_millicents_per_month": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "The card's minimum monthly usage charge per tenant."
          },
          "prorate_monthly_fees": {
            "type": "boolean",
            "description": "Whether the first month's fees are prorated."
          },
          "price_millicents_per_unit": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "included_units_per_month": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Free units per tenant per UTC calendar month."
          },
          "tiers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/APIConsumerRateCardTier"
            },
            "description": "Ladder counted per tenant per UTC calendar month; absent for flat cards."
          },
          "tier_mode": {
            "type": "string",
            "enum": [
              "graduated",
              "volume"
            ],
            "description": "How the tenant ladder prices a month."
          },
          "route_weights": {
            "type": "object",
            "description": "Units per request on a route; absent when every request counts 1.",
            "additionalProperties": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            }
          },
          "effective_from": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformTenantPlanBudget": {
        "description": "The request budget a tenant plan sets; zero disables a ceiling.",
        "type": "object",
        "required": [
          "max_requests_per_minute",
          "max_requests_per_day"
        ],
        "properties": {
          "max_requests_per_minute": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000000
          },
          "max_requests_per_day": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 100000000
          }
        }
      },
      "PlatformTenantPlanRequest": {
        "description": "A reusable tenant plan: rate card terms and an optional request budget that assigning the plan applies.",
        "type": "object",
        "required": [
          "name",
          "currency",
          "price_millicents_per_unit"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "price_millicents_per_unit": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "included_units_per_month": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "tiers": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/APIConsumerRateCardTier"
            }
          },
          "route_weights": {
            "type": "object",
            "maxProperties": 50,
            "additionalProperties": {
              "type": "integer",
              "format": "int64",
              "minimum": 1,
              "maximum": 1000
            }
          },
          "request_budget": {
            "$ref": "#/components/schemas/PlatformTenantPlanBudget"
          },
          "unit": {
            "type": "string",
            "pattern": "^(request|compute_second|response_megabyte|app:[a-z][a-z0-9_]{0,31})$",
            "default": "request",
            "description": "What the card a plan assignment creates prices. Assigning a plan also starts a free card for each other unit the tenant is charged for, so the plan is the tenant's whole price."
          },
          "base_fee_millicents_per_month": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Fixed monthly charge per tenant the plan's card sets."
          },
          "minimum_millicents_per_month": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Minimum monthly usage charge per tenant the plan's card sets."
          },
          "prorate_monthly_fees": {
            "type": "boolean",
            "default": false,
            "description": "Prorate the first month's fees."
          },
          "tier_mode": {
            "type": "string",
            "enum": [
              "graduated",
              "volume"
            ],
            "default": "graduated",
            "description": "How the plan's ladder prices a tenant's month; volume needs tiers."
          }
        }
      },
      "PlatformTenantPlanResponse": {
        "description": "One tenant plan.",
        "type": "object",
        "required": [
          "id",
          "name",
          "currency",
          "price_millicents_per_unit",
          "included_units_per_month",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "price_millicents_per_unit": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "included_units_per_month": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "tiers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/APIConsumerRateCardTier"
            }
          },
          "route_weights": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            }
          },
          "request_budget": {
            "$ref": "#/components/schemas/PlatformTenantPlanBudget"
          },
          "unit": {
            "type": "string",
            "pattern": "^(request|compute_second|response_megabyte|app:[a-z][a-z0-9_]{0,31})$",
            "description": "What the plan's card prices."
          },
          "base_fee_millicents_per_month": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "minimum_millicents_per_month": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "prorate_monthly_fees": {
            "type": "boolean"
          },
          "tier_mode": {
            "type": "string",
            "enum": [
              "graduated",
              "volume"
            ],
            "description": "How the plan's ladder prices a month."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformTenantPlanListResponse": {
        "description": "An account's tenant plans by name.",
        "type": "object",
        "required": [
          "plans"
        ],
        "properties": {
          "plans": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantPlanResponse"
            }
          }
        }
      },
      "AssignPlatformTenantPlanRequest": {
        "description": "Moves a tenant onto a plan from the next minute.",
        "type": "object",
        "required": [
          "plan_id"
        ],
        "properties": {
          "plan_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "PlatformTenantPlanAssignmentResponse": {
        "description": "One plan assignment and the tenant rate card it created.",
        "type": "object",
        "required": [
          "id",
          "tenant_id",
          "plan_id",
          "rate_card_id",
          "effective_from",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "plan_id": {
            "type": "string",
            "format": "uuid"
          },
          "plan_name": {
            "type": "string"
          },
          "rate_card_id": {
            "type": "string",
            "format": "uuid"
          },
          "effective_from": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformTenantPlanAssignmentListResponse": {
        "description": "A tenant's plan assignments, newest first.",
        "type": "object",
        "required": [
          "assignments"
        ],
        "properties": {
          "assignments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantPlanAssignmentResponse"
            }
          }
        }
      },
      "PlatformTenantRateCardListResponse": {
        "description": "Chronological immutable tariff versions for one customer.",
        "type": "object",
        "required": [
          "rate_cards"
        ],
        "properties": {
          "rate_cards": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantRateCardResponse"
            }
          }
        }
      },
      "LinkPlatformTenantConsumerRequest": {
        "description": "Attach an existing app-local API consumer to one platform customer.",
        "type": "object",
        "required": [
          "consumer_id"
        ],
        "properties": {
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "LinkPlatformTenantSurfaceRequest": {
        "description": "Attach an existing tenant surface to one platform customer.",
        "type": "object",
        "required": [
          "surface_id"
        ],
        "properties": {
          "surface_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "PlatformTenantResponse": {
        "description": "Account-level end customer; links and credentials are separate resources.",
        "type": "object",
        "required": [
          "id",
          "external_ref",
          "name",
          "status",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "external_ref": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "suspended"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformTenantInvocationResponse": {
        "description": "Status and result for customer work; omits account, deployment, original payload and headers.",
        "type": "object",
        "required": [
          "id",
          "state",
          "method",
          "path",
          "attempts",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "dispatching",
              "completed",
              "failed",
              "cancelled",
              "dead_letter"
            ]
          },
          "method": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "attempts": {
            "type": "integer"
          },
          "result": {
            "description": "JSON result returned by the guest, when available."
          },
          "last_error": {
            "type": "string"
          },
          "outcome": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "PlatformTenantListResponse": {
        "description": "A bounded page of account-level customers.",
        "type": "object",
        "required": [
          "tenants"
        ],
        "properties": {
          "tenants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantResponse"
            }
          },
          "next_offset": {
            "type": "integer",
            "minimum": 0
          },
          "next_page_token": {
            "type": "string",
            "description": "Opaque cursor for the next stable page; omitted when no more tenants remain."
          }
        }
      },
      "CreatePlatformTenantAccessTokenRequest": {
        "description": "Mint a bearer for one downstream tenant. Plaintext is returned once and expires no later than one year after creation.",
        "type": "object",
        "required": [
          "name",
          "scopes"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "scopes": {
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "platform_tenant:usage:read",
                "platform_tenant:statements:read",
                "platform_tenant:activation:read",
                "platform_tenant:hostnames:manage",
                "platform_tenant:credentials:read",
                "platform_tenant:credentials:manage",
                "platform_tenant:consumers:manage",
                "platform_tenant:invocations:read",
                "platform_tenant:invocations:manage",
                "platform_tenant:events:read",
                "platform_tenant:events:manage",
                "platform_tenant:stored_workflows:read",
                "platform_tenant:stored_workflows:manage"
              ]
            }
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "Defaults to 90 days from creation; maximum 365 days."
          }
        }
      },
      "PlatformTenantAccessTokenResponse": {
        "description": "Redacted token metadata. Plaintext is never returned by list or revoke.",
        "type": "object",
        "required": [
          "id",
          "tenant_id",
          "name",
          "prefix",
          "scopes",
          "created_at",
          "expires_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "prefix": {
            "type": "string",
            "pattern": "^fp_tenant_[0-9a-f]{8}$"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "platform_tenant:usage:read",
                "platform_tenant:statements:read",
                "platform_tenant:activation:read",
                "platform_tenant:hostnames:manage",
                "platform_tenant:credentials:read",
                "platform_tenant:credentials:manage",
                "platform_tenant:consumers:manage",
                "platform_tenant:invocations:read",
                "platform_tenant:invocations:manage",
                "platform_tenant:events:read",
                "platform_tenant:events:manage",
                "platform_tenant:stored_workflows:read",
                "platform_tenant:stored_workflows:manage"
              ]
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_used_at": {
            "type": "string",
            "format": "date-time"
          },
          "revoked_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreatePlatformTenantAccessTokenResponse": {
        "description": "Token metadata plus one-time plaintext bearer. Save the token securely; it is never retrievable again.",
        "type": "object",
        "required": [
          "id",
          "tenant_id",
          "name",
          "prefix",
          "scopes",
          "created_at",
          "expires_at",
          "token"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "prefix": {
            "type": "string",
            "pattern": "^fp_tenant_[0-9a-f]{8}$"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "platform_tenant:usage:read",
                "platform_tenant:statements:read",
                "platform_tenant:activation:read",
                "platform_tenant:hostnames:manage",
                "platform_tenant:credentials:read",
                "platform_tenant:credentials:manage",
                "platform_tenant:consumers:manage",
                "platform_tenant:invocations:read",
                "platform_tenant:invocations:manage",
                "platform_tenant:events:read",
                "platform_tenant:events:manage",
                "platform_tenant:stored_workflows:read",
                "platform_tenant:stored_workflows:manage"
              ]
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_used_at": {
            "type": "string",
            "format": "date-time"
          },
          "revoked_at": {
            "type": "string",
            "format": "date-time"
          },
          "token": {
            "type": "string",
            "pattern": "^fp_tenant_[0-9a-f]{64}$",
            "description": "One-time plaintext bearer; emitted only by create."
          }
        }
      },
      "PlatformTenantAccessTokenListResponse": {
        "description": "Tenant access-token metadata without any recoverable plaintext bearer.",
        "type": "object",
        "required": [
          "tokens"
        ],
        "properties": {
          "tokens": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantAccessTokenResponse"
            }
          }
        }
      },
      "PlatformTenantSurfaceResponse": {
        "description": "A linked tenant surface summary; managed_by_platform_tenant is true only when a platform-tenant apply created it. Use the app endpoint for hostnames.",
        "type": "object",
        "required": [
          "id",
          "app_id",
          "name",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "managed_by_platform_tenant": {
            "type": "boolean",
            "description": "True when this surface originated in the account owner's tenant bundle apply; absent otherwise."
          }
        }
      },
      "PlatformTenantDetailResponse": {
        "description": "One customer and its current app-local consumer and surface links. Resource managed_by_platform_tenant fields distinguish tenant-bundle-created resources from pre-existing resources merely linked to the tenant.",
        "type": "object",
        "required": [
          "id",
          "external_ref",
          "name",
          "status",
          "created_at",
          "updated_at",
          "consumers",
          "surfaces"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "external_ref": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "suspended"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "consumers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/APIConsumerResponse"
            }
          },
          "surfaces": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantSurfaceResponse"
            }
          }
        }
      },
      "PlatformTenantUsageBucketResponse": {
        "description": "One UTC day of durable tenant-attributed usage. Exactly one of consumer_id, surface_id, or jwt_authorization_rule_id is present.",
        "type": "object",
        "required": [
          "app_id",
          "window_start",
          "request_count",
          "error_count",
          "billable_units"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "surface_id": {
            "type": "string",
            "format": "uuid"
          },
          "jwt_authorization_rule_id": {
            "type": "string",
            "format": "uuid"
          },
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "request_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "billable_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "PlatformTenantUsageResponse": {
        "description": "Cross-app raw usage totals with app and consumer, surface, or JWT-rule attribution.",
        "type": "object",
        "required": [
          "tenant_id",
          "period_start",
          "period_end",
          "request_count",
          "error_count",
          "billable_units",
          "buckets",
          "as_of"
        ],
        "properties": {
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "period_end": {
            "type": "string",
            "format": "date-time"
          },
          "request_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "billable_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "buckets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantUsageBucketResponse"
            }
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformTenantActivityItem": {
        "description": "One observed telemetry row and the app it belongs to. Request details contain no HTTP body or headers.",
        "type": "object",
        "required": [
          "app_id",
          "request"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "request": {
            "$ref": "#/components/schemas/DebugTelemetryRequestItem"
          }
        }
      },
      "PlatformTenantActivityFilters": {
        "description": "Normalized app and HTTP status filters applied to every page.",
        "type": "object",
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599
          }
        }
      },
      "PlatformTenantActivityResponse": {
        "description": "A retention-bounded page of observed debugger evidence. Page totals weight each collapsed telemetry row by request.count and must not be treated as complete usage.",
        "type": "object",
        "required": [
          "tenant_id",
          "since",
          "window_start",
          "window_end",
          "plan_retention_days",
          "retention_clamped",
          "page_telemetry_rows",
          "page_represented_requests",
          "page_error_requests",
          "page_complete",
          "filters",
          "requests"
        ],
        "properties": {
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "since": {
            "type": "string",
            "description": "Actual lookback duration after applying the account's debugger retention ceiling."
          },
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "window_end": {
            "type": "string",
            "format": "date-time"
          },
          "plan_retention_days": {
            "type": "integer",
            "minimum": 0
          },
          "retention_clamped": {
            "type": "boolean"
          },
          "page_telemetry_rows": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "page_represented_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "page_error_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "page_complete": {
            "type": "boolean",
            "description": "True when this page contains all matching retained rows in the pinned window; it does not imply complete telemetry capture."
          },
          "next_cursor": {
            "type": "string",
            "description": "Present when another page of retained rows exists."
          },
          "filters": {
            "$ref": "#/components/schemas/PlatformTenantActivityFilters"
          },
          "requests": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantActivityItem"
            }
          }
        }
      },
      "PlatformTenantStatementLineResponse": {
        "description": "Compact immutable invoice line grouped by app, tenant-attributed consumer, surface, or JWT rule, and effective price source. window_start is the earliest included UTC minute; window_end is the exclusive end after the latest included minute and may span gaps. Exact minute coverage remains internal for additive revisions. Exactly one of consumer_id, surface_id, or jwt_authorization_rule_id is present. Each line is billable_units × price_millicents_per_unit; free allowance units and each ladder step have their own line. In an adjustment that re-prices a month for a tenant allowance or tiers, a line is the difference from finalized revisions and can be negative, while the revision total never is.",
        "type": "object",
        "required": [
          "app_id",
          "window_start",
          "window_end",
          "billable_units",
          "amount_millicents"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "surface_id": {
            "type": "string",
            "format": "uuid"
          },
          "jwt_authorization_rule_id": {
            "type": "string",
            "format": "uuid"
          },
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "window_end": {
            "type": "string",
            "format": "date-time",
            "description": "Exclusive end after the latest included UTC minute; gaps inside the interval may have no usage."
          },
          "billable_units": {
            "type": "integer",
            "format": "int64",
            "description": "Units on this line; negative only in a re-priced month adjustment."
          },
          "rate_card_id": {
            "type": "string",
            "format": "uuid"
          },
          "platform_tenant_rate_card_id": {
            "type": "string",
            "format": "uuid",
            "description": "Tenant-wide price source; mutually exclusive with rate_card_id."
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "price_millicents_per_unit": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "amount_millicents": {
            "type": "integer",
            "format": "int64",
            "description": "billable_units × price_millicents_per_unit; negative only in a re-priced month adjustment."
          }
        }
      },
      "PlatformTenantStatementResponse": {
        "description": "One immutable initial or additive adjustment revision for a cross-app customer period, with compact invoice lines and private minute-level adjustment coverage.",
        "type": "object",
        "required": [
          "id",
          "tenant_id",
          "period_start",
          "period_end",
          "revision",
          "status",
          "billable_units",
          "unpriced_units",
          "amount_millicents",
          "lines",
          "as_of",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "period_end": {
            "type": "string",
            "format": "date-time"
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "finalized",
              "superseded"
            ]
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "billable_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unpriced_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "amount_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantStatementLineResponse"
            }
          },
          "fees": {
            "type": "array",
            "maxItems": 64,
            "description": "Monthly base fees and minimum top-ups this revision bills; amount_millicents includes them. A revision can bill fees without lines for a tenant without usage.",
            "items": {
              "$ref": "#/components/schemas/APIConsumerStatementFeeResponse"
            }
          },
          "credit_applied_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Prepaid credit drawn when the revision was finalized."
          },
          "amount_due_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "amount_millicents less credit_applied_millicents: what invoice exports bill."
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "finalized_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformTenantStatementListResponse": {
        "description": "Immutable statement revisions for one tenant and period.",
        "type": "object",
        "required": [
          "statements"
        ],
        "properties": {
          "statements": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantStatementResponse"
            }
          },
          "next_offset": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "PlatformTenantStatementSummaryResponse": {
        "description": "Finalized statement metadata without the potentially large line-item collection; retrieve line items by statement ID.",
        "type": "object",
        "required": [
          "id",
          "tenant_id",
          "period_start",
          "period_end",
          "revision",
          "status",
          "billable_units",
          "unpriced_units",
          "amount_millicents",
          "as_of",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "period_end": {
            "type": "string",
            "format": "date-time"
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "finalized"
            ]
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "billable_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unpriced_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "amount_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "finalized_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformTenantSelfStatementListResponse": {
        "description": "Bounded page of finalized statement summaries. next_offset is present only when another page exists.",
        "type": "object",
        "required": [
          "statements"
        ],
        "properties": {
          "statements": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantStatementSummaryResponse"
            }
          },
          "next_offset": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "PlatformTenantStatementHandoffResponse": {
        "description": "Provider-neutral receipt for a finalized cross-app statement revision.",
        "type": "object",
        "required": [
          "id",
          "statement_id",
          "external_invoice_id",
          "currency",
          "amount_millicents",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "statement_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_invoice_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "amount_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreatePlatformTenantWebhookRequest": {
        "type": "object",
        "description": "Create a receiver for this tenant's supported customer, operation effect, hostname, certificate, deployment, reconciliation, and finalized billing events.",
        "required": [
          "target_url",
          "webhook_secret"
        ],
        "properties": {
          "target_url": {
            "type": "string",
            "format": "uri",
            "minLength": 8,
            "maxLength": 2048
          },
          "webhook_secret": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "event_filter": {
            "type": "array",
            "description": "Events delivered to this receiver. Defaults to platform_tenant.statement.finalized when omitted.",
            "minItems": 1,
            "maxItems": 8,
            "uniqueItems": true,
            "default": [
              "platform_tenant.statement.finalized"
            ],
            "items": {
              "type": "string",
              "enum": [
                "platform_tenant.statement.finalized",
                "platform_tenant.hostname.verified",
                "platform_tenant.surface.certificate.changed",
                "platform_tenant.surface.deployment.changed",
                "platform_tenant.customer.linked",
                "platform_tenant.customer.offboarded",
                "platform_tenant.reconciliation.applied",
                "operation.effect"
              ]
            }
          },
          "retry_policy": {
            "type": "string",
            "enum": [
              "default",
              "aggressive",
              "none"
            ],
            "default": "default"
          },
          "delivery_format": {
            "type": "string",
            "enum": [
              "json",
              "cloudevents"
            ],
            "default": "json"
          },
          "enabled": {
            "type": "boolean",
            "default": true
          }
        },
        "example": {
          "target_url": "https://billing.example.com/gregale/events",
          "webhook_secret": "store-this-secret-before-submitting"
        }
      },
      "UpdatePlatformTenantWebhookRequest": {
        "type": "object",
        "description": "Update a tenant event receiver. Its event filter is immutable; create a replacement to change subscribed events.",
        "minProperties": 1,
        "properties": {
          "target_url": {
            "type": "string",
            "format": "uri",
            "minLength": 8,
            "maxLength": 2048
          },
          "retry_policy": {
            "type": "string",
            "enum": [
              "default",
              "aggressive",
              "none"
            ]
          },
          "delivery_format": {
            "type": "string",
            "enum": [
              "json",
              "cloudevents"
            ]
          },
          "enabled": {
            "type": "boolean"
          }
        }
      },
      "PlatformTenantWebhookResponse": {
        "type": "object",
        "description": "Tenant-scoped event receiver. The secret is never returned.",
        "required": [
          "id",
          "scope",
          "platform_tenant_id",
          "account_id",
          "target_url",
          "webhook_secret_sealed_masked",
          "event_filter",
          "retry_policy",
          "delivery_format",
          "enabled",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string",
            "enum": [
              "platform_tenant"
            ]
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "target_url": {
            "type": "string",
            "format": "uri"
          },
          "webhook_secret_sealed_masked": {
            "type": "string",
            "enum": [
              "***"
            ]
          },
          "event_filter": {
            "type": "array",
            "minItems": 1,
            "maxItems": 8,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "platform_tenant.statement.finalized",
                "platform_tenant.hostname.verified",
                "platform_tenant.surface.certificate.changed",
                "platform_tenant.surface.deployment.changed",
                "platform_tenant.customer.linked",
                "platform_tenant.customer.offboarded",
                "platform_tenant.reconciliation.applied",
                "operation.effect"
              ]
            }
          },
          "retry_policy": {
            "type": "string",
            "enum": [
              "default",
              "aggressive",
              "none"
            ]
          },
          "delivery_format": {
            "type": "string",
            "enum": [
              "json",
              "cloudevents"
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformTenantWebhookListResponse": {
        "type": "object",
        "description": "Tenant-scoped webhook subscriptions owned by one platform tenant.",
        "required": [
          "webhooks"
        ],
        "properties": {
          "webhooks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantWebhookResponse"
            }
          }
        }
      },
      "CreateAPIConsumerRequest": {
        "description": "Stable customer identity to which consumer credentials can be attached.",
        "type": "object",
        "required": [
          "external_ref",
          "name"
        ],
        "properties": {
          "external_ref": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "example": "customer-42"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "example": "Acme"
          },
          "trial_days": {
            "type": "integer",
            "minimum": 1,
            "maximum": 365,
            "description": "Starts the consumer's one free trial at the next UTC minute for this many days."
          }
        }
      },
      "APIConsumerResponse": {
        "description": "Stable API consumer identity. No credential secret is returned. managed_by_platform_tenant distinguishes tenant-bundle-created identities from pre-existing linked identities.",
        "type": "object",
        "required": [
          "id",
          "app_id",
          "external_ref",
          "name",
          "status",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_ref": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "revoked"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "revoked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "managed_by_platform_tenant": {
            "type": "boolean",
            "description": "True only when a platform-tenant bundle created this consumer; omitted otherwise."
          }
        }
      },
      "APIConsumerListResponse": {
        "description": "Stable API consumer identities for an app.",
        "type": "object",
        "required": [
          "consumers"
        ],
        "properties": {
          "consumers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/APIConsumerResponse"
            }
          }
        }
      },
      "CreateConsumerKeyRequest": {
        "description": "Consumer credential request. The generated plaintext is returned only once.",
        "type": "object",
        "required": [
          "name",
          "scopes"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "example": "primary"
          },
          "scopes": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "enum": [
                "read",
                "write",
                "admin",
                "billing"
              ]
            },
            "description": "read allows GET, write and admin allow every method; billing lets the consumer read its own billing and grants no app access."
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "ConsumerKeyResponse": {
        "description": "Consumer credential projection. key is present only on the create response.",
        "type": "object",
        "required": [
          "id",
          "name",
          "prefix",
          "scopes",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "prefix": {
            "type": "string",
            "description": "Public lookup prefix; not secret."
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "read",
                "write",
                "admin",
                "billing"
              ]
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_used_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "revoked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "key": {
            "type": "string",
            "description": "Plaintext credential, returned exactly once from POST."
          }
        }
      },
      "ConsumerKeyListResponse": {
        "description": "Credential metadata for an API consumer.",
        "type": "object",
        "required": [
          "keys"
        ],
        "properties": {
          "keys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConsumerKeyResponse"
            }
          }
        }
      },
      "APIConsumerUsageBucketResponse": {
        "description": "One UTC minute of durable API consumer usage.",
        "type": "object",
        "required": [
          "window_start",
          "request_count",
          "error_count",
          "billable_units"
        ],
        "properties": {
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "request_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "billable_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "APIConsumerUsageResponse": {
        "description": "Durable minute usage for one stable API consumer.",
        "type": "object",
        "required": [
          "consumer_id",
          "period_start",
          "period_end",
          "request_count",
          "error_count",
          "billable_units",
          "buckets",
          "as_of"
        ],
        "properties": {
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "period_end": {
            "type": "string",
            "format": "date-time"
          },
          "request_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "billable_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "buckets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/APIConsumerUsageBucketResponse"
            }
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreateAPIConsumerRateCardRequest": {
        "description": "Immutable app-level request price. Currency defaults to EUR and effective_from defaults to the next UTC minute.",
        "type": "object",
        "required": [
          "price_millicents_per_unit"
        ],
        "properties": {
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$",
            "default": "EUR",
            "example": "EUR"
          },
          "price_millicents_per_unit": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "example": 1000
          },
          "included_units_per_month": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "default": 0,
            "example": 10000,
            "description": "Free request units per consumer per UTC calendar month while this card is effective, consumed in minute order. Once any card includes units, effective_from cannot be in the past."
          },
          "tiers": {
            "type": "array",
            "minItems": 2,
            "maxItems": 10,
            "description": "Optional graduated ladder that replaces price_millicents_per_unit and included_units_per_month. Each consumer's units are counted per UTC calendar month in minute order and priced by the step their position falls in. Bounds increase strictly, only the last step is unbounded, and only the first step may be free. Statements of periods priced by a tiered card must cover exactly one UTC calendar month.",
            "items": {
              "$ref": "#/components/schemas/APIConsumerRateCardTier"
            }
          },
          "route_weights": {
            "type": "object",
            "maxProperties": 50,
            "description": "Counts each request on a listed \"METHOD /template\" route as that many units (1..1000, at most 50 routes); unlisted routes count 1. Weighted units feed included units, tiers, and statements. Route labels match the app's declared or discovered route templates.",
            "additionalProperties": {
              "type": "integer",
              "format": "int64",
              "minimum": 1,
              "maximum": 1000
            }
          },
          "plan_id": {
            "type": "string",
            "format": "uuid",
            "description": "Adds the version to a consumer plan's price history; omitted prices the app default plan. Plan cards cannot be backdated."
          },
          "unit": {
            "type": "string",
            "pattern": "^(request|compute_second|response_megabyte|app:[a-z][a-z0-9_]{0,31})$",
            "default": "request",
            "description": "What the card prices: requests; compute_second or response_megabyte, rounded per consumer minute; or app:<meter>, the units the app reports in its Gregale-Usage header. Cards of different units price side by side; non-request cards take no route weights and cannot be backdated."
          },
          "base_fee_millicents_per_month": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Fixed charge per consumer per UTC month while this card is in force when the consumer's month starts."
          },
          "minimum_millicents_per_month": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Minimum usage charge per consumer per UTC month; statements top up the difference."
          },
          "prorate_monthly_fees": {
            "type": "boolean",
            "default": false,
            "description": "Scale the base fee and minimum in a consumer's first month to the share of it left after the consumer was created."
          },
          "tier_mode": {
            "type": "string",
            "enum": [
              "graduated",
              "volume"
            ],
            "default": "graduated",
            "description": "How tiers price a consumer's month: graduated prices each unit at the step its position falls in; volume prices every unit of the month at the step the month's total reaches. volume needs tiers."
          },
          "effective_from": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "UTC minute at which this version starts; omitted means the next UTC minute."
          }
        }
      },
      "CreateAPIConsumerPlanRequest": {
        "description": "Named consumer plan. Zero limits are unlimited.",
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$",
            "example": "pro"
          },
          "max_requests_per_minute": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Admitted requests per consumer per minute; over the limit the gateway returns 429."
          },
          "max_units_per_month": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Weighted units per consumer per UTC month; over the cap the gateway returns 429 until the month ends."
          },
          "alert_thresholds_percent": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "type": "integer",
              "format": "int32",
              "minimum": 1,
              "maximum": 100
            },
            "description": "Percentages of max_units_per_month at which a consumer.usage_threshold webhook fires, once per consumer per UTC month. Requires max_units_per_month."
          }
        }
      },
      "UpdateAPIConsumerPlanLimitsRequest": {
        "description": "Replacement limits for a consumer plan. Omitting alert_thresholds_percent keeps the plan's thresholds; an empty list clears them.",
        "type": "object",
        "required": [
          "max_requests_per_minute",
          "max_units_per_month"
        ],
        "properties": {
          "max_requests_per_minute": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "max_units_per_month": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "alert_thresholds_percent": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "type": "integer",
              "format": "int32",
              "minimum": 1,
              "maximum": 100
            },
            "description": "Replacement alert thresholds, as percentages of max_units_per_month (at most 5). Omit to keep the current thresholds; send an empty list to remove them."
          }
        }
      },
      "APIConsumerPlanResponse": {
        "description": "Named consumer plan with enforcement limits.",
        "type": "object",
        "required": [
          "id",
          "app_id",
          "name",
          "max_requests_per_minute",
          "max_units_per_month",
          "alert_thresholds_percent",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "max_requests_per_minute": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "max_units_per_month": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "alert_thresholds_percent": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32",
              "minimum": 1,
              "maximum": 100
            },
            "description": "The plan's usage alert thresholds, ascending; empty means no alerts."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "APIConsumerPlanListResponse": {
        "description": "An app's consumer plans by name.",
        "type": "object",
        "required": [
          "plans"
        ],
        "properties": {
          "plans": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/APIConsumerPlanResponse"
            }
          }
        }
      },
      "AssignAPIConsumerPlanRequest": {
        "description": "Plan assignment; an empty plan_id returns the consumer to the default plan.",
        "type": "object",
        "properties": {
          "plan_id": {
            "type": "string",
            "format": "uuid"
          },
          "effective_from": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "UTC minute the plan takes effect; omitted means the next minute."
          }
        }
      },
      "APIConsumerPlanAssignmentResponse": {
        "description": "One append-only plan assignment; no plan_id is the default plan.",
        "type": "object",
        "required": [
          "id",
          "consumer_id",
          "effective_from",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "plan_id": {
            "type": "string",
            "format": "uuid"
          },
          "effective_from": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "APIConsumerPlanAssignmentListResponse": {
        "description": "A consumer's plan assignments, oldest first.",
        "type": "object",
        "required": [
          "assignments"
        ],
        "properties": {
          "assignments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/APIConsumerPlanAssignmentResponse"
            }
          }
        }
      },
      "APIConsumerRateCardTier": {
        "description": "One step of a graduated per-request price ladder.",
        "type": "object",
        "required": [
          "up_to",
          "price_millicents_per_unit"
        ],
        "properties": {
          "up_to": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 1,
            "description": "Exclusive upper bound of this step's monthly position; null for the unbounded last step."
          },
          "price_millicents_per_unit": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "APIConsumerRateCardResponse": {
        "description": "Immutable, versioned app-level price for one API request unit.",
        "type": "object",
        "required": [
          "id",
          "app_id",
          "currency",
          "unit",
          "price_millicents_per_unit",
          "included_units_per_month",
          "effective_from",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "unit": {
            "type": "string",
            "pattern": "^(request|compute_second|response_megabyte|app:[a-z][a-z0-9_]{0,31})$",
            "description": "What the card prices: billable requests, their compute seconds or response megabytes, or the units of an app meter."
          },
          "base_fee_millicents_per_month": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "The card's fixed monthly charge per consumer."
          },
          "minimum_millicents_per_month": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "The card's minimum monthly usage charge per consumer."
          },
          "prorate_monthly_fees": {
            "type": "boolean",
            "description": "Whether a consumer's first-month fees are prorated."
          },
          "price_millicents_per_unit": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "included_units_per_month": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "tiers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/APIConsumerRateCardTier"
            }
          },
          "tier_mode": {
            "type": "string",
            "enum": [
              "graduated",
              "volume"
            ],
            "description": "How the ladder prices a consumer's month."
          },
          "route_weights": {
            "type": "object",
            "description": "Units charged per request on a listed route; unlisted routes count 1.",
            "additionalProperties": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            }
          },
          "plan_id": {
            "type": "string",
            "format": "uuid"
          },
          "effective_from": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "APIConsumerRateCardListResponse": {
        "description": "Chronological history of immutable API consumer rate cards for an app.",
        "type": "object",
        "required": [
          "rate_cards"
        ],
        "properties": {
          "rate_cards": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/APIConsumerRateCardResponse"
            }
          }
        }
      },
      "APIConsumerUsageQuoteBucketResponse": {
        "description": "One durable usage minute priced by the rate card effective at that minute.",
        "type": "object",
        "required": [
          "window_start",
          "billable_units",
          "charged_units",
          "amount_millicents"
        ],
        "properties": {
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "billable_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "rate_card_id": {
            "type": "string",
            "format": "uuid"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "price_millicents_per_unit": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "charged_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Units billed at the price; the rest are covered by the rate card's monthly allowance."
          },
          "tier_units": {
            "type": "array",
            "description": "Units per step of a tiered rate card's ladder.",
            "items": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          "amount_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "trial": {
            "type": "boolean",
            "description": "A minute of the consumer's free trial, quoted at zero."
          },
          "unit": {
            "type": "string",
            "description": "The quoted minute's price stream when it is not request."
          }
        }
      },
      "APIConsumerUsageQuoteResponse": {
        "description": "Deterministic estimate from durable API consumer usage and versioned app pricing; not an invoice.",
        "type": "object",
        "required": [
          "consumer_id",
          "period_start",
          "period_end",
          "billable_units",
          "unpriced_units",
          "amount_millicents",
          "priced",
          "buckets",
          "as_of"
        ],
        "properties": {
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "period_end": {
            "type": "string",
            "format": "date-time"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "billable_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unpriced_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "amount_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "priced": {
            "type": "boolean"
          },
          "buckets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/APIConsumerUsageQuoteBucketResponse"
            }
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "APIConsumerUsageCompletenessResponse": {
        "description": "Comparison of an API consumer's billing ledger with request telemetry over successful requests.",
        "type": "object",
        "required": [
          "consumer_id",
          "status",
          "checked_from",
          "checked_until",
          "ledger_requests",
          "telemetry_requests",
          "confirmed_requests",
          "missing_requests",
          "hours_checked",
          "hours_without_telemetry"
        ],
        "properties": {
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "verified",
              "partial",
              "gaps_detected",
              "unverifiable"
            ],
            "description": "gaps_detected means telemetry saw successful requests the ledger never billed; partial means telemetry confirms only part of the billed requests; unverifiable means telemetry holds no evidence for them."
          },
          "checked_from": {
            "type": "string",
            "format": "date-time",
            "description": "First whole UTC hour checked, clamped to request telemetry retention."
          },
          "checked_until": {
            "type": "string",
            "format": "date-time",
            "description": "Exclusive end of the checked hours, clamped to hours that have settled."
          },
          "ledger_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Successful requests in the billing ledger."
          },
          "telemetry_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Successful requests in request telemetry."
          },
          "confirmed_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Billed successful requests telemetry corroborates."
          },
          "missing_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Lower bound of successful requests telemetry saw that the ledger lacks."
          },
          "hours_checked": {
            "type": "integer",
            "minimum": 0
          },
          "hours_without_telemetry": {
            "type": "integer",
            "minimum": 0,
            "description": "Hours with billed requests but no telemetry."
          }
        }
      },
      "CreateAPIConsumerUsageStatementRequest": {
        "description": "Explicit UTC-minute period to snapshot as an immutable usage statement.",
        "type": "object",
        "required": [
          "period_start",
          "period_end"
        ],
        "properties": {
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "period_end": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "APIConsumerUsageStatementBucketResponse": {
        "description": "One UTC minute captured in a durable usage statement.",
        "type": "object",
        "required": [
          "window_start",
          "billable_units",
          "charged_units",
          "amount_millicents"
        ],
        "properties": {
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "billable_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "rate_card_id": {
            "type": "string",
            "format": "uuid"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "price_millicents_per_unit": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "charged_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Units this revision bills at the price; the rest are covered by the monthly allowance. An adjustment may charge units it does not add when late usage exhausted the allowance sooner."
          },
          "tier_units": {
            "type": "array",
            "description": "Units per step of a tiered rate card's ladder. In an adjustment revision, entries are differences and can be negative when late usage moved billed units into a cheaper step.",
            "items": {
              "type": "integer",
              "format": "int64"
            }
          },
          "amount_millicents": {
            "type": "integer",
            "format": "int64",
            "description": "Exact charge for this minute. Negative only on a tiered adjustment line that re-rates billed units into a cheaper step; a revision's total is never negative."
          },
          "trial": {
            "type": "boolean",
            "description": "A minute of the consumer's free trial, billed at zero."
          },
          "unit": {
            "type": "string",
            "description": "The billed minute's price stream when it is not request: compute_second, response_megabyte or app:<meter>."
          }
        }
      },
      "APIConsumerStatementFeeResponse": {
        "description": "A statement's monthly base fee or minimum-spend top-up.",
        "type": "object",
        "required": [
          "kind",
          "rate_card_id",
          "amount_millicents"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "base_fee",
              "minimum"
            ]
          },
          "rate_card_id": {
            "type": "string",
            "format": "uuid"
          },
          "amount_millicents": {
            "type": "integer",
            "format": "int64",
            "description": "Negative only for a minimum top-up an adjustment reduces because late usage covers it."
          }
        }
      },
      "APIConsumerUsageStatementResponse": {
        "description": "Immutable, auditable API consumer usage snapshot. One period can hold several revisions: a changed draft is superseded by the next revision, and every revision after a finalized one carries only usage that arrived later.",
        "type": "object",
        "required": [
          "id",
          "consumer_id",
          "period_start",
          "period_end",
          "revision",
          "status",
          "billable_units",
          "unpriced_units",
          "amount_millicents",
          "priced",
          "buckets",
          "as_of",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "period_end": {
            "type": "string",
            "format": "date-time"
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "finalized",
              "superseded"
            ]
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "billable_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unpriced_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "amount_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "priced": {
            "type": "boolean"
          },
          "buckets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/APIConsumerUsageStatementBucketResponse"
            }
          },
          "fees": {
            "type": "array",
            "description": "The month's base fees and minimum top-ups; amount_millicents includes them.",
            "items": {
              "$ref": "#/components/schemas/APIConsumerStatementFeeResponse"
            }
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "finalized_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "credit_applied_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Prepaid credit drawn when this usage statement was finalized."
          },
          "amount_due_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "amount_millicents less credit_applied_millicents: what is left to bill."
          }
        }
      },
      "CreateAPIConsumerCreditRequest": {
        "description": "Prepaid credit for one consumer.",
        "type": "object",
        "required": [
          "currency",
          "amount_millicents"
        ],
        "properties": {
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "amount_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 1000000000000,
            "description": "Credit in millicents; 100000 is 1.00."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "When unused credit lapses; omitted, it never does."
          },
          "note": {
            "type": "string",
            "maxLength": 200
          }
        }
      },
      "APIConsumerCreditResponse": {
        "description": "One prepaid credit grant.",
        "type": "object",
        "required": [
          "id",
          "consumer_id",
          "currency",
          "amount_millicents",
          "remaining_millicents",
          "status",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "amount_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "remaining_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "used",
              "expired",
              "voided"
            ]
          },
          "note": {
            "type": "string"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "voided_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "APIConsumerCreditBalance": {
        "description": "Credit a consumer can still use in one currency.",
        "type": "object",
        "required": [
          "currency",
          "available_millicents"
        ],
        "properties": {
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "available_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "APIConsumerCreditListResponse": {
        "description": "A consumer's credit grants, newest first, with balances per currency.",
        "type": "object",
        "required": [
          "credits",
          "balances"
        ],
        "properties": {
          "credits": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/APIConsumerCreditResponse"
            }
          },
          "balances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/APIConsumerCreditBalance"
            }
          }
        }
      },
      "PutAPIConsumerTrialRequest": {
        "description": "A consumer's trial length in days from its start, or its end. Set exactly one.",
        "type": "object",
        "properties": {
          "days": {
            "type": "integer",
            "minimum": 1,
            "maximum": 365
          },
          "ends_at": {
            "type": "string",
            "format": "date-time",
            "description": "A UTC minute from the next minute on."
          }
        }
      },
      "APIConsumerTrialResponse": {
        "description": "A consumer's free trial: usage in [starts_at, ends_at) is priced at zero.",
        "type": "object",
        "required": [
          "consumer_id",
          "starts_at",
          "ends_at",
          "active"
        ],
        "properties": {
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "starts_at": {
            "type": "string",
            "format": "date-time"
          },
          "ends_at": {
            "type": "string",
            "format": "date-time"
          },
          "active": {
            "type": "boolean",
            "description": "False once the trial has ended."
          }
        }
      },
      "PutAPIConsumerBillingPolicyRequest": {
        "description": "An app's overdue-invoice rule.",
        "type": "object",
        "required": [
          "block_overdue_after_days"
        ],
        "properties": {
          "block_overdue_after_days": {
            "type": "integer",
            "minimum": 0,
            "maximum": 365,
            "description": "Days past an invoice's due date before its consumer is refused; 0 refuses at once."
          }
        }
      },
      "APIConsumerBillingPolicyResponse": {
        "description": "An app's stored overdue-invoice rule.",
        "type": "object",
        "required": [
          "app_id",
          "block_overdue_after_days",
          "updated_at"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "block_overdue_after_days": {
            "type": "integer",
            "minimum": 0,
            "maximum": 365
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformTenantTrialResponse": {
        "description": "A platform tenant's free trial: its usage in [starts_at, ends_at) is priced at zero.",
        "type": "object",
        "required": [
          "tenant_id",
          "starts_at",
          "ends_at",
          "active"
        ],
        "properties": {
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "starts_at": {
            "type": "string",
            "format": "date-time"
          },
          "ends_at": {
            "type": "string",
            "format": "date-time"
          },
          "active": {
            "type": "boolean",
            "description": "False once the tenant's trial has ended."
          }
        }
      },
      "PlatformTenantBillingPolicyResponse": {
        "description": "The account's stored overdue-invoice rule for platform tenants.",
        "type": "object",
        "required": [
          "block_overdue_after_days",
          "updated_at"
        ],
        "properties": {
          "block_overdue_after_days": {
            "type": "integer",
            "minimum": 0,
            "maximum": 365
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformTenantOverdueHoldResponse": {
        "description": "A platform tenant the gateway refuses because of an overdue invoice.",
        "type": "object",
        "required": [
          "tenant_id",
          "export_id",
          "due_at",
          "since"
        ],
        "properties": {
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "export_id": {
            "type": "string",
            "format": "uuid",
            "description": "The oldest overdue invoice export holding the tenant."
          },
          "due_at": {
            "type": "string",
            "format": "date-time"
          },
          "since": {
            "type": "string",
            "format": "date-time",
            "description": "When the hold was placed."
          }
        }
      },
      "PlatformTenantOverdueHoldListResponse": {
        "description": "Platform tenants on hold for overdue invoices, oldest due date first.",
        "type": "object",
        "required": [
          "holds"
        ],
        "properties": {
          "holds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantOverdueHoldResponse"
            }
          }
        }
      },
      "APIConsumerOverdueHoldResponse": {
        "description": "A consumer the gateway refuses because of its oldest overdue invoice.",
        "type": "object",
        "required": [
          "consumer_id",
          "export_id",
          "due_at",
          "since"
        ],
        "properties": {
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "export_id": {
            "type": "string",
            "format": "uuid"
          },
          "due_at": {
            "type": "string",
            "format": "date-time"
          },
          "since": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "APIConsumerOverdueHoldListResponse": {
        "description": "An app's consumers held for overdue invoices.",
        "type": "object",
        "required": [
          "holds"
        ],
        "properties": {
          "holds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/APIConsumerOverdueHoldResponse"
            }
          }
        }
      },
      "PutAPIConsumerSpendCapRequest": {
        "description": "A consumer's monthly spend cap after prepaid credit.",
        "type": "object",
        "required": [
          "currency",
          "monthly_cap_millicents"
        ],
        "properties": {
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "monthly_cap_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000000000000,
            "description": "0 allows prepaid usage only."
          }
        }
      },
      "APIConsumerSpendCapResponse": {
        "description": "A consumer's spend cap and its last check.",
        "type": "object",
        "required": [
          "consumer_id",
          "currency",
          "monthly_cap_millicents",
          "capped",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "monthly_cap_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "capped": {
            "type": "boolean",
            "description": "True while the gateway refuses the consumer this month."
          },
          "month": {
            "type": "string",
            "pattern": "^[0-9]{4}-[0-9]{2}$",
            "description": "UTC month of the last check."
          },
          "amount_due_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "The month's amount due after prepaid credit at the last check."
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformTenantCreditResponse": {
        "description": "One prepaid credit grant to a platform tenant.",
        "type": "object",
        "required": [
          "id",
          "tenant_id",
          "currency",
          "amount_millicents",
          "remaining_millicents",
          "status",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "amount_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "remaining_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "used",
              "expired",
              "voided"
            ]
          },
          "note": {
            "type": "string"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "voided_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformTenantCreditListResponse": {
        "description": "A tenant's credit grants, newest first, with balances per currency.",
        "type": "object",
        "required": [
          "credits",
          "balances"
        ],
        "properties": {
          "credits": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantCreditResponse"
            }
          },
          "balances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/APIConsumerCreditBalance"
            }
          }
        }
      },
      "PlatformTenantSpendCapResponse": {
        "description": "A tenant's spend cap and its last check.",
        "type": "object",
        "required": [
          "tenant_id",
          "currency",
          "monthly_cap_millicents",
          "capped",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "monthly_cap_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "capped": {
            "type": "boolean",
            "description": "True while the gateway refuses the tenant this month."
          },
          "month": {
            "type": "string",
            "pattern": "^[0-9]{4}-[0-9]{2}$",
            "description": "UTC month of the tenant's last check."
          },
          "amount_due_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "The month's usage after prepaid credit at the last check; monthly fees are not counted."
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "APIConsumerUsageStatementListResponse": {
        "description": "Durable API consumer usage statements, newest period first.",
        "type": "object",
        "required": [
          "statements"
        ],
        "properties": {
          "statements": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/APIConsumerUsageStatementResponse"
            }
          }
        }
      },
      "ClaimAPIConsumerUsageStatementRequest": {
        "description": "Customer billing system's external invoice reference for a finalized statement.",
        "type": "object",
        "required": [
          "external_invoice_id"
        ],
        "properties": {
          "external_invoice_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          }
        }
      },
      "APIConsumerUsageStatementHandoffResponse": {
        "description": "Immutable receipt linking a finalized usage statement to a customer-owned external invoice.",
        "type": "object",
        "required": [
          "id",
          "statement_id",
          "external_invoice_id",
          "amount_millicents",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "statement_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_invoice_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "amount_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AppRestartResponse": {
        "description": "Correlation handle for an accepted app restart.",
        "type": "object",
        "required": [
          "wake_id"
        ],
        "properties": {
          "wake_id": {
            "type": "string",
            "format": "uuid",
            "description": "Wake id stamped on the replacement instance and wake timeline."
          }
        }
      },
      "RuntimeConfigRestartStatusResponse": {
        "description": "Durable status for an accepted fresh runtime-configuration restart.",
        "type": "object",
        "required": [
          "wake_id",
          "status",
          "attempts",
          "requested_at"
        ],
        "properties": {
          "wake_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "retrying",
              "completed",
              "failed"
            ]
          },
          "attempts": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of scheduler handling attempts so far."
          },
          "failure_reason": {
            "type": "string",
            "enum": [
              "telemetry_missing",
              "requests_active",
              "quiet_period_not_elapsed",
              "restart_attempt_failed"
            ],
            "description": "Stable safe reason from the most recent unsuccessful attempt, when available."
          },
          "requested_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AppWakeResponse": {
        "description": "Correlation handle for an accepted explicit app wake.",
        "type": "object",
        "required": [
          "wake_id"
        ],
        "properties": {
          "wake_id": {
            "type": "string",
            "format": "uuid",
            "description": "Wake id on the admitted instance and wake timeline (the running instance's when already_running)."
          },
          "already_running": {
            "type": "boolean",
            "description": "True when the app already had a routable running instance and no wake was queued."
          },
          "instance_id": {
            "type": "string",
            "format": "uuid",
            "description": "The instance the wake resolves to: the running instance when already_running is true, or the frozen instance a queued wake resumes under its own wake_id."
          }
        }
      },
      "PreAuthRateLimitConfig": {
        "description": "Optional per-source gateway limit evaluated before consumer-key lookup, JWT verification, and VM wake. App-wide and failed-response budgets are replica-local; exact routes can opt into shared request budgets. Observe mode records threshold crossings without rejecting requests.",
        "type": "object",
        "required": [
          "mode"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "off",
              "observe",
              "enforce"
            ]
          },
          "requests_per_second": {
            "type": "integer",
            "minimum": 1,
            "maximum": 500,
            "description": "Required in observe/enforce mode and bounded by the app plan's request rate."
          },
          "burst": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2000,
            "description": "Required in observe/enforce mode and bounded by the app plan's request burst."
          },
          "routes": {
            "type": "array",
            "maxItems": 16,
            "description": "Optional exact public method/path limits, evaluated in addition to the app-wide source limit. Each route rate and burst must be no greater than the app-wide values.",
            "items": {
              "$ref": "#/components/schemas/PreAuthRouteLimit"
            }
          }
        }
      },
      "PreAuthRouteLimit": {
        "description": "Optional stricter per-source limit for one public method and path, with optional shared request coordination and a response-based failure budget.",
        "type": "object",
        "required": [
          "method",
          "path",
          "requests_per_second",
          "burst"
        ],
        "properties": {
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "HEAD",
              "POST",
              "PUT",
              "PATCH",
              "DELETE",
              "OPTIONS"
            ]
          },
          "path": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Canonical absolute public URL path with no query, fragment, or percent encoding. Matching is exact after normalizing the decoded request path.",
            "example": "/login"
          },
          "requests_per_second": {
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          },
          "burst": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2000
          },
          "coordination": {
            "type": "string",
            "enum": [
              "local",
              "central"
            ],
            "default": "local",
            "description": "Optional shared request budget across gateway replicas. Defaults to local. Central mode uses 1,024 opaque source shards per exact route; collisions share allowance. On database errors it falls back to the replica-local bucket. Failed-response coordination is configured separately."
          },
          "failed_responses": {
            "$ref": "#/components/schemas/PreAuthFailedResponseLimit"
          },
          "observe_targets": {
            "type": "boolean",
            "default": false,
            "description": "Observe repeated application login failures for the same app-declared target across source IPs. Requires POST, failed_responses, and central coordination. The application supplies X-Gregale-Abuse-Target as lowercase hex HMAC-SHA256 of the normalized submitted login identifier on selected failed responses; the gateway strips it before sending the response. This signal never rejects requests."
          }
        }
      },
      "PreAuthFailedResponseLimit": {
        "description": "Optional per-source budget spent only by selected proxied application 4xx responses. When statuses is omitted, 401 and 403 are counted. In enforce mode, subsequent requests are rejected before authentication and wake after this budget is exhausted.",
        "type": "object",
        "required": [
          "failures_per_minute",
          "burst"
        ],
        "properties": {
          "failures_per_minute": {
            "type": "integer",
            "minimum": 1,
            "maximum": 30000,
            "description": "Continuous token refill per minute; no greater than the parent route's requests_per_second times 60."
          },
          "burst": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2000,
            "description": "Maximum consecutive failed responses; no greater than the parent route's burst."
          },
          "coordination": {
            "type": "string",
            "enum": [
              "local",
              "central"
            ],
            "default": "local",
            "description": "Optional shared failed-response budget across gateway replicas. Defaults to local. Central mode checks one of 1,024 opaque source shards before compute and records selected application failures afterward. Concurrent failures can incur bounded debt. On database errors the replica-local bucket remains active."
          },
          "statuses": {
            "type": "array",
            "maxItems": 4,
            "uniqueItems": true,
            "description": "Selected application response statuses. Defaults to [401, 403]. Only 4xx codes except 429 are supported.",
            "items": {
              "type": "integer",
              "minimum": 400,
              "maximum": 499
            }
          }
        }
      },
      "PreAuthObservationsResponse": {
        "description": "Observe-mode decisions and final response classes for an app's configured pre-auth policies.",
        "type": "object",
        "required": [
          "app_id",
          "range",
          "source",
          "as_of",
          "policies"
        ],
        "properties": {
          "app_id": {
            "type": "string"
          },
          "range": {
            "type": "string",
            "enum": [
              "5m",
              "15m",
              "1h",
              "6h",
              "24h",
              "7d",
              "15d"
            ]
          },
          "source": {
            "type": "string",
            "description": "prometheus or degraded: <reason>."
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "policies": {
            "type": "array",
            "maxItems": 49,
            "items": {
              "$ref": "#/components/schemas/PreAuthPolicyObservation"
            }
          },
          "suggestion": {
            "$ref": "#/components/schemas/PreAuthEnforcementSuggestion"
          }
        }
      },
      "EdgeProtectionResponse": {
        "description": "Edge rejection counts for one app over a range.",
        "type": "object",
        "required": [
          "app_id",
          "range",
          "source",
          "as_of",
          "pre_auth",
          "validation_failures",
          "rejections",
          "waf",
          "challenge",
          "penalty",
          "attack_mode",
          "ai_crawlers"
        ],
        "properties": {
          "app_id": {
            "type": "string"
          },
          "range": {
            "type": "string",
            "enum": [
              "5m",
              "15m",
              "1h",
              "6h",
              "24h",
              "7d",
              "15d"
            ]
          },
          "source": {
            "type": "string",
            "description": "Where the edge counts come from: prometheus, or degraded: <reason> when they are unavailable (counts are then zero, not measured)."
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "pre_auth": {
            "type": "object",
            "required": [
              "blocked",
              "would_block"
            ],
            "properties": {
              "blocked": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "Requests the pre-auth source limit rejected in enforce mode."
              },
              "would_block": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "Requests observe mode would have rejected."
              }
            }
          },
          "validation_failures": {
            "type": "array",
            "description": "kind=validate mismatches by validate_mode (block, observe, warn); zero counts are omitted.",
            "items": {
              "type": "object",
              "required": [
                "name",
                "count"
              ],
              "properties": {
                "name": {
                  "type": "string"
                },
                "count": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 0
                }
              }
            }
          },
          "rejections": {
            "type": "array",
            "description": "Requests answered by an edge gate, largest count first; zero counts are omitted.",
            "items": {
              "type": "object",
              "required": [
                "gate",
                "status",
                "count"
              ],
              "properties": {
                "gate": {
                  "type": "string",
                  "enum": [
                    "jwt",
                    "ip_allowlist",
                    "internal_only",
                    "ip",
                    "geo",
                    "limit",
                    "body_limit",
                    "throttle",
                    "waf",
                    "challenge",
                    "penalty"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "401",
                    "403",
                    "413",
                    "429",
                    "503",
                    "other"
                  ]
                },
                "count": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 0
                }
              }
            }
          },
          "waf": {
            "type": "object",
            "description": "kind=waf inspections. Sampled detections are never blocked; block rules' 403s also appear in rejections under gate waf.",
            "required": [
              "inspected",
              "detected",
              "not_inspected",
              "warned",
              "blocked",
              "inline_skipped",
              "categories",
              "top_rules"
            ],
            "properties": {
              "inspected": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "Requests scored by the OWASP CRS."
              },
              "detected": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "Inspected requests at or above the rule's anomaly threshold."
              },
              "not_inspected": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "Matched requests skipped to protect the node (budget, full queue, or error)."
              },
              "warned": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "Requests a warn rule detected in-path and tagged with X-WAF-Warning."
              },
              "blocked": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "Requests a block rule detected in-path and answered with 403."
              },
              "inline_skipped": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "Requests that passed a warn or block rule unchecked because the in-path budget was exhausted."
              },
              "categories": {
                "type": "array",
                "description": "Detections by CRS attack category, largest first; one detection may count several.",
                "items": {
                  "type": "object",
                  "required": [
                    "name",
                    "count"
                  ],
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "count": {
                      "type": "integer",
                      "format": "int64",
                      "minimum": 0
                    }
                  }
                }
              },
              "top_rules": {
                "type": "array",
                "maxItems": 10,
                "description": "CRS rule IDs that scored most, largest first, for tuning exclude_rule_ids.",
                "items": {
                  "type": "object",
                  "required": [
                    "name",
                    "count"
                  ],
                  "properties": {
                    "name": {
                      "type": "string",
                      "description": "CRS rule ID."
                    },
                    "count": {
                      "type": "integer",
                      "format": "int64",
                      "minimum": 0
                    }
                  }
                }
              }
            }
          },
          "challenge": {
            "type": "object",
            "description": "kind=challenge decisions; its 403s also appear in rejections under gate challenge.",
            "required": [
              "issued",
              "solved",
              "rejected",
              "passed",
              "bypassed",
              "invalid"
            ],
            "properties": {
              "issued": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "Challenge pages served to browser navigations."
              },
              "solved": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "Passes earned by solving the proof of work."
              },
              "rejected": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "Non-navigation requests answered 403 challenge_required."
              },
              "passed": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "Requests let through on a pass from an earlier solve."
              },
              "bypassed": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "Requests let through on a verified API key, consumer key or JWT."
              },
              "invalid": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "Solutions refused: wrong work or an expired token."
              },
              "raised": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "The part of issued served at a difficulty raised under attack."
              }
            }
          },
          "penalty": {
            "type": "object",
            "description": "Penalty boxes; refusals also appear in rejections under gate penalty.",
            "required": [
              "boxed",
              "rejected"
            ],
            "properties": {
              "boxed": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "Clients a rule's penalty boxed."
              },
              "rejected": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "Requests refused from boxed clients."
              }
            }
          },
          "attack_mode": {
            "$ref": "#/components/schemas/EdgeAttackModeStatus"
          },
          "ai_crawlers": {
            "type": "array",
            "description": "Requests whose User-Agent names an AI crawler, largest first, counted before any edge rule acted on them.",
            "items": {
              "$ref": "#/components/schemas/EdgeProtectionAICrawler"
            }
          }
        }
      },
      "EdgeAttackModeStatus": {
        "type": "object",
        "description": "An app's attack mode. While it is on, every\nrequest without a challenge pass is challenged: browsers solve a\nshort proof of work once and continue, verified search crawlers and\nrequests with a verified API key, consumer key or JWT pass straight\nthrough, and other clients get 403 `challenge_required`. It always\nends on its own at `expires_at`. Read from the rules, so it is\ncurrent even when the edge-protection counts are degraded.\n",
        "required": [
          "active"
        ],
        "properties": {
          "active": {
            "type": "boolean",
            "description": "Attack mode is on now."
          },
          "rule_id": {
            "type": "string",
            "description": "The app-wide challenge rule that carries attack mode (managed_by attack_mode). Still set after attack mode ran out, until it is switched on again or off."
          },
          "started_at": {
            "type": "string",
            "format": "date-time",
            "description": "When attack mode was switched on; extending it keeps this time."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "When attack mode ends",
            "or ended.": null
          },
          "difficulty": {
            "type": "integer",
            "description": "Leading zero bits the browser's proof of work must find."
          },
          "pass_ttl_seconds": {
            "type": "integer",
            "description": "Seconds a browser that solved the attack-mode challenge is let through."
          }
        }
      },
      "EnableEdgeAttackModeRequest": {
        "type": "object",
        "description": "Switches attack mode on for a duration, or moves the end of an active one.",
        "additionalProperties": false,
        "properties": {
          "duration_seconds": {
            "type": "integer",
            "minimum": 900,
            "maximum": 86400,
            "default": 3600,
            "description": "How long attack mode stays on from now. Switching it on while it is on restarts the clock with this duration."
          }
        }
      },
      "EdgeProtectionAICrawler": {
        "type": "object",
        "description": "One AI crawler's requests over the summary's range.",
        "required": [
          "name",
          "operator",
          "purpose",
          "count"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "Crawler name as the ai_crawler match field uses it, e.g. gptbot."
          },
          "operator": {
            "type": "string",
            "description": "Company that runs the crawler."
          },
          "purpose": {
            "type": "string",
            "enum": [
              "training",
              "search",
              "assistant"
            ],
            "description": "What its fetches are for: training models, AI search, or an assistant answering a user."
          },
          "count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "EdgeRulePenalty": {
        "type": "object",
        "description": "A rule's penalty box. Once the rule has refused\nthe same client `after` times within `within_seconds`, every request\nfrom that client to the app is refused with 403 `penalty_box` and\nRetry-After for `seconds`, whichever rule or path it targets. The\nclient is its IP address (an IPv6 client is its /64). Boxes are held\nin each gateway node's memory. Allowed on ip, geo, throttle and waf\n(block mode) rules; editing the rule's penalty away, disabling it or\nputting it in log mode releases its clients.\n",
        "required": [
          "seconds"
        ],
        "properties": {
          "seconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 86400,
            "description": "How long a boxed client is refused."
          },
          "after": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000,
            "default": 1,
            "description": "Refusals by this rule that box the client."
          },
          "within_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3600,
            "default": 60,
            "description": "Window the refusals count in."
          }
        }
      },
      "PreAuthEnforcementSuggestion": {
        "description": "Advice on switching an observe-mode guard to enforce, judged on the\nresponse range. Present only for observe mode\nwith a healthy metrics source; nothing is applied automatically.\n`ready` needs a range of 24h or longer, at least 1000 requests, and no\nsuccessful (2xx/3xx) request among those the guard would have blocked.\n",
        "type": "object",
        "required": [
          "status",
          "reason",
          "requests",
          "would_block",
          "would_block_succeeded"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ready",
              "review",
              "insufficient_data"
            ]
          },
          "reason": {
            "type": "string"
          },
          "requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Every gateway request to the app in the range."
          },
          "would_block": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Sum over the app and route policies."
          },
          "would_block_succeeded": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Would-block requests whose final response was 2xx or 3xx."
          }
        }
      },
      "PreAuthPolicyObservation": {
        "description": "Counts for one bounded app, route, failed-response, or target-observation policy slot.",
        "type": "object",
        "required": [
          "policy_id",
          "kind",
          "would_block",
          "result_2xx",
          "result_3xx",
          "result_4xx",
          "result_5xx",
          "result_unknown"
        ],
        "properties": {
          "policy_id": {
            "type": "string",
            "description": "Bounded app, route_<index>, failures_<index>, or targets_<index> policy identifier. Index is the route's current array position."
          },
          "kind": {
            "type": "string",
            "enum": [
              "app",
              "route",
              "failures",
              "targets"
            ]
          },
          "method": {
            "type": "string",
            "description": "Configured public method; omitted for the app policy."
          },
          "path": {
            "type": "string",
            "description": "Configured public path; omitted for the app policy."
          },
          "would_block": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "result_2xx": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "result_3xx": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "result_4xx": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "result_5xx": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "result_unknown": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "target_failures": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Selected app failures carrying a valid target identifier."
          },
          "target_threshold": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Failures for which both bounded target shards exceeded the configured failed-response budget. Approximate signal; never blocks."
          },
          "target_missing": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Selected app failures without a target header."
          },
          "target_invalid": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Selected app failures with an invalid target header."
          },
          "target_fallback": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Valid target failures observed with process-local fallback because central coordination was unavailable."
          }
        }
      },
      "CreateAppRequest": {
        "description": "App creation payload: slug, type (app|function), runtime (required for function; must be omitted for app), RAM MB, max concurrency, idle timeout, and optional manifest.",
        "type": "object",
        "required": [
          "slug"
        ],
        "properties": {
          "project_id": {
            "type": "string",
            "format": "uuid",
            "description": "Existing project in the selected workspace. Projects managed by a repository or an active release set require their project release workflow."
          },
          "profiling": {
            "$ref": "#/components/schemas/ProfilingConfig"
          },
          "tracing": {
            "$ref": "#/components/schemas/TracingConfig"
          },
          "slug": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{1,38})[a-z0-9]$",
            "not": {
              "pattern": "^tag-"
            },
            "minLength": 3,
            "maxLength": 40,
            "example": "hello-world",
            "description": "The tag- prefix is reserved for stable deployment-alias hostnames."
          },
          "type": {
            "type": "string",
            "enum": [
              "app",
              "function"
            ],
            "example": "app"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "internal"
            ],
            "default": "public",
            "description": "Ingress exposure for the new app. Choose internal to make it service-only; available on every plan."
          },
          "allowed_service_callers": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "string"
            },
            "description": "Standalone target-side service allowlist. Omit for same-account access; [] denies all. Names are normalized to lowercase, sorted, and deduplicated."
          },
          "allowed_service_call_scopes": {
            "$ref": "#/components/schemas/ServiceCallerScopes",
            "description": "Optional target-side per-caller method/path grants. When present, callers absent from this map are denied; if allowed_service_callers is also set, both policies must allow the caller."
          },
          "service_binding_targets": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "string"
            },
            "description": "Standalone outbound target app slugs. Names are normalized, sorted, and deduplicated; the platform derives read-only binding keys and internal URLs, including the HTTPS canary companion and optional HTTPS-first canonical URL. Targets may be declared before they exist. Omit or [] for no bindings."
          },
          "service_reliability": {
            "$ref": "#/components/schemas/ServiceReliabilityPolicies",
            "description": "Optional timeout and retry overrides for service_binding_targets."
          },
          "service_binding_policy": {
            "type": "string",
            "enum": [
              "account",
              "declared"
            ],
            "description": "Standalone caller authorization. Omit for legacy same-account reachability; declared permits only service_binding_targets."
          },
          "service_binding_transport": {
            "$ref": "#/components/schemas/ServiceBindingTransport",
            "description": "Standalone canonical URL scheme. Omit to preserve the legacy HTTP contract; choose https to make GREGALE_SERVICE_<NAME>_URL use https://<service>.internal."
          },
          "runtime": {
            "type": "string",
            "enum": [
              "node22",
              "python312",
              "go124",
              "go124-alpine",
              "node24",
              "python313",
              "binary"
            ]
          },
          "ram_mb": {
            "type": "integer",
            "example": 256
          },
          "vcpu": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4,
            "description": "Optional guest vCPU assertion. When supplied with ram_mb, the pair must match the plan shape: Free (128 MB/2), Hobby (256 MB/2), Pro (512 MB/2), or Scale (1024 MB/4). Omit to use the plan default."
          },
          "cpu_millicores": {
            "type": "integer",
            "enum": [
              250,
              500,
              1000
            ],
            "default": 1000,
            "description": "Sustained CPU allowance per instance. Omit for 1000 millicores."
          },
          "resource_profile": {
            "$ref": "#/components/schemas/ResourceProfile",
            "description": "Named memory/CPU profile. When set, ram_mb and cpu_millicores are filled from the profile; explicit values must agree with it."
          },
          "max_concurrency": {
            "type": "integer"
          },
          "idle_timeout_s": {
            "type": "integer"
          },
          "request_timeout_s": {
            "type": "integer",
            "minimum": 0,
            "maximum": 30,
            "description": "Per-app request wall-clock timeout in seconds. 0 inherits the plan/type default; the current platform ceiling is 30 seconds."
          },
          "function_concurrency": {
            "type": "integer",
            "minimum": 0,
            "maximum": 80,
            "description": "Requests one Node or Python function worker may serve at once. Omitted, 0 or 1 keeps one request per worker; the plan's concurrency_per_vm bound caps it. Python runs sync handlers on threads."
          },
          "execution_mode": {
            "type": "string",
            "enum": [
              "request",
              "service",
              "worker",
              "job"
            ],
            "description": "Lifecycle contract for the app. Default is request; service/worker/job are plan-gated.",
            "example": "service"
          },
          "restart_policy": {
            "type": "string",
            "enum": [
              "no",
              "on-failure",
              "always",
              "unless-stopped"
            ],
            "description": "Restart behavior for the workload. Omitted uses the execution-mode default.",
            "example": "always"
          },
          "after_restore": {
            "$ref": "#/components/schemas/AfterRestoreHook"
          },
          "before_checkpoint": {
            "$ref": "#/components/schemas/BeforeCheckpointHook"
          },
          "pause": {
            "type": "string",
            "enum": [
              "between_requests",
              "when_idle",
              "never"
            ],
            "description": "When the platform may pause the app's VM: between_requests pauses it between requests and freezes it at the idle timeout, when_idle freezes it at the idle timeout, never parks it as before. Omitted uses the default: between_requests for functions, when_idle for request-mode apps. Worker, service and job execution modes accept only never.",
            "example": "when_idle"
          },
          "startup_deadline_s": {
            "type": "integer",
            "minimum": 0,
            "description": "Upper bound on time-to-ready in seconds. 0 uses the plan default.",
            "example": 30
          },
          "stop_grace_period_s": {
            "type": "integer",
            "minimum": 0,
            "description": "Upper bound on worker or service shutdown draining time in seconds before SIGKILL. 0 uses the mode/plan default.",
            "example": 30
          },
          "stop_signal": {
            "type": "string",
            "description": "Signal sent to initiate graceful stop (e.g. SIGTERM, SIGINT, SIGQUIT, SIGHUP, SIGUSR1, SIGUSR2). Omitted defaults to SIGTERM.",
            "example": "SIGTERM"
          },
          "max_retries": {
            "type": "integer",
            "minimum": 0,
            "description": "Maximum consecutive restart attempts. 0 uses the plan default.",
            "example": 5
          },
          "retry_policy": {
            "$ref": "#/components/schemas/RetryPolicyDTO",
            "description": "Initial app-level invocation retry default; queue binding and per-invocation policies may override it."
          },
          "service_replicas": {
            "$ref": "#/components/schemas/ServiceReplicas"
          },
          "worker_replicas": {
            "$ref": "#/components/schemas/WorkerScaling"
          },
          "ports": {
            "type": "array",
            "maxItems": 16,
            "description": "App-owned listener declarations. Named TCP listeners are publicly routable at `<slug>--port-<name>.<domain>`; UDP listeners remain guest-only.",
            "items": {
              "$ref": "#/components/schemas/WorkloadPort"
            }
          },
          "favicon": {
            "type": [
              "string",
              "null"
            ],
            "format": "byte",
            "maxLength": 43692,
            "description": "Create-time base64-encoded favicon for the gateway edge answer; the decoded payload is capped at 32 KiB."
          },
          "robots_txt": {
            "type": [
              "string",
              "null"
            ],
            "description": "Create-time per-app robots.txt body; empty uses the platform allow-all default."
          },
          "head_wakes": {
            "type": "boolean",
            "default": false,
            "description": "Create-time opt-in to waking a parked app for HEAD / instead of receiving the cached edge answer."
          },
          "crawler_policy": {
            "type": "string",
            "enum": [
              "wake",
              "cached",
              "block"
            ],
            "default": "wake",
            "description": "Policy for known monitor/crawler requests: wake the app, serve only a fresh edge cache hit, or suppress the wake."
          },
          "pre_auth_rate_limit": {
            "$ref": "#/components/schemas/PreAuthRateLimitConfig"
          },
          "health_path": {
            "type": "string",
            "default": "/healthz",
            "description": "Monitor-facing health path. Empty/omitted uses /healthz."
          },
          "health_path_wakes": {
            "type": "boolean",
            "default": false,
            "description": "Allow health probes to wake the app. Pro/Scale only; omitted uses the non-waking edge answer."
          },
          "session_affinity": {
            "description": "Enable best-effort cookie-based routing to the same running instance. Omitted uses false.",
            "type": "boolean",
            "default": false
          },
          "version_affinity_cookie": {
            "description": "Use a stable, non-secret browser cookie for rollout affinity. Omit to disable.",
            "type": "string",
            "pattern": "^[A-Za-z0-9_][A-Za-z0-9_.-]{0,63}$"
          },
          "version_affinity_managed_cookie": {
            "description": "Issue an opaque, host-only browser cookie for rollout affinity. Mutually exclusive with version_affinity_cookie; omitted uses false.",
            "type": "boolean",
            "default": false
          },
          "revision_pin_ttl_seconds": {
            "description": "Maximum lifetime of a superseded deployment for revision-pinned requests; zero disables pinning.",
            "type": "integer",
            "minimum": 0,
            "maximum": 604800,
            "default": 0
          },
          "release_policy": {
            "description": "Default rollout for production releases that name no rollout policy. Omit for safe.",
            "type": "string",
            "enum": [
              "safe",
              "fast",
              "immediate"
            ]
          },
          "release_probe_paths": {
            "description": "Up to 3 concrete GET paths the default rollout probe checks instead of /.",
            "type": "array",
            "maxItems": 3,
            "items": {
              "type": "string",
              "maxLength": 240,
              "pattern": "^/"
            }
          },
          "streaming_enabled": {
            "description": "Per-app streaming flag. Omitted at create-time → the API applies the plan default.",
            "type": "boolean",
            "example": false
          },
          "websocket_enabled": {
            "description": "Per-app raw-bytes Upgrade bridge flag. Omitted → the API applies the plan default; PATCH-true on Free is rejected by the API with 403 plan_websocket_not_allowed.",
            "type": "boolean",
            "example": false
          },
          "route_metrics_enabled": {
            "description": "Per-app per-route observability flag. Omitted → the API applies the plan default (Free = false; Hobby/Pro/Scale = true). PATCH-true on Free is rejected by the API with 403 plan_route_metrics_not_allowed.",
            "type": "boolean",
            "example": false
          },
          "maintenance_mode": {
            "description": "Coarse per-app maintenance toggle. Omitted → the API applies the default (false). Free-tier allowed; no plan gate. Flipping this on at create time pins the app for maintenance from the first request.",
            "type": "boolean",
            "example": false
          },
          "app_protocol": {
            "description": "Per-app wire-protocol selector. Closed set {http1, http2, grpc}. Omit to use the per-plan default ('http1'); set explicitly to opt in to http2 or grpc. Free customers POSTing 'grpc' are rejected with 403 plan_app_protocol_grpc_not_allowed.",
            "type": "string",
            "enum": [
              "http1",
              "http2",
              "grpc"
            ],
            "example": "http1"
          },
          "warm_snapshot_enabled": {
            "description": "Per-app two-tier snapshot flag. Omitted at create-time → the API applies the plan default. Free/Hobby PATCH-true is rejected.",
            "type": "boolean",
            "example": true
          },
          "warm_snapshot_min_requests": {
            "description": "Optional create-time override for the warm-tier request-count threshold. Range [1, 100]. Omitted → the API applies the plan default.",
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "example": 5
          },
          "warm_snapshot_min_ms": {
            "description": "Optional create-time override for the warm-tier time-since-first-ready threshold, milliseconds. Range [100, 60000]. Omitted → the API applies the plan default.",
            "type": "integer",
            "minimum": 100,
            "maximum": 60000,
            "example": 2000
          },
          "warm_pool_size": {
            "description": "Desired paused warm-pool size. Omit for the default of zero; non-zero values require Hobby+ and may not exceed max_concurrency.",
            "type": "integer",
            "minimum": 0,
            "example": 0
          },
          "eviction_priority": {
            "description": "Per-app eviction tier. 'best_effort' (default) keeps the pre-#475 LRU-by-last_request_at reaper behaviour; 'reserved' protects the app from cross-account RAM-pressure eviction. Omitted at create-time → the API applies the schema default 'best_effort'.",
            "type": "string",
            "enum": [
              "best_effort",
              "reserved"
            ],
            "example": "best_effort"
          },
          "overflow_node": {
            "description": "Per-app preferred spill target for cross-node pressure rebalance. Wire form is compute_nodes.name (resolved server-side). Omitted → no preference; empty string at create-time is rejected with 422 invalid_overflow_node because the column starts NULL and there is no 'clear' path at create-time.",
            "type": "string",
            "minLength": 1,
            "example": "box-eu-1"
          },
          "require_authn": {
            "description": "Per-deployment token-gate flag. Omitted at create-time → the API applies the plan default (false). Pro/Scale only.",
            "type": "boolean",
            "example": false
          },
          "platform_tenant_required": {
            "description": "Require verified platform tenant identity on app traffic from creation. Omitted or false leaves the policy disabled. Available on Hobby and above.",
            "type": "boolean",
            "example": true
          }
        }
      },
      "PreviewEnvironmentStatusResponse": {
        "description": "Aggregate current-head readiness for a recorded GitHub PR preview workload set.",
        "type": "object",
        "required": [
          "root_slug",
          "repo_full_name",
          "pr_number",
          "commit_sha",
          "phase",
          "ready",
          "summary",
          "live_workloads",
          "total_workloads",
          "members"
        ],
        "properties": {
          "root_slug": {
            "type": "string"
          },
          "repo_full_name": {
            "type": "string"
          },
          "pr_number": {
            "type": "integer",
            "minimum": 1
          },
          "commit_sha": {
            "type": "string"
          },
          "phase": {
            "type": "string",
            "enum": [
              "building",
              "live",
              "failed",
              "closed"
            ]
          },
          "ready": {
            "type": "boolean"
          },
          "summary": {
            "type": "string"
          },
          "live_workloads": {
            "type": "integer",
            "minimum": 0
          },
          "total_workloads": {
            "type": "integer",
            "minimum": 1
          },
          "members": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PreviewEnvironmentMemberResponse"
            }
          }
        }
      },
      "PreviewEnvironmentMemberResponse": {
        "description": "One expected preview workload and its latest deployment for the recorded commit.",
        "type": "object",
        "required": [
          "app_id",
          "slug",
          "workload_name",
          "app_status",
          "preview_state",
          "deployment_id",
          "deployment_status"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string",
            "description": "Empty if the recorded app is missing."
          },
          "workload_name": {
            "type": "string"
          },
          "app_status": {
            "type": "string",
            "description": "Includes missing when the recorded app is unavailable."
          },
          "preview_state": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string",
            "description": "Empty until a deployment for the recorded commit exists."
          },
          "deployment_status": {
            "type": "string",
            "description": "Missing until a deployment for the recorded commit exists."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "Preview workload expiration."
          },
          "changes_from_production": {
            "description": "Safe artifact and configuration-group comparison with the production parent; never includes secret values.",
            "$ref": "#/components/schemas/PreviewProductionChangesResponse"
          },
          "links": {
            "description": "URL and diagnostic links for this preview workload.",
            "$ref": "#/components/schemas/PreviewResourceLinksResponse"
          }
        }
      },
      "CreatePreviewRequest": {
        "description": "Pull-request preview provisioning payload. Source is deployed separately after the preview app is created.",
        "type": "object",
        "required": [
          "pr_number"
        ],
        "properties": {
          "pr_number": {
            "type": "integer",
            "minimum": 1,
            "description": "Pull-request number used to derive the stable preview slug pr-{N}-{parent_slug}.",
            "example": 42
          },
          "ttl_hours": {
            "type": "integer",
            "minimum": 1,
            "maximum": 720,
            "default": 168,
            "description": "Preview lease duration. The server defaults to 168 hours and caps it at 30 days."
          }
        }
      },
      "PreviewResourceResponse": {
        "description": "A first-class preview with production comparison and observability links.",
        "type": "object",
        "required": [
          "app",
          "changes_from_production",
          "links"
        ],
        "properties": {
          "app": {
            "$ref": "#/components/schemas/AppResponse"
          },
          "parent": {
            "$ref": "#/components/schemas/AppResponse"
          },
          "latest_deployment": {
            "$ref": "#/components/schemas/DeploymentResponse"
          },
          "production_deployment": {
            "$ref": "#/components/schemas/DeploymentResponse"
          },
          "changes_from_production": {
            "$ref": "#/components/schemas/PreviewProductionChangesResponse"
          },
          "links": {
            "$ref": "#/components/schemas/PreviewResourceLinksResponse"
          }
        }
      },
      "PreviewProductionChangesResponse": {
        "description": "Non-secret preview differences from the production parent.",
        "type": "object",
        "required": [
          "artifact_changed",
          "preview_artifact",
          "production_artifact",
          "configuration_changed_groups"
        ],
        "properties": {
          "artifact_changed": {
            "type": "boolean"
          },
          "preview_artifact": {
            "$ref": "#/components/schemas/PreviewArtifactResponse"
          },
          "production_artifact": {
            "$ref": "#/components/schemas/PreviewArtifactResponse"
          },
          "configuration_changed_groups": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "runtime",
                "resources",
                "scaling",
                "routing",
                "policies"
              ]
            }
          }
        }
      },
      "PreviewArtifactResponse": {
        "description": "Strongest available non-secret deployment artifact identity.",
        "type": "object",
        "properties": {
          "deployment_id": {
            "type": "string"
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "status": {
            "type": "string"
          },
          "image_digest": {
            "type": "string"
          },
          "source_sha256": {
            "type": "string"
          },
          "commit_sha": {
            "type": "string"
          },
          "build_id": {
            "type": "string"
          }
        }
      },
      "PreviewResourceLinksResponse": {
        "description": "Public preview URL and native APIs for its logs, metrics, and effective app configuration.",
        "type": "object",
        "required": [
          "url",
          "logs",
          "metrics",
          "configuration"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "logs": {
            "type": "string"
          },
          "metrics": {
            "type": "string"
          },
          "configuration": {
            "type": "string"
          }
        }
      },
      "UpsertDevSessionRequest": {
        "description": "Application shape and opaque local identity for a CLI-managed developer environment.",
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "app",
              "function"
            ],
            "default": "app"
          },
          "runtime": {
            "type": "string",
            "enum": [
              "node22",
              "python312",
              "go124",
              "go124-alpine",
              "node24",
              "python313",
              "binary"
            ]
          },
          "workspace_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "description": "Opaque identity derived locally from the CLI installation and canonical source path. Omit only for legacy sessions."
          },
          "postgres": {
            "$ref": "#/components/schemas/DevPostgresRequest"
          },
          "buckets": {
            "type": "array",
            "description": "Explicitly provision private workspace buckets and bindings. Requires storage:manage or admin in addition to developer session authorization. Omission preserves existing resources. Repeating a revoked binding returns conflict.",
            "items": {
              "$ref": "#/components/schemas/DevBucketRequest"
            }
          },
          "lease_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 3600,
            "description": "How long the environment survives after this request. Omit for the 24-hour default. Values above the plan's developer lease maximum return 403 plan_limit_developer_lease."
          },
          "watch": {
            "$ref": "#/components/schemas/DevWatch"
          },
          "go_command": {
            "type": "string",
            "example": "worker",
            "description": "Builds cmd/<go_command> of the Go module at the source root, as a project service's Go command does. Omit to build what the source builds by default; applies from the next developer build. Refused with 400 for a function or a name that is not a cmd/ directory name."
          }
        }
      },
      "DevWatch": {
        "description": "Watch mode. The environment runs this development server instead of the production build, and live source patches reach the server's own reloader. Omit to turn watch mode off; the change applies from the next developer build. Refused with 422 dev_watch_unsupported when the developer app has less than 512 MB of RAM or does not require authentication.",
        "type": "object",
        "required": [
          "command"
        ],
        "properties": {
          "command": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512,
            "description": "One-line command that starts the development server, for example \"npm run dev\"."
          }
        }
      },
      "ScenarioSimulationPlan": {
        "description": "Immutable fixtures for contained serving apps using the managed outbound relay. Requires action evidence version 2. Canonical JSON is bounded to 64 KiB. No live provider fallback.",
        "type": "object",
        "required": [
          "version",
          "fixtures"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "fixtures": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ScenarioSimulationFixture"
            },
            "minItems": 1,
            "maxItems": 64
          }
        }
      },
      "ScenarioSimulationFixture": {
        "description": "One exact workload, integration, method and path. Responses advance per idempotency key, or per fixture without a key; the final response repeats. Only named top-level JSON fields are retained.",
        "type": "object",
        "required": [
          "workload",
          "name",
          "integration",
          "adapter",
          "method",
          "path",
          "responses"
        ],
        "properties": {
          "workload": {
            "type": "string",
            "minLength": 3,
            "maxLength": 40
          },
          "name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "integration": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$"
          },
          "adapter": {
            "type": "string",
            "enum": [
              "http",
              "resend"
            ]
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "HEAD",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ]
          },
          "path": {
            "type": "string",
            "maxLength": 1024,
            "description": "Exact origin path without query, fragment, percent encoding or traversal. Resend supports POST /emails."
          },
          "capture_fields": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,63}$"
            },
            "maxItems": 32,
            "uniqueItems": true
          },
          "responses": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ScenarioSimulationResponse"
            },
            "minItems": 1,
            "maxItems": 16
          }
        }
      },
      "ScenarioSimulationResponse": {
        "description": "Deterministic JSON HTTP response or connection fault. Redirects are refused. Timeout requires a positive bounded delay, then closes the connection without an HTTP response. This does not attest which error the application observed.",
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "minimum": 200,
            "maximum": 599,
            "description": "Required for HTTP responses. Status 300 through 399 is unsupported. Absent for faults."
          },
          "body": {
            "type": "string",
            "maxLength": 8192,
            "description": "Literal JSON response body. Absent for faults."
          },
          "retry_after_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 30,
            "description": "Supported with status 429 or 503 only."
          },
          "fault": {
            "type": "string",
            "enum": [
              "timeout",
              "disconnect"
            ]
          },
          "delay_ms": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2000
          }
        }
      },
      "ScenarioSimulationAttempt": {
        "description": "Durable simulated relay attempt recorded before response delivery. This is not proof of email delivery or payment. Headers are excluded. Payload contains declared JSON fields. Hashes identify the canonical full request and idempotency key.",
        "type": "object",
        "required": [
          "id",
          "workload",
          "fixture",
          "integration",
          "adapter",
          "method",
          "path",
          "request_sha256",
          "payload",
          "attempt",
          "status",
          "response_status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "workload": {
            "type": "string"
          },
          "fixture": {
            "type": "string"
          },
          "integration": {
            "type": "string"
          },
          "adapter": {
            "type": "string",
            "enum": [
              "http",
              "resend"
            ]
          },
          "method": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "request_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "idempotency_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "payload": {
            "description": "Captured top-level JSON fields selected by the fixture."
          },
          "attempt": {
            "type": "integer",
            "minimum": 1,
            "maximum": 256
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "completed",
              "interrupted",
              "unsupported"
            ]
          },
          "response_status": {
            "type": "integer",
            "minimum": 0,
            "maximum": 599
          },
          "fault": {
            "type": "string",
            "enum": [
              "timeout",
              "disconnect"
            ]
          }
        }
      },
      "ScenarioObjectsSpec": {
        "description": "Versioned single-bucket object rehearsal contract with a canonical fixture inventory digest.",
        "type": "object",
        "required": [
          "version",
          "bucket",
          "fixture_sha256"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "bucket": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{1,29}[a-z0-9]$"
          },
          "fixture_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        }
      },
      "ScenarioObjectsData": {
        "description": "Bounded object fixture input; raw content is never included in evidence responses.",
        "type": "object",
        "required": [
          "key",
          "body",
          "content_type",
          "metadata"
        ],
        "properties": {
          "key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "body": {
            "type": "string",
            "format": "byte",
            "maxLength": 87384,
            "description": "Base64-encoded bytes, at most 65536 decoded bytes per object and 262144 decoded bytes in total."
          },
          "content_type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "metadata": {
            "type": "object",
            "maxProperties": 8,
            "additionalProperties": {
              "type": "string",
              "maxLength": 256
            }
          }
        }
      },
      "ScenarioObjectsObject": {
        "description": "Independent key, byte length, content digest and stable metadata without object content.",
        "type": "object",
        "required": [
          "key",
          "size",
          "sha256",
          "content_type",
          "metadata"
        ],
        "properties": {
          "key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "size": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 65536
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "content_type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "metadata": {
            "type": "object",
            "maxProperties": 8,
            "additionalProperties": {
              "type": "string",
              "maxLength": 256
            }
          }
        }
      },
      "CreateScenarioObjectsRequest": {
        "description": "Fresh primary workload and exact initial objects for an isolated rehearsal namespace.",
        "type": "object",
        "required": [
          "app_slug",
          "spec",
          "objects"
        ],
        "properties": {
          "app_slug": {
            "type": "string"
          },
          "spec": {
            "$ref": "#/components/schemas/ScenarioObjectsSpec"
          },
          "objects": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/ScenarioObjectsData"
            }
          }
        }
      },
      "SealScenarioObjectsRequest": {
        "description": "Deployment identity that must own this rehearsal object's primary app.",
        "type": "object",
        "required": [
          "deployment_id"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "ScenarioObjectsReceipt": {
        "description": "Immutable storage enrollment acknowledgement containing neither content nor credentials.",
        "type": "object",
        "required": [
          "version",
          "run_id",
          "app_id",
          "resource_id",
          "fixture_sha256",
          "contract_sha256",
          "initial_sha256",
          "collector_id"
        ],
        "properties": {
          "collector_id": {
            "type": "string",
            "format": "uuid",
            "description": "Private listener incarnation that acknowledged the namespace before deployment."
          },
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "run_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "resource_id": {
            "type": "string",
            "format": "uuid"
          },
          "fixture_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "contract_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "initial_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        }
      },
      "ScenarioObjectsMutation": {
        "description": "Successful mutation completion receipt; repeated writes remain separate entries.",
        "type": "object",
        "required": [
          "sequence",
          "method",
          "key",
          "status"
        ],
        "properties": {
          "workload": {
            "type": "string",
            "description": "Logical participant responsible for this mutation when managed work is enrolled."
          },
          "sequence": {
            "type": "integer",
            "minimum": 1,
            "maximum": 256,
            "description": "Mutation completion order within the namespace."
          },
          "method": {
            "type": "string",
            "enum": [
              "PUT",
              "DELETE"
            ]
          },
          "key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "status": {
            "type": "integer",
            "enum": [
              200,
              204
            ]
          },
          "object": {
            "$ref": "#/components/schemas/ScenarioObjectsObject"
          }
        }
      },
      "ScenarioObjectsEvidence": {
        "description": "Independently collected object state and mutation receipts, published atomically with content cleanup.",
        "allOf": [
          {
            "$ref": "#/components/schemas/ScenarioObjectsReceipt"
          },
          {
            "type": "object",
            "required": [
              "status",
              "provenance",
              "deployment_id",
              "spec",
              "before",
              "after",
              "mutations",
              "cleanup_confirmed",
              "collector_closed"
            ],
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "complete"
                ]
              },
              "provenance": {
                "type": "string",
                "enum": [
                  "platform_object_collector"
                ]
              },
              "deployment_id": {
                "type": "string",
                "format": "uuid"
              },
              "spec": {
                "$ref": "#/components/schemas/ScenarioObjectsSpec"
              },
              "before": {
                "type": "array",
                "maxItems": 32,
                "items": {
                  "$ref": "#/components/schemas/ScenarioObjectsObject"
                }
              },
              "after": {
                "type": "array",
                "maxItems": 32,
                "items": {
                  "$ref": "#/components/schemas/ScenarioObjectsObject"
                }
              },
              "mutations": {
                "type": "array",
                "maxItems": 256,
                "items": {
                  "$ref": "#/components/schemas/ScenarioObjectsMutation"
                }
              },
              "collector_closed": {
                "type": "boolean",
                "enum": [
                  true
                ],
                "description": "The original collector acknowledged a closed capture window."
              },
              "cleanup_confirmed": {
                "type": "boolean",
                "enum": [
                  true
                ]
              },
              "reason": {
                "type": "string"
              }
            }
          }
        ]
      },
      "ScenarioPostgresTable": {
        "type": "object",
        "description": "Explicit stable columns from one ordinary persistent table in the fixture database.",
        "additionalProperties": false,
        "required": [
          "schema",
          "name",
          "columns"
        ],
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "public"
            ]
          },
          "name": {
            "type": "string",
            "pattern": "^[a-z_][a-z0-9_]{0,62}$"
          },
          "columns": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^[a-z_][a-z0-9_]{0,62}$"
            }
          }
        }
      },
      "ScenarioPostgresSpec": {
        "type": "object",
        "description": "Versioned fixture digest, selected table contract and sampled lock-wait assertion.",
        "additionalProperties": false,
        "required": [
          "version",
          "fixture_sha256",
          "tables",
          "max_lock_wait_ms"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "fixture_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "tables": {
            "type": "array",
            "minItems": 1,
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/ScenarioPostgresTable"
            }
          },
          "max_lock_wait_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 10000
          }
        }
      },
      "CreateScenarioPostgresRequest": {
        "type": "object",
        "description": "Sanitized fixture SQL and its exact collection contract for a fresh contained workload.",
        "additionalProperties": false,
        "required": [
          "app_slug",
          "spec",
          "sql"
        ],
        "properties": {
          "app_slug": {
            "type": "string"
          },
          "spec": {
            "$ref": "#/components/schemas/ScenarioPostgresSpec"
          },
          "sql": {
            "type": "string",
            "minLength": 1,
            "maxLength": 65536,
            "description": "Sanitized UTF-8 fixture SQL; the server also enforces a 65536-byte limit."
          }
        }
      },
      "SealScenarioPostgresRequest": {
        "type": "object",
        "description": "Pinned deployment identity whose fixture effects are ready for independent collection.",
        "additionalProperties": false,
        "required": [
          "deployment_id"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "ScenarioPostgresReceipt": {
        "type": "object",
        "description": "Non-sensitive identity and starting-data hashes for one isolated PostgreSQL fixture.",
        "required": [
          "version",
          "run_id",
          "app_id",
          "resource_id",
          "fixture_sha256",
          "contract_sha256",
          "initial_sha256"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "run_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "resource_id": {
            "type": "string",
            "format": "uuid"
          },
          "fixture_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "contract_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "initial_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        }
      },
      "ScenarioPostgresSnapshot": {
        "type": "object",
        "description": "Bounded multiset of independently collected selected rows; duplicate rows are retained.",
        "required": [
          "table",
          "rows"
        ],
        "properties": {
          "table": {
            "type": "string"
          },
          "rows": {
            "type": "array",
            "maxItems": 1000,
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          }
        }
      },
      "ScenarioPostgresDelta": {
        "type": "object",
        "description": "Inserted and deleted selected-row multisets; updates appear as deletion and insertion.",
        "required": [
          "table",
          "inserted",
          "deleted"
        ],
        "properties": {
          "table": {
            "type": "string"
          },
          "inserted": {
            "type": "array",
            "maxItems": 1000,
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "deleted": {
            "type": "array",
            "maxItems": 1000,
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          }
        }
      },
      "ScenarioPostgresEvidence": {
        "description": "Independent fixture observations with a fenced final capture and confirmed database/login deletion.",
        "allOf": [
          {
            "$ref": "#/components/schemas/ScenarioPostgresReceipt"
          },
          {
            "type": "object",
            "required": [
              "status",
              "provenance",
              "deployment_id",
              "spec",
              "before",
              "after",
              "changes",
              "lock_samples",
              "max_observed_lock_wait_ms",
              "lock_budget_passed",
              "cleanup_confirmed"
            ],
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "complete"
                ]
              },
              "provenance": {
                "type": "string",
                "enum": [
                  "platform_postgres_collector"
                ]
              },
              "deployment_id": {
                "type": "string",
                "format": "uuid"
              },
              "spec": {
                "$ref": "#/components/schemas/ScenarioPostgresSpec"
              },
              "before": {
                "type": "array",
                "maxItems": 16,
                "items": {
                  "$ref": "#/components/schemas/ScenarioPostgresSnapshot"
                }
              },
              "after": {
                "type": "array",
                "maxItems": 16,
                "items": {
                  "$ref": "#/components/schemas/ScenarioPostgresSnapshot"
                }
              },
              "changes": {
                "type": "array",
                "maxItems": 16,
                "items": {
                  "$ref": "#/components/schemas/ScenarioPostgresDelta"
                }
              },
              "lock_samples": {
                "type": "integer",
                "format": "int64",
                "minimum": 1
              },
              "max_observed_lock_wait_ms": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "lock_budget_passed": {
                "type": "boolean"
              },
              "cleanup_confirmed": {
                "type": "boolean",
                "enum": [
                  true
                ]
              },
              "reason": {
                "type": "string"
              }
            }
          }
        ]
      },
      "ScenarioManagedWorkPlan": {
        "description": "Explicit participants and fixture permissions for managed async-route rehearsals. Requires contained commands and simulation; rollout is operator gated.",
        "type": "object",
        "required": [
          "version",
          "primary",
          "participants"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "primary": {
            "type": "string",
            "minLength": 3,
            "maxLength": 40
          },
          "worker_termination": {
            "$ref": "#/components/schemas/ScenarioWorkerTermination"
          },
          "postgres_fault": {
            "$ref": "#/components/schemas/ScenarioPostgresFaultSpec"
          },
          "participants": {
            "type": "array",
            "minItems": 2,
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/ScenarioManagedWorkParticipant"
            }
          }
        }
      },
      "ScenarioPostgresFaultSpec": {
        "description": "Separately gated warm rehearsal with one managed worker and one isolated database. Disconnects existing sessions and rejects new connections before restoring access. Excludes cold start, suspend/resume and worker termination.",
        "type": "object",
        "required": [
          "workload",
          "checkpoint",
          "unavailable_ms",
          "recover_within_ms"
        ],
        "properties": {
          "workload": {
            "type": "string",
            "minLength": 3,
            "maxLength": 40
          },
          "checkpoint": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "unavailable_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 100,
            "maximum": 30000
          },
          "recover_within_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 120000
          }
        }
      },
      "ScenarioPostgresFaultReceipt": {
        "description": "Durable original-owner confirmation of a database-specific connection fence and independent recovery probe. Missing proof remains inconclusive; a proven recovery exceeding the budget fails comparison.",
        "type": "object",
        "required": [
          "id",
          "account_id",
          "run_id",
          "app_id",
          "resource_id",
          "deployment_id",
          "instance_id",
          "recorder_session_id",
          "invocation_id",
          "checkpoint_attempt_id",
          "owner_id",
          "backend_sha256",
          "plan_sha256",
          "spec",
          "state",
          "activated",
          "recovered",
          "closed_connections",
          "outage_ms",
          "recovery_ms"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "run_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "resource_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "instance_id": {
            "type": "string",
            "format": "uuid"
          },
          "recorder_session_id": {
            "type": "string",
            "format": "uuid"
          },
          "invocation_id": {
            "type": "string",
            "format": "uuid"
          },
          "checkpoint_attempt_id": {
            "type": "string",
            "format": "uuid"
          },
          "owner_id": {
            "type": "string",
            "format": "uuid"
          },
          "backend_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "plan_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "spec": {
            "$ref": "#/components/schemas/ScenarioPostgresFaultSpec"
          },
          "state": {
            "type": "string",
            "enum": [
              "requested",
              "cutting",
              "active",
              "recovering",
              "recovered",
              "failed"
            ]
          },
          "activated": {
            "type": "boolean"
          },
          "recovered": {
            "type": "boolean"
          },
          "closed_connections": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "outage_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Confirmed active interval from disconnect acknowledgement until restoration starts."
          },
          "recovery_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Elapsed time from planned restoration through a fresh connection and privilege probe."
          },
          "error": {
            "type": "string"
          }
        }
      },
      "ScenarioSuspendResumeSpec": {
        "description": "One contained in-place pause after setup or at a cooperative managed-job checkpoint. No persistent VM snapshot is written.",
        "type": "object",
        "required": [
          "version",
          "checkpoint",
          "workloads",
          "pause_ms",
          "within_ms"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "checkpoint": {
            "type": "string",
            "enum": [
              "after_setup",
              "managed_job"
            ]
          },
          "worker_checkpoint": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$",
            "description": "Required for managed_job; names one successful POST HTTP simulation fixture on the sole selected async worker."
          },
          "workloads": {
            "type": "array",
            "minItems": 1,
            "maxItems": 16,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 3,
              "maxLength": 40
            }
          },
          "pause_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 30000
          },
          "within_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 120000,
            "description": "Maximum host-observed resume duration through hook and readiness."
          }
        }
      },
      "ScenarioSuspendResumeReceipt": {
        "description": "Original-owner physical pause and resume proof, acknowledged by the scheduler after publishing the same VM with its captured runtime configuration.",
        "type": "object",
        "required": [
          "id",
          "account_id",
          "app_id",
          "run_id",
          "workload",
          "deployment_id",
          "instance_id",
          "recorder_session_id",
          "state",
          "pause_ms",
          "resume_ms"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "run_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "workload": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "instance_id": {
            "type": "string",
            "format": "uuid"
          },
          "recorder_session_id": {
            "type": "string",
            "format": "uuid"
          },
          "invocation_id": {
            "type": "string",
            "format": "uuid",
            "description": "Enrolled managed job; present only for managed_job checkpoints."
          },
          "invocation_attempt": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1,
            "description": "First dispatch held across the pause."
          },
          "checkpoint_attempt_id": {
            "type": "string",
            "format": "uuid",
            "description": "Independently completed simulation held by the original relay."
          },
          "state": {
            "type": "string",
            "enum": [
              "waiting",
              "armed",
              "claimed",
              "fenced",
              "paused",
              "resuming",
              "resumed",
              "complete",
              "failed"
            ]
          },
          "method": {
            "type": "string",
            "enum": [
              "in_place"
            ]
          },
          "pause_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "resume_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ScenarioSuspendResumeEvidence": {
        "description": "Versioned lifecycle inventory. Complete receipts preserve identity while comparisons exclude timing jitter; missing proof remains inconclusive.",
        "type": "object",
        "required": [
          "version",
          "run_id",
          "spec",
          "plan_sha256",
          "status",
          "receipts"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "run_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "spec": {
            "$ref": "#/components/schemas/ScenarioSuspendResumeSpec"
          },
          "plan_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "complete",
              "incomplete"
            ]
          },
          "receipts": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/ScenarioSuspendResumeReceipt"
            }
          }
        }
      },
      "ScenarioColdStartSpec": {
        "description": "Versioned contained cold-start budget for every declared workload. Requires an operator-qualified cold-start fleet and excludes worker termination.",
        "type": "object",
        "required": [
          "version",
          "within_ms"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "within_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 120000,
            "description": "Maximum host-observed startup duration through guest readiness."
          }
        }
      },
      "ScenarioColdPreparation": {
        "description": "Original-owner retirement and actual cold-boot receipts for one workload and deployment. Missing receipts never establish lifecycle parity.",
        "type": "object",
        "required": [
          "id",
          "account_id",
          "app_id",
          "run_id",
          "workload",
          "deployment_id",
          "state",
          "startup_ms"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "run_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "workload": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "instance_id": {
            "type": "string",
            "format": "uuid",
            "description": "Original serving VM when one existed at preparation."
          },
          "recorder_session_id": {
            "type": "string",
            "format": "uuid",
            "description": "Original retired collector owner."
          },
          "state": {
            "type": "string",
            "enum": [
              "armed",
              "claimed",
              "fenced",
              "retired",
              "ready",
              "booted",
              "failed"
            ]
          },
          "boot_instance_id": {
            "type": "string",
            "format": "uuid"
          },
          "boot_recorder_session_id": {
            "type": "string",
            "format": "uuid"
          },
          "wake_id": {
            "type": "string",
            "format": "uuid"
          },
          "method": {
            "type": "string",
            "enum": [
              "cold_boot"
            ]
          },
          "startup_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ScenarioColdStartEvidence": {
        "description": "Sealed cold-start inventory with immutable recipe identity and independent host receipts. Raw timing jitter and runtime IDs are excluded from behavioral equality.",
        "type": "object",
        "required": [
          "version",
          "run_id",
          "spec",
          "plan_sha256",
          "status",
          "preparations"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "run_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "spec": {
            "$ref": "#/components/schemas/ScenarioColdStartSpec"
          },
          "plan_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "complete",
              "incomplete"
            ]
          },
          "preparations": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/ScenarioColdPreparation"
            }
          }
        }
      },
      "ScenarioWorkerTermination": {
        "description": "One cooperative worker termination at a named POST HTTP simulation checkpoint. The target must execute one job and recover on a fresh VM; rollout is separately operator gated.",
        "type": "object",
        "required": [
          "workload",
          "checkpoint"
        ],
        "properties": {
          "workload": {
            "type": "string",
            "minLength": 3,
            "maxLength": 40
          },
          "checkpoint": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63
          }
        }
      },
      "ScenarioWorkerFault": {
        "description": "Platform-owned checkpoint, collector and VM termination identity. Complete evidence requires a terminated receipt and independently journalled recovery on a different VM.",
        "type": "object",
        "required": [
          "id",
          "account_id",
          "app_id",
          "run_id",
          "workload",
          "deployment_id",
          "instance_id",
          "invocation_id",
          "checkpoint_attempt_id",
          "recorder_session_id",
          "state"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "run_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "workload": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "instance_id": {
            "type": "string",
            "format": "uuid"
          },
          "invocation_id": {
            "type": "string",
            "format": "uuid"
          },
          "checkpoint_attempt_id": {
            "type": "string",
            "format": "uuid"
          },
          "recorder_session_id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "armed",
              "ready",
              "claimed",
              "fenced",
              "terminated",
              "failed"
            ]
          },
          "recovery_instance_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "ScenarioManagedWorkParticipant": {
        "description": "One enrolled workload and its explicit resource capabilities. Async workers must execute at least one managed job.",
        "type": "object",
        "required": [
          "workload"
        ],
        "properties": {
          "workload": {
            "type": "string",
            "minLength": 3,
            "maxLength": 40
          },
          "async": {
            "type": "boolean"
          },
          "postgres": {
            "type": "string",
            "enum": [
              "read_write"
            ]
          },
          "objects": {
            "type": "string",
            "enum": [
              "read",
              "read_write"
            ]
          }
        }
      },
      "ScenarioManagedWorkBinding": {
        "description": "Platform identities and fixture resources bound to a logical workload. Missing identities make evidence incomplete.",
        "type": "object",
        "required": [
          "workload",
          "app_id",
          "deployment_id"
        ],
        "properties": {
          "workload": {
            "type": "string"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string"
          },
          "postgres_resource_id": {
            "type": "string",
            "format": "uuid"
          },
          "objects_resource_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "ScenarioManagedWorkAttempt": {
        "description": "Durable dispatch ownership and terminal outcome, retained across retries. Unknown outcomes cannot establish completion.",
        "type": "object",
        "required": [
          "number",
          "instance_id",
          "deployment_id",
          "outcome"
        ],
        "properties": {
          "number": {
            "type": "integer",
            "minimum": 1,
            "maximum": 32
          },
          "instance_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "outcome": {
            "type": "string"
          }
        }
      },
      "ScenarioManagedWorkJob": {
        "description": "One managed async invocation. Runtime identities support inspection; comparison retains request digest and retry outcomes.",
        "type": "object",
        "required": [
          "id",
          "workload",
          "app_id",
          "deployment_id",
          "method",
          "path",
          "payload_sha256",
          "state",
          "attempts"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "workload": {
            "type": "string"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string"
          },
          "method": {
            "type": "string",
            "maxLength": 10
          },
          "path": {
            "type": "string",
            "maxLength": 2048
          },
          "payload_sha256": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "attempts": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/ScenarioManagedWorkAttempt"
            }
          }
        }
      },
      "ScenarioManagedWorkEvidence": {
        "description": "Bounded participant inventory and managed async completion proof. A complete result requires worker execution, successful receipts and closed admission.",
        "type": "object",
        "required": [
          "version",
          "run_id",
          "plan_sha256",
          "status",
          "closing",
          "plan",
          "bindings",
          "jobs"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "run_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "plan_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "incomplete",
              "complete"
            ]
          },
          "closing": {
            "type": "boolean"
          },
          "plan": {
            "$ref": "#/components/schemas/ScenarioManagedWorkPlan"
          },
          "worker_fault": {
            "$ref": "#/components/schemas/ScenarioWorkerFault"
          },
          "postgres_fault": {
            "$ref": "#/components/schemas/ScenarioPostgresFaultReceipt"
          },
          "bindings": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/ScenarioManagedWorkBinding"
            }
          },
          "jobs": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "$ref": "#/components/schemas/ScenarioManagedWorkJob"
            }
          },
          "reason": {
            "type": "string"
          }
        }
      },
      "RegisterScenarioTestRequest": {
        "description": "Complete set of developer sessions in one isolated scenario run.",
        "type": "object",
        "required": [
          "members"
        ],
        "properties": {
          "suspend_resume": {
            "$ref": "#/components/schemas/ScenarioSuspendResumeSpec"
          },
          "cold_start": {
            "$ref": "#/components/schemas/ScenarioColdStartSpec"
          },
          "managed_work": {
            "$ref": "#/components/schemas/ScenarioManagedWorkPlan"
          },
          "command_version": {
            "type": "integer",
            "enum": [
              1
            ],
            "description": "Require acknowledgement of contained command execution before deployment. Requires simulation enrollment and an operator-qualified command fleet."
          },
          "simulation": {
            "$ref": "#/components/schemas/ScenarioSimulationPlan"
          },
          "network_mode": {
            "type": "string",
            "enum": [
              "contained"
            ],
            "description": "Opt in to runtime outbound containment version 1. Requires capture mode and an operator-qualified fleet. Supports same-run private HTTP and declared simulation adapters; other outbound traffic is blocked."
          },
          "action_evidence_version": {
            "type": "integer",
            "enum": [
              1,
              2
            ],
            "description": "Require support for sealed action evidence before deploying. Version 2 requires simulation fixtures. The server must echo this version in its acknowledgement. Requires webhook_mode capture."
          },
          "webhook_mode": {
            "type": "string",
            "enum": [
              "capture"
            ],
            "description": "Capture managed webhook effects and suppress all other webhook deliveries from these fresh test apps. Requires no existing deployments or work. Does not intercept direct application HTTP calls."
          },
          "members": {
            "type": "array",
            "minItems": 1,
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/ScenarioTestWorkload"
            }
          }
        }
      },
      "ScenarioCapturedAction": {
        "description": "A managed operation or workflow webhook intent captured at completion. Runtime IDs support inspection; comparison uses logical workloads and committed business data.",
        "type": "object",
        "required": [
          "id",
          "workload",
          "source",
          "operation_id",
          "name",
          "webhook_id",
          "receiver_sha256",
          "type",
          "payload"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "workload": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "operation",
              "workflow"
            ]
          },
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "workflow": {
            "type": "string",
            "maxLength": 128
          },
          "step": {
            "type": "string",
            "maxLength": 128
          },
          "name": {
            "type": "string"
          },
          "webhook_id": {
            "type": "string",
            "format": "uuid"
          },
          "receiver_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Fingerprint of destination scope, business tenant reference, exact URL, delivery format and retry policy observed at completion. URLs and secrets are not exported."
          },
          "type": {
            "type": "string"
          },
          "payload": {
            "description": "Committed JSON business data bounded to 64 KiB per intent."
          }
        }
      },
      "ScenarioCapturedEvent": {
        "description": "An event an enrolled app published. It never reached the account's event bus; the sealed snapshot is its only record. Platform-generated IDs and times do not compare.",
        "type": "object",
        "required": [
          "id",
          "workload",
          "source",
          "type",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "workload": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "maxLength": 256
          },
          "type": {
            "type": "string",
            "maxLength": 256
          },
          "schema_version": {
            "type": "string",
            "maxLength": 256
          },
          "data": {
            "description": "Published JSON event data bounded to 64 KiB."
          }
        }
      },
      "ScenarioSuppressedWebhookEvents": {
        "description": "Count of ordinary webhook deliveries the capture fence suppressed for one workload and event type. Their payloads carry platform-generated identifiers, so only multiplicity compares.",
        "type": "object",
        "required": [
          "workload",
          "event",
          "count"
        ],
        "properties": {
          "workload": {
            "type": "string"
          },
          "event": {
            "type": "string",
            "maxLength": 256
          },
          "count": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        }
      },
      "ScenarioCapturedQueueMessage": {
        "description": "A queue send, inbox message, delayed task or asynchronous invoke an enrolled app requested through the run-local platform API. It was never enqueued.",
        "type": "object",
        "required": [
          "id",
          "workload",
          "kind",
          "target",
          "message"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "workload": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "queue",
              "delayed_task",
              "async_invoke"
            ]
          },
          "target": {
            "type": "string",
            "pattern": "^(workload|app):[a-z0-9][a-z0-9-]{0,62}$",
            "description": "A member of the same run is named workload:<name>; any other app is app:<slug>."
          },
          "queue_name": {
            "type": "string",
            "maxLength": 256
          },
          "schedule": {
            "type": "string",
            "pattern": "^(absolute|delay:[0-9]{1,8})$",
            "description": "A delayed task's requested delay, or absolute when it gave scheduled_at."
          },
          "message": {
            "description": "The request's business content, bounded to 64 KiB."
          }
        }
      },
      "ScenarioCapturedPlatformCall": {
        "description": "A workflow or realtime call an enrolled app requested through the run-local platform API. It was never performed.",
        "type": "object",
        "required": [
          "id",
          "workload",
          "kind",
          "target",
          "name",
          "message"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "workload": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "workflow_run",
              "workflow_event",
              "realtime_publish",
              "realtime_signal"
            ]
          },
          "target": {
            "type": "string",
            "maxLength": 512,
            "description": "What the call addressed, without platform IDs the run created."
          },
          "name": {
            "type": "string",
            "maxLength": 256,
            "description": "The workflow, event or channel name."
          },
          "message": {
            "description": "The call's compared content, bounded to 64 KiB."
          }
        }
      },
      "ScenarioActionSnapshot": {
        "description": "Bounded evidence for a sealed action window. Version 1 covers managed webhooks. Version 2 adds declared simulated relay attempts and durable host recorder coverage. Incomplete snapshots never establish equivalent behavior.",
        "type": "object",
        "required": [
          "version",
          "scope",
          "run_id",
          "status",
          "workloads",
          "intents",
          "captured_count",
          "pending_managed_work",
          "incomplete_managed_effects",
          "suppressed_deliveries",
          "truncated"
        ],
        "properties": {
          "suspend_resume": {
            "$ref": "#/components/schemas/ScenarioSuspendResumeEvidence"
          },
          "cold_start": {
            "$ref": "#/components/schemas/ScenarioColdStartEvidence"
          },
          "managed_work": {
            "$ref": "#/components/schemas/ScenarioManagedWorkEvidence"
          },
          "recorder_version": {
            "type": "integer",
            "enum": [
              1
            ],
            "description": "Required in simulation scope. Durable host recorder and closing barrier contract."
          },
          "recorder_sessions": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 256,
            "description": "Retained serving-VM recorder sessions. Every simulation workload must have acknowledged recorder coverage."
          },
          "pending_recorder_sessions": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 256
          },
          "incomplete_recorder_sessions": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "version": {
            "type": "integer",
            "enum": [
              1,
              2
            ]
          },
          "scope": {
            "type": "string",
            "enum": [
              "managed_operation_webhooks",
              "managed_webhooks_and_simulated_outbound"
            ]
          },
          "run_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "complete",
              "pending",
              "incomplete"
            ]
          },
          "sealed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Present only after the managed-effect window has closed."
          },
          "workloads": {
            "type": "array",
            "minItems": 1,
            "maxItems": 16,
            "uniqueItems": true,
            "items": {
              "type": "string"
            }
          },
          "intents": {
            "type": "array",
            "maxItems": 256,
            "items": {
              "$ref": "#/components/schemas/ScenarioCapturedAction"
            }
          },
          "simulation_version": {
            "type": "integer",
            "enum": [
              1
            ],
            "description": "Present in version 2 snapshots. HTTP and Resend simulation contract version."
          },
          "simulation_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Canonical immutable fixture plan identity. Required for simulation scope."
          },
          "simulated_attempts": {
            "type": "array",
            "maxItems": 256,
            "items": {
              "$ref": "#/components/schemas/ScenarioSimulationAttempt"
            }
          },
          "pending_simulation_attempts": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "incomplete_simulation_attempts": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "captured_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "pending_managed_work": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "incomplete_managed_effects": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "suppressed_deliveries": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Unsupported ordinary deliveries blocked by the run policy; these are not successful business effects."
          },
          "truncated": {
            "type": "boolean"
          },
          "reason": {
            "type": "string"
          },
          "event_capture_version": {
            "type": "integer",
            "enum": [
              1
            ],
            "description": "Present from servers that capture published events. A comparison across capture versions is inconclusive."
          },
          "published_events": {
            "type": "array",
            "maxItems": 256,
            "items": {
              "$ref": "#/components/schemas/ScenarioCapturedEvent"
            }
          },
          "suppressed_webhook_events": {
            "type": "array",
            "maxItems": 256,
            "items": {
              "$ref": "#/components/schemas/ScenarioSuppressedWebhookEvents"
            }
          },
          "incomplete_captured_events": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "queue_capture_version": {
            "type": "integer",
            "enum": [
              1
            ],
            "description": "Present from servers that capture queue sends and delayed tasks."
          },
          "queue_messages": {
            "type": "array",
            "maxItems": 256,
            "items": {
              "$ref": "#/components/schemas/ScenarioCapturedQueueMessage"
            }
          },
          "incomplete_queue_messages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "platform_capture_version": {
            "type": "integer",
            "enum": [
              1
            ],
            "description": "Present from servers that capture workflow and realtime calls."
          },
          "platform_calls": {
            "type": "array",
            "maxItems": 256,
            "items": {
              "$ref": "#/components/schemas/ScenarioCapturedPlatformCall"
            }
          },
          "incomplete_platform_calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "RegisterScenarioTestResponse": {
        "description": "Acknowledgement that the versioned webhook capture policy was committed before source deployment.",
        "type": "object",
        "required": [
          "webhook_mode",
          "policy_version"
        ],
        "properties": {
          "suspend_resume_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Acknowledges the exact suspend/resume plan and workload inventory before deployment."
          },
          "cold_start_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Acknowledges the exact cold-start budget and workload inventory before deployment."
          },
          "managed_work_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Acknowledges the exact durable participant plan before deployment."
          },
          "command_version": {
            "type": "integer",
            "enum": [
              1
            ],
            "description": "Echoes supported contained command execution. Each command also requires a matching guest receipt and owner retirement before success."
          },
          "recorder_version": {
            "type": "integer",
            "enum": [
              1
            ],
            "description": "Required when simulation is enrolled. Acknowledges durable recorder support before source deployment."
          },
          "simulation_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Echoes the canonical fixture plan identity after durable enrollment."
          },
          "network_mode": {
            "type": "string",
            "enum": [
              "contained"
            ],
            "description": "Echoes the durable network containment enrollment. Each runtime must also acknowledge the exact run before publication."
          },
          "action_evidence_version": {
            "type": "integer",
            "enum": [
              1,
              2
            ],
            "description": "Present when the requested sealed action-evidence protocol is supported."
          },
          "webhook_mode": {
            "type": "string",
            "enum": [
              "capture"
            ]
          },
          "policy_version": {
            "type": "integer",
            "enum": [
              1
            ]
          }
        }
      },
      "ScenarioTestWorkload": {
        "description": "Logical service name and developer session app slug for a scenario run.",
        "type": "object",
        "required": [
          "workload",
          "app_slug"
        ],
        "properties": {
          "workload": {
            "type": "string",
            "minLength": 3,
            "maxLength": 40
          },
          "app_slug": {
            "type": "string",
            "minLength": 3,
            "maxLength": 40
          }
        }
      },
      "InjectScenarioTestChaosRequest": {
        "description": "Bounded HTTP, private-service DNS, and TCP fault plan applied only within one scenario test namespace.",
        "type": "object",
        "required": [
          "duration_ms",
          "rules"
        ],
        "properties": {
          "duration_ms": {
            "type": "integer",
            "minimum": 1000,
            "maximum": 300000
          },
          "rules": {
            "type": "array",
            "minItems": 1,
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/ScenarioTestChaosRule"
            }
          }
        }
      },
      "ScenarioTestChaosRule": {
        "description": "One bounded HTTP request, private-service DNS lookup, TCP stream, or new TCP connection fault for matching scenario workloads.",
        "type": "object",
        "required": [
          "to",
          "kind",
          "percent",
          "seed"
        ],
        "properties": {
          "correlation_scope": {
            "type": "string",
            "pattern": "^[0-9a-f]{16}$",
            "description": "Optional strict per-request HTTP attempt scope; requires a full-coverage latency/status rule with an explicit source."
          },
          "from": {
            "type": "string",
            "minLength": 3,
            "maxLength": 40
          },
          "to": {
            "type": "string",
            "minLength": 3,
            "maxLength": 40
          },
          "kind": {
            "type": "string",
            "enum": [
              "latency",
              "http_status",
              "http_malformed_json",
              "http_truncated_body",
              "http_response_lost",
              "dns_latency",
              "dns_timeout",
              "dns_servfail",
              "dns_nxdomain",
              "tcp_latency",
              "tcp_bandwidth",
              "tcp_timeout",
              "tcp_reset",
              "tcp_connect_timeout",
              "tcp_connect_refused"
            ]
          },
          "percent": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "latency_ms": {
            "type": "integer",
            "minimum": 1,
            "maximum": 30000
          },
          "status_code": {
            "description": "Synthetic HTTP status; accepts 429 or 500 through 599.",
            "oneOf": [
              {
                "type": "integer",
                "enum": [
                  429
                ]
              },
              {
                "type": "integer",
                "minimum": 500,
                "maximum": 599
              }
            ]
          },
          "retry_after_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 30,
            "description": "Optional Retry-After delta-seconds header. Only valid for http_status with status_code 429 or 503."
          },
          "seed": {
            "type": "integer",
            "minimum": 0
          },
          "port": {
            "type": "integer",
            "minimum": 1,
            "maximum": 65535,
            "description": "Required target port for TCP rules."
          },
          "direction": {
            "type": "string",
            "enum": [
              "upstream",
              "downstream",
              "both"
            ],
            "description": "TCP direction relative to the calling application. Defaults to both; connection faults require both."
          },
          "rate_kib_per_second": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000,
            "description": "Required per-connection directional throughput cap for tcp_bandwidth."
          },
          "reset_after_ms": {
            "type": "integer",
            "minimum": 0,
            "maximum": 30000,
            "description": "Delay before tcp_reset. Defaults to an immediate reset."
          }
        }
      },
      "InjectScenarioTestChaosResponse": {
        "description": "Receipt confirming the plan generation, number of rules installed, and automatic expiry time.",
        "type": "object",
        "required": [
          "expires_at",
          "rules_installed",
          "generation"
        ],
        "properties": {
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "rules_installed": {
            "type": "integer",
            "minimum": 1,
            "maximum": 16
          },
          "generation": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "ScenarioTestChaosMatchesResponse": {
        "description": "Run-scoped counts of HTTP requests, private-service DNS lookups, and TCP connections that matched the current or most recently cleared plan.",
        "type": "object",
        "required": [
          "matches"
        ],
        "properties": {
          "generation": {
            "type": "string",
            "format": "uuid"
          },
          "matches": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ScenarioTestChaosMatch"
            }
          }
        }
      },
      "ScenarioTestChaosMatch": {
        "description": "Count of matches for one fault rule in the scenario run.",
        "type": "object",
        "required": [
          "rule_id",
          "count"
        ],
        "properties": {
          "rule_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "count": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "DevPostgresRequest": {
        "description": "Opts the developer environment into an isolated managed PostgreSQL database.",
        "type": "object",
        "properties": {
          "region": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$",
            "description": "Optional placement region; omitted uses the platform default."
          }
        }
      },
      "DevPatchPreview": {
        "description": "Set only on the response to a developer source upload (`gregale dev`). Reports whether the sync could have been applied as a live source patch to the deployment that was live at upload time (phase 1). It is a measurement only; the normal developer build always runs.",
        "type": "object",
        "required": [
          "eligible",
          "changed_paths",
          "patch_bytes"
        ],
        "properties": {
          "eligible": {
            "type": "boolean"
          },
          "reason": {
            "type": "string",
            "enum": [
              "not_railpack",
              "plan_unreadable",
              "no_source_layer",
              "build_command",
              "source_not_deployed",
              "no_live_build",
              "no_base_manifest",
              "full_snapshot",
              "rebuild_input_changed",
              "unsupported_entry",
              "patch_too_large",
              "unsupported_source_map"
            ],
            "description": "Why the sync could not use a live patch. Absent when eligible."
          },
          "changed_paths": {
            "type": "integer",
            "minimum": 0,
            "description": "Files added, modified or deleted inside the build's source root."
          },
          "patch_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Total size of the added or modified files."
          },
          "generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Set when this sync published a live patch; poll getDevPatchStatus with it."
          }
        }
      },
      "DevPatchStatusResponse": {
        "description": "Delivery state of one developer live patch.",
        "type": "object",
        "required": [
          "generation",
          "state",
          "created_at"
        ],
        "properties": {
          "generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "applied",
              "failed"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "applied_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the first instance acknowledged the patch."
          },
          "apply_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "How long the instance took to write the patch and request the restart."
          },
          "error_code": {
            "type": "string",
            "description": "Bounded guest error code when state is failed, for example apply_failed or restart_failed."
          }
        }
      },
      "DevBucketRequest": {
        "description": "Opt-in private bucket in the developer workspace, bound in the default secret scope. Bucket and binding names are unique within the batch.",
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "region": {
            "type": "string",
            "description": "Omit to reuse existing placement or the current creation default."
          },
          "permission": {
            "type": "string",
            "enum": [
              "read",
              "write",
              "read_write"
            ],
            "default": "read_write"
          },
          "prefix": {
            "type": "string",
            "pattern": "^[A-Z][A-Z0-9_]{0,47}$",
            "description": "Defaults to GREGALE_S3_ followed by the normalized bucket name."
          },
          "triggers": {
            "type": "array",
            "maxItems": 1000,
            "description": "Opt-in ObjectCreated triggers targeting this developer app. Omission preserves managed intent; an empty array clears it.",
            "items": {
              "$ref": "#/components/schemas/ObjectStorageComputeTrigger"
            }
          }
        }
      },
      "DevBucketResponse": {
        "description": "Safe metadata for an active automatic developer bucket binding. No credential secret or provider placement is returned.",
        "type": "object",
        "required": [
          "bucket",
          "binding"
        ],
        "properties": {
          "bucket": {
            "$ref": "#/components/schemas/ObjectBucket"
          },
          "binding": {
            "$ref": "#/components/schemas/ObjectStorageComputeBinding"
          }
        }
      },
      "DevPostgresResponse": {
        "description": "Safe receipt for the isolated developer database and its app binding. Credentials are injected into DATABASE_URL and never returned.",
        "type": "object",
        "required": [
          "database_id",
          "name",
          "state",
          "binding_id",
          "binding_state",
          "environment_key"
        ],
        "properties": {
          "database_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "provisioning",
              "ready",
              "updating",
              "deleting",
              "failed",
              "deleted"
            ]
          },
          "binding_id": {
            "type": "string"
          },
          "binding_state": {
            "type": "string",
            "enum": [
              "provisioning",
              "ready",
              "deleting",
              "failed",
              "deleted"
            ]
          },
          "environment_key": {
            "type": "string",
            "example": "DATABASE_URL"
          }
        }
      },
      "DevSessionResponse": {
        "description": "Stable remote developer workspace and its renewable lease.",
        "type": "object",
        "required": [
          "app",
          "expires_at"
        ],
        "properties": {
          "app": {
            "$ref": "#/components/schemas/AppResponse"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "postgres": {
            "$ref": "#/components/schemas/DevPostgresResponse"
          },
          "buckets": {
            "type": "array",
            "description": "Active automatic bucket bindings, including resources omitted from the latest upsert. Included only for principals with storage:manage or admin. Revoked bindings are excluded.",
            "items": {
              "$ref": "#/components/schemas/DevBucketResponse"
            }
          },
          "watch": {
            "$ref": "#/components/schemas/DevWatch"
          },
          "go_command": {
            "type": "string",
            "description": "The stored Go command; omitted when none."
          }
        }
      },
      "DevSyncPhase": {
        "description": "Safe phase-level timing from a developer sync.",
        "type": "object",
        "required": [
          "phase",
          "status"
        ],
        "properties": {
          "phase": {
            "type": "string",
            "enum": [
              "sync",
              "cache",
              "build",
              "boot",
              "ready",
              "route"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "completed",
              "failed",
              "in_progress"
            ]
          },
          "duration_ms": {
            "type": "integer",
            "minimum": 0,
            "maximum": 3600000
          },
          "reason": {
            "type": "string",
            "maxLength": 512
          }
        }
      },
      "RecordDevSyncRequest": {
        "description": "Redacted edit-to-live receipt written by the developer CLI.",
        "type": "object",
        "required": [
          "workspace_id",
          "deployment_id",
          "status",
          "edit_to_live_ms",
          "slo_target_ms",
          "within_slo",
          "phases"
        ],
        "properties": {
          "workspace_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "deployment_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "status": {
            "type": "string",
            "enum": [
              "live",
              "failed"
            ]
          },
          "edit_to_live_ms": {
            "type": "integer",
            "minimum": 0,
            "maximum": 3600000
          },
          "slo_target_ms": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3600000
          },
          "within_slo": {
            "type": "boolean"
          },
          "phases": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/DevSyncPhase"
            }
          }
        }
      },
      "DevSyncHistoryItem": {
        "description": "One redacted developer sync receipt.",
        "type": "object",
        "required": [
          "deployment_id",
          "status",
          "edit_to_live_ms",
          "slo_target_ms",
          "within_slo",
          "phases",
          "created_at"
        ],
        "properties": {
          "deployment_id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "live",
              "failed"
            ]
          },
          "edit_to_live_ms": {
            "type": "integer",
            "minimum": 0,
            "maximum": 3600000
          },
          "slo_target_ms": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3600000
          },
          "within_slo": {
            "type": "boolean"
          },
          "phases": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DevSyncPhase"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DevSyncHistorySummary": {
        "description": "Aggregate trend and regression guidance for recent developer syncs.",
        "type": "object",
        "required": [
          "count",
          "within_slo_count",
          "p50_edit_to_live_ms",
          "p95_edit_to_live_ms",
          "slo_target_ms"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "minimum": 0
          },
          "within_slo_count": {
            "type": "integer",
            "minimum": 0
          },
          "p50_edit_to_live_ms": {
            "type": "integer",
            "minimum": 0
          },
          "p95_edit_to_live_ms": {
            "type": "integer",
            "minimum": 0
          },
          "slo_target_ms": {
            "type": "integer",
            "minimum": 0
          },
          "slowest_phase": {
            "type": "string"
          },
          "slowest_phase_ms": {
            "type": "integer",
            "minimum": 0
          },
          "guidance": {
            "type": "string"
          }
        }
      },
      "DevSyncHistoryResponse": {
        "description": "Bounded newest-first developer sync history.",
        "type": "object",
        "required": [
          "project",
          "items"
        ],
        "properties": {
          "project": {
            "type": "string"
          },
          "workspace_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "items": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/DevSyncHistoryItem"
            }
          },
          "summary": {
            "$ref": "#/components/schemas/DevSyncHistorySummary"
          }
        }
      },
      "AppDeploySettingsCondition": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_app_id",
          "expected_deployment_id",
          "expected_settings"
        ],
        "description": "Atomic preconditions for single-app lifecycle/scaling recovery. The app must retain this identity and its newest deployment must be the expected live deployment. Every targeted field must still match its observed value, including targeted fields omitted from the partial update because they already match the desired value. Checked in the same transaction as the update. A conflict returns 409 deploy_settings_conflict with field names, without setting values. Cannot be combined with environment edits or other app fields. Ordinary updates can omit this object.",
        "properties": {
          "expected_app_id": {
            "type": "string",
            "minLength": 1,
            "description": "Exact app ID returned by the app read."
          },
          "expected_deployment_id": {
            "type": "string",
            "minLength": 1,
            "description": "Exact accepted deployment being recovered."
          },
          "expected_settings": {
            "type": "object",
            "minProperties": 1,
            "maxProperties": 13,
            "propertyNames": {
              "enum": [
                "execution_mode",
                "restart_policy",
                "startup_deadline_s",
                "max_retries",
                "request_timeout_s",
                "stop_grace_period_s",
                "stop_signal",
                "service_replicas",
                "worker_replicas",
                "after_restore",
                "before_checkpoint",
                "scaling_policy",
                "retry_policy"
              ]
            },
            "additionalProperties": {},
            "description": "Observed values from the app read; null represents an unset optional policy. Must cover every mutated setting."
          }
        }
      },
      "UpdateAppRequest": {
        "description": "Partial update — every field is optional; omitted fields are unchanged.",
        "type": "object",
        "properties": {
          "deploy_settings_condition": {
            "$ref": "#/components/schemas/AppDeploySettingsCondition"
          },
          "profiling": {
            "$ref": "#/components/schemas/ProfilingConfig"
          },
          "tracing": {
            "$ref": "#/components/schemas/TracingConfig"
          },
          "visibility": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "public",
              "internal",
              null
            ],
            "description": "Change the app's public edge exposure. Omit for no change; internal visibility is available on every plan."
          },
          "allowed_service_callers": {
            "type": [
              "array",
              "null"
            ],
            "maxItems": 100,
            "items": {
              "type": "string"
            },
            "description": "Standalone target policy. Omit to keep unchanged, [] to deny all, an array to replace, or null to restore same-account access. Project-managed and preview apps reject this PATCH."
          },
          "allowed_service_call_scopes": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ServiceCallerScopes"
              },
              {
                "type": "null"
              }
            ],
            "description": "Replace standalone target-side per-caller method/path grants. Omit to keep unchanged, null to clear, or an object (including {}) to replace. Project-managed and preview apps reject this PATCH."
          },
          "service_binding_targets": {
            "type": [
              "array",
              "null"
            ],
            "maxItems": 100,
            "items": {
              "type": "string"
            },
            "description": "Replace standalone outbound target app slugs. Omit or null to keep unchanged; [] clears all bindings. Project-managed and preview apps reject non-null changes."
          },
          "service_reliability": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ServiceReliabilityPolicies"
              },
              {
                "type": "null"
              }
            ],
            "description": "Replace standalone dependency timeout and retry policies. Omit to keep unchanged; null or {} clears. Project-managed and preview apps reject this PATCH."
          },
          "service_binding_policy": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "account",
              "declared",
              null
            ],
            "description": "Set standalone caller authorization. Omit or null to keep unchanged; account restores same-account reachability; declared enforces the bound target list. Project-managed and preview apps reject non-null changes."
          },
          "service_binding_transport": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "http",
              "https",
              null
            ],
            "description": "Set standalone canonical service URL scheme. Omit or null to keep unchanged; http restores the legacy endpoint and https selects the private `.internal` alias. Project-managed and preview apps reject non-null changes."
          },
          "ram_mb": {
            "type": [
              "integer",
              "null"
            ],
            "example": 256
          },
          "cpu_millicores": {
            "type": [
              "integer",
              "null"
            ],
            "enum": [
              250,
              500,
              1000,
              null
            ],
            "description": "Sustained CPU allowance per instance. Omit for no change."
          },
          "resource_profile": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ResourceProfile"
              },
              {
                "type": "null"
              }
            ],
            "description": "Named memory/CPU profile. Omit for no change; explicit ram_mb or cpu_millicores must agree with the selected profile."
          },
          "idle_timeout_s": {
            "type": [
              "integer",
              "null"
            ]
          },
          "max_concurrency": {
            "type": [
              "integer",
              "null"
            ]
          },
          "execution_mode": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "request",
              "service",
              "worker",
              "job",
              null
            ],
            "description": "Lifecycle contract for the app. Omit for no change; service/worker/job are plan-gated.",
            "example": "service"
          },
          "restart_policy": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "no",
              "on-failure",
              "always",
              "unless-stopped",
              null
            ],
            "description": "Restart behavior for the workload. Omit for no change.",
            "example": "always"
          },
          "after_restore": {
            "$ref": "#/components/schemas/AfterRestoreHook",
            "description": "Set a restore callback for request or service apps. Omit to preserve; an empty object clears it."
          },
          "before_checkpoint": {
            "$ref": "#/components/schemas/BeforeCheckpointHook",
            "description": "Set a terminal init snapshot callback for request or service apps. Omit to preserve; an empty object clears it."
          },
          "pause": {
            "type": "string",
            "enum": [
              "between_requests",
              "when_idle",
              "never",
              ""
            ],
            "description": "When the platform may pause the app's VM: between_requests pauses it between requests and freezes it at the idle timeout, when_idle freezes it at the idle timeout, never parks it as before. Omitted uses the default: between_requests for functions, when_idle for request-mode apps. Worker, service and job execution modes accept only never. Omit to preserve; an empty string restores the default.",
            "example": "never"
          },
          "startup_deadline_s": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "description": "Upper bound on time-to-ready in seconds. Omit for no change; 0 uses the plan default.",
            "example": 30
          },
          "stop_grace_period_s": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "description": "Upper bound on worker or service shutdown draining time in seconds before SIGKILL. Omit for no change; 0 uses the mode/plan default.",
            "example": 30
          },
          "stop_signal": {
            "type": [
              "string",
              "null"
            ],
            "description": "Signal sent to initiate graceful stop (e.g. SIGTERM, SIGINT, SIGQUIT, SIGHUP, SIGUSR1, SIGUSR2). Omit for no change.",
            "example": "SIGTERM"
          },
          "max_retries": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "description": "Maximum consecutive restart attempts. Omit for no change; 0 uses the plan default.",
            "example": 5
          },
          "retry_policy": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/RetryPolicyDTO"
              },
              {
                "type": "null"
              }
            ],
            "description": "Replace the app-level invocation retry default. Omit for no change; an empty object clears it."
          },
          "request_timeout_s": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 30,
            "description": "Per-app request wall-clock timeout in seconds. 0 inherits the plan/type default."
          },
          "function_concurrency": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 80,
            "description": "Changes how many requests one Node or Python function worker serves at once. 0 or 1 restores one request per worker; capped by the plan's concurrency_per_vm. Existing functions pick up the change on their next deploy."
          },
          "function_callables": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": {
              "type": "string"
            },
            "description": "Replaces the names a function's typed client may call and their app slugs; {} clears them. Takes effect on the next deploy as GREGALE_FUNCTIONS. Function apps only."
          },
          "function_input_schema": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true,
            "description": "Replaces the JSON Schema an SDK functions client's calls to this function are checked against; {} clears it. Takes effect on the next deploy. Function apps only."
          },
          "request_rate_limit_rps": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "description": "Runtime override for the app-wide edge rate-limit refill rate. 0 restores the plan default; positive values may only tighten the plan ceiling. Does not create a deployment."
          },
          "request_rate_limit_burst": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "description": "Runtime override for the app-wide edge rate-limit burst capacity. 0 restores the plan default; positive values may only tighten the plan ceiling. Does not create a deployment."
          },
          "service_replicas": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ServiceReplicas"
              }
            ],
            "description": "Full replacement of the service replica policy. Omit for no change."
          },
          "worker_replicas": {
            "allOf": [
              {
                "$ref": "#/components/schemas/WorkerScaling"
              }
            ],
            "description": "Full replacement of the worker replica scaling policy. Omit for no change."
          },
          "ports": {
            "type": [
              "array",
              "null"
            ],
            "maxItems": 16,
            "description": "Replace the app-owned listener declaration. Omit for no change; an empty array clears it. Named TCP listeners use the `<slug>--port-<name>.<domain>` hostname form; UDP remains guest-only.",
            "items": {
              "$ref": "#/components/schemas/WorkloadPort"
            }
          },
          "favicon": {
            "type": [
              "string",
              "null"
            ],
            "format": "byte",
            "maxLength": 43692,
            "description": "Replace the per-app base64-encoded favicon; an empty value clears it. Omit for no change."
          },
          "robots_txt": {
            "type": [
              "string",
              "null"
            ],
            "description": "Replace the per-app robots.txt body; an empty value restores the allow-all default. Omit for no change."
          },
          "head_wakes": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Opt into waking a parked app for HEAD /. Omit for no change."
          },
          "crawler_policy": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "wake",
              "cached",
              "block",
              null
            ],
            "description": "Policy for known monitor/crawler requests. Omit for no change."
          },
          "pre_auth_rate_limit": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PreAuthRateLimitConfig"
              },
              {
                "type": "null"
              }
            ],
            "description": "Replace the pre-auth source limit; set mode=off to disable. Omit or send null for no change."
          },
          "health_path": {
            "type": [
              "string",
              "null"
            ],
            "description": "Monitor-facing health path. Omit for no change; empty resets to /healthz."
          },
          "health_path_wakes": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Allow health probes to wake the app. Omit for no change; Pro/Scale only when true."
          },
          "session_affinity": {
            "description": "Toggle best-effort cookie-based routing to the same running instance. Omit for no change.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "version_affinity_cookie": {
            "description": "Replace the rollout-affinity cookie name; an empty string disables it. Omit for no change.",
            "type": [
              "string",
              "null"
            ]
          },
          "version_affinity_managed_cookie": {
            "description": "Toggle edge-issued rollout-affinity cookie. Mutually exclusive with version_affinity_cookie; omit for no change.",
            "type": [
              "boolean",
              "null"
            ]
          },
          "revision_pin_ttl_seconds": {
            "description": "Set the revision pin window in seconds; zero disables future retention. Omit for no change.",
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 604800
          },
          "release_policy": {
            "description": "Set the default rollout for production releases. Omit for no change.",
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "safe",
              "fast",
              "immediate",
              null
            ]
          },
          "release_probe_paths": {
            "description": "Replace the paths the default rollout probe checks. An empty list restores /. Omit for no change.",
            "type": [
              "array",
              "null"
            ],
            "maxItems": 3,
            "items": {
              "type": "string",
              "maxLength": 240,
              "pattern": "^/"
            }
          },
          "min_instances": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "egress_allowlist": {
            "description": "v4 or v6 CIDR allowlist; empty array clears to chain-default-accept.",
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[0-9a-fA-F:./]+$",
              "example": "1.2.3.0/24"
            }
          },
          "egress_ports": {
            "description": "Replaces the app's extra TCP egress ports. Pro and Scale only, capped per plan. SMTP, remote-administration, SMB, IRC, well-known mining and DNS ports are refused; 80 and 443 are always allowed and are dropped from the stored list. An empty array clears the extra ports.",
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 65535,
              "example": 5432
            }
          },
          "autoscale_target_rps": {
            "description": "Per-instance RPS target for the reactive scale-up trigger. 0 = disable. Hobby/Pro/Scale only. Values < 0 are 422 invalid_autoscale_target_rps.",
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "example": 50
          },
          "autoscale_target_cpu_pct": {
            "description": "Per-instance CPU% target (1..100, 0 = disable) for the reactive scale-up trigger. Pro/Scale only. Values outside [1, 100] (other than 0) are 422 invalid_autoscale_target_cpu_pct.",
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 100,
            "example": 70
          },
          "streaming_enabled": {
            "description": "Per-app streaming flag. Omitted → no change. Free PATCHing true is 403 plan_streaming_not_allowed.",
            "type": [
              "boolean",
              "null"
            ],
            "example": false
          },
          "websocket_enabled": {
            "description": "Per-app raw-bytes Upgrade bridge flag. Omitted → no change. Free PATCHing true is 403 plan_websocket_not_allowed.",
            "type": [
              "boolean",
              "null"
            ],
            "example": false
          },
          "route_metrics_enabled": {
            "description": "Per-app per-route observability flag. Omitted → no change. Free PATCHing true is 403 plan_route_metrics_not_allowed.",
            "type": [
              "boolean",
              "null"
            ],
            "example": false
          },
          "only_allow_declared_routes": {
            "description": "Enable or disable gateway-side rejection of paths not declared by the app. Enabling requires declared_routes or an imported OpenAPI document.",
            "type": [
              "boolean",
              "null"
            ],
            "example": true
          },
          "declared_routes": {
            "description": "Replace the explicit route contract. An empty array clears it and makes the gateway use the imported OpenAPI document.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeclaredRoute"
            }
          },
          "maintenance_mode": {
            "description": "Coarse per-app maintenance toggle. Omitted → no change. PATCH true pins the app for maintenance (every request 503 + Retry-After); PATCH false restores normal handling. Free-tier allowed; no plan gate. The apps_maintenance_mode_notify trigger fires pg_notify on flip.",
            "type": [
              "boolean",
              "null"
            ],
            "example": false
          },
          "app_protocol": {
            "description": "Per-app wire-protocol selector. Closed set {http1, http2, grpc}. Omit for no change; set explicitly to opt in (http2/grpc) or reset to 'http1'. Free customers PATCHing 'grpc' are rejected with 403 plan_app_protocol_grpc_not_allowed.",
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "http1",
              "http2",
              "grpc"
            ],
            "example": "http1"
          },
          "scaling_policy": {
            "description": "Per-app scaling policy. Omitted → no change. Non-null → atomic full-overwrite of the jsonb column.",
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ScalingPolicy"
              }
            ]
          },
          "require_signed": {
            "description": "DEPRECATED on this surface. The customer PATCH /v1/apps/{slug} endpoint silently drops require_signed; the operator endpoint PATCH /v1/apps/{slug}/security is the only path that flips the flag. The field is parsed for backwards compatibility but never persisted from this endpoint.",
            "type": [
              "boolean",
              "null"
            ],
            "example": false
          },
          "warm_snapshot_enabled": {
            "description": "Per-app two-tier snapshot flag. Omitted → no change. PATCH-true on Free/Hobby is rejected with 403 plan_warm_snapshot_not_allowed.",
            "type": [
              "boolean",
              "null"
            ],
            "example": true
          },
          "warm_snapshot_min_requests": {
            "description": "Per-app request-count threshold for warm-tier capture. Range [1, 100]. Omitted → no change.",
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 100,
            "example": 5
          },
          "warm_snapshot_min_ms": {
            "description": "Per-app time-since-first-ready threshold for warm-tier capture, milliseconds. Range [100, 60000]. Omitted → no change.",
            "type": [
              "integer",
              "null"
            ],
            "minimum": 100,
            "maximum": 60000,
            "example": 2000
          },
          "warm_pool_size": {
            "description": "Desired paused warm-pool size. Omitted → no change; zero explicitly disables the pool. Non-zero values require Hobby+ and may not exceed max_concurrency.",
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "example": 0
          },
          "eviction_priority": {
            "description": "Per-app eviction tier. 'best_effort' (default) keeps the pre-#475 LRU-by-last_request_at reaper behaviour; 'reserved' protects the app from cross-account RAM-pressure eviction (every best_effort candidate is drained before any reserved is parked). Plan-gated upstream: Free PATCH 'reserved' returns 402 plan_eviction_priority_reserved_not_allowed. Per-account cap (Hobby 1, Pro 2, Scale 4): 422 plan_eviction_priority_reserved_quota when exhausted. Omitted → no change.",
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "best_effort",
              "reserved",
              null
            ],
            "example": "best_effort"
          },
          "require_authn": {
            "description": "Per-deployment token-gate flag. Omitted → no change. PATCH-true on Free/Hobby is rejected with 403 plan_require_authn_not_allowed.",
            "type": [
              "boolean",
              "null"
            ],
            "example": false
          },
          "consumer_auth_mode": {
            "description": "End-customer credential policy for this app. Omit for no change; optional accepts anonymous requests, required mandates a valid consumer key.",
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "optional",
              "required",
              null
            ],
            "example": "required"
          },
          "platform_tenant_required": {
            "description": "Require verified platform tenant identity on app traffic. Omit for no change; true requires a linked consumer key, verified tenant surface, or opted-in JWT rule. Available on Hobby and above.",
            "type": [
              "boolean",
              "null"
            ],
            "example": true
          },
          "public_auth": {
            "description": "Per-app public-URL auth configuration. Omitted → no change. When present, mode is the closed enum {open, bearer, basic}; basic_user + basic_pass are required when mode='basic' and the API seal step encrypts them under the APP_BASIC_AUTH secretbox namespace before persistence.",
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/PublicAuthBlock"
              }
            ]
          },
          "overflow_node": {
            "description": "Per-app preferred spill target for cross-node pressure rebalance. Wire form is the human-readable compute_nodes.name; the API resolves to UUID server-side. Tri-state: omitted → no change; empty string → clear (back to A9 fallback); non-empty → resolve name → UUID via Store.ComputeNodeByName and persist the UUID. 404 on unknown name; 422 on inactive node.",
            "type": [
              "string",
              "null"
            ],
            "example": "box-eu-1"
          },
          "cors_default_enabled": {
            "type": [
              "boolean",
              "null"
            ],
            "example": true
          },
          "cors_default_origins": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "https://*.example.com"
            ]
          },
          "expected_service_binding_fingerprint": {
            "type": "string",
            "minLength": 64,
            "maxLength": 64,
            "pattern": "^[a-f0-9]{64}$",
            "description": "Apply only if the locked app service settings still match this fingerprint. Supported only for app-level service-only updates; returns 409 on conflict. Omit for the existing unguarded behavior."
          }
        }
      },
      "RenameAppRequest": {
        "description": "Rename payload: new slug. Old slug returns 404 immediately on the next request.",
        "type": "object",
        "required": [
          "new_slug"
        ],
        "properties": {
          "new_slug": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{1,38})[a-z0-9]$",
            "not": {
              "pattern": "^tag-"
            },
            "minLength": 3,
            "maxLength": 40,
            "example": "hello-world-v2",
            "description": "App slugs beginning with tag- are reserved for deployment-alias hostnames."
          }
        }
      },
      "RaiseOverageCapRequest": {
        "description": "Spend-cap payload. *int64 so a missing/null\nfield round-trips as NULL (no cap). 0 is a valid write and\nmeans \"no overage allowed\". Negative values are rejected at\nthe validator before reaching the store (the migration CHECK\nat accounts/00049 is the storage-layer enforcement).\n",
        "type": "object",
        "required": [
          "overage_cap_cents"
        ],
        "properties": {
          "overage_cap_cents": {
            "oneOf": [
              {
                "type": "integer",
                "minimum": 0,
                "description": "Set the monthly ceiling to N cents. 0 = no overage allowed."
              },
              {
                "type": "null",
                "description": "Clear the cap (NULL on the column)."
              }
            ],
            "description": "Cents-per-month ceiling, or null to clear."
          }
        }
      },
      "ScalingPolicy": {
        "description": "Per-app autoscaling configuration. Mirrors the on-disk jsonb column `apps.scaling_policy`. Empty values map to the engine default (the API gate is load-bearing for the floor / ceiling, not the encoder).",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "min_instances": {
            "description": "Per-app cold-wake floor. 0 = scale to zero (default). Available on Hobby and above. Free → 403 plan_min_instances_not_allowed.",
            "type": "integer",
            "minimum": 0,
            "example": 1
          },
          "max_instances": {
            "description": "Per-app ceiling on live instances. Must be in [min_instances, plan.MaxConcurrency]. Available on Hobby and above. Free → 403 plan_max_instances_not_allowed. 0 = use plan max_concurrency.",
            "type": "integer",
            "minimum": 0,
            "example": 5
          },
          "target": {
            "description": "Single-signal form, superseded by `targets` and still accepted: it is read as a one-element list. Closed metric set: rps | cpu | concurrent_requests | queue_depth. queue_depth is a per-worker backlog budget and is valid for job/worker apps. Empty/null = engine falls back to the legacy autoscale_target_rps / autoscale_target_cpu_pct columns. Worker-class apps reject concurrent_requests with 422 scaling_target_incompatible_with_workload_class (carve-out). Mutually exclusive with `targets` — setting both is 422.",
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ScalingTarget"
              }
            ]
          },
          "targets": {
            "description": "Multi-signal autoscaling. Each entry states how much load ONE instance should carry on that metric; the platform evaluates every entry independently and provisions for the largest resulting instance count. The combination rule, the windowing and the cooldowns are platform policy and are not configurable per metric — declaring the signals is the whole surface. Each metric may appear at most once, every value must be > 0, and cpu is a percentage capped at 100. Mutually exclusive with `target`.",
            "type": "array",
            "minItems": 1,
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/ScalingTarget"
            },
            "example": [
              {
                "metric": "concurrent_requests",
                "value": 80
              },
              {
                "metric": "cpu",
                "value": 70
              }
            ]
          },
          "scale_out_cooldown_s": {
            "description": "Minimum seconds between two scale-out events. Floor 1 (no 0 traps); ceiling 3600 (1 h). Out-of-range → 422 invalid_cooldown.",
            "type": "integer",
            "minimum": 1,
            "maximum": 3600,
            "example": 5
          },
          "scale_in_cooldown_s": {
            "description": "Minimum seconds between two scale-in events. Floor 5 (matches the reaper's 5 s idle window); ceiling 86400 (1 day). Out-of-range → 422 invalid_cooldown.",
            "type": "integer",
            "minimum": 5,
            "maximum": 86400,
            "example": 60
          },
          "concurrency_overflow": {
            "description": "Behavior when the app concurrency boundary is saturated. queue waits up to max_queue_wait_ms; drop returns 429 immediately. Empty uses queue.",
            "type": "string",
            "enum": [
              "queue",
              "drop"
            ],
            "example": "queue"
          },
          "max_queue_wait_ms": {
            "description": "Maximum admission wait in milliseconds. 0 uses the plan default; capped at 120000.",
            "type": "integer",
            "minimum": 0,
            "maximum": 120000,
            "example": 5000
          },
          "max_queue_depth": {
            "description": "Per-app warm saturation waiter cap. 0 uses the plan default; positive values are plan-capped. This is independent from the cold-wake queue.",
            "type": "integer",
            "minimum": 0,
            "example": 64
          },
          "wake_max_queue_depth": {
            "description": "Per-app cold-wake waiter cap. 0 uses the plan default; positive values are capped at 8x the plan default.",
            "type": "integer",
            "minimum": 0,
            "example": 32
          },
          "wake_max_queue_wait_seconds": {
            "description": "Per-app cold-wake wait budget in seconds. 0 uses the plan default; capped at 60 seconds.",
            "type": "integer",
            "minimum": 0,
            "maximum": 60,
            "example": 30
          },
          "per_instance_concurrency": {
            "description": "Requests one instance serves at once. The gateway admits at most this many to an instance and scales out on the next request; requests over every instance's limit wait in the warm queue (30 s unless max_queue_wait_ms is set). 0 uses the plan's concurrency_per_vm, which is also the upper bound.",
            "type": "integer",
            "minimum": 0,
            "example": 2
          },
          "timezone": {
            "description": "IANA timezone every schedule's cron expression is evaluated in. Empty means UTC. One zone per app rather than one per schedule: a business has a working day, not a working day per rule.",
            "type": "string",
            "example": "Europe/Istanbul"
          },
          "schedules": {
            "description": "Recurring windows that raise the warm floor. Each entry is a cron fire plus a duration; while the window is open the app's min_instances is at least the entry's value, and outside every window the app falls back to min_instances and parks. Schedules only ever RAISE the floor — they cannot lower one and cannot cap max_instances, because a rule that only adds capacity cannot take an app down. Overlapping windows take the maximum, so list order carries no meaning. Every schedule's min_instances counts toward the plan gate and the per-plan min_instances cap.",
            "type": "array",
            "minItems": 1,
            "maxItems": 12,
            "items": {
              "$ref": "#/components/schemas/ScalingSchedule"
            },
            "example": [
              {
                "cron": "0 8 * * 1-5",
                "duration_s": 43200,
                "min_instances": 3
              }
            ]
          }
        }
      },
      "PublicAuthBlock": {
        "description": "Per-app public-URL auth write shape. Sent on PATCH /v1/apps/{slug}; the API seals the basic_user + basic_pass into a single APP_BASIC_AUTH secretbox blob before persistence. The plaintext is never echoed on read (see PublicAuthStatus). For mode='ip_allowlist', ip_allowlist carries the per-app CIDR allowlist (Pro 16 max, Scale 64 max — Free/Hobby → 403 plan_public_auth_ip_allowlist_not_allowed).",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "mode"
        ],
        "properties": {
          "mode": {
            "description": "Auth mode (closed set). 'open' is the pre-#477 default (every request passes). 'bearer' requires Authorization: Bearer (Hobby+; 402 on Free). 'basic' requires HTTP Basic auth with sealed credentials (Pro+; 402 on Free/Hobby). 'ip_allowlist' restricts the app to requests originating from a client IP inside the per-app CIDR allowlist (Pro+; 402 on Free/Hobby). 'internal_only' restricts the app to requests carrying an Authorization: Bearer JWT with aud='gregale.internal' signed by a Gregale daemon's Ed25519 key (per-service public-key allowlist is operator-side; available on all plans). Unknown values → 422 invalid_public_auth_mode.",
            "type": "string",
            "enum": [
              "open",
              "bearer",
              "basic",
              "ip_allowlist",
              "internal_only"
            ],
            "example": "basic"
          },
          "basic_user": {
            "description": "Basic-auth username (RFC 7617 §2). Plaintext at PATCH time; sealed into apps.public_auth_basic under the APP_BASIC_AUTH secretbox namespace. Required when mode='basic'; ignored otherwise. Range [1, 128] bytes after TrimSpace.",
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "example": "editor"
          },
          "basic_pass": {
            "description": "Basic-auth password (RFC 7617 §2). Plaintext at PATCH time; sealed alongside basic_user under the APP_BASIC_AUTH secretbox namespace. Required when mode='basic'; ignored otherwise. Range [1, 256] bytes.",
            "type": "string",
            "format": "password",
            "minLength": 1,
            "maxLength": 256,
            "example": "hunter2"
          },
          "ip_allowlist": {
            "description": "Per-app ingress CIDR allowlist. Required when mode='ip_allowlist' (must be non-empty). Each entry is an RFC 4632 CIDR (e.g. '10.0.0.0/8' or '2001:db8::/32'); masklen /0 is rejected at the wire and by the apps_public_auth_ip_allowlist_cidr trigger. v4-mapped-v6 prefixes are rejected at the handler. After canonicalisation, the cap is plan.PublicAuthIPAllowlistMaxEntries (Pro 16, Scale 64). On the audit row, only the entry count is recorded — never the CIDR strings.",
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "pattern": "^([0-9a-fA-F:]+|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)/[0-9]+$"
            },
            "example": [
              "10.0.0.0/8",
              "2001:db8::/32"
            ]
          }
        }
      },
      "PublicAuthStatus": {
        "description": "Read-only per-app public-URL auth shape on AppResponse. Mirrors the row contents without the plaintext credentials. The redaction posture is a load-bearing invariant — 're-redaction invariant': neither basic_user nor basic_pass is EVER returned on the wire, even when mode='basic'. To rotate credentials, the customer PATCHes a fresh public_auth block.",
        "type": "object",
        "required": [
          "mode",
          "has_basic_creds"
        ],
        "properties": {
          "mode": {
            "description": "Active auth mode. One of 'open', 'bearer', 'basic', 'ip_allowlist', 'internal_only'. Matches apps.public_auth_mode on disk; a PATCH 'open' cleared any prior sealed blob so a stale secretbox row never reaches a fresh request. 'internal_only' requires an Authorization: Bearer JWT with aud='gregale.internal' signed by a Gregale daemon's Ed25519 key — see PublicAuthBlock.mode for the write-side description.",
            "type": "string",
            "enum": [
              "open",
              "bearer",
              "basic",
              "ip_allowlist",
              "internal_only"
            ],
            "example": "basic"
          },
          "has_basic_creds": {
            "description": "True iff the row carries a non-null apps.public_auth_basic blob (i.e. mode='basic' with credentials). A mode='basic' row without creds would 401 every request — has_basic_creds is the operator-greppable signal that the seal succeeded.",
            "type": "boolean",
            "example": true
          },
          "ip_allowlist_entry_count": {
            "description": "Integer count of CIDRs in apps.public_auth_ip_allowlist. Returned (not the CIDR strings themselves) so the dashboard can show 'app X has 3 CIDRs configured' without leaking the partner-customer ranges. Always 0 when mode != 'ip_allowlist'.",
            "type": "integer",
            "minimum": 0,
            "maximum": 64,
            "example": 3
          }
        }
      },
      "ScalingSchedule": {
        "description": "One recurring window that raises the warm floor. `cron` is a five-field expression evaluated in the policy's `timezone`; each fire opens a window of `duration_s` seconds during which the app's floor is at least `min_instances`. Cron expresses instants rather than intervals, so the duration is what makes a window — and it needs no special case for a window that crosses midnight.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "cron",
          "duration_s",
          "min_instances"
        ],
        "properties": {
          "cron": {
            "description": "Five-field cron expression (minute hour day-of-month month day-of-week), evaluated in the policy timezone.",
            "type": "string",
            "example": "0 8 * * 1-5"
          },
          "duration_s": {
            "description": "How long the window stays open after each fire, in seconds. Between 60 and 604800 (7 days). The floor of 60 s exists because the scheduler sweep is coarser than that, so a shorter window could close before any tick observed it — billing a floor that never produced an instance.",
            "type": "integer",
            "minimum": 60,
            "maximum": 604800,
            "example": 43200
          },
          "min_instances": {
            "description": "Warm floor while the window is open. Must be > 0: a schedule raises the floor and cannot lower it.",
            "type": "integer",
            "minimum": 1,
            "example": 3
          }
        }
      },
      "CustomMetricRequest": {
        "description": "Push body. The metric name travels in the URL path, so the body carries only the number that varies — which is what makes the push idempotent by construction.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "value"
        ],
        "properties": {
          "value": {
            "description": "Fleet-total quantity one instance should carry. The scheduler computes ceil(value / target). Must be finite, >= 0, and <= 1e12; a larger reading is a broken producer, and without the bound one bad push would demand the plan cap's worth of instances on the very next tick.",
            "type": "number",
            "minimum": 0,
            "example": 1284
          }
        }
      },
      "CreateNotificationChannelRequest": {
        "description": "Adds a Slack, PagerDuty or email alert channel. Set only the fields for the chosen kind.",
        "type": "object",
        "required": [
          "name",
          "kind"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_-]{0,62}$",
            "description": "Unique per account.",
            "example": "ops-slack"
          },
          "kind": {
            "type": "string",
            "enum": [
              "slack",
              "pagerduty",
              "email"
            ],
            "description": "Destination type."
          },
          "slack_webhook_url": {
            "type": "string",
            "format": "uri",
            "description": "Slack incoming webhook, https://hooks.slack.com/services/… (kind slack)."
          },
          "pagerduty_routing_key": {
            "type": "string",
            "pattern": "^[A-Za-z0-9]{32}$",
            "description": "Events API v2 integration key (kind pagerduty)."
          },
          "pagerduty_region": {
            "type": "string",
            "enum": [
              "us",
              "eu"
            ],
            "default": "us",
            "description": "PagerDuty service region (kind pagerduty)."
          },
          "email": {
            "type": "string",
            "format": "email",
            "description": "The account's own email address (kind email)."
          }
        }
      },
      "UpdateNotificationChannelRequest": {
        "description": "Renames a channel or replaces its destination; set name, the channel's own destination, or both.",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_-]{0,62}$",
            "description": "New name, unique per account."
          },
          "slack_webhook_url": {
            "type": "string",
            "format": "uri",
            "description": "New Slack incoming webhook (kind slack)."
          },
          "pagerduty_routing_key": {
            "type": "string",
            "pattern": "^[A-Za-z0-9]{32}$",
            "description": "New Events API v2 integration key (kind pagerduty)."
          },
          "pagerduty_region": {
            "type": "string",
            "enum": [
              "us",
              "eu"
            ],
            "description": "PagerDuty service region of the new key (kind pagerduty); default us."
          }
        }
      },
      "NotificationChannelResponse": {
        "description": "One alert notification channel.",
        "type": "object",
        "required": [
          "id",
          "name",
          "kind",
          "target",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "example": "ops-slack"
          },
          "kind": {
            "type": "string",
            "enum": [
              "slack",
              "pagerduty",
              "email"
            ]
          },
          "target": {
            "type": "string",
            "description": "Non-secret hint: Slack workspace and hook ids, the routing key last four characters, or the email address."
          },
          "pagerduty_region": {
            "type": "string",
            "enum": [
              "us",
              "eu"
            ],
            "description": "Region of a PagerDuty channel."
          },
          "last_delivered_at": {
            "type": "string",
            "format": "date-time",
            "description": "Last successful delivery or test."
          },
          "last_error": {
            "type": "string",
            "description": "Most recent delivery error, if any."
          },
          "last_error_at": {
            "type": "string",
            "format": "date-time",
            "description": "When last_error occurred."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "TestNotificationChannelResponse": {
        "description": "Outcome of a test notification.",
        "type": "object",
        "required": [
          "delivered"
        ],
        "properties": {
          "delivered": {
            "type": "boolean",
            "description": "Whether the destination accepted the test."
          },
          "error": {
            "type": "string",
            "description": "Why delivery failed, when it did."
          }
        }
      },
      "CreateSLORequest": {
        "description": "Defines a customer SLO on an app.",
        "type": "object",
        "required": [
          "name",
          "sli",
          "objective_pct",
          "window_days"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_-]{0,62}$",
            "description": "Unique per app; lowercase letters, digits, dashes and underscores.",
            "example": "checkout-latency"
          },
          "sli": {
            "type": "string",
            "enum": [
              "availability",
              "latency"
            ],
            "description": "availability counts non-5xx responses among 2xx and 5xx; latency counts requests completing within latency_threshold_ms."
          },
          "latency_threshold_ms": {
            "type": "integer",
            "enum": [
              5,
              10,
              25,
              50,
              100,
              250,
              500,
              1000,
              2000,
              5000,
              10000
            ],
            "description": "Required for the latency SLI and rejected otherwise; one of the gateway histogram bucket bounds."
          },
          "objective_pct": {
            "type": "number",
            "format": "double",
            "minimum": 90,
            "maximum": 99.99,
            "description": "Target share of good requests, as a percentage with at most two decimals.",
            "example": 99.9
          },
          "window_days": {
            "type": "integer",
            "enum": [
              7,
              30
            ],
            "description": "Rolling window over which the error budget is measured."
          }
        }
      },
      "SLOResponse": {
        "description": "One customer-defined SLO.",
        "type": "object",
        "required": [
          "id",
          "name",
          "sli",
          "objective_pct",
          "window_days",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "example": "checkout-latency"
          },
          "sli": {
            "type": "string",
            "enum": [
              "availability",
              "latency"
            ]
          },
          "latency_threshold_ms": {
            "type": "integer",
            "description": "Threshold for a latency SLO; absent for availability."
          },
          "objective_pct": {
            "type": "number",
            "format": "double",
            "example": 99.9
          },
          "window_days": {
            "type": "integer",
            "enum": [
              7,
              30
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "$ref": "#/components/schemas/SLOStatus"
          }
        }
      },
      "SLOStatus": {
        "description": "Error-budget position of one SLO, returned by GET /v1/apps/{slug}/slos/{id}.",
        "type": "object",
        "required": [
          "window_start",
          "hours_recorded",
          "hours_expected",
          "good",
          "total",
          "attainment_pct",
          "budget_remaining_pct",
          "burn_rate_1h",
          "burn_rate_6h",
          "source"
        ],
        "properties": {
          "window_start": {
            "type": "string",
            "format": "date-time",
            "description": "Start of the rolling window: the later of window_days ago and the hour the SLO was created."
          },
          "hours_recorded": {
            "type": "integer",
            "description": "Completed hours the metering service has recorded in the window."
          },
          "hours_expected": {
            "type": "integer",
            "description": "Completed hours in the window; fewer recorded hours means history is still being backfilled or was lost."
          },
          "good": {
            "type": "integer",
            "format": "int64",
            "description": "Requests that met the SLI in the recorded hours."
          },
          "total": {
            "type": "integer",
            "format": "int64",
            "description": "Requests the SLI counted in the recorded hours."
          },
          "attainment_pct": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "good / total as a percentage; null when the window had no requests."
          },
          "budget_remaining_pct": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Share of the error budget left: 100 when nothing failed, 0 when it is spent, negative once the objective is missed."
          },
          "burn_rate_1h": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Budget burn over the last hour, live from Prometheus: 1 spends exactly the budget over the window."
          },
          "burn_rate_6h": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Budget burn over the last six hours, live from Prometheus."
          },
          "source": {
            "type": "string",
            "description": "prometheus, or degraded: <reason> when budget history or burn rates are unavailable."
          }
        }
      },
      "CreateSyntheticCheckRequest": {
        "description": "Defines a scheduled HTTP check against the app.",
        "type": "object",
        "required": [
          "name",
          "path",
          "interval_seconds"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_-]{0,62}$",
            "description": "Unique per app.",
            "example": "health"
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "HEAD"
            ],
            "default": "GET",
            "description": "HTTP method of the probe."
          },
          "path": {
            "type": "string",
            "maxLength": 512,
            "pattern": "^/([^/\\s\\\\][^\\s\\\\]*)?$",
            "description": "Origin-relative path, query string allowed. The host is always the app's own default hostname.",
            "example": "/healthz"
          },
          "expected_status": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599,
            "description": "Exact status that counts as success; omit to accept any 2xx. Redirects are not followed."
          },
          "timeout_ms": {
            "type": "integer",
            "minimum": 1000,
            "maximum": 30000,
            "default": 10000,
            "description": "Whole-request timeout, including any wake of a parked app."
          },
          "interval_seconds": {
            "type": "integer",
            "enum": [
              300,
              900,
              3600
            ],
            "description": "How often the check runs. Five minutes is the floor so a check never keeps an app permanently awake."
          }
        }
      },
      "UpdateSyntheticCheckRequest": {
        "description": "Pauses or resumes a synthetic check.",
        "type": "object",
        "required": [
          "enabled"
        ],
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "false pauses the check; true resumes it."
          }
        }
      },
      "SyntheticCheckResponse": {
        "description": "One synthetic check definition.",
        "type": "object",
        "required": [
          "id",
          "name",
          "method",
          "path",
          "url",
          "timeout_ms",
          "interval_seconds",
          "enabled",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "example": "health"
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "HEAD"
            ]
          },
          "path": {
            "type": "string",
            "example": "/healthz"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "The full URL each probe requests."
          },
          "expected_status": {
            "type": "integer",
            "description": "Exact expected status; absent means any 2xx."
          },
          "timeout_ms": {
            "type": "integer"
          },
          "interval_seconds": {
            "type": "integer",
            "enum": [
              300,
              900,
              3600
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "results": {
            "$ref": "#/components/schemas/SyntheticCheckResults"
          }
        }
      },
      "SyntheticCheckResults": {
        "description": "Recent outcomes of one synthetic check, returned by GET /v1/apps/{slug}/synthetics/{id}.",
        "type": "object",
        "required": [
          "uptime_24h_pct",
          "uptime_7d_pct",
          "runs_24h",
          "p95_latency_ms_24h",
          "recent"
        ],
        "properties": {
          "uptime_24h_pct": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Share of runs in the last 24 hours that succeeded; null when none ran."
          },
          "uptime_7d_pct": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Share of runs in the last 7 days that succeeded; null when none ran."
          },
          "runs_24h": {
            "type": "integer",
            "format": "int64",
            "description": "Runs in the last 24 hours."
          },
          "p95_latency_ms_24h": {
            "type": "number",
            "format": "double",
            "description": "95th-percentile latency of successful runs in the last 24 hours, including any wake; 0 when none succeeded."
          },
          "recent": {
            "type": "array",
            "description": "The most recent runs, newest first (at most 20).",
            "items": {
              "$ref": "#/components/schemas/SyntheticCheckRun"
            }
          }
        }
      },
      "SyntheticCheckRun": {
        "description": "One synthetic check probe.",
        "type": "object",
        "required": [
          "started_at",
          "ok",
          "latency_ms"
        ],
        "properties": {
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "ok": {
            "type": "boolean"
          },
          "status_code": {
            "type": "integer",
            "description": "HTTP status received; absent when no response arrived."
          },
          "latency_ms": {
            "type": "integer"
          },
          "error_class": {
            "type": "string",
            "enum": [
              "status",
              "timeout",
              "dns",
              "connect",
              "tls",
              "other"
            ],
            "description": "Why the run failed; absent on success. status means a response arrived with an unexpected code."
          }
        }
      },
      "CustomMetricResponse": {
        "description": "One stored gauge.",
        "type": "object",
        "required": [
          "name",
          "value",
          "observed_at",
          "stale"
        ],
        "properties": {
          "name": {
            "type": "string",
            "example": "orders_pending"
          },
          "value": {
            "type": "number",
            "example": 1284
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "stale": {
            "description": "True when this row is older than the freshness window and is therefore NOT driving scaling. Computed server-side so the API and the scheduler cannot disagree about which rows count.",
            "type": "boolean"
          },
          "kind": {
            "type": "string",
            "enum": [
              "gauge",
              "counter"
            ],
            "description": "gauge for pushed values (a scaling signal); counter for OTLP cumulative sums, which never drive scaling."
          },
          "series": {
            "description": "A labelled metric's series. value is then their aggregate: the sum for counters, the maximum of fresh series for gauges. Absent for an unlabelled metric.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomMetricSeriesValue"
            }
          }
        },
        "example": {
          "name": "orders_pending",
          "value": 1284,
          "observed_at": "2026-09-21T12:00:00Z",
          "stale": false,
          "kind": "gauge"
        }
      },
      "CustomMetricSeriesValue": {
        "description": "One labelled series of a custom metric (from OTLP data point attributes).",
        "type": "object",
        "required": [
          "key",
          "labels",
          "value",
          "observed_at",
          "stale"
        ],
        "properties": {
          "key": {
            "type": "string",
            "description": "Canonical k=v,... form, keys sorted; pass it as labels to the history endpoint.",
            "example": "queue=emails"
          },
          "labels": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "example": {
              "queue": "emails"
            }
          },
          "value": {
            "type": "number"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "stale": {
            "type": "boolean"
          }
        }
      },
      "CustomMetricSeriesResponse": {
        "description": "History of one pushed custom metric. Degraded responses carry null points.",
        "type": "object",
        "required": [
          "app_id",
          "name",
          "kind",
          "range",
          "step",
          "source",
          "points"
        ],
        "properties": {
          "app_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "gauge",
              "counter"
            ],
            "description": "counter histories are a per-second rate of the cumulative count."
          },
          "labels": {
            "type": "string",
            "description": "The series key this history is for; absent for the metric's aggregate."
          },
          "range": {
            "type": "string",
            "enum": [
              "1h",
              "6h",
              "24h",
              "7d",
              "15d"
            ]
          },
          "step": {
            "type": "string",
            "description": "Prometheus step between points."
          },
          "source": {
            "type": "string",
            "description": "\"prometheus\", or \"degraded: <reason>\" when the metric history could not be read."
          },
          "points": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/CustomMetricSeriesPoint"
            }
          }
        }
      },
      "CustomMetricSeriesPoint": {
        "description": "One recorded custom metric value.",
        "type": "object",
        "required": [
          "at",
          "value"
        ],
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "value": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "CustomMetricListResponse": {
        "description": "The app's gauges, plus the two limits needed to interpret them so debugging does not require reading the docs.",
        "type": "object",
        "required": [
          "metrics",
          "freshness_seconds",
          "max_metrics"
        ],
        "properties": {
          "metrics": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomMetricResponse"
            }
          },
          "freshness_seconds": {
            "description": "A metric older than this reports no signal to the scheduler rather than its last value, so a dead pusher cannot pin the fleet at a frozen backlog.",
            "type": "integer",
            "example": 300
          },
          "max_metrics": {
            "description": "Maximum distinct metric names this app may hold (per plan).",
            "type": "integer",
            "example": 50
          },
          "max_series": {
            "description": "Maximum labelled series this app may hold across its metrics (per plan); each metric also holds at most 50.",
            "type": "integer",
            "example": 500
          }
        }
      },
      "MCPTaskHandlerCompatibility": {
        "description": "Outstanding task counts and live worker coverage for one tool and handler version.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "tool_name",
          "handler_version",
          "waiting_tasks",
          "live_compatible_workers"
        ],
        "properties": {
          "tool_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[!-~]{1,128}$"
          },
          "handler_version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[A-Za-z0-9._-]{1,64}$"
          },
          "waiting_tasks": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000000000
          },
          "live_compatible_workers": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000000000
          },
          "unknown_deployment_workers": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000000000,
            "description": "Workers whose deployment identity is not available yet, including workers from older starter versions."
          },
          "deployments": {
            "type": "array",
            "maxItems": 64,
            "description": "Per-deployment worker counts. A report contains at most 768 deployment entries overall; larger snapshots set truncated=true.",
            "items": {
              "$ref": "#/components/schemas/MCPTaskHandlerDeploymentWorkers"
            }
          }
        }
      },
      "MCPTaskHandlerDeploymentWorkers": {
        "description": "Compatible workers attributed to a specific serving deployment.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "deployment_id",
          "workers"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "workers": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000000000
          }
        }
      },
      "MCPTaskCompatibilityReportRequest": {
        "description": "Bounded aggregate handler inventory published by the task observer.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "handlers"
        ],
        "properties": {
          "handlers": {
            "type": "array",
            "maxItems": 256,
            "items": {
              "$ref": "#/components/schemas/MCPTaskHandlerCompatibility"
            }
          },
          "truncated": {
            "type": "boolean",
            "default": false
          }
        }
      },
      "MCPTaskCompatibilityReportResponse": {
        "description": "Latest observer inventory with platform timestamps and freshness state.",
        "type": "object",
        "required": [
          "published",
          "handlers",
          "truncated",
          "freshness_seconds",
          "stale"
        ],
        "properties": {
          "published": {
            "type": "boolean"
          },
          "handlers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MCPTaskHandlerCompatibility"
            }
          },
          "truncated": {
            "type": "boolean"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "freshness_seconds": {
            "type": "integer",
            "example": 45
          },
          "stale": {
            "type": "boolean"
          }
        }
      },
      "ScalingTarget": {
        "description": "(metric, value) pair the engine watches for the scale-up trigger. The metric surface is closed, and every member of it is backed by a live source and read by a scheduler trigger. `p99_latency_ms` was removed: it validated for releases with no latency source behind it, and is now rejected with 422 pointing at concurrent_requests. The unset state (null) is the legacy 'engine falls back to autoscale_target_rps' path.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "metric": {
            "description": "rps = per-instance requests/second. cpu = max per-instance CPU percent. concurrent_requests = max per-instance in-flight requests. queue_depth = fleet backlog budget per worker.",
            "type": "string",
            "enum": [
              "rps",
              "cpu",
              "concurrent_requests",
              "queue_depth"
            ],
            "example": "rps"
          },
          "name": {
            "description": "Which custom metric this target watches. Required when metric is `custom`, and REJECTED otherwise — a name on a platform-measured metric would be silently ignored, which is the accepted-but-inert shape this API keeps having to remove.",
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,62}$",
            "example": "orders_pending"
          },
          "labels": {
            "description": "custom targets only: watch the one labelled gauge series of the metric with exactly these labels instead of its aggregate. Keys match ^[a-z_][a-z0-9_]{0,62}$.",
            "type": "object",
            "maxProperties": 3,
            "additionalProperties": {
              "type": "string",
              "maxLength": 128
            }
          },
          "value": {
            "description": "Target value (units depend on Metric). Must be >= 0 in the singular `target` field for compatibility; inside `targets` it must be > 0. queue_depth requires a positive per-worker backlog budget, and cpu is capped at 100.",
            "type": "number",
            "minimum": 0,
            "example": 1
          }
        }
      },
      "AfterRestoreHook": {
        "description": "Optional loopback callback that must succeed after snapshot restore, or after a frozen instance resumes, before the instance becomes ready.",
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "Absolute path on the app's loopback HTTP listener. Called with POST after restore, before readiness.",
            "example": "/internal/after-restore"
          },
          "timeout_ms": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2000,
            "default": 500,
            "description": "Callback timeout in milliseconds; 0 uses the 500 ms default."
          },
          "identity": {
            "type": "string",
            "enum": [
              "reload"
            ],
            "description": "reload lets an environment branch wake from the parent deployment's credential-free capture instead of a cold boot; the callback then re-reads config and reconnects under the branch's identity. Omit to cold-boot branches."
          }
        }
      },
      "BeforeCheckpointHook": {
        "description": "Optional loopback callback for new terminal init snapshots. A failure aborts capture. Enabling it disables warm snapshots; snapshot reuse skips the callback.",
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "Absolute path on the app's loopback HTTP listener. Called with POST and X-Faas-Before-Checkpoint: 1 immediately before pausing the VM.",
            "example": "/internal/before-checkpoint"
          },
          "timeout_ms": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2000,
            "default": 500,
            "description": "Deadline for checkpoint response in milliseconds; 0 uses the 500 ms default."
          }
        }
      },
      "AppManifest": {
        "description": "App manifest: environment variables, build commands, working directory, healthcheck, user, and Dockerfile-as-source flag. The optional `env_secrets` field carries sealed-secret refs (\"secret:NAME\" strings) resolved by the host at wake time against the app_secrets table. Values are NEVER sealed ciphertext — only refs. widens the contract additively with `healthcheck`, `stop_signal`, `stop_grace_period` from the OCI image-config spec; old guest-init ignores unknown fields per JSON semantics, so the widen is wire-compatible. widens additively with `execution_mode`, `restart_policy`, `startup_deadline_s`, `max_retries`, and `service_replicas` — these govern the lifecycle contract (request vs service vs worker vs job) and the per-mode replica scaffold. Defaults preserve today's behaviour (execution_mode=request, restart_policy=on-failure).",
        "type": "object",
        "required": [
          "entrypoint"
        ],
        "properties": {
          "profiling": {
            "$ref": "#/components/schemas/ProfilingConfig"
          },
          "tracing": {
            "$ref": "#/components/schemas/TracingConfig"
          },
          "profiling_on_demand": {
            "type": "boolean",
            "description": "Dormant on-demand profile collectors stamped by the image service."
          },
          "entrypoint": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "minItems": 1
          },
          "env": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "env_secrets": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Env override via sealed-secret refs. Each value is \"secret:NAME\"; the host resolver looks up NAME against the app_secrets table at wake."
          },
          "working_dir": {
            "type": [
              "string",
              "null"
            ]
          },
          "port": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 65535
          },
          "service_binding_transport": {
            "$ref": "#/components/schemas/ServiceBindingTransport",
            "description": "Scheme for canonical service binding URLs. Omitted manifests retain the legacy HTTP behavior."
          },
          "ports": {
            "type": "array",
            "maxItems": 16,
            "description": "Protocol-aware listeners preserved from OCI ExposedPorts. The legacy port remains the primary HTTP/readiness listener; named TCP entries may be selected through the app--port-<name> public hostname, while all entries remain available for in-task discovery.",
            "items": {
              "$ref": "#/components/schemas/WorkloadPort"
            }
          },
          "healthz": {
            "type": [
              "string",
              "null"
            ]
          },
          "user": {
            "type": [
              "string",
              "null"
            ]
          },
          "healthcheck": {
            "$ref": "#/components/schemas/AppManifestHealthcheck"
          },
          "stop_signal": {
            "type": [
              "string",
              "null"
            ],
            "description": "OCI STOPSIGNAL (default SIGTERM). Wired into the Engine.StopInstance signal-and-grace flow."
          },
          "secret_reload_signal": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "SIGHUP",
              "SIGUSR1",
              "SIGUSR2",
              null
            ],
            "description": "Opt this image's workload into live secret-file refresh by selecting the signal guest-init sends after replacing FAAS_SECRETS_FILE; the app must handle the signal and reload its config. Main and long-running sidecar images opt in independently, including deployments with companions; each workload reloads only its own granted secrets. Must differ from stop_signal."
          },
          "secret_reload_readiness": {
            "type": "boolean",
            "default": false,
            "description": "Wait for the workload to publish FAAS_SECRETS_RELOAD_READY_FILE before sending a secret reload signal. Requires secret_reload_signal. Main and sidecar workloads opt in independently."
          },
          "secret_files": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SecretFile"
            },
            "description": "App secrets guest-init writes to /run/secrets for the main workload. Set from the app's Compose service secrets."
          },
          "stop_grace_period": {
            "type": [
              "string",
              "null"
            ],
            "description": "OCI StopGracePeriod as a Go duration string (e.g. \"30s\"). Per-plan cap (Hobby 30s, Pro 60s, Scale 120s) enforced by Validate."
          },
          "execution_mode": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "request",
              "service",
              "worker",
              "job",
              null
            ],
            "description": "Lifecycle contract for this app. Default 'request' preserves today's behaviour.",
            "example": "request"
          },
          "restart_policy": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "no",
              "on-failure",
              "always",
              "unless-stopped",
              null
            ],
            "description": "Restart behaviour when the main workload exits. Default is mode-derived: always for worker/service, no for job, on-failure for request.",
            "example": "on-failure"
          },
          "after_restore": {
            "$ref": "#/components/schemas/AfterRestoreHook"
          },
          "before_checkpoint": {
            "$ref": "#/components/schemas/BeforeCheckpointHook"
          },
          "pause": {
            "type": "string",
            "enum": [
              "between_requests",
              "when_idle",
              "never"
            ],
            "description": "The app's declared pause tier. Absent means the default for its type: between_requests for a function, when_idle for a request-mode app.",
            "example": "when_idle"
          },
          "startup_deadline_s": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "description": "Upper bound on time-to-ready (seconds). Per-plan cap enforced by Validate. Default 0 means 'use plan default'.",
            "example": 30
          },
          "max_retries": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "description": "Consecutive restart-attempt cap. Per-plan cap: Hobby 5, Pro 10, Scale 20. Default 0 means 'use plan default'.",
            "example": 3
          },
          "request_timeout_s": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 30,
            "description": "Runtime request wall-clock timeout in seconds. 0 inherits the plan/type default."
          },
          "function_concurrency": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 80,
            "description": "Per-worker request concurrency the image service stamps into the function's build as FAAS_FUNCTION_CONCURRENCY. 0 or 1 means one request per worker."
          },
          "service_replicas": {
            "$ref": "#/components/schemas/ServiceReplicas"
          },
          "worker_replicas": {
            "$ref": "#/components/schemas/WorkerScaling"
          },
          "favicon": {
            "type": [
              "string",
              "null"
            ],
            "format": "byte",
            "maxLength": 43692,
            "description": "Persisted base64-encoded favicon for the gateway edge answer; the decoded payload is capped at 32 KiB."
          },
          "robots_txt": {
            "type": [
              "string",
              "null"
            ],
            "description": "Persisted per-app robots.txt body; empty uses the platform allow-all default."
          },
          "head_wakes": {
            "type": "boolean",
            "default": false,
            "description": "Persisted opt-in to waking a parked app for HEAD / instead of receiving the cached edge answer."
          },
          "crawler_policy": {
            "type": "string",
            "enum": [
              "wake",
              "cached",
              "block"
            ],
            "default": "wake",
            "description": "Effective policy for known monitor/crawler requests."
          },
          "pre_auth_rate_limit": {
            "$ref": "#/components/schemas/PreAuthRateLimitConfig"
          },
          "health_path": {
            "type": "string",
            "default": "/healthz",
            "description": "Monitor-facing health path."
          },
          "health_path_wakes": {
            "type": "boolean",
            "default": false,
            "description": "Whether health probes may wake this app."
          },
          "session_affinity": {
            "description": "Whether the edge prefers the same running instance. Best effort only; stale or unhealthy instances are bypassed automatically.",
            "type": "boolean",
            "default": false
          },
          "version_affinity_cookie": {
            "description": "Configured browser cookie name for rollout affinity; omitted when disabled.",
            "type": "string"
          },
          "version_affinity_managed_cookie": {
            "description": "Whether the edge issues its own host-only rollout-affinity cookie.",
            "type": "boolean",
            "default": false
          },
          "revision_pin_ttl_seconds": {
            "description": "Configured revision pin window in seconds; zero disables pinning.",
            "type": "integer",
            "minimum": 0,
            "maximum": 604800,
            "default": 0
          },
          "release_policy": {
            "description": "Effective default rollout for production releases.",
            "type": "string",
            "enum": [
              "safe",
              "fast",
              "immediate"
            ]
          },
          "release_probe_paths": {
            "description": "Paths the default rollout probe checks; absent means /.",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "WorkloadPort": {
        "description": "One protocol-aware listener in a container workload.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "port",
          "protocol"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,30}$"
          },
          "port": {
            "type": "integer",
            "minimum": 1,
            "maximum": 65535
          },
          "protocol": {
            "type": "string",
            "enum": [
              "tcp",
              "udp"
            ]
          },
          "internal": {
            "type": "boolean",
            "description": "Internal-only listener: never public; same-account services reach it at the private service address."
          }
        }
      },
      "TCPListenerResponse": {
        "description": "One app-owned raw TCP listener with a stable public endpoint.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "name",
          "guest_port",
          "public_port",
          "protocol",
          "enabled",
          "created_at",
          "updated_at",
          "tls"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Stable listener identifier."
          },
          "name": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,30}$"
          },
          "guest_port": {
            "type": "integer",
            "minimum": 1,
            "maximum": 65535,
            "description": "TCP port exposed by the workload."
          },
          "public_port": {
            "type": "integer",
            "minimum": 40000,
            "maximum": 49999,
            "description": "Stable Gregale public TCP port."
          },
          "protocol": {
            "type": "string",
            "enum": [
              "tcp"
            ]
          },
          "enabled": {
            "type": "boolean",
            "description": "Whether the edge accepts new TCP connections."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "tls": {
            "$ref": "#/components/schemas/TCPListenerTLSConfig"
          }
        }
      },
      "CreateTCPListenerRequest": {
        "description": "Request to expose one workload TCP port.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "guest_port"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,30}$"
          },
          "guest_port": {
            "type": "integer",
            "minimum": 1,
            "maximum": 65535
          },
          "public_port": {
            "type": "integer",
            "minimum": 40000,
            "maximum": 49999,
            "description": "Optional stable public port; Gregale allocates one when omitted."
          },
          "tls": {
            "$ref": "#/components/schemas/TCPListenerTLSConfig"
          }
        }
      },
      "UpdateTCPListenerRequest": {
        "description": "Supply exactly one serving-state or TLS-policy mutation. TLS changes disable the listener.",
        "type": "object",
        "additionalProperties": false,
        "oneOf": [
          {
            "required": [
              "enabled"
            ]
          },
          {
            "required": [
              "tls"
            ]
          }
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "tls": {
            "$ref": "#/components/schemas/TCPListenerTLSConfig"
          }
        }
      },
      "TCPListenerTLSConfig": {
        "description": "Listener TLS intent. Termination requires a verified app-owned ASCII DNS hostname; passthrough forbids a hostname.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "mode"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "passthrough",
              "terminate"
            ],
            "default": "passthrough"
          },
          "hostname": {
            "type": "string",
            "maxLength": 253,
            "description": "Normalized DNS hostname for termination. IP-shaped names and wildcards are forbidden."
          }
        }
      },
      "TCPListenerTLSStatusResponse": {
        "description": "Certificate evidence from observed edges; empty observations mean unknown status, never fleet-wide readiness.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "tls",
          "enabled",
          "scope",
          "observations"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "tls": {
            "$ref": "#/components/schemas/TCPListenerTLSConfig"
          },
          "enabled": {
            "type": "boolean"
          },
          "scope": {
            "type": "string",
            "enum": [
              "observed_edges"
            ]
          },
          "observations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TCPListenerTLSCertificateStatus"
            }
          }
        }
      },
      "TCPListenerTLSCertificateStatus": {
        "description": "Certificate evidence for one edge. Unknown evidence omits certificate expiry.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "edge_id",
          "status",
          "observed_at"
        ],
        "properties": {
          "edge_id": {
            "type": "string",
            "maxLength": 128
          },
          "status": {
            "type": "string",
            "enum": [
              "ready",
              "not_ready",
              "unknown"
            ]
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "not_after": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AppManifestHealthcheck": {
        "description": "AppManifest-level healthcheck shape: OCI HEALTHCHECK fields plus typed deployment probe overrides. Durations are integer seconds at the JSON boundary to match OCI/Docker conventions.",
        "type": "object",
        "properties": {
          "image_timing": {
            "$ref": "#/components/schemas/OCIHealthcheckTiming"
          },
          "test": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Argv of the check command, prefixed by \"CMD\", \"CMD-SHELL\", or \"NONE\" per Docker semantics."
          },
          "exec": {
            "$ref": "#/components/schemas/SidecarExecProbe"
          },
          "http_get": {
            "$ref": "#/components/schemas/SidecarHTTPGetProbe"
          },
          "tcp_socket": {
            "$ref": "#/components/schemas/SidecarTCPSocketProbe"
          },
          "grpc": {
            "$ref": "#/components/schemas/SidecarGRPCProbe",
            "description": "Companion-only probe action; rejected on the app's own healthcheck."
          },
          "period_s": {
            "type": "integer",
            "minimum": 0,
            "maximum": 300,
            "description": "Typed sidecar probe cadence in seconds; defaults to 10, or 30 for legacy OCI checks."
          },
          "interval_s": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Poll cadence after StartPeriodS elapses (Docker default 30s)."
          },
          "timeout_s": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Per-probe exec timeout (Docker default 30s)."
          },
          "retries": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Consecutive failure count to mark unhealthy (Docker default 3)."
          },
          "failure_threshold": {
            "type": "integer",
            "minimum": 0,
            "maximum": 20,
            "description": "Failure count that marks a startup probe failed or restarts a liveness workload; defaults to 3."
          },
          "success_threshold": {
            "type": "integer",
            "minimum": 0,
            "maximum": 20,
            "description": "Consecutive passes required before the probe reports healthy; defaults to 1."
          },
          "initial_delay_s": {
            "type": "integer",
            "minimum": 0,
            "maximum": 600,
            "description": "Seconds to wait before the first typed sidecar probe."
          },
          "start_period_s": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Startup grace during which failures don't count (Docker 17.05+, default 0s)."
          }
        }
      },
      "OCIHealthcheckTiming": {
        "description": "Exact OCI image healthcheck durations in nanoseconds, preserved without rounding to whole seconds.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "interval_ns": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "timeout_ns": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "start_period_ns": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "start_interval_ns": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "UDPListenerResponse": {
        "description": "One app-owned public datagram listener with a reserved stable port.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "name",
          "guest_port",
          "public_port",
          "protocol",
          "enabled",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,30}$"
          },
          "guest_port": {
            "type": "integer",
            "minimum": 1,
            "maximum": 65535
          },
          "public_port": {
            "type": "integer",
            "minimum": 40000,
            "maximum": 49999
          },
          "protocol": {
            "type": "string",
            "enum": [
              "udp"
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreateUDPListenerRequest": {
        "description": "Reserve a disabled public datagram endpoint for a declared workload port.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "guest_port"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,30}$"
          },
          "guest_port": {
            "type": "integer",
            "minimum": 1,
            "maximum": 65535
          },
          "public_port": {
            "description": "Omit or set to zero for automatic allocation; otherwise reserve a port in the public UDP range.",
            "oneOf": [
              {
                "type": "integer",
                "enum": [
                  0
                ]
              },
              {
                "type": "integer",
                "minimum": 40000,
                "maximum": 49999
              }
            ]
          }
        }
      },
      "UpdateUDPListenerRequest": {
        "description": "Set whether an existing datagram endpoint accepts peers.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "enabled"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          }
        }
      },
      "SidecarExecProbe": {
        "description": "Exec probe command passed as argv inside the container; no shell is implied.",
        "type": "object",
        "required": [
          "command"
        ],
        "properties": {
          "command": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "minLength": 1
            },
            "description": "Executable and arguments, in order."
          }
        }
      },
      "SidecarHTTPGetProbe": {
        "description": "HTTP GET probe sent from inside the container.",
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "pattern": "^/",
            "description": "HTTP path; defaults to /."
          },
          "port": {
            "type": "integer",
            "minimum": 0,
            "maximum": 65535,
            "description": "HTTP container port; 0/omitted inherits the workload port."
          }
        }
      },
      "SidecarTCPSocketProbe": {
        "description": "TCP connection probe opened from inside the container.",
        "type": "object",
        "properties": {
          "port": {
            "type": "integer",
            "minimum": 0,
            "maximum": 65535,
            "description": "TCP container port; 0/omitted inherits the workload port."
          }
        }
      },
      "SidecarGRPCProbe": {
        "description": "Standard gRPC health Check RPC sent to the companion's loopback listener.",
        "type": "object",
        "properties": {
          "port": {
            "type": "integer",
            "minimum": 0,
            "maximum": 65535,
            "description": "gRPC container port; 0/omitted inherits the workload port."
          },
          "service": {
            "type": "string",
            "maxLength": 256,
            "description": "Optional gRPC health service name; empty checks overall server health."
          }
        }
      },
      "SidecarProbe": {
        "description": "Container-local startup, liveness, or readiness probe for a companion. Specify\nexactly one action: exec, http_get, tcp_socket, grpc, or the legacy OCI\ntest field. Network probes use port 0/omitted to inherit the workload's\ndeclared port, then the image port, then the platform default.\n",
        "type": "object",
        "properties": {
          "test": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Legacy OCI exec form: CMD, CMD-SHELL, or NONE. Retained for startup_probe compatibility."
          },
          "exec": {
            "$ref": "#/components/schemas/SidecarExecProbe"
          },
          "http_get": {
            "$ref": "#/components/schemas/SidecarHTTPGetProbe"
          },
          "tcp_socket": {
            "$ref": "#/components/schemas/SidecarTCPSocketProbe"
          },
          "grpc": {
            "$ref": "#/components/schemas/SidecarGRPCProbe"
          },
          "period_s": {
            "type": "integer",
            "minimum": 0,
            "maximum": 300,
            "description": "Probe interval in seconds; typed-probe default 10, legacy OCI default 30."
          },
          "interval_s": {
            "type": "integer",
            "minimum": 0,
            "maximum": 300,
            "description": "Legacy alias for period_s."
          },
          "timeout_s": {
            "type": "integer",
            "minimum": 0,
            "maximum": 120,
            "description": "Probe timeout in seconds; defaults to 1 for typed probes and 30 for legacy OCI probes."
          },
          "failure_threshold": {
            "type": "integer",
            "minimum": 0,
            "maximum": 20,
            "description": "Consecutive failures before startup fails or liveness restarts the workload; defaults to 3."
          },
          "retries": {
            "type": "integer",
            "minimum": 0,
            "maximum": 20,
            "description": "Legacy alias for failure_threshold."
          },
          "success_threshold": {
            "type": "integer",
            "minimum": 0,
            "maximum": 20,
            "description": "Consecutive passes required to become healthy; defaults to 1."
          },
          "initial_delay_s": {
            "type": "integer",
            "minimum": 0,
            "maximum": 600,
            "description": "Delay before the first probe."
          },
          "start_period_s": {
            "type": "integer",
            "minimum": 0,
            "maximum": 600,
            "description": "Legacy OCI liveness grace period during which failures do not count."
          }
        }
      },
      "ServiceReplicas": {
        "description": "Per-deployment replica scaffold for execution_mode='service'. Replica count is bounded by ServiceReplicasMax per plan (Hobby 3, Pro 5, Scale 20), and desired must also fit the app's max_concurrency ceiling. min ≤ desired ≤ max must hold. Foundation here; rolling-deploy / rollback / image-digest pinning semantics land.",
        "type": "object",
        "required": [
          "min",
          "max",
          "desired"
        ],
        "properties": {
          "min": {
            "type": "integer",
            "minimum": 0,
            "description": "Minimum desired replicas the Engine keeps alive. 0 = no minimum.",
            "example": 1
          },
          "max": {
            "type": "integer",
            "minimum": 0,
            "description": "Maximum desired replicas (engine-side cap; service autoscale bounds).",
            "example": 3
          },
          "desired": {
            "type": "integer",
            "minimum": 0,
            "description": "Desired replica count. Engine wakes replacement instances to maintain this when one fails or is destroyed.",
            "example": 2
          }
        }
      },
      "WorkerScaling": {
        "description": "Queue-driven or custom-metric autoscaling policy for execution_mode='worker'. Supports scale-to-zero when min=0.",
        "type": "object",
        "required": [
          "min",
          "max",
          "metric",
          "target"
        ],
        "properties": {
          "min": {
            "type": "integer",
            "minimum": 0,
            "description": "Minimum worker instances to maintain. 0 enables scale-to-zero.",
            "example": 0
          },
          "max": {
            "type": "integer",
            "minimum": 1,
            "description": "Maximum worker instances (bounded by plan WorkerReplicasMax and app max_concurrency).",
            "example": 50
          },
          "metric": {
            "type": "string",
            "enum": [
              "queue_lag",
              "queue_depth",
              "custom"
            ],
            "description": "Queue or customer-pushed metric driving autoscaling.",
            "example": "queue_lag"
          },
          "name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,62}$",
            "description": "Required when metric is custom; the app-scoped custom gauge name."
          },
          "target": {
            "type": "number",
            "description": "Target backlog per worker instance. Custom metric targets use the custom gauge's units.",
            "example": 500
          },
          "observer_app_slug": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{1,38})[a-z0-9]$",
            "description": "Separate always-on worker app publishing MCP task metrics; required when mcp_tasks_outstanding scales this worker to zero."
          }
        }
      },
      "ParkedDeploymentRef": {
        "description": "Reference to a deployment that was parked. Returned in AppResponse.parked_deployment when the app has at least one parked deployment. The `parked_reason` field is closed-set (liveness_exhausted | lifecycle_park | admin_park | security_scan_regressed) — enforced at the schema layer via the deployments_parked_reason_check constraint.",
        "type": "object",
        "required": [
          "id",
          "parked_reason",
          "parked_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "parked_reason": {
            "type": "string",
            "enum": [
              "liveness_exhausted",
              "lifecycle_park",
              "admin_park",
              "security_scan_regressed"
            ],
            "description": "Closed-set parking reason from the schema-layer CHECK constraint."
          },
          "parked_at": {
            "type": "string",
            "format": "date-time",
            "description": "Wall-clock timestamp the deployment was parked (set once, idempotent across the scheduler restart cycles)."
          }
        }
      },
      "RetryDeploymentRequest": {
        "description": "Body for POST /v1/deployments/{id}/retry. Identifies the stage the retry should resume from. The closed-6 vocabulary mirrors `state.AllStageNames`; the API rejects unknown values with 400. Empty strings are rejected for the same reason.",
        "type": "object",
        "required": [
          "from_stage"
        ],
        "properties": {
          "from_stage": {
            "type": "string",
            "enum": [
              "source_download",
              "dependency_restore",
              "image_build",
              "security_scan",
              "snapshot_prepare",
              "readiness"
            ],
            "description": "Closed-6 stage vocabulary. `source_download` re-runs the whole pipeline (intentional retry-from-top); any other value resumes from that stage with all prior inputs copied from the source row."
          }
        }
      },
      "UploadStartRequest": {
        "description": "Body of POST /v1/uploads. `total_size` must be ≤ the per-plan SourceTarballMaxMB cap (Free/Hobby 100 MB, Pro/Scale 250 MB); the handler returns 413 + `source_too_large` otherwise. `sha256_hex` is recorded for the build_provenance audit row only — the server does NOT re-verify it at commit time (trust boundary).",
        "type": "object",
        "required": [
          "app_slug",
          "total_size"
        ],
        "properties": {
          "app_slug": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{1,30}[a-z0-9]$",
            "example": "my-app"
          },
          "total_size": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1073741824,
            "description": "Total tarball bytes after gzip. Hard ceiling is 1 GiB; per-plan cap is enforced by the handler."
          },
          "sha256_hex": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[a-f0-9]{64}$",
            "description": "Optional sha256 of the tarball for build_provenance. Server does not verify."
          },
          "deploy_options": {
            "$ref": "#/components/schemas/UploadDeployOptions"
          }
        }
      },
      "UploadDeployOptions": {
        "type": "object",
        "additionalProperties": false,
        "description": "Deployment metadata persisted with the upload session and applied at commit.",
        "properties": {
          "healthcheck": {
            "$ref": "#/components/schemas/DeploymentHealthcheck",
            "description": "Startup readiness for this resumable upload. Select exactly one HTTP path or standard gRPC health probe; omitted preserves source inference."
          },
          "runtime": {
            "type": "string"
          },
          "handler": {
            "type": "string"
          },
          "dockerfile": {
            "type": "boolean"
          },
          "source_root": {
            "type": "string",
            "description": "Build directory saved for this resumable upload. Empty or omitted inherits the app's configured root; '.' selects the archive root."
          },
          "scope": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$",
            "description": "Named environment scope applied when the upload is committed; omitted uses default."
          },
          "source_url": {
            "type": "string",
            "maxLength": 1024,
            "description": "Informational repository provenance URL; never fetched by the API."
          },
          "commit_sha": {
            "type": "string",
            "minLength": 7,
            "maxLength": 64,
            "pattern": "^[0-9a-f]+$",
            "description": "Lowercase hexadecimal Git commit identifier."
          },
          "environment": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$",
            "description": "Registered project environment to resolve at upload commit."
          },
          "reason": {
            "type": "string",
            "maxLength": 280
          },
          "tag": {
            "type": "string"
          },
          "deployed_by": {
            "type": "string"
          },
          "pr_number": {
            "type": "integer",
            "minimum": 1
          },
          "workflows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowSpec"
            }
          },
          "companions": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/Sidecar"
            },
            "description": "Preferred field for up to five helpers carried across the resumable upload session (one init helper and up to four long-running companions)."
          },
          "sidecars": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/Sidecar"
            },
            "deprecated": true,
            "description": "Deprecated spelling of companions."
          },
          "rollback_on_5xx": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Resumable deploy policy persisted with deploy_options; Pro/Scale may enable first-wake 5xx auto-rollback, while omitted or null keeps the default false."
          },
          "disable_startup_cpu_boost": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Create this deployment without temporary startup CPU headroom; omitted or null keeps the default boost."
          },
          "no_triggers": {
            "type": "boolean",
            "description": "Skip reconciling trigger declarations from the uploaded gregale manifest at commit time."
          },
          "override_freeze": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Commit this upload to production while a deploy freeze is active; the reason is audited with the freezes it overrode."
          },
          "release_at": {
            "type": "string",
            "format": "date-time",
            "description": "Build this upload now, keep it live without traffic, and start its production rollout at this time; deploy freezes are checked at that time."
          },
          "release_notify": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "description": "Slack or email notification channels told when this upload, scheduled with release_at, starts or cannot start."
          }
        }
      },
      "UploadStartResponse": {
        "description": "Body of POST /v1/uploads response. The session row persists for 24h; the reaper flips `status='open'` rows whose `expires_at` has passed to 'expired' on a 5-min ticker. `chunk_size` is server-decided (8 MiB default; 16 MiB for Scale).",
        "type": "object",
        "required": [
          "upload_id",
          "chunk_size",
          "total_size",
          "expires_at"
        ],
        "properties": {
          "upload_id": {
            "type": "string",
            "example": "a1b2c3d4e5f6"
          },
          "chunk_size": {
            "type": "integer",
            "minimum": 1,
            "maximum": 67108864,
            "description": "Server-decided chunk size in bytes. Default 8 MiB; 16 MiB for Scale."
          },
          "total_size": {
            "type": "integer",
            "description": "Echo of the requested total_size for client confirmation."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "ISO 8601 UTC timestamp; PATCH after this returns 410 Gone."
          }
        }
      },
      "UploadSessionResponse": {
        "description": "Current resumable upload state. The received_bytes value is the next Upload-Offset a client should use.",
        "type": "object",
        "required": [
          "upload_id",
          "app_slug",
          "chunk_size",
          "total_size",
          "received_bytes",
          "status",
          "expires_at"
        ],
        "properties": {
          "upload_id": {
            "type": "string"
          },
          "app_slug": {
            "type": "string"
          },
          "chunk_size": {
            "type": "integer",
            "minimum": 1
          },
          "total_size": {
            "type": "integer",
            "minimum": 1
          },
          "received_bytes": {
            "type": "integer",
            "minimum": 0
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "committed",
              "cancelled",
              "expired"
            ]
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "deployment_id": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "DeploymentPromotionHold": {
        "description": "Compatibility hold and durable recovery progress for a deployment awaiting promotion.",
        "type": "object",
        "required": [
          "code",
          "detail",
          "observed_at",
          "held_at",
          "recovery_attempts",
          "recovery_in_progress"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "held_at": {
            "type": "string",
            "format": "date-time",
            "description": "First compatibility hold observation."
          },
          "recovery_attempts": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of claimed automatic recovery attempts."
          },
          "next_retry_at": {
            "type": "string",
            "format": "date-time",
            "description": "Eligibility time; while an attempt runs this is its lease expiry, not a promise of execution."
          },
          "recovery_in_progress": {
            "type": "boolean"
          },
          "last_recovery_outcome": {
            "type": "string",
            "enum": [
              "held",
              "retry",
              "recovered",
              "inactive",
              "cancelled"
            ]
          },
          "last_recovery_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_recovery_error_code": {
            "type": "string"
          }
        }
      },
      "DeploymentWorkerDrainStatus": {
        "type": "object",
        "description": "Worker instance shutdown progress from the deployment audit timeline. Counts are instances, not application tasks. Overdue spans passed their deadline without a recorded outcome.",
        "required": [
          "active",
          "completed",
          "timed_out",
          "failed",
          "overdue"
        ],
        "properties": {
          "active": {
            "type": "integer",
            "minimum": 0
          },
          "completed": {
            "type": "integer",
            "minimum": 0
          },
          "timed_out": {
            "type": "integer",
            "minimum": 0
          },
          "failed": {
            "type": "integer",
            "minimum": 0
          },
          "overdue": {
            "type": "integer",
            "minimum": 0
          },
          "deadline": {
            "type": "string",
            "format": "date-time",
            "description": "Earliest unfinished worker drain deadline."
          }
        }
      },
      "DurableEntityValidatorDeploymentInfo": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "status"
        ],
        "description": "Observational validator readiness on deployment detail; not a reservation or code-purity attestation.",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "disabled",
              "unavailable",
              "ready"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "registry",
              "object_storage"
            ]
          },
          "sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          }
        }
      },
      "DeploymentCronConfig": {
        "type": "object",
        "additionalProperties": false,
        "description": "Closed scheduling intent for one HTTP cron; command and execution data are excluded.",
        "required": [
          "id",
          "schedule",
          "path",
          "enabled",
          "timezone",
          "skip_if_running"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "schedule": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "timezone": {
            "type": "string"
          },
          "skip_if_running": {
            "type": "boolean"
          }
        }
      },
      "DeploymentCronStagingSnapshot": {
        "type": "object",
        "description": "The owned app and current HTTP scheduling set captured before staging.",
        "required": [
          "app_id",
          "revision",
          "latest_deployment_id",
          "crons"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "latest_deployment_id": {
            "type": "string"
          },
          "crons": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeploymentCronConfig"
            }
          },
          "environment": {
            "type": "string",
            "description": "The non-production environment read; omitted for production."
          }
        }
      },
      "DeploymentCronStagingRequest": {
        "type": "object",
        "description": "Immutable HTTP cron intent. Prepare retains active schedules until the submitted production release owns all traffic; cancel fences an unsubmitted intent. Stage and restore support legacy recovery.",
        "additionalProperties": false,
        "required": [
          "session_id",
          "operation",
          "expected_app_id",
          "expected_deployment_id",
          "expected_revision",
          "before",
          "desired"
        ],
        "properties": {
          "upload_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9_-]+$",
            "description": "Owned opaque upload identity to track for autonomous committed-upload recovery."
          },
          "session_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          },
          "operation": {
            "type": "string",
            "enum": [
              "stage",
              "restore",
              "prepare",
              "cancel",
              "track_upload"
            ]
          },
          "expected_app_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_deployment_id": {
            "type": "string"
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "before": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeploymentCronConfig"
            }
          },
          "desired": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeploymentCronConfig"
            }
          },
          "environment": {
            "type": "string",
            "description": "Stages the manifest's HTTP crons into this non-production environment of the app's project; it activates when the environment's deployment owns all of its traffic and replaces only its manifest crons. Only prepare, cancel and track_upload take one."
          }
        }
      },
      "DeploymentStagingSnapshot": {
        "type": "object",
        "description": "An atomic snapshot for journaling selected deployment policies before staging.",
        "required": [
          "app_id",
          "revision",
          "latest_deployment_id",
          "settings"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "latest_deployment_id": {
            "type": "string",
            "description": "The latest deployment ID, or an empty string when no deployment exists."
          },
          "settings": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "profiling": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/ProfilingConfig"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "tracing": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/TracingConfig"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          }
        }
      },
      "DeploymentStagingRequest": {
        "type": "object",
        "description": "The immutable non-secret intent used to stage or restore deployment policies.",
        "required": [
          "session_id",
          "operation",
          "expected_app_id",
          "expected_deployment_id",
          "expected_revision",
          "before",
          "desired"
        ],
        "properties": {
          "session_id": {
            "type": "string",
            "minLength": 32,
            "maxLength": 32,
            "pattern": "^[0-9a-f]{32}$"
          },
          "operation": {
            "type": "string",
            "enum": [
              "stage",
              "restore"
            ]
          },
          "expected_app_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_deployment_id": {
            "type": "string",
            "description": "The captured latest deployment ID, or an empty string when none exists."
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "before": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "profiling": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/ProfilingConfig"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "tracing": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/TracingConfig"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          "desired": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "profiling": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/ProfilingConfig"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "tracing": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/TracingConfig"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          }
        }
      },
      "DeploymentStagingReceipt": {
        "type": "object",
        "description": "The outcome of an atomic deployment policy staging or cleanup operation.",
        "required": [
          "session_id",
          "app_id",
          "status",
          "revision"
        ],
        "properties": {
          "session_id": {
            "type": "string",
            "minLength": 32,
            "maxLength": 32,
            "pattern": "^[0-9a-f]{32}$"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "staged",
              "cleaned",
              "prepared",
              "activated",
              "conflict",
              "discarded"
            ]
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ServiceAbortReceipt": {
        "description": "Immutable acceptance of an original reviewed service-abort intent; ACK/drain completion and the current handoff remain separate.",
        "type": "object",
        "required": [
          "attempt_id",
          "request_hash",
          "app_id",
          "deployment_id",
          "predecessor_deployment_id",
          "request_id",
          "scope",
          "accepted_at"
        ],
        "properties": {
          "attempt_id": {
            "type": "string",
            "minLength": 32,
            "maxLength": 32,
            "pattern": "^[0-9a-f]{32}$"
          },
          "request_hash": {
            "type": "string",
            "minLength": 64,
            "maxLength": 64,
            "pattern": "^[0-9a-f]{64}$"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "predecessor_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string",
            "description": "Default scope or the original named environment slug."
          },
          "project_id": {
            "type": "string",
            "format": "uuid",
            "description": "Original project identity; present for named scopes."
          },
          "environment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Original environment identity; present for named scopes."
          },
          "accepted_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EnvironmentPromotionReceipt": {
        "type": "object",
        "description": "Immutable original promotion admission evidence. The source/target identities cannot be reassigned; completion and current health remain separate.",
        "required": [
          "attempt_id",
          "request_hash",
          "promotion_id",
          "promotion_hash",
          "project_id",
          "from_environment_id",
          "environment_id",
          "accepted_at"
        ],
        "properties": {
          "attempt_id": {
            "type": "string",
            "minLength": 32,
            "maxLength": 32,
            "pattern": "^[0-9a-f]{32}$"
          },
          "request_hash": {
            "type": "string",
            "minLength": 64,
            "maxLength": 64,
            "pattern": "^[0-9a-f]{64}$"
          },
          "promotion_id": {
            "type": "string",
            "format": "uuid"
          },
          "promotion_hash": {
            "type": "string",
            "minLength": 64,
            "maxLength": 64,
            "pattern": "^[0-9a-f]{64}$"
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "from_environment_id": {
            "type": "string",
            "format": "uuid"
          },
          "environment_id": {
            "type": "string",
            "format": "uuid"
          },
          "accepted_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EnvironmentRollbackReceipt": {
        "type": "object",
        "description": "Immutable original rollback admission evidence. The source/target identities cannot be reassigned; restoration and current health remain separate.",
        "required": [
          "attempt_id",
          "request_hash",
          "promotion_id",
          "promotion_hash",
          "project_id",
          "from_environment_id",
          "environment_id",
          "accepted_at"
        ],
        "properties": {
          "attempt_id": {
            "type": "string",
            "minLength": 32,
            "maxLength": 32,
            "pattern": "^[0-9a-f]{32}$"
          },
          "request_hash": {
            "type": "string",
            "minLength": 64,
            "maxLength": 64,
            "pattern": "^[0-9a-f]{64}$"
          },
          "promotion_id": {
            "type": "string",
            "format": "uuid"
          },
          "promotion_hash": {
            "type": "string",
            "minLength": 64,
            "maxLength": 64,
            "pattern": "^[0-9a-f]{64}$"
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "from_environment_id": {
            "type": "string",
            "format": "uuid"
          },
          "environment_id": {
            "type": "string",
            "format": "uuid"
          },
          "accepted_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DeploymentPromotionReceipt": {
        "description": "Immutable acceptance of an original guarded 100 percent traffic promotion; current traffic and health are separate.",
        "type": "object",
        "required": [
          "attempt_id",
          "request_hash",
          "app_id",
          "deployment_id",
          "expected_serving_deployment_id",
          "scope",
          "accepted_at"
        ],
        "properties": {
          "attempt_id": {
            "type": "string",
            "minLength": 32,
            "maxLength": 32,
            "pattern": "^[0-9a-f]{32}$"
          },
          "request_hash": {
            "type": "string",
            "minLength": 64,
            "maxLength": 64,
            "pattern": "^[0-9a-f]{64}$"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_serving_deployment_id": {
            "type": "string",
            "description": "Original serving guard; empty requires no serving sibling."
          },
          "scope": {
            "type": "string"
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "environment_id": {
            "type": "string",
            "format": "uuid"
          },
          "accepted_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DeploymentSubmissionReceipt": {
        "description": "Immutable acceptance evidence for one opaque deployment submission attempt.",
        "type": "object",
        "required": [
          "attempt_id",
          "app_id",
          "deployment_id",
          "accepted_at"
        ],
        "properties": {
          "attempt_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$",
            "minLength": 32,
            "maxLength": 32
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "accepted_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DeploymentConfigurationStatus": {
        "type": "object",
        "description": "Server-managed cron activation diagnostics. CLI-owned settings are additionally reflected in CLI receipt configuration_complete. Reads never create builds or modify schedules.",
        "required": [
          "complete",
          "crons"
        ],
        "properties": {
          "complete": {
            "type": "boolean",
            "description": "True when no deferred cron activation is recorded or the tracked intent was activated."
          },
          "crons": {
            "$ref": "#/components/schemas/DeploymentCronActivationStatus"
          }
        }
      },
      "DeploymentCronActivationStatus": {
        "type": "object",
        "description": "The latest retained cron intent for this deployment. Activated records historical completion even after a later deployment changes schedules.",
        "required": [
          "status",
          "message"
        ],
        "properties": {
          "session_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "description": "Opaque intent identity; may be generated by APID for direct API deployments."
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "App cron revision at preparation; identifies the latest intent bound to this deployment."
          },
          "status": {
            "type": "string",
            "enum": [
              "not_managed",
              "pending",
              "activated",
              "conflicted",
              "discarded"
            ],
            "description": "Cron activation outcome, independent of the release lifecycle status."
          },
          "reason": {
            "type": "string",
            "enum": [
              "awaiting_readiness",
              "awaiting_full_traffic",
              "awaiting_rollout",
              "competing_traffic",
              "awaiting_activation",
              "cron_changed",
              "quota_changed",
              "identity_conflict",
              "plan_unavailable",
              "intent_superseded",
              "deployment_superseded",
              "deployment_failed",
              "deployment_canceled",
              "rollout_aborted",
              "non_production",
              "cron_guard_conflict",
              "activation_discarded"
            ],
            "description": "Stable diagnostic code. Absent when activated or not managed."
          },
          "message": {
            "type": "string",
            "description": "Customer-facing explanation of the activation outcome."
          },
          "hint": {
            "type": "string",
            "description": "Recovery guidance; pending changes finish automatically and terminal conflicts require inspection before a new attempt."
          }
        }
      },
      "DeploymentStageState": {
        "type": "object",
        "description": "Customer-visible deployment stage progress. `current` is the open stage, or an empty string once the deployment is live, failed or cancelled and that stage has moved into `history`.",
        "required": [
          "current",
          "history"
        ],
        "properties": {
          "current": {
            "type": "string",
            "enum": [
              "",
              "source_download",
              "dependency_restore",
              "image_build",
              "security_scan",
              "snapshot_prepare",
              "readiness"
            ]
          },
          "current_started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Start of the open stage. Null or absent when no stage is open, and on legacy rows created before stage timing."
          },
          "history": {
            "type": "array",
            "description": "Closed stages, oldest first. Writers keep the most recent 64 (MaxStageHistory).",
            "items": {
              "$ref": "#/components/schemas/DeploymentStageHistoryEntry"
            }
          },
          "retry_requested_stage": {
            "type": "string",
            "enum": [
              "source_download",
              "dependency_restore",
              "image_build",
              "security_scan",
              "snapshot_prepare",
              "readiness"
            ],
            "description": "Stage a retry asked to resume from. Present only on retry deployments, which always restart at source_download."
          },
          "retry_restart_reason": {
            "type": "string",
            "description": "Why a retry restarted from source_download rather than retry_requested_stage."
          },
          "retry_intent": {
            "$ref": "#/components/schemas/DeploymentRetryIntent"
          },
          "dependency_gate": {
            "$ref": "#/components/schemas/DeploymentDependencyGate"
          },
          "build_dependency_gate": {
            "$ref": "#/components/schemas/DeploymentBuildDependencyGate"
          },
          "hosting_verification": {
            "$ref": "#/components/schemas/DeploymentHostingVerification"
          }
        }
      },
      "DeploymentRetryIntent": {
        "type": "object",
        "readOnly": true,
        "description": "Admission-time release intent retained across routing, failure and stage changes. Absent on legacy deployments.",
        "required": [
          "version",
          "traffic_percent",
          "traffic_percent_explicit",
          "service_rollout"
        ],
        "properties": {
          "version": {
            "type": "string",
            "enum": [
              "v1"
            ]
          },
          "traffic_percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "traffic_percent_explicit": {
            "type": "boolean"
          },
          "service_rollout": {
            "type": "boolean"
          }
        }
      },
      "DeploymentStageHistoryEntry": {
        "type": "object",
        "description": "One closed stage with server-measured duration.",
        "required": [
          "name",
          "started_at",
          "ended_at",
          "duration_ms",
          "status"
        ],
        "properties": {
          "name": {
            "type": "string",
            "enum": [
              "source_download",
              "dependency_restore",
              "image_build",
              "security_scan",
              "snapshot_prepare",
              "readiness"
            ]
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "ended_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "duration_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "status": {
            "type": "string",
            "enum": [
              "completed",
              "failed",
              "cancelled"
            ]
          },
          "reason": {
            "type": "string",
            "description": "Failure or cancellation detail; absent or empty for completed stages."
          }
        }
      },
      "DeploymentDependencyGate": {
        "type": "object",
        "description": "Compose dependency readiness gate pinned at admission. The deadline starts when the candidate first presents its own readiness proof.",
        "required": [
          "dependencies",
          "status"
        ],
        "properties": {
          "dependencies": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeploymentDependencyPin"
            }
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "deadline_at": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": [
              "waiting",
              "ready",
              "failed"
            ]
          },
          "blocker": {
            "type": "string",
            "description": "The dependency or deadline currently blocking release."
          }
        }
      },
      "DeploymentBuildDependencyGate": {
        "type": "object",
        "description": "Build-time wait on the API deployments a guided service migration selected. It is checked before cache lookup and slot allocation and never holds a build slot while waiting.",
        "required": [
          "dependencies",
          "status",
          "deadline_at",
          "check_after"
        ],
        "properties": {
          "dependencies": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeploymentDependencyPin"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "waiting",
              "ready",
              "failed"
            ]
          },
          "code": {
            "type": "string",
            "description": "Machine-readable reason while waiting or failed, for example build_dependency_not_ready or build_dependency_timeout. Absent once ready."
          },
          "blocker": {
            "type": "string",
            "description": "The dependency or deadline currently blocking the build."
          },
          "deadline_at": {
            "type": "string",
            "format": "date-time"
          },
          "check_after": {
            "type": "string",
            "format": "date-time",
            "description": "Earliest time the gate is re-checked. Zero time (0001-01-01T00:00:00Z) when no re-check is scheduled."
          }
        }
      },
      "DeploymentDependencyPin": {
        "type": "object",
        "description": "A dependency deployment captured at admission; it never follows a later deployment.",
        "required": [
          "service",
          "app_id",
          "deployment_id"
        ],
        "properties": {
          "service": {
            "type": "string"
          },
          "app_id": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string"
          }
        }
      },
      "DeploymentHostingVerification": {
        "type": "object",
        "description": "Candidate hosting verification recovery progress. last_error_code distinguishes publication, gateway, transport and candidate-evidence failures; a transport failure does not attribute blame to the app or platform. retry_not_before is an eligibility floor, not a promised delivery time; completed_at means the attempt finished, while the hosting receipt records its verdict.",
        "required": [
          "started_at",
          "deadline_at",
          "attempts"
        ],
        "properties": {
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "deadline_at": {
            "type": "string",
            "format": "date-time"
          },
          "attempts": {
            "type": "integer",
            "minimum": 0
          },
          "last_error_code": {
            "type": "string"
          },
          "last_route_checks": {
            "$ref": "#/components/schemas/HostingRouteCheckSet"
          },
          "retry_not_before": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "HostingRouteCheckSet": {
        "type": "object",
        "description": "API route checks from the app's imported OpenAPI document. document_sha256 binds them to that exact document.",
        "required": [
          "source",
          "status",
          "checks"
        ],
        "properties": {
          "source": {
            "type": "string",
            "enum": [
              "app_openapi"
            ]
          },
          "document_sha256": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "verified",
              "failed",
              "unavailable"
            ]
          },
          "checks": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/HostingRouteCheckResult"
            }
          }
        }
      },
      "HostingRouteCheckResult": {
        "type": "object",
        "description": "Bounded, non-secret evidence from one authenticated candidate GET. Request and response bodies are omitted.",
        "required": [
          "method",
          "path",
          "status",
          "verified_at"
        ],
        "properties": {
          "method": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "verified",
              "failed",
              "skipped"
            ]
          },
          "status_code": {
            "type": "integer"
          },
          "latency_ms": {
            "type": "integer",
            "format": "int64"
          },
          "verified_at": {
            "type": "string",
            "format": "date-time",
            "description": "Zero time (0001-01-01T00:00:00Z) when the check did not run."
          },
          "request_id": {
            "type": "string"
          },
          "error_code": {
            "type": "string"
          },
          "error": {
            "type": "string"
          }
        }
      },
      "DeploymentCompanion": {
        "type": "object",
        "description": "One companion of a deployment: identity, image, port and size. Environment values and secret grants are never included.",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "Companion name."
          },
          "image": {
            "type": "string",
            "description": "Digest-pinned image reference."
          },
          "preset": {
            "type": "string",
            "description": "Built-in preset the companion uses, when any."
          },
          "type": {
            "type": "string",
            "description": "init or sidecar."
          },
          "port": {
            "type": "integer",
            "description": "Declared port; it also opens the public <app>--<name> hostname."
          },
          "ram_mb": {
            "type": "integer",
            "description": "Reserved RAM in MB."
          },
          "primary_ingress": {
            "type": "boolean",
            "description": "Whether the companion receives the app's public traffic."
          }
        }
      },
      "DeploymentResponse": {
        "description": "One deployment: id, app, source ref, build status, commit SHA, and lifecycle timestamps. The optional `has_overrides` and `override_*` fields are the persisted echo of the create-time overrides object; they round-trip via `GET /v1/apps/{slug}/deployments/{id}` so a customer can audit what their last deploy pinned. Env values are NEVER echoed — only the keys (`override_env_keys`); env_secrets refs ARE echoed because the ref shape is non-secret by design.",
        "type": "object",
        "required": [
          "id",
          "app_id",
          "image_digest",
          "kind",
          "status",
          "created_at"
        ],
        "properties": {
          "canary_cache_preflight": {
            "$ref": "#/components/schemas/DeploymentCachePreflight"
          },
          "canary_cache_preparation": {
            "$ref": "#/components/schemas/CanaryCachePreparation"
          },
          "configuration": {
            "$ref": "#/components/schemas/DeploymentConfigurationStatus",
            "description": "Read-only diagnostics included by GET /v1/deployments/{id}; absent on older servers and other response surfaces."
          },
          "staged_review": {
            "$ref": "#/components/schemas/AppReleaseReview",
            "description": "Intent snapshot committed with a zero-traffic reviewed candidate."
          },
          "worker_drain": {
            "$ref": "#/components/schemas/DeploymentWorkerDrainStatus"
          },
          "promotion_hold": {
            "$ref": "#/components/schemas/DeploymentPromotionHold",
            "description": "Latest blocked automatic MCP task promotion; omitted once the candidate becomes live or terminal. A hold is not a failed deployment."
          },
          "scheduled_release": {
            "$ref": "#/components/schemas/ScheduledRelease",
            "description": "The schedule of a release that waits live without traffic for its scheduled start, or how its latest schedule ended."
          },
          "database_switch": {
            "$ref": "#/components/schemas/DatabaseSwitch",
            "description": "The switch a rollback with restore_databases started."
          },
          "durable_entity_validator": {
            "$ref": "#/components/schemas/DurableEntityValidatorDeploymentInfo"
          },
          "stage_state": {
            "$ref": "#/components/schemas/DeploymentStageState",
            "description": "Actual stage progress; the same document GET /v1/deployments/{id}/stages serves. retry_requested_stage and retry_restart_reason appear when prerequisites must be rebuilt; hosting_verification appears during unavailable candidate verification recovery."
          },
          "dev_patch": {
            "$ref": "#/components/schemas/DevPatchPreview"
          },
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "revision": {
            "type": "integer",
            "minimum": 1,
            "example": 42,
            "description": "Per-app deployment revision, rendered as `v42`. Accepted in place of a deployment id wherever this API takes one (e.g. `target_deployment_id` on rollback). This is the same N that appears in the `deploy-{N}-{slug}` preview hostname. Omitted for rows created before the column existed; address those by id."
          },
          "build_id": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[a-f0-9]{32}$"
          },
          "build_cache_status": {
            "type": "string",
            "enum": [
              "hit",
              "miss",
              "invalidated"
            ],
            "description": "Builderd cache decision for the associated build. Omitted until the build reaches its cache lookup."
          },
          "cache_key_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "SHA-256 digest of the versioned BuildCacheRecipe. Plan, runtime base, builder identity, platform, framework, and source root remain part of the digest input."
          },
          "image_digest": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "example": "active"
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "error_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "error_hint": {
            "type": [
              "string",
              "null"
            ],
            "description": "One-line next-action lifted catalog."
          },
          "error_why": {
            "type": [
              "string",
              "null"
            ],
            "description": "Human-readable cause with observed value."
          },
          "error_fix": {
            "type": [
              "string",
              "null"
            ],
            "description": "Prescriptive remediation (1-3 lines)."
          },
          "error_relevant_logs": {
            "type": "array",
            "description": "Per-line log excerpts explaining the failure (error-explanations cluster). Capped at 20 entries × 512 bytes by the CLI tripwire.",
            "items": {
              "$ref": "#/components/schemas/LogExcerpt"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "source_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "Upstream repository or registry reference that produced this deployment, when known."
          },
          "commit_sha": {
            "type": [
              "string",
              "null"
            ],
            "description": "Upstream commit SHA that produced this deployment, when known."
          },
          "source_root": {
            "type": "string",
            "description": "Repository-relative build root used by a workspace context upload; omitted when the archive root is built."
          },
          "source_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "SHA-256 digest of the exact source archive handed to the builder; stable identity for local-source revisions."
          },
          "has_overrides": {
            "type": "boolean",
            "description": "True when this deployment carries a non-null override_* column set."
          },
          "disable_startup_cpu_boost": {
            "type": "boolean",
            "description": "Whether the deployment opted out of the temporary startup CPU allowance; absent/false preserves the default boost."
          },
          "override_entrypoint": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Entrypoint override echoed verbatim from the create request. nil when no override was supplied."
          },
          "override_cmd": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Cmd override echoed verbatim from the create request."
          },
          "override_env_keys": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Sorted set of env-var keys set by the env override. VALUES ARE NEVER ECHOED."
          },
          "override_env_secret_keys": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Sorted set of env-var keys set by the env_secrets override. The parallel refs are echoed in `override_env_secret_refs` because the ref shape is non-secret by design."
          },
          "override_env_secret_refs": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Verbatim `secret:NAME` ref map; the customer needs to see which secret they bound to which env var to debug a misconfigured deploy."
          },
          "override_port": {
            "type": "integer",
            "minimum": 0,
            "maximum": 65535,
            "description": "Listen-port override; 0 = absent (fall back to image default)."
          },
          "override_healthcheck": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DeploymentHealthcheck"
              },
              {
                "type": "null"
              }
            ],
            "description": "Startup readiness-probe override echoed verbatim."
          },
          "override_readiness_probe": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DeploymentReadinessProbe"
              },
              {
                "type": "null"
              }
            ],
            "description": "Continuous primary-app readiness probe echoed verbatim. Unready instances are withdrawn from request routing and restored after recovery; the VM is not restarted."
          },
          "override_main_depends_on": {
            "type": "array",
            "maxItems": 6,
            "items": {
              "$ref": "#/components/schemas/WorkloadDependency"
            },
            "description": "Primary workload startup dependencies echoed verbatim. Init companions remain implicit prerequisites."
          },
          "override_liveness_probe": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DeploymentLivenessProbe"
              },
              {
                "type": "null"
              }
            ],
            "description": "Liveness-probe override echoed verbatim. nil when the deployment used the per-plan default (Hobby/Pro/Scale → 5s / 3 consecutive / 60s cooldown). Echoed on GET /v1/apps/{slug}/deployments/{id} so the customer can audit which probe the host is running against the VM."
          },
          "min_instances": {
            "type": "integer",
            "minimum": 0,
            "description": "Per-deployment cold-wake floor override (closure). 0 = inherit from parent app (default); positive value is the deployment's own floor. Effective per-instance floor = max(app.EffectiveMinInstances, d.EffectiveMinInstances). Validated against the parent app's plan MaxMinInstances cap on PATCH."
          },
          "scan": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ScanResult"
              },
              {
                "type": "null"
              }
            ],
            "description": "Per-deploy grype CVE scan surface. nil on pre-feature rows (the migration backfilled scan_status='skipped' + scan_result={reason: 'pre-feature'} on those; the API read path returns nil so the dashboard / CLI see a clean absence — the /scan route surfaces the 'skipped' sentinel for those rows). Non-nil for post-feature rows in any of the {pending, complete, failed, skipped} states. With security_policy=enforce, the deployment is promoted only after a complete, digest-matched scan with no HIGH, CRITICAL, or UNKNOWN findings; off/warn remain advisory."
          },
          "parked_reason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              null,
              "liveness_exhausted",
              "lifecycle_park",
              "admin_park",
              "security_scan_regressed"
            ],
            "description": "Per-deployment parking reason (and scheduled image quarantine). Closed-set vocabulary enforced at the schema layer via the deployments_parked_reason_check constraint. nil for never-parked deployments — surfaced as no field on the wire via omitempty."
          },
          "parked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Wall-clock timestamp the deployment was parked (set once, idempotent across the scheduler restart cycles). nil for never-parked deployments."
          },
          "traffic_percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Per-deployment traffic-split weight. Summed across live rows for the app = 100 by construction.",
            "example": 100
          },
          "scope": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$",
            "description": "Per-deployment env scope. Lowercase alnum + dash, 1..40 chars, no leading/trailing dash. nil/omitted = `default`.",
            "example": "staging"
          },
          "secret_scan": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/SecretScanResult"
              },
              {
                "type": "null"
              }
            ],
            "description": "Per-deploy secret-scan audit row. Mirrors\nthe `scan` field shape — absent when the row has not been\nscanned yet (deploy mid-pipeline or an older deployment), present\nwith `findings=[]` for a clean walk, present with\none-or-more entries for a hit. Read by the dashboard's\n\"secret scan\" card and the CLI's `--show-secret-scan`\nflag. Stamped both for the image service-side layer walk (main\nimage + each sidecar; post-build, loud-fail on any\nfinding) and — forward-compat — for the API-side\nsource-tree 422 path. Status closed-set the writer\nstamps: \"complete\" (clean) | \"complete_with_redactions\"\n(hit). The `image_digest` sub-field records which OCI\ndigest the image service walk ran against; null on legacy\nolder rows.\n"
          },
          "build_plan": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/BuildPlan"
              },
              {
                "type": "null"
              }
            ],
            "description": "Auto-detected build plan. One-line summary the CLI prints after `gregale deploy`. nil for image deploys."
          },
          "workflows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowSpec"
            },
            "description": "Validated workflow definitions persisted with this immutable deployment revision."
          },
          "companions": {
            "type": "array",
            "description": "Companions this deployment carries: name, image, port and size. Environment values and secret grants are never included.",
            "items": {
              "$ref": "#/components/schemas/DeploymentCompanion"
            }
          },
          "hosting_receipt": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true,
            "description": "Durable non-secret deployment evidence captured after readiness, including the resolved API profile, artifact identity, and post-readiness smoke result."
          },
          "deployed_by_user_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "UUID of the deploying local account (FK → accounts.id, ON DELETE SET NULL). Empty when the deploy came from a non-local source (e.g. a GitHub integration pusher not bound to a local account).",
            "example": "8a2f4e7c-1234-4abc-9def-0123456789ab"
          },
          "deployed_via": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              null,
              "api",
              "cli",
              "dashboard",
              "github",
              "operator"
            ],
            "description": "Closed-set classifier of how this deployment was submitted. One of `api` (SDK / API key) / `cli` (bearer token) / `dashboard` (session cookie) / `github` (GitHub integration) / `operator` (admin). Enforced by a database CHECK constraint.",
            "example": "cli"
          },
          "deployed_from_ip": {
            "type": [
              "string",
              "null"
            ],
            "description": "The client IP the platform's edge established for the request. Deployments started by the GitHub integration record an internal platform address. Both IPv4 and IPv6 are accepted at the wire and stored in Postgres' native `inet` type (which canonicalises both families); the OpenAPI schema intentionally omits `format: ipv4` so v6 deployments (which grow as the public gateway picks up AAAA records) do not fail schema validation. v6 is rendered as the bracketed colon-hex form per RFC 5952.",
            "example": "203.0.113.42",
            "examples": {
              "ipv4": {
                "summary": "IPv4 (RFC 791)",
                "value": "203.0.113.42"
              },
              "ipv6": {
                "summary": "IPv6 (RFC 5952 canonical form)",
                "value": "2001:db8::1"
              }
            }
          },
          "pusher_login": {
            "type": [
              "string",
              "null"
            ],
            "description": "Raw GitHub login of the pusher when `deployed_via == \"github\"`. Empty for all other via values. Distinct from the human-readable `DeployedBy` text column — pusher_login is the unmodified GH identity, suitable for downstream GitHub-API correlation.",
            "example": "poyrazK"
          },
          "reason": {
            "type": "string",
            "maxLength": 280,
            "description": "Free-form operator note on the source-ref deploy request (≤280 chars). Example: 'Emergency rollback after payment provider incident'."
          },
          "tag": {
            "type": "string",
            "enum": [
              "incident_recovery",
              "hotfix",
              "scheduled_maintenance",
              "compliance_hold",
              "partner_request"
            ],
            "description": "Closed-set annotation tag on the source-ref deploy request for grouping/filtering."
          },
          "deployed_by": {
            "type": "string",
            "description": "Human-readable actor label on the source-ref deploy request. CLI auto-captures from `git config user.name`; the GitHub integration stamps pusher.name; the GitHub Action defaults to ${{ github.actor }}."
          },
          "pr_number": {
            "type": "integer",
            "minimum": 1,
            "description": "Pull-request number that drove this source-ref deploy request (the GitHub integration pull_request.number; Action ${{ github.event.pull_request.number }}). NULL for push-to-main with no inferred PR."
          },
          "canary_preset": {
            "type": "string",
            "enum": [
              "none",
              "slow",
              "balanced",
              "aggressive",
              "1-10-50-100",
              "adaptive"
            ],
            "description": "Canary preset used by the deployment's progressive rollout. `none` preserves the default 100% deployment path."
          },
          "canary_step": {
            "type": "integer",
            "minimum": 0,
            "description": "Current zero-based canary ladder step."
          },
          "canary_total_steps": {
            "type": "integer",
            "minimum": 0,
            "description": "Total number of canary ladder steps; zero means no canary ladder."
          },
          "canary_step_started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Wall-clock timestamp at which the current canary step began."
          },
          "rollout_state": {
            "type": "string",
            "enum": [
              "pending",
              "rolling_out",
              "complete",
              "aborted"
            ],
            "description": "Durable rollout state used by the canary orchestrator and operator recovery path."
          },
          "rollout_started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Wall-clock timestamp at which rollout processing began."
          },
          "rollout_completed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Wall-clock timestamp at which the rollout reached complete."
          },
          "rollout_aborted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Wall-clock timestamp at which the rollout was aborted."
          },
          "rollout_aborted_reason": {
            "type": "string",
            "description": "Operator or orchestrator reason recorded when the rollout is aborted."
          },
          "rollout_decision": {
            "$ref": "#/components/schemas/RolloutDecision",
            "description": "Evidence recorded with the latest rollout transition. It explains an outcome only when its kind matches: an advance record for completion, an abort record for an abort."
          },
          "rollout_hold": {
            "$ref": "#/components/schemas/RolloutDecision",
            "description": "The newest hold recorded since the current canary step started, while the rollout is in flight. Filled on GET /v1/deployments/{id} and the deployment summary."
          },
          "release": {
            "$ref": "#/components/schemas/DeploymentRelease",
            "description": "The deployment's release command run, for a deployment that declares one. Filled on GET /v1/deployments/{id} and the deployment summary."
          },
          "rollback_operation": {
            "$ref": "#/components/schemas/RollbackOperation"
          },
          "service_rollout_handoff": {
            "$ref": "#/components/schemas/ServiceRolloutHandoffResponse"
          }
        }
      },
      "ServiceRolloutBindingGate": {
        "type": "object",
        "description": "Bounded progress of an exact binding check at the service routing boundary. Passed confirms the routing transaction; scheduler ACK and drain completion are reported by the enclosing handoff phase.",
        "required": [
          "request_id",
          "action",
          "deployment_id",
          "status"
        ],
        "properties": {
          "traffic_percent": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "description": "Exact recipient traffic percentage authorized by this routing check. Omission denotes the legacy full cutover."
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "action": {
            "type": "string",
            "enum": [
              "promote",
              "abort"
            ]
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "blocked",
              "passed"
            ]
          },
          "code": {
            "type": "string"
          },
          "blockers": {
            "type": "array",
            "maxItems": 4,
            "items": {
              "$ref": "#/components/schemas/BindingCheckFinding"
            }
          },
          "checked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "policy_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "audit_id": {
            "type": "string"
          }
        }
      },
      "ServiceRolloutHandoffResponse": {
        "description": "Durable scheduler progress for a zero-downtime service rollout routing and request-drain handoff.",
        "type": "object",
        "required": [
          "action",
          "phase",
          "retry_count"
        ],
        "properties": {
          "bindings_check": {
            "$ref": "#/components/schemas/ServiceRolloutBindingGate"
          },
          "action": {
            "type": "string",
            "enum": [
              "promote",
              "abort"
            ]
          },
          "phase": {
            "type": "string",
            "enum": [
              "pending",
              "routing",
              "draining",
              "complete"
            ]
          },
          "predecessor_deployment_id": {
            "type": "string"
          },
          "generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "expected_gateways": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "acknowledged_gateways": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "missing_gateways": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "retry_count": {
            "type": "integer",
            "minimum": 0
          },
          "last_error": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "acknowledged_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "BuildPlan": {
        "description": "Effective build plan surfaced on DeploymentResponse. Captured from the exact source archive at enqueue time and retained after spool cleanup; legacy rows fall back to marker detection when the spool is still available. Embedded on DeploymentResponse; never returned by a dedicated route.",
        "type": "object",
        "required": [
          "framework"
        ],
        "properties": {
          "framework": {
            "type": "string",
            "enum": [
              "node",
              "python",
              "go",
              "docker",
              "unknown"
            ],
            "description": "Compatibility framework family derived from the persisted source profile. `unknown` means no supported framework was inferred (monorepo / custom build)."
          },
          "runtime": {
            "type": [
              "string",
              "null"
            ],
            "description": "Runtime the app is pinned to (eg `node22`, `python312`). Echoed from app.Runtime. nil for apps without a runtime set (image deploys)."
          },
          "version": {
            "type": [
              "string",
              "null"
            ],
            "description": "Framework version extracted from the detected marker (eg `package.json` `engines.node`, `requirements.txt` head pin). nil when the marker has no version or framework is `unknown`."
          },
          "entrypoint": {
            "type": [
              "string",
              "null"
            ],
            "description": "Effective start command from the persisted source profile, replaced by an explicit entrypoint override when supplied."
          },
          "port": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 65535,
            "description": "Effective listen port from the persisted source profile, replaced by an explicit port override when supplied."
          },
          "health_path": {
            "type": [
              "string",
              "null"
            ],
            "description": "Effective readiness path selected by the source profile or deployment override."
          },
          "config_file": {
            "type": [
              "string",
              "null"
            ],
            "description": "Framework configuration file that supplied the resolved build settings, when present."
          },
          "class": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              null,
              "app",
              "function"
            ],
            "description": "App class from `app.Type` — `app` for plain apps, `function` for function rewrites."
          },
          "handler": {
            "type": [
              "string",
              "null"
            ],
            "description": "Function-layer export (for example `handler.handler`). Distinct from the process entrypoint."
          },
          "source_sha256": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[a-f0-9]{64}$",
            "description": "Content identity of the exact source archive being previewed. Source contents are never returned."
          }
        }
      },
      "SourceTarballDeployRequest": {
        "description": "Body for the informational `sidecar` form field on POST /v1/apps/{slug}/deployments/source-tarball. The CLI is the trust root for this deploy path; the API does NOT consult `github_installations` and does NOT attempt a server-side git fetch. The sidecar fields are recorded on the build row for provenance only — the build pipeline does NOT use them to fetch upstream.",
        "type": "object",
        "properties": {
          "healthcheck": {
            "$ref": "#/components/schemas/DeploymentHealthcheck",
            "description": "Startup readiness for this source-tarball deployment. Select exactly one HTTP path or standard gRPC health probe; omitted preserves source inference."
          },
          "repo": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[a-z0-9]([a-z0-9-]{1,38})[a-z0-9]/[a-z0-9._-]{1,100}$",
            "description": "`owner/repo` from the customer's git remote, parsed by the CLI. nil when the sidecar is omitted entirely."
          },
          "ref": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[a-f0-9]{40}$",
            "description": "40-char lowercase SHA from `git rev-parse HEAD`. Informational only; the build pipeline does NOT pin to this SHA."
          },
          "no_triggers": {
            "type": "boolean",
            "description": "Skip reconciling trigger declarations from the uploaded gregale manifest; app defaults and event subscriptions remain unchanged by this flag."
          },
          "environment": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$",
            "description": "Registered project environment to target for this local tarball deployment."
          },
          "reason": {
            "type": "string",
            "maxLength": 280,
            "description": "Free-form operator note on the tarball deploy request (≤280 chars). Example: 'Emergency rollback after payment provider incident'."
          },
          "tag": {
            "type": "string",
            "enum": [
              "incident_recovery",
              "hotfix",
              "scheduled_maintenance",
              "compliance_hold",
              "partner_request"
            ],
            "description": "Closed-set annotation tag on the tarball deploy request for grouping/filtering."
          },
          "deployed_by": {
            "type": "string",
            "description": "Human-readable actor label on the tarball deploy request. CLI auto-captures from `git config user.name`; the GitHub integration stamps pusher.name; the GitHub Action defaults to ${{ github.actor }}."
          },
          "pr_number": {
            "type": "integer",
            "minimum": 1,
            "description": "Pull-request number that drove this tarball deploy request (the GitHub integration pull_request.number; Action ${{ github.event.pull_request.number }}). NULL for push-to-main with no inferred PR."
          },
          "traffic_percent": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 100,
            "description": "Explicit initial traffic weight for this source-tarball deployment. Omitted uses the normal stable rollout; zero stages a dark live revision."
          },
          "canary": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CanaryPresetSpec"
              },
              {
                "type": "null"
              }
            ],
            "description": "Canary rollout policy for this source-tarball deployment. Mutually exclusive with traffic_percent."
          },
          "rollback_on_5xx": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Source-tarball deployment opt-in for first-wake 5xx auto-rollback; Pro/Scale only, with omitted or null defaulting to false."
          },
          "mcp_task_migration_override": {
            "type": "boolean",
            "description": "One-use operator override to allow this deployment to cut over while queued MCP tasks still need handler versions it does not provide."
          },
          "override_freeze": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Release this source tarball to production while a deploy freeze is active; the reason is audited."
          },
          "release_at": {
            "type": "string",
            "format": "date-time",
            "description": "Build this source tarball now, keep it live without traffic, and start its production rollout at this time; deploy freezes are checked at that time."
          },
          "release_notify": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "description": "Slack or email notification channels told when this source tarball, scheduled with release_at, starts or cannot start."
          },
          "disable_startup_cpu_boost": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Opt this source-tarball deployment out of temporary startup CPU headroom. Omitted or null preserves the default boost."
          }
        }
      },
      "UpdateDeploymentRequest": {
        "description": "Body for PATCH /v1/deployments/{id} (closure). The only mutable field post-create is the per-deployment cold-wake floor; image / digest / overrides / sidecars stay immutable.",
        "type": "object",
        "required": [
          "min_instances"
        ],
        "properties": {
          "min_instances": {
            "type": "integer",
            "minimum": 0,
            "description": "Per-deployment cold-wake floor override for PATCH /v1/deployments/{id}. 0 = inherit from parent app; positive value is the deployment's own floor. Effective per-instance floor = max(app, deployment). Validated against the parent app's plan MaxMinInstances cap."
          }
        }
      },
      "CancelDeploymentRequest": {
        "description": "Body for POST /v1/apps/{slug}/deployments/{id}/cancel. Optional — empty body defaults to reason='user' server-side. Reason is the closed set user | auto_quota | auto_health | system.",
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "enum": [
              "user",
              "auto_quota",
              "auto_health",
              "system"
            ]
          }
        }
      },
      "ClearObsoleteReport": {
        "description": "Response for POST /v1/apps/{slug}/deployments/clear-obsolete. Count is the number of soft-deleted rows in this call; OlderThan echoes the cutoff the store applied (default 168h).",
        "type": "object",
        "required": [
          "app_slug",
          "count",
          "older_than"
        ],
        "properties": {
          "app_slug": {
            "type": "string"
          },
          "count": {
            "type": "integer"
          },
          "older_than": {
            "type": "string",
            "description": "Echoes the cutoff the store applied to this clear pass (e.g. 168h = 7 days)."
          }
        }
      },
      "UpdateDeploymentTrafficRequest": {
        "description": "Body for PATCH /v1/deployments/{id}/traffic. Optionally require a particular live sibling to remain the sole 100% serving deployment when the update commits.",
        "type": "object",
        "required": [
          "traffic_percent"
        ],
        "properties": {
          "expected_review": {
            "$ref": "#/components/schemas/AppReleaseReview",
            "description": "Atomically require this named-environment review at promotion. Requires 100% traffic and expected_serving_deployment_id; protected targets cannot use manual promotion."
          },
          "traffic_percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Per-deployment traffic-split weight. 0 = no traffic (used during rollback). 100 = sole live deployment.",
            "example": 25
          },
          "expected_serving_deployment_id": {
            "type": "string",
            "description": "Optional 32-hex or dashed deployment id. An explicit empty string requires no live sibling with positive traffic, for guarded first deployment promotion. If the condition changes at the transaction boundary, the update returns 409 traffic_serving_changed without changing traffic."
          },
          "expected_traffic": {
            "type": "object",
            "description": "Optional split the change was planned from: every live release in the deployment's environment with positive traffic, keyed by deployment id, mapped to its percent (1-100, summing to 100, at most 100 releases). If the split differs at the transaction boundary, the update returns 409 traffic_serving_changed without changing traffic. Cannot be combined with expected_serving_deployment_id or expected_review.",
            "additionalProperties": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          "expected_mcp_access_policy": {
            "type": "object",
            "description": "Optional account-wide stored MCP policy condition, checked in the traffic transaction. Changed overlapping JWT rules return 409 mcp_access_policy_changed without changing traffic. When account_revision is supplied, the transaction also requires the unchanged account revision and fresh replay from every currently registered serving gateway. Gateway evidence is a database snapshot at admission, not runtime authorization or a lease on fleet membership.",
            "additionalProperties": false,
            "required": [
              "resource",
              "fingerprint"
            ],
            "properties": {
              "resource": {
                "type": "string",
                "format": "uri",
                "description": "Reviewed HTTPS MCP endpoint without credentials, query or fragment."
              },
              "account_revision": {
                "type": "integer",
                "format": "int64",
                "minimum": 1,
                "description": "Optional audited account edge-rule revision. Returns 409 mcp_account_revision_changed, mcp_gateway_evidence_unavailable, mcp_gateway_evidence_stale, or mcp_gateway_replay_pending when the transaction cannot admit promotion."
              },
              "fingerprint": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$",
                "description": "Version 1 SHA-256 fingerprint returned by gregale mcp access audit."
              }
            }
          }
        }
      },
      "AdvanceCanaryRequest": {
        "description": "Body for POST /v1/deployments/{id}/canary/advance. expected_step is the persisted canary step observed by the progression worker; APID derives the next traffic percentage and rejects stale observations.",
        "type": "object",
        "required": [
          "expected_step"
        ],
        "properties": {
          "profile_gate_rollback": {
            "type": "boolean",
            "default": false,
            "description": "Reserved for the lease-bound internal worker. Public requests reject true. Rollback intent cannot fall back to promotion when gate context changes."
          },
          "profile_gate_override": {
            "$ref": "#/components/schemas/ProfileGateOverride"
          },
          "expected_step": {
            "type": "integer",
            "minimum": 0,
            "description": "The canary_step the caller read before requesting the next stage.",
            "example": 1
          },
          "decision": {
            "$ref": "#/components/schemas/RolloutDecision",
            "description": "Reserved for Gregale's Safe Deploy worker. Public requests that set it are rejected with 422."
          },
          "cache_recovery": {
            "$ref": "#/components/schemas/CanaryCacheRecovery",
            "description": "Optional operator choice for the current final-step cache hold."
          }
        }
      },
      "RolloutDecision": {
        "description": "Evidence behind one decision about a rollout: why a canary stage advanced, is held, or was aborted. Aggregates only; no request payloads, routes, URLs or customer text.",
        "type": "object",
        "required": [
          "kind",
          "rule",
          "step",
          "traffic_percent",
          "decided_at"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "advance",
              "hold",
              "abort"
            ]
          },
          "rule": {
            "type": "string",
            "enum": [
              "advance_healthy",
              "advance_probe_evidence",
              "advance_low_traffic",
              "advance_no_predecessor",
              "advance_manual",
              "hold_insufficient_samples",
              "hold_signal_unavailable",
              "hold_observation_unavailable",
              "hold_health_alert",
              "abort_5xx",
              "abort_p95_latency",
              "abort_cold_boot_p95",
              "abort_cpu_per_request",
              "abort_dependency_errors",
              "abort_oom",
              "abort_crash_loop",
              "abort_manual",
              "abort_worker_lease_expired",
              "abort_post_release_5xx",
              "abort_post_release_p95_latency",
              "abort_release_gate",
              "abort_post_release_gate",
              "hold_awaiting_approval",
              "abort_approval_rejected",
              "abort_approval_timeout",
              "abort_route_health_timeout"
            ],
            "description": "Closed set; the breaker rules reuse the canary_progression_circuit_breaker_total event names."
          },
          "summary": {
            "type": "string",
            "maxLength": 256,
            "description": "The circuit breaker's aggregate-only reason."
          },
          "step": {
            "type": "integer",
            "minimum": 0,
            "description": "Zero-based canary step that was evaluated."
          },
          "traffic_percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "The candidate's share during the observation window."
          },
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "window_end": {
            "type": "string",
            "format": "date-time"
          },
          "stable_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "candidate": {
            "$ref": "#/components/schemas/RolloutDecisionSample"
          },
          "stable": {
            "$ref": "#/components/schemas/RolloutDecisionSample"
          },
          "probes_included": {
            "type": "boolean",
            "description": "The 5xx sample included synthetic probes of the app."
          },
          "signals": {
            "$ref": "#/components/schemas/RolloutDecisionSignals"
          },
          "gates": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/ReleaseGateResult"
            },
            "description": "The release gates judged with this decision."
          },
          "rollback_skipped": {
            "type": "string",
            "description": "Post-release decisions only: why an automatic rollback did not take the release off: the problem code that refused it, such as rollback_crosses_release, or rollback_failed when it ran and did not restore the previous release. The regression was found; the release keeps serving until someone rolls back or ships a fix."
          },
          "decided_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "RolloutDecisionSample": {
        "description": "One side's aggregates over the observation window. Request counts are organic requests; probe counts are reported separately.",
        "type": "object",
        "required": [
          "requests",
          "server_errors"
        ],
        "properties": {
          "requests": {
            "type": "integer",
            "minimum": 0
          },
          "server_errors": {
            "type": "integer",
            "minimum": 0
          },
          "probe_requests": {
            "type": "integer",
            "minimum": 0
          },
          "probe_server_errors": {
            "type": "integer",
            "minimum": 0
          },
          "p95_latency_ms": {
            "type": "number",
            "minimum": 0
          },
          "cold_boot_requests": {
            "type": "integer",
            "minimum": 0
          },
          "cold_boot_p95_latency_ms": {
            "type": "number",
            "minimum": 0
          },
          "cpu_requests": {
            "type": "integer",
            "minimum": 0
          },
          "cpu_usec": {
            "type": "integer",
            "minimum": 0
          },
          "dependency_calls": {
            "type": "integer",
            "minimum": 0
          },
          "dependency_errors": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "RolloutDecisionSignals": {
        "description": "The candidate's OOM kills and both sides' liveness-driven restarts over the window.",
        "type": "object",
        "required": [
          "oom_kills",
          "candidate_liveness_restarts",
          "stable_liveness_restarts"
        ],
        "properties": {
          "oom_kills": {
            "type": "number",
            "minimum": 0
          },
          "candidate_liveness_restarts": {
            "type": "number",
            "minimum": 0
          },
          "stable_liveness_restarts": {
            "type": "number",
            "minimum": 0
          }
        }
      },
      "CanaryAdvanceResponse": {
        "description": "The atomic canary transition result and the deployment_audit row id.",
        "type": "object",
        "required": [
          "deployment",
          "audit_id"
        ],
        "properties": {
          "profile_gate": {
            "$ref": "#/components/schemas/ProfileCanaryGateDecision"
          },
          "route_health": {
            "$ref": "#/components/schemas/RouteHealthDecision"
          },
          "route_gate": {
            "$ref": "#/components/schemas/RouteGateDecision"
          },
          "deployment": {
            "$ref": "#/components/schemas/DeploymentResponse"
          },
          "audit_id": {
            "type": "string",
            "description": "The deployment_audit row id, stringified for SDK portability.",
            "example": "42"
          }
        }
      },
      "AlertRollback": {
        "type": "object",
        "description": "Durable exact canary, active service, or opt-in completed-release rollback captured atomically with one production alert fire. Historical actions link one checked rollback operation and complete only after readiness, checked routing and service handoff barriers. Service actions pin the retained predecessor and complete only after the matching abort handoff finishes. Binding evidence is never reusable. Unavailable or ambiguous selections fail closed. Deleting the alert rule deletes its delivery and action ledger.",
        "required": [
          "id",
          "rule_id",
          "account_id",
          "app_id",
          "scope",
          "status",
          "reason",
          "observed_value",
          "fired_at",
          "updated_at"
        ],
        "properties": {
          "deployment_evidence": {
            "$ref": "#/components/schemas/AlertRollbackDeploymentEvidence"
          },
          "historical": {
            "type": "boolean"
          },
          "rollback_operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "rollback_phase": {
            "type": "string",
            "enum": [
              "preparing",
              "ready",
              "blocked",
              "routing",
              "complete",
              "failed"
            ]
          },
          "rollback_routing_audit_id": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "rule_id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "candidate_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "predecessor_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "blocked",
              "complete",
              "failed"
            ]
          },
          "reason": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "blockers": {
            "type": "array",
            "maxItems": 4,
            "items": {
              "$ref": "#/components/schemas/BindingCheckFinding"
            }
          },
          "observed_value": {
            "type": "number",
            "format": "double"
          },
          "fired_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "audit_id": {
            "type": "string"
          },
          "service": {
            "type": "boolean"
          },
          "service_request_id": {
            "type": "string",
            "format": "uuid"
          },
          "service_phase": {
            "type": "string",
            "enum": [
              "pending",
              "routing",
              "draining",
              "complete"
            ]
          },
          "service_routing_audit_id": {
            "type": "string"
          }
        }
      },
      "AlertRollbackDeploymentEvidence": {
        "type": "object",
        "description": "Exact deployment request evidence for post-deploy rollback. Windows contain only complete minutes after cutover and before the fire with 30 seconds of ingestion lag. Requests counts only 2xx and 5xx responses, weighted by telemetry publisher counts. At least 20 requests, one server error, and a sample within two minutes of the window end are required. Only error_rate_pct with gt or gte comparisons qualifies. Unaccepted fires expire after two minutes. Accepted evidence is immutable and included in intent and completion audits; existing accepted operations continue without requalification.",
        "required": [
          "version",
          "deployment_id",
          "metric",
          "comparison",
          "threshold",
          "window_spec",
          "cutover_at",
          "window_start",
          "window_end",
          "requests",
          "server_errors",
          "minimum_requests",
          "error_rate_pct",
          "status"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "metric": {
            "type": "string"
          },
          "comparison": {
            "type": "string"
          },
          "threshold": {
            "type": "number",
            "format": "double"
          },
          "window_spec": {
            "type": "string"
          },
          "cutover_at": {
            "type": "string",
            "format": "date-time"
          },
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "window_end": {
            "type": "string",
            "format": "date-time"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_sample_at": {
            "type": "string",
            "format": "date-time"
          },
          "requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "server_errors": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "minimum_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 20
          },
          "error_rate_pct": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 100
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "breached",
              "healthy",
              "insufficient",
              "unavailable",
              "unsupported",
              "stale",
              "expired"
            ]
          },
          "code": {
            "type": "string"
          }
        }
      },
      "RollbackOperation": {
        "type": "object",
        "description": "Durable progress of a rollback. A checked historical rollback reports its binding gates; a plain rollback (manual, dashboard, alert, or first-wake 5xx auto-rollback) reports preparing until its target serves (complete, with recovery_ms) or fails. This receipt grants no authority to reuse binding evidence or move traffic for another operation.",
        "required": [
          "id",
          "app_id",
          "scope",
          "target_deployment_id",
          "current_deployment_id",
          "status",
          "service",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "target_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "current_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "preparing",
              "ready",
              "blocked",
              "routing",
              "complete",
              "failed"
            ]
          },
          "service": {
            "type": "boolean"
          },
          "reason": {
            "type": "string",
            "maxLength": 256
          },
          "code": {
            "type": "string"
          },
          "blockers": {
            "type": "array",
            "maxItems": 4,
            "items": {
              "$ref": "#/components/schemas/BindingCheckFinding"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "audit_id": {
            "type": "string"
          },
          "trigger": {
            "type": "string",
            "enum": [
              "manual",
              "auto_5xx",
              "alert"
            ],
            "description": "What started a plain rollback. Absent for a checked rollback."
          },
          "recovery_ms": {
            "type": "integer",
            "minimum": 0,
            "description": "Milliseconds from the plain rollback request until its target served. Present once a plain rollback is complete."
          },
          "error": {
            "type": "string",
            "maxLength": 1024,
            "description": "Why a failed plain rollback did not restore the previous release; code carries the stable error code."
          },
          "cache": {
            "$ref": "#/components/schemas/RollbackCacheStatus"
          }
        }
      },
      "RollbackCacheStatus": {
        "type": "object",
        "description": "Background cache work tied to the exact production rollback. The traffic switch completes independently.",
        "required": [
          "status"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "restoring",
              "restored",
              "refreshing",
              "refreshed",
              "failed"
            ]
          },
          "receipt_id": {
            "type": "string",
            "format": "uuid"
          },
          "first_hit_state": {
            "type": "string",
            "enum": [
              "collecting",
              "observed",
              "unavailable"
            ],
            "description": "Whether the gateway observed a fresh cache hit within the first minute of this rollback."
          },
          "first_fresh_hit_ms": {
            "type": "integer",
            "minimum": 0,
            "description": "Milliseconds from cutover to the first observed fresh hit, sampled during the first minute."
          }
        }
      },
      "RollbackRequest": {
        "description": "Body for POST /v1/apps/{slug}/rollback. All fields optional. Without a body the handler falls back to rolling back to the most-recent superseded deployment (pre-#976 behaviour). With `target_deployment_id` set, the handler validates that the named deployment belongs to this app and is superseded or live with zero traffic.",
        "type": "object",
        "properties": {
          "target_deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "The UUID or vN of the deployment to promote back to 'live'. Must belong to the same app as the URL slug, and be superseded or live with zero traffic. Nil/empty falls back to the most-recent superseded deployment (legacy behaviour).",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "alert_rule_id": {
            "type": "string",
            "format": "uuid",
            "description": "When set, the handler stamps the deployment_audit row's alert_rule_id column with this UUID so an operator can cross-link the audit timeline back to /dashboard/alerts/{id}. Wire-additive; the field is ignored when nil/empty. Only privileged in-process callers (the metering service ActionDispatcher) set this; the API does not enforce role because the endpoint already requires MFA + ScopesDeployWrite.",
            "example": "abcdef0123456789abcdef0123456789"
          },
          "expected_current_deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Exact current deployment UUID or vN. Together with an explicit target starts the checked asynchronous workflow and returns rollback_operation. Rejects a changed current deployment instead of selecting another one."
          },
          "reason": {
            "type": "string",
            "maxLength": 256,
            "description": "One-line reason for an exact checked rollback. Cannot be combined with alert_rule_id."
          },
          "acknowledge_releases": {
            "type": "boolean",
            "description": "Roll back although release commands ran after the target last served. Rollback does not undo them. Without it such a rollback is refused with rollback_crosses_release, which lists them. Automated rollbacks never set it."
          },
          "restore_databases": {
            "type": "boolean",
            "description": "Also restore the managed PostgreSQL database the crossed release commands migrated to just before the earliest of them, and switch the app to that copy. Requires acknowledge_releases and the postgres:manage scope; cannot be combined with expected_current_deployment_id. The response carries database_switch; the code rollback happens inside it while the app is fenced."
          }
        }
      },
      "RollbackCrossedRelease": {
        "description": "A release command that ran after a rollback target last served. A rollback does not undo it.",
        "type": "object",
        "required": [
          "deployment_id",
          "status",
          "started_at"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "minimum": 1,
            "description": "The deployment's vN revision."
          },
          "status": {
            "type": "string",
            "description": "The release task's status. A failed release may still have committed changes."
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ReleaseRestorePoint": {
        "description": "The moment before the earliest crossed release for one managed PostgreSQL database the app's release commands can migrate, with the command that restores it into a new database.",
        "type": "object",
        "required": [
          "database_id",
          "database_name",
          "point_in_time",
          "command"
        ],
        "properties": {
          "database_id": {
            "type": "string",
            "format": "uuid"
          },
          "database_name": {
            "type": "string"
          },
          "point_in_time": {
            "type": "string",
            "format": "date-time"
          },
          "command": {
            "type": "string",
            "example": "gregale postgres restore 0123... --name orders-before-v42 --point-in-time 2026-10-15T10:02:13Z"
          }
        }
      },
      "ReleaseDatabaseRef": {
        "description": "A managed PostgreSQL database a release command can migrate.",
        "type": "object",
        "required": [
          "id",
          "name"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          }
        }
      },
      "DeploymentRelease": {
        "description": "A deployment's release command run.",
        "type": "object",
        "required": [
          "status"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "queued",
              "restoring",
              "running",
              "succeeded",
              "failed",
              "timed_out",
              "cancelled"
            ],
            "description": "The release task's status; pending before the image service has admitted the task."
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": "string",
            "format": "date-time"
          },
          "migration_databases": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReleaseDatabaseRef"
            },
            "description": "Managed PostgreSQL databases whose migration binding the release task receives."
          }
        }
      },
      "RecoverRolloutRequest": {
        "description": "Body for POST /v1/apps/{slug}/rollouts/recover. Closed-set `action` ∈ {advance, promote, abort}; `reason` is the operator-supplied free-text captured into the deployment_audit row's data payload.",
        "type": "object",
        "required": [
          "action"
        ],
        "properties": {
          "expected_review": {
            "$ref": "#/components/schemas/AppReleaseReview"
          },
          "action": {
            "type": "string",
            "enum": [
              "advance",
              "promote",
              "abort"
            ],
            "description": "The recovery action. `advance` requires the rollout to be stuck (>30 min in the same canary step); `promote` short-circuits the rollout to 100% / complete; `abort` flips rollout_state='aborted'.",
            "example": "promote"
          },
          "reason": {
            "type": "string",
            "description": "Operator-supplied reason (≤1024 chars). Lands verbatim in the deployment_audit row's data payload under the `reason` key.",
            "example": "manual-test"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Exact active canary or service rollout to abort. Requires action abort and expected_predecessor_deployment_id; both are checked in the recovery transaction."
          },
          "expected_predecessor_deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Exact older live predecessor in the candidate scope. Canary recovery requires positive serving weight; a service handoff also accepts its retained zero-weight predecessor. Required with deployment_id. Enforced binding policies check this exact recipient before routing can change."
          }
        }
      },
      "RolloutTransitionResponse": {
        "description": "POST /v1/apps/{slug}/rollouts/recover response. The post-recovery Deployment + the audit row id (so the operator's terminal can echo audit_id=…).",
        "type": "object",
        "required": [
          "deployment",
          "audit_id"
        ],
        "properties": {
          "deployment": {
            "$ref": "#/components/schemas/DeploymentResponse"
          },
          "audit_id": {
            "type": "string",
            "description": "The deployment_audit row id (stringified so JSON-number → int64 → BigInt drift doesn't poison SDK callers).",
            "example": "42"
          },
          "recovery": {
            "$ref": "#/components/schemas/RolloutRecoveryReceipt"
          },
          "service_recovery": {
            "$ref": "#/components/schemas/ServiceRolloutRecoveryReceipt"
          }
        }
      },
      "ServiceRolloutRecoveryReceipt": {
        "type": "object",
        "description": "Durable exact service abort request. Acceptance does not confirm traffic restoration, gateway acknowledgement or request drain. Poll the exact deployment's service_rollout_handoff.",
        "required": [
          "deployment_id",
          "predecessor_deployment_id",
          "request_id",
          "status"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "predecessor_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "accepted"
            ]
          }
        }
      },
      "RolloutRecoveryReceipt": {
        "type": "object",
        "description": "Committed exact canary abort, including the restored traffic recipient and any binding reports required by its stored release policy.",
        "required": [
          "deployment_id",
          "predecessor_deployment_id",
          "restored_traffic_percent"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "predecessor_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "restored_traffic_percent": {
            "type": "integer",
            "enum": [
              100
            ]
          },
          "bindings_checks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BindingCheckReport"
            }
          }
        }
      },
      "DeploymentListResponse": {
        "description": "Paginated deployment list with a `next_before` cursor for backward pagination.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeploymentResponse"
            }
          },
          "next_before": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "LatestDeploymentsByAppResponse": {
        "description": "At most one newest deployment for each non-deleted app owned by the authenticated account.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeploymentResponse"
            }
          }
        }
      },
      "DeploymentSummaryResponse": {
        "description": "App-scoped release cockpit: selected deployment, immediate predecessor, non-secret field-level diff, and eligible rollback target.",
        "type": "object",
        "required": [
          "deployment",
          "changes"
        ],
        "properties": {
          "deployment": {
            "$ref": "#/components/schemas/DeploymentResponse"
          },
          "previous": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DeploymentResponse"
              },
              {
                "type": "null"
              }
            ],
            "description": "The immediately older deployment by created_at, or null for an initial release."
          },
          "changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeploymentChange"
            }
          },
          "rollback_target_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The latest superseded deployment eligible for POST /v1/apps/{slug}/rollback; omitted when none exists."
          },
          "rollback_target_revision": {
            "type": "integer",
            "minimum": 1,
            "example": 41,
            "description": "Revision of `rollback_target_id`, so a client can render the rollback command with the `v41` handle a customer can read and retype. Omitted when the target predates the revision column; fall back to `rollback_target_id` rather than rendering `v0`."
          }
        }
      },
      "DeploymentChange": {
        "description": "One non-secret release field that changed from the previous deployment.",
        "type": "object",
        "required": [
          "field",
          "before",
          "after"
        ],
        "properties": {
          "field": {
            "type": "string",
            "enum": [
              "status",
              "kind",
              "build_id",
              "image_digest",
              "source_url",
              "commit_sha",
              "source_root",
              "scope",
              "build_plan",
              "min_instances",
              "traffic_percent",
              "has_overrides",
              "canary_preset",
              "rollout_state"
            ]
          },
          "before": {
            "type": [
              "string",
              "number",
              "boolean",
              "object",
              "null"
            ]
          },
          "after": {
            "type": [
              "string",
              "number",
              "boolean",
              "object",
              "null"
            ]
          }
        }
      },
      "OperationWorkflowPlaybookCompletionReview": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookCompletionReview. Bounded retained post-completion monitoring; updates never reopen or rewrite the original closure.",
        "required": [
          "id",
          "revision",
          "owner",
          "status",
          "expires_at",
          "state_revision",
          "current"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowPlaybookCompletionReview.id. Exact durable review identity."
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "OperationWorkflowPlaybookCompletionReview.revision. Worker observation fence."
          },
          "owner": {
            "type": "string",
            "description": "OperationWorkflowPlaybookCompletionReview.owner. Coordination owner frozen at completion."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "expired",
              "stopped"
            ],
            "description": "OperationWorkflowPlaybookCompletionReview.status. Monitoring lifetime; expired reviews no longer publish."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowPlaybookCompletionReview.expires_at. Original bounded window end from actual completion."
          },
          "state_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "OperationWorkflowPlaybookCompletionReview.state_revision. Highest comparable retained application revision."
          },
          "current": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookBusinessOutcome"
          }
        }
      },
      "OperationWorkflowPlaybookCompletionReviewEvent": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookCompletionReviewEvent. Durable result change linked to the original closed escalation; conveys no application execution authority.",
        "required": [
          "review_id",
          "source_notification_id",
          "source_sequence",
          "resolution",
          "previous",
          "current"
        ],
        "properties": {
          "review_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowPlaybookCompletionReviewEvent.review_id. Exact review identity."
          },
          "source_notification_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowPlaybookCompletionReviewEvent.source_notification_id. Original closed escalation notification."
          },
          "source_sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "OperationWorkflowPlaybookCompletionReviewEvent.source_sequence. Linkable original inbox sequence."
          },
          "resolution": {
            "type": "string",
            "enum": [
              "expected_outcome_achieved",
              "alternative_accepted",
              "follow_up_canceled"
            ],
            "description": "OperationWorkflowPlaybookCompletionReviewEvent.resolution. Original human disposition, unchanged by later evidence."
          },
          "previous": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookBusinessOutcome"
          },
          "current": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookBusinessOutcome"
          }
        }
      },
      "Invoice": {
        "description": "One persisted billing-provider invoice. Money is\ninteger cents in the provider's currency; EUR is the platform\ncurrency today, the field is preserved per-row so multi-currency\nsupport can land without a backfill. The PDF availability flag\nis the only PDF surface we expose — the hosted PDF URL is\nprovider-scoped and the customer fetches it from the\nStripe/Paddle portal, not via this API. The hosted URL itself\nis not on the wire; the column exists in invoices.hosted_url\nfor audit only.\n",
        "type": "object",
        "required": [
          "id",
          "provider",
          "provider_invoice_id",
          "status",
          "period_start",
          "period_end",
          "subtotal_cents",
          "tax_cents",
          "total_cents",
          "amount_paid_cents",
          "currency",
          "pdf_available",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "provider": {
            "type": "string",
            "enum": [
              "stripe",
              "paddle"
            ]
          },
          "provider_invoice_id": {
            "type": "string",
            "example": "in_1NxAbC2eZvKYlo2C0D4E5F6G"
          },
          "number": {
            "type": "string",
            "example": "FaaS-2026-007"
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "open",
              "paid",
              "uncollectible",
              "void"
            ]
          },
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "period_end": {
            "type": "string",
            "format": "date-time"
          },
          "subtotal_cents": {
            "type": "integer",
            "format": "int64"
          },
          "tax_cents": {
            "type": "integer",
            "format": "int64"
          },
          "total_cents": {
            "type": "integer",
            "format": "int64"
          },
          "amount_paid_cents": {
            "type": "integer",
            "format": "int64"
          },
          "currency": {
            "type": "string",
            "enum": [
              "eur"
            ],
            "example": "eur"
          },
          "pdf_available": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "InvoiceListResponse": {
        "description": "Paginated invoice list. Items is one page (period_end DESC, id\nDESC order). next_before is the cursor the caller passes on the\nnext request to fetch the older page. Empty Items with 200 OK\nis the empty-history shape — never 404.\n",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Invoice"
            }
          },
          "next_before": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "InvoiceRefreshResponse": {
        "description": "Persisted line coverage after refreshing an existing invoice from its billing provider.",
        "type": "object",
        "required": [
          "invoice_id",
          "provider",
          "detailed",
          "line_items",
          "updated_at"
        ],
        "properties": {
          "invoice_id": {
            "type": "string",
            "format": "uuid"
          },
          "provider": {
            "type": "string",
            "enum": [
              "stripe",
              "paddle",
              "polar"
            ]
          },
          "detailed": {
            "type": "boolean",
            "description": "Whether the refreshed line snapshot is complete, classified, and exactly reconciled."
          },
          "line_items": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000
          },
          "source_gap": {
            "type": "string",
            "enum": [
              "unavailable",
              "incomplete",
              "empty",
              "unclassified",
              "tax_in_non_tax_lines",
              "totals_mismatch"
            ],
            "description": "Reason for aggregate fallback; omitted when detailed is true."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "InvoiceHistoryBackfillResponse": {
        "description": "Counts and cursor for one provider invoice-history page.",
        "type": "object",
        "required": [
          "provider",
          "scanned",
          "imported",
          "skipped",
          "has_more"
        ],
        "properties": {
          "provider": {
            "type": "string",
            "enum": [
              "stripe",
              "paddle",
              "polar"
            ]
          },
          "scanned": {
            "type": "integer",
            "minimum": 0,
            "maximum": 25
          },
          "imported": {
            "type": "integer",
            "minimum": 0,
            "maximum": 25
          },
          "skipped": {
            "type": "integer",
            "minimum": 0,
            "maximum": 25
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": "string",
            "maxLength": 2048
          }
        }
      },
      "BillingStatusResponse": {
        "description": "Provider-independent customer billing status.",
        "type": "object",
        "required": [
          "mode",
          "enabled",
          "provider",
          "plan",
          "account_status",
          "customer_configured",
          "subscription_configured",
          "usage_reconciliation_enabled"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "live",
              "disabled"
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "provider": {
            "type": "string",
            "description": "Configured provider name; no provider-specific identifiers are exposed."
          },
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "hobby",
              "pro",
              "scale"
            ]
          },
          "account_status": {
            "type": "string",
            "enum": [
              "active",
              "past_due",
              "suspended",
              "deleted_pending"
            ]
          },
          "customer_configured": {
            "type": "boolean"
          },
          "subscription_configured": {
            "type": "boolean"
          },
          "usage_reconciliation_enabled": {
            "type": "boolean"
          },
          "subscription_ends_at": {
            "type": "string",
            "format": "date-time",
            "description": "When a scheduled cancellation ends the subscription instead of renewing it; the plan then returns to Free. Absent when none is scheduled."
          },
          "scheduled_plan": {
            "type": "string",
            "enum": [
              "free",
              "hobby",
              "pro",
              "scale"
            ],
            "description": "The plan a scheduled downgrade moves to at scheduled_plan_at. Absent when none is scheduled."
          },
          "scheduled_plan_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the scheduled downgrade applies."
          }
        }
      },
      "BillingPortalResponse": {
        "description": "Provider-authenticated or operator-configured billing portal URL plus the\ncard-on-file summary. The url field is omitted\nwhen neither a provider session nor FAAS_BILLING_PORTAL_URL is\navailable — that is the \"absent\" sentinel; the CLI branches on it\nto print a friendly hint instead of opening the browser to \"\". The payment_method\nfield is omitted when the account has no card on file (Free\nplan, or post-checkout before the first paid cycle settles).\n",
        "type": "object",
        "properties": {
          "url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "description": "Short-lived provider session URL, or substituted operator URL when no provider session is available."
          },
          "payment_method": {
            "$ref": "#/components/schemas/PaymentMethodSummary",
            "description": "Card-on-file summary. Omitted when the account has no\npayment method on file (Free / never-checked-out). The\nCLI's `faas billing payment-method` and the dashboard's\nbilling page render from this field.\n"
          }
        }
      },
      "PaymentMethodSummary": {
        "description": "Card-on-file summary. Provider-agnostic shape —\nthe same wire shape is returned whether the operator runs\nStripe or Paddle. brand is the lowercase network label\n(\"visa\", \"mastercard\", \"amex\"); last4 is the last-4 of the\nPAN (no full PAN, no PCI surface); exp_month / exp_year are\ninteger card-face expiry fields.\n",
        "type": "object",
        "required": [
          "brand",
          "last4",
          "exp_month",
          "exp_year"
        ],
        "properties": {
          "brand": {
            "type": "string",
            "example": "visa",
            "description": "Card network (lowercase)."
          },
          "last4": {
            "type": "string",
            "example": "4242",
            "description": "Last 4 digits of the PAN."
          },
          "exp_month": {
            "type": "integer",
            "minimum": 1,
            "maximum": 12,
            "example": 12,
            "description": "Card expiry month (1-12)."
          },
          "exp_year": {
            "type": "integer",
            "minimum": 2020,
            "example": 2027,
            "description": "Card expiry year."
          }
        }
      },
      "BillingRetryResponse": {
        "description": "Returned by POST /v1/billing/retry. The CLI\nprints attempt_id and provider_ref_id so the customer can\nquote them to support if the charge still fails. status is\n\"pending_provider_confirmation\" — the CLI does not poll for\na settlement flip; that flip arrives via the provider's\nwebhook (EventPaymentSucceeded) and is rendered by the\ndashboard / dunning email pipeline.\n",
        "type": "object",
        "required": [
          "attempt_id",
          "provider_ref_id",
          "status"
        ],
        "properties": {
          "attempt_id": {
            "type": "string",
            "description": "apId-side attempt handle (Stripe: in_…, Paddle: txn_…-related)."
          },
          "provider_ref_id": {
            "type": "string",
            "description": "Provider-side handle for the new attempt (Stripe: pi_…, Paddle: tx_…)."
          },
          "status": {
            "type": "string",
            "description": "Always \"pending_provider_confirmation\" today; reserved for future settlement states."
          },
          "next_billing_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Next scheduled billing instant after the retry settles; null when not known yet."
          }
        }
      },
      "BillingCancelResponse": {
        "description": "Returned by POST /v1/billing/cancel. The CLI\nrenders effective_at as \"your apps will stop on <date>\".\ncancel_scheduled is always true on 200; the 409 path returns\na Problem with a friendly \"already cancelled\" hint so a\nre-cancel idempotency click does not surface as a server error.\n",
        "type": "object",
        "required": [
          "cancel_scheduled",
          "effective_at"
        ],
        "properties": {
          "cancel_scheduled": {
            "type": "boolean",
            "description": "Always true; the absence of an active subscription returns 409 instead."
          },
          "effective_at": {
            "type": "string",
            "format": "date-time",
            "description": "RFC 3339 instant at which the subscription terminates (Stripe: current_period_end; Paddle: next month-rollover)."
          }
        }
      },
      "BillingReconcileResponse": {
        "description": "Returned by POST /v1/admin/billing-reconcile/{id}.\nmb_seconds is the integer total the provider SDK returned\nfor the rolling 30-day window [start, end). Operators can\ndiff the SDK-side number against the local usage_minutes\nsum to spot drift between the platform's billing source\nof truth and the provider's ledger.\n",
        "type": "object",
        "required": [
          "account_id",
          "start",
          "end",
          "mb_seconds"
        ],
        "properties": {
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "start": {
            "type": "string",
            "format": "date-time",
            "description": "Window start (RFC 3339, UTC)."
          },
          "end": {
            "type": "string",
            "format": "date-time",
            "description": "Window end (RFC 3339, UTC)."
          },
          "mb_seconds": {
            "type": "integer",
            "minimum": 0,
            "description": "Integer mb_seconds total for the window."
          }
        }
      },
      "BillingCatalogEntry": {
        "description": "One row in the provider price + product catalog.\nPlan values are the billable api.Plan constants\n(\"hobby\", \"pro\", \"scale\") — PlanFree is intentionally\nabsent because it carries no recurring line item.\nHandle is the provider-side product or price ID. SyncedAt is\nRFC 3339 UTC from the catalog's last successful preflight.\n",
        "type": "object",
        "required": [
          "plan",
          "kind",
          "handle",
          "synced_at"
        ],
        "properties": {
          "plan": {
            "type": "string",
            "enum": [
              "hobby",
              "pro",
              "scale"
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "monthly",
              "overage",
              "product"
            ]
          },
          "handle": {
            "type": "string",
            "description": "Provider price or product ID."
          },
          "synced_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "BillingCatalogResponse": {
        "description": "Wire shape for GET / POST / DELETE\n/v1/admin/billing-paddle-catalog compatibility endpoints. Provider is the active billing provider's name\n(polar / paddle); providers without a catalog surface\nreturn 501. SyncedAt is the timestamp of the most recent\nsuccessful catalog preflight; empty when no hydration has\ncompleted.\n",
        "type": "object",
        "required": [
          "provider",
          "synced_at",
          "entries"
        ],
        "properties": {
          "provider": {
            "type": "string",
            "description": "Active provider name (polar / paddle)."
          },
          "synced_at": {
            "type": "string",
            "description": "RFC 3339 last-sync timestamp; empty string when never synced."
          },
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BillingCatalogEntry"
            }
          }
        }
      },
      "BillingPaddleOveragePreflightResponse": {
        "description": "Wire shape for GET /v1/admin/billing-paddle-overage/preflight\nOperator-side guard that\nprobes information_schema.columns for the four migration-00041\ncolumns + counts the per-state rows in a single round-trip.\n\ntable_exists is false when the paddle_overage_dedupe table is\nentirely absent (migrations 00034 + 00041 both unapplied).\nhas_window_start / has_state / has_claimed_at / has_claimed_by\neach correspond to one of the four columns added by\nmigration 00041; all four must be true for the metering service\noverage pusher to land. pending_rows / completed_rows are\nthe per-state row totals (a single SQL filter pair).\n",
        "type": "object",
        "required": [
          "table_exists",
          "has_window_start",
          "has_state",
          "has_claimed_at",
          "has_claimed_by",
          "pending_rows",
          "completed_rows"
        ],
        "properties": {
          "table_exists": {
            "type": "boolean",
            "description": "true if the paddle_overage_dedupe table is present (00034+)."
          },
          "has_window_start": {
            "type": "boolean",
            "description": "true if the migration-00041 window_start column exists."
          },
          "has_state": {
            "type": "boolean",
            "description": "true if the migration-00041 state column exists."
          },
          "has_claimed_at": {
            "type": "boolean",
            "description": "true if the migration-00041 claimed_at column exists."
          },
          "has_claimed_by": {
            "type": "boolean",
            "description": "true if the migration-00041 claimed_by column exists."
          },
          "pending_rows": {
            "type": "integer",
            "minimum": 0,
            "description": "count(*) where state = pending."
          },
          "completed_rows": {
            "type": "integer",
            "minimum": 0,
            "description": "count(*) where state = completed."
          }
        }
      },
      "BuildProvenanceResponse": {
        "description": "The\npost-mortem \"what ran?\" record for a single successful build.\nField names mirror the `build_provenance` table columns. Empty\nstrings indicate a column the populator hasn't filled yet —\n`buildkit_version`, `railpack_version`, `base_digest`,\n`runner_digest`, and `sbom_storage_key` are populated by\nPhase 3 (cosign signer + syft SBOM), but the columns exist\ntoday so is a zero-cost schema change.\n`framework_version` is the language version the customer's\nsource declares (`.nvmrc`, `package.json::engines.node`,\n`pyproject.toml::requires-python`, `.python-version`,\n`.tool-versions`, `go.mod` directive); added. OBSERVATIONAL ONLY — the build\npipeline never reads it (the runtime is bound by the OCI\nbase ref via `FAAS_DEPLOY_BASE_REF_<RUNTIME>`).\n",
        "type": "object",
        "required": [
          "id",
          "build_id",
          "source_sha256",
          "plan",
          "builder_node_id",
          "started_at",
          "finished_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "build_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "buildkit_version": {
            "type": "string"
          },
          "railpack_version": {
            "type": "string"
          },
          "base_digest": {
            "type": "string"
          },
          "source_sha256": {
            "type": "string",
            "description": "sha256 of the customer's source tarball (the cache lookup key)."
          },
          "source_url": {
            "type": "string"
          },
          "commit_sha": {
            "type": "string"
          },
          "plan": {
            "type": "string",
            "description": "free / hobby / pro / scale — copied from the account at claim time."
          },
          "runner_digest": {
            "type": "string"
          },
          "builder_node_id": {
            "type": "string",
            "description": "Compute node name (`default-local` on a single-node install)."
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": "string",
            "format": "date-time"
          },
          "sbom_storage_key": {
            "type": [
              "string",
              "null"
            ],
            "description": "Populator fills this from `syft` output. Empty string when not yet populated."
          },
          "framework_version": {
            "type": [
              "string",
              "null"
            ],
            "description": "Source-declared language version (nodes 22.11.0 / python 3.13 / go 1.24, etc.). Empty string when no version file is present or any parser fails — best-effort, never an error. Added."
          }
        }
      },
      "BuildResponse": {
        "description": "The LIFECYCLE row for\na single build — current status, enqueued/started/finished\ntimestamps, failure_class, server-computed duration_seconds.\nCompanion to BuildProvenanceResponse (post-mortem export) and the /sbom route (post-mortem blob). The status field mirrors builds.status — a\n5-state enum `queued|running|succeeded|failed|cancelled`.\n\nfailure_class is the low-cardinality enum\n`oom|timeout|user_error|infra` per the\n`builds_failure_class_check` CHECK; present only when\nstatus='failed'.\n\nduration_seconds is server-computed from started_at to the terminal\nfinished_at or cancelled_at timestamp; absent when the build never\nstarted. CI scripts can\nrely on its presence as \"the build reached a terminal state\nand elapsed N wall-clock seconds.\" error_message is\nintentionally NOT in this response — it lives on\ndeployments; clients that need the per-failure string call\nGET /v1/deployments/{id}.\n",
        "type": "object",
        "required": [
          "id",
          "deployment_id",
          "kind",
          "source_bytes",
          "status",
          "enqueued_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "deployment_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "kind": {
            "type": "string",
            "enum": [
              "railpack",
              "dockerfile",
              "tarball",
              "github"
            ]
          },
          "source_bytes": {
            "type": "integer",
            "format": "int64"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "succeeded",
              "failed",
              "cancelled"
            ]
          },
          "failure_class": {
            "type": "string",
            "enum": [
              "oom",
              "timeout",
              "user_error",
              "infra"
            ]
          },
          "enqueued_at": {
            "type": "string",
            "format": "date-time"
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": "string",
            "format": "date-time"
          },
          "cancelled_at": {
            "type": "string",
            "format": "date-time",
            "description": "Terminal cancellation timestamp. A queued cancellation can have cancelled_at without started_at or duration_seconds."
          },
          "duration_seconds": {
            "type": "integer",
            "description": "Server-computed terminal timestamp (finished_at or cancelled_at) minus started_at in whole seconds. Absent when the build never started."
          },
          "cache_status": {
            "type": "string",
            "enum": [
              "hit",
              "miss",
              "invalidated"
            ],
            "description": "Builderd cache decision for this build."
          },
          "cache_key_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "SHA-256 digest of the versioned BuildCacheRecipe."
          }
        }
      },
      "BuildListResponse": {
        "description": "The page shape for GET /v1/builds. Items is one page of\nbuilds ordered started_at DESC NULLS LAST — queued builds\n(started_at IS NULL) sink to the bottom of the first page\nper the new index builds_deployment_started_idx. The\nnext_before cursor is the opaque tuple\n`<rfc3339nano>|<id_hex>` of the LAST row on this page\n(post-review fix; code review surfaced issues 1+2 that\nthe id tiebreaker resolves). The started_at segment is\nempty for queued-tail pages (the cursor becomes a pure\nid anchor in the NULL zone). An empty next_before\nsignals end-of-list. Round-trip the cursor verbatim on\nsubsequent requests; do NOT re-parse or re-encode.\n\nMirrors DeploymentListResponse in shape only. The new\nindex and the sibling ListBuildsForAccountPaged method\n(state layer) make this O(page-size) regardless of\naccount size; the unlimited\nListBuildsForAccount(ctx, accountID) stays intact for the\nGDPR export.\n",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BuildResponse"
            }
          },
          "next_before": {
            "type": "string",
            "description": "Opaque cursor for the next page. Empty = end of list.\nWire format: `<rfc3339nano>|<id_hex>` (pipe-separated).\nThe id is the Build.ID of the LAST row on this page;\nthe started_at segment is RFC3339Nano (sub-second\npreserved) for non-queued rows, or empty for queued\nrows (the cursor then keys on id alone in the NULL\nzone). Round-trip verbatim — server-parsed, no client\nre-encoding.\n"
          }
        }
      },
      "AccountCreditResponse": {
        "description": "One row in the account_credits table. cents_remaining\nis the integer-cents balance still available; consumption\ndecrements it (the consumption reducer lands in a follow-up\nPR). expires_at is RFC 3339 when set; absent (or null) means\nthe credit is valid until fully consumed. reason is the\noperator-supplied audit text (3..500 chars).\n",
        "type": "object",
        "required": [
          "id",
          "account_id",
          "cents_remaining",
          "reason",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "cents_remaining": {
            "type": "integer",
            "minimum": 0
          },
          "reason": {
            "type": "string",
            "minLength": 3,
            "maxLength": 500
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "AdminRefundResponse": {
        "description": "Result of an operator-initiated Polar refund. The local invoice and\nprovider refund identifiers are both returned for reconciliation.\nAmounts are integer EUR cents.\n",
        "type": "object",
        "required": [
          "account_id",
          "invoice_id",
          "provider",
          "provider_refund_id",
          "charge_id",
          "amount_cents",
          "currency",
          "status"
        ],
        "properties": {
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "invoice_id": {
            "type": "string",
            "format": "uuid"
          },
          "provider": {
            "type": "string",
            "enum": [
              "polar"
            ]
          },
          "provider_refund_id": {
            "type": "string"
          },
          "charge_id": {
            "type": "string",
            "description": "Polar order ID used by the refund."
          },
          "amount_cents": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "currency": {
            "type": "string",
            "example": "eur"
          },
          "status": {
            "type": "string",
            "description": "Provider refund status."
          }
        }
      },
      "AdminSetGithubWebhookSecretResponse": {
        "description": "Response shape for POST /v1/admin/github-webhook-secrets. upgraded_at is the\npost-upsert stamp — every successful call bumps it\n(the audit trail; an operator re-running with the same\nsecret is itself a rotation event worth recording).\n",
        "type": "object",
        "required": [
          "installation_id",
          "upgraded_at",
          "upgraded_by"
        ],
        "properties": {
          "installation_id": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "upgraded_at": {
            "type": "string",
            "format": "date-time"
          },
          "upgraded_by": {
            "type": "string",
            "description": "admin:<account_id> or platform"
          }
        }
      },
      "AdminSetGithubWebhookSecretRequest": {
        "description": "Body shape for POST /v1/admin/github-webhook-secrets. The CLI takes hex so the\nplaintext never has to be a binary argv value; the API\nhandler hex-decodes before the INSERT.\n",
        "type": "object",
        "required": [
          "installation_id",
          "secret_hex"
        ],
        "properties": {
          "installation_id": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "GitHub App installation_id (positive bigint)."
          },
          "secret_hex": {
            "type": "string",
            "minLength": 32,
            "maxLength": 128,
            "description": "Hex-encoded secret (16..64 bytes; 32..128 hex chars)."
          }
        }
      },
      "ConsumeInvoiceResponse": {
        "description": "Returned by POST /v1/invoices/{id}/consume-credits. consumed_cents is the floored integer cents of\noverage drained against this invoice. remaining_credits_cents\nis the sum of cents_remaining across the account's active\ncredits after the call. already_consumed_for_invoice is true\non idempotent replays (the reducer returns the same\nconsumed_cents without double-decrementing). per_credit lists\nFIFO-ordered credit drains with their post-decrement balance.\nMoney is integer cents (CLAUDE.md).\n",
        "type": "object",
        "required": [
          "invoice_id",
          "consumed_cents",
          "remaining_credits_cents",
          "already_consumed_for_invoice",
          "per_credit"
        ],
        "properties": {
          "invoice_id": {
            "type": "string",
            "format": "uuid"
          },
          "consumed_cents": {
            "type": "integer",
            "minimum": 0
          },
          "remaining_credits_cents": {
            "type": "integer",
            "minimum": 0
          },
          "already_consumed_for_invoice": {
            "type": "boolean"
          },
          "per_credit": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConsumedCreditRow"
            }
          }
        }
      },
      "ConsumedCreditRow": {
        "description": "One FIFO drain row inside ConsumeInvoiceResponse.per_credit.\ndelta_cents is the negative-cents decrement applied to the\ncredit; new_balance is cents_remaining after the call.\n",
        "type": "object",
        "required": [
          "credit_id",
          "delta_cents",
          "new_balance"
        ],
        "properties": {
          "credit_id": {
            "type": "string",
            "format": "uuid"
          },
          "delta_cents": {
            "type": "integer",
            "maximum": 0,
            "description": "Negative integer cents applied to the credit."
          },
          "new_balance": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "WorkflowTriggerSpec": {
        "description": "Manual start, a five-field recurring schedule, or an internal event start. Event triggers use source/event_type patterns and a JSON content filter; matching runs receive the full CloudEvents envelope as input. Event recipients and workflow definitions are captured when an event is accepted. Scheduled starts skip missed minutes by default; catch_up latest recovers at most one unconsumed fire inside a bounded window. Overlapping runs are skipped by default. Scheduling is active only on the live default deployment and requires the workflow runtime. New deployments and changed triggers arm before firing. An app owner may mark a schedule tenant_configurable to let each linked customer manage only its own cadence, timezone, overlap behavior, and enabled state; catch-up remains owner-controlled.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "manual",
              "schedule",
              "event"
            ]
          },
          "schedule": {
            "type": "string",
            "description": "Five-field cron expression, required for schedule triggers."
          },
          "timezone": {
            "type": "string",
            "description": "IANA timezone for schedule triggers; defaults to UTC."
          },
          "input": {
            "description": "Fixed JSON input for scheduled runs, bounded by the workflow run-input limit."
          },
          "overlap": {
            "type": "string",
            "enum": [
              "skip",
              "allow"
            ],
            "description": "Skip a minute while any run of this workflow is active, or allow overlap subject to the app run quota. Defaults to skip."
          },
          "catch_up": {
            "type": "string",
            "enum": [
              "skip",
              "latest"
            ],
            "description": "Schedule-only recovery policy; defaults to skip. Latest coalesces missed fires into at most one run inside the recovery window; a current-minute fire takes precedence. Quota and overlap skips consume the interval."
          },
          "catch_up_window": {
            "type": "string",
            "description": "Schedule-only duration used with catch_up latest, between 1m and 24h. Defaults to 1h; fires exactly at the age limit are included. Other policies reject this field."
          },
          "enabled": {
            "type": "boolean",
            "description": "Whether the automatic trigger is enabled; defaults to true. Already accepted events and existing runs continue after disabling."
          },
          "tenant_configurable": {
            "type": "boolean",
            "description": "For schedule triggers, allow each linked platform tenant to manage its own schedule, timezone, overlap behavior, and enabled state. Workflow input and definition remain app-owned."
          },
          "source": {
            "type": "string",
            "description": "Required for event triggers; exact source or edge wildcard pattern."
          },
          "event_type": {
            "type": "string",
            "description": "Required for event triggers; exact event type or edge wildcard pattern."
          },
          "filter": {
            "type": "object",
            "additionalProperties": true,
            "description": "Optional JSON predicate evaluated against the CloudEvents envelope. Event triggers reject schedule, timezone, input, overlap, and catch-up options."
          }
        }
      },
      "StoredWorkflowFailurePolicy": {
        "type": "object",
        "additionalProperties": false,
        "description": "Opt-in thresholds for scheduler-enforced failure admission pausing.",
        "required": [
          "version",
          "enabled",
          "failure_threshold",
          "min_completed_runs",
          "window_seconds"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Monotonic failure monitoring policy revision; zero means no policy has been configured."
          },
          "enabled": {
            "type": "boolean",
            "description": "Whether scheduler evaluation can create a new runtime failure pause."
          },
          "failure_threshold": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Terminal failures required to latch a failure pause.",
            "maximum": 10000
          },
          "min_completed_runs": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Minimum terminal non-cancelled sample count before failure pausing.",
            "maximum": 10000
          },
          "window_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 60,
            "description": "Lookback in seconds, bounded by the latest monitoring epoch.",
            "maximum": 86400
          }
        }
      },
      "SetStoredWorkflowFailurePolicyRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Complete failure policy replacement guarded by an expected version.",
        "required": [
          "expected_version",
          "enabled",
          "failure_threshold",
          "min_completed_runs",
          "window_seconds"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Failure policy revision the caller intends to replace."
          },
          "enabled": {
            "type": "boolean",
            "description": "Requested setting controlling whether scheduler evaluation can create a new runtime failure pause."
          },
          "failure_threshold": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Requested number of terminal failures required to latch a failure pause.",
            "maximum": 10000
          },
          "min_completed_runs": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Requested minimum terminal non-cancelled sample count before failure pausing.",
            "maximum": 10000
          },
          "window_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 60,
            "description": "Requested lookback in seconds, bounded by the latest monitoring epoch.",
            "maximum": 86400
          }
        }
      },
      "ResumeStoredWorkflowFailurePauseRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Explicit failure guard resume guarded by its current generation.",
        "required": [
          "expected_generation"
        ],
        "properties": {
          "expected_generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Positive pause generation reviewed by the caller."
          }
        }
      },
      "StoredWorkflowFailureTransition": {
        "type": "object",
        "additionalProperties": false,
        "description": "Immutable bounded aggregate evidence for a failure guard transition.",
        "required": [
          "generation",
          "state",
          "reason",
          "recorded_at",
          "failures",
          "completed_runs",
          "policy_version"
        ],
        "properties": {
          "generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Unique runtime transition generation for this stored workflow."
          },
          "state": {
            "type": "string",
            "enum": [
              "paused",
              "resumed"
            ],
            "description": "Failure guard state resulting from this transition."
          },
          "reason": {
            "type": "string",
            "enum": [
              "failure_threshold",
              "operator_resume"
            ],
            "description": "Closed reason for the recorded transition."
          },
          "recorded_at": {
            "type": "string",
            "format": "date-time",
            "description": "Server timestamp of the pause or operator resume."
          },
          "failures": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Observed failures recorded with this transition."
          },
          "completed_runs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Observed completed sample count recorded with this transition."
          },
          "policy_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Failure monitoring policy revision used for this transition."
          },
          "actor_account_id": {
            "type": "string",
            "description": "Account that explicitly resumed; empty or omitted for an automatic pause."
          }
        }
      },
      "StoredWorkflowFailurePolicyResponse": {
        "type": "object",
        "additionalProperties": false,
        "description": "Failure guard state, monitoring configuration and advisory retained-work preview.",
        "required": [
          "policy",
          "paused",
          "generation",
          "observed_failures",
          "observed_completed_runs",
          "pending_runs",
          "running_runs",
          "waiting_runs",
          "retained_events",
          "history"
        ],
        "properties": {
          "policy": {
            "$ref": "#/components/schemas/StoredWorkflowFailurePolicy"
          },
          "paused": {
            "type": "boolean",
            "description": "Whether automatic admissions are blocked by the durable failure guard."
          },
          "generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Current guard generation; resume requires this value."
          },
          "monitoring_since": {
            "type": "string",
            "format": "date-time",
            "description": "Start of the fresh monitoring epoch; absent before configuration."
          },
          "paused_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time the current failure pause was latched; absent while unpaused."
          },
          "observed_failures": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Failed and dead runs completed in the current bounded observation window."
          },
          "observed_completed_runs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Succeeded, failed and dead runs completed in the current observation window."
          },
          "pending_runs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Existing pending runs that continue despite a failure admission pause."
          },
          "running_runs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Already running workflows unaffected by admission pausing."
          },
          "waiting_runs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Existing workflows parked on timers or external events."
          },
          "retained_events": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Advisory count of unadmitted retained event recipients for this stored workflow."
          },
          "history": {
            "type": "array",
            "maxItems": 100,
            "description": "Latest pause and resume transitions in descending generation order.",
            "items": {
              "$ref": "#/components/schemas/StoredWorkflowFailureTransition"
            }
          }
        }
      },
      "StoredWorkflowResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "version",
          "source",
          "draft",
          "enabled"
        ],
        "properties": {
          "test_suite": {
            "$ref": "#/components/schemas/StoredWorkflowTestSuite"
          },
          "test_report": {
            "$ref": "#/components/schemas/StoredWorkflowTestReport"
          },
          "failure_paused": {
            "type": "boolean",
            "description": "Runtime failure guard blocks automatic admissions independently of configured enabled intent."
          },
          "name": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Opaque monotonically increasing revision. Zero creates the first draft. A stale value returns stored_workflow_version_conflict."
          },
          "source": {
            "type": "string",
            "enum": [
              "manifest",
              "dashboard",
              "draft"
            ]
          },
          "draft": {
            "$ref": "#/components/schemas/WorkflowSpec"
          },
          "published": {
            "$ref": "#/components/schemas/WorkflowSpec"
          },
          "published_version": {
            "type": "integer",
            "format": "int64"
          },
          "enabled": {
            "type": "boolean"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "description": "Saved draft, publication, ownership and opaque revision of one stored workflow."
      },
      "ListStoredWorkflowsResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "app_slug",
          "runtime_enabled",
          "max_definitions",
          "stored_workflows"
        ],
        "properties": {
          "app_slug": {
            "type": "string"
          },
          "runtime_enabled": {
            "type": "boolean"
          },
          "unavailable_reason": {
            "type": "string"
          },
          "max_definitions": {
            "type": "integer"
          },
          "stored_workflows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StoredWorkflowResponse"
            }
          }
        },
        "description": "App stored workflow definitions, plan limit and execution availability."
      },
      "StoredWorkflowHealthRun": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "status",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "running",
              "awaiting_event",
              "succeeded",
              "failed",
              "dead"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "description": "Safe recent-run identity and timestamps; workflow input, output and error text are omitted."
      },
      "StoredWorkflowHealthStepFailure": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "step_name",
          "failed_run_count",
          "last_failed_at"
        ],
        "properties": {
          "step_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "failed_run_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "last_failed_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "description": "Number of terminal runs that failed at this logical step; loop items are grouped by parent."
      },
      "StoredWorkflowQueueHealth": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "observed_at",
          "waiting_run_count",
          "due_run_count",
          "stale_run_count",
          "oldest_due_age_seconds",
          "app_running_count",
          "app_dispatch_limit",
          "tenant_dispatch_limit",
          "app_at_capacity",
          "reason_counts"
        ],
        "properties": {
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "waiting_run_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Current pending and parked runs plus expired running leases for this stored workflow; reason counts sum to this value."
          },
          "due_run_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Due waiting runs including capacity blockers and lease recovery."
          },
          "stale_run_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Running stored workflow runs whose dispatch lease has expired."
          },
          "oldest_due_age_seconds": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "description": "Age since the oldest due run became eligible, bounded by creation time; zero if none is due."
          },
          "app_running_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Live stored workflow dispatch claims across all workflows and tenants in this app; excludes expired leases and native operation custody."
          },
          "app_dispatch_limit": {
            "type": "integer",
            "minimum": 1
          },
          "tenant_dispatch_limit": {
            "type": "integer",
            "minimum": 1,
            "description": "Live claim limit per tenant within this app."
          },
          "app_at_capacity": {
            "type": "boolean"
          },
          "reason_counts": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "ready",
              "scheduled",
              "retry_backoff",
              "parked_wait",
              "app_capacity",
              "tenant_capacity",
              "workflow_capacity"
            ],
            "properties": {
              "ready": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "Due and passes observed run admission checks; does not guarantee immediate handler execution."
              },
              "scheduled": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "Future scheduling deadline that is not a pending step retry."
              },
              "retry_backoff": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "A pending step retry deadline equals the future persisted run wake."
              },
              "parked_wait": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "Intentional future wait or timeout; inspect steps for timer, condition, event or callback details."
              },
              "app_capacity": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "tenant_capacity": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "workflow_capacity": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "The captured workflow definition run budget is full."
              }
            }
          }
        },
        "description": "Current app-owned queue diagnostics independent of the historical health window. Each waiting run has one primary reason; future wakes take precedence followed by app, tenant and workflow capacity. No payloads or tenant identities, global worker occupancy or completion estimates are returned."
      },
      "StoredWorkflowHealthResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "app_slug",
          "stored_workflow_name",
          "window_start",
          "window_end",
          "run_count",
          "completed_run_count",
          "active_run_count",
          "queued_run_count",
          "success_rate",
          "status_counts",
          "failed_steps"
        ],
        "properties": {
          "app_slug": {
            "type": "string"
          },
          "stored_workflow_name": {
            "type": "string"
          },
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "window_end": {
            "type": "string",
            "format": "date-time"
          },
          "run_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "completed_run_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "active_run_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Current non-terminal runs that have started, including retries and parked waits; independent of the requested health window."
          },
          "queued_run_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Current pending runs that have not started; independent of the requested health window."
          },
          "queue": {
            "$ref": "#/components/schemas/StoredWorkflowQueueHealth"
          },
          "success_rate": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 1,
            "description": "Succeeded runs divided by succeeded, failed and dead runs; zero when none completed."
          },
          "status_counts": {
            "type": "object",
            "required": [
              "pending",
              "running",
              "awaiting_event",
              "succeeded",
              "failed",
              "dead"
            ],
            "properties": {
              "pending": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "running": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "awaiting_event": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "succeeded": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "failed": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "dead": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              }
            },
            "additionalProperties": false
          },
          "p50_duration_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Median duration of completed runs with start and finish timestamps; omitted when no samples exist."
          },
          "p95_duration_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "95th percentile duration of completed runs with start and finish timestamps; omitted when no samples exist."
          },
          "last_run": {
            "$ref": "#/components/schemas/StoredWorkflowHealthRun"
          },
          "last_success": {
            "$ref": "#/components/schemas/StoredWorkflowHealthRun"
          },
          "last_failure": {
            "$ref": "#/components/schemas/StoredWorkflowHealthRun"
          },
          "failed_steps": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/StoredWorkflowHealthStepFailure"
            }
          }
        },
        "description": "Bounded aggregate stored workflow health. Customer payloads and error strings are never returned."
      },
      "StoredWorkflowPublishPolicy": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "mode",
          "version"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "optional",
              "scenarios",
              "coverage"
            ]
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        },
        "description": "App policy for dashboard publication. YAML deployment is a separate surface. Changes require admin scope and invalidate previously issued receipts."
      },
      "SetStoredWorkflowPublishPolicyRequest": {
        "description": "Versioned app policy change; requires an admin credential.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "mode",
          "expected_version"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "optional",
              "scenarios",
              "coverage"
            ]
          },
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "StoredWorkflowCheckAttempt": {
        "description": "Expected ordered simulation attempt outcome and optional failure status.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "outcome"
        ],
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "success",
              "failure",
              "timeout"
            ]
          },
          "http_status": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599
          }
        }
      },
      "StoredWorkflowCheckExpectation": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "step"
        ],
        "properties": {
          "step": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "loop": {
            "type": "string",
            "maxLength": 256
          },
          "item_index": {
            "type": "integer",
            "minimum": 0,
            "maximum": 127
          },
          "state": {
            "type": "string",
            "enum": [
              "mocked",
              "would_execute",
              "resolved",
              "expanded",
              "would_wait",
              "would_retry",
              "timed_out",
              "failed",
              "dead",
              "skipped",
              "blocked",
              "error"
            ]
          },
          "reason": {
            "type": "string"
          },
          "when_matched": {
            "type": "boolean"
          },
          "output": {
            "description": "Exact JSON assertion; explicit null differs from omitted."
          },
          "attempt_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 25
          },
          "attempts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StoredWorkflowCheckAttempt"
            },
            "maxItems": 25
          }
        },
        "description": "Requires at least one assertion. Loop item assertions use step <loop>/action, loop name and canonical zero-based item index."
      },
      "StoredWorkflowTestInputs": {
        "description": "Saved test data — Explicitly saved synthetic inputs and mocks. Runs always bind the current saved draft.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "input": {
            "description": "Saved test data — Workflow input as any JSON value; omission is equivalent to null."
          },
          "mock_outputs": {
            "description": "Saved test data — Successful action outputs keyed by root step name; explicit null is a supplied result.",
            "type": "object",
            "additionalProperties": {}
          },
          "mock_item_outputs": {
            "description": "Saved test data — Ordered successful output prefix keyed by for_each root name; waits and controls cannot be mocked.",
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "maxItems": 128,
              "items": {}
            }
          },
          "mock_item_attempts": {
            "description": "Saved test data — Per-item attempt outcomes keyed by for_each root name and canonical zero-based item index (0..127). Sparse indexes are allowed but must exist in the materialized collection. Cannot be combined with mock_item_outputs for the same loop. Item timeouts require an action timeout and follow its retry policy. Terminal item failures stop later items unless on_item_failure is continue; the loop remains failed or dead, with null placeholders for failed items when continuing.",
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "minProperties": 1,
              "maxProperties": 128,
              "additionalProperties": {
                "type": "array",
                "minItems": 1,
                "maxItems": 25,
                "items": {
                  "$ref": "#/components/schemas/StoredWorkflowSimulationMockAttempt"
                }
              }
            }
          },
          "mock_attempts": {
            "description": "Saved test data — Ordered per-attempt outcomes keyed by action or wait name. Event and callback waits accept exactly one success with the received payload as output, or one timeout with a configured timeout and on_timeout route. Other waits accept timeout only. Successful wait payloads cannot be the reserved timeout sentinel. Action timeouts require on_timeout. Cannot be combined with mock_outputs for the same step.",
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "minItems": 1,
              "maxItems": 25,
              "items": {
                "$ref": "#/components/schemas/StoredWorkflowSimulationMockAttempt"
              }
            }
          }
        }
      },
      "StoredWorkflowTestCase": {
        "description": "A uniquely named set of definition-free mocks and expected step results.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "simulation",
          "expectations"
        ],
        "properties": {
          "live": {
            "description": "Optional live assertions saved with this case; null disables its live test.",
            "anyOf": [
              {
                "$ref": "#/components/schemas/StoredWorkflowLiveTest"
              },
              {
                "type": "null"
              }
            ]
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "simulation": {
            "$ref": "#/components/schemas/StoredWorkflowTestInputs"
          },
          "expectations": {
            "type": "array",
            "maxItems": 4096,
            "items": {
              "$ref": "#/components/schemas/StoredWorkflowCheckExpectation"
            }
          }
        }
      },
      "StoredWorkflowLiveExpectation": {
        "description": "A separate assertion against a real terminal workflow step, not a mock trace.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "step"
        ],
        "properties": {
          "step": {
            "type": "string"
          },
          "loop": {
            "type": "string"
          },
          "item_index": {
            "type": "integer",
            "minimum": 0,
            "maximum": 127
          },
          "state": {
            "type": "string",
            "enum": [
              "succeeded",
              "failed",
              "dead",
              "skipped"
            ]
          },
          "output": {
            "description": "Optional expected JSON result; an explicit null is asserted."
          },
          "attempt_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 425
          }
        }
      },
      "StoredWorkflowLiveTest": {
        "description": "Explicit live assertions frozen when a saved case is admitted for execution.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expectations"
        ],
        "properties": {
          "expected_run_status": {
            "type": "string",
            "enum": [
              "succeeded",
              "failed",
              "dead"
            ],
            "description": "Desired terminal run state; omitted means succeeded. Cancellation always fails verification."
          },
          "expectations": {
            "type": "array",
            "minItems": 1,
            "maxItems": 128,
            "items": {
              "$ref": "#/components/schemas/StoredWorkflowLiveExpectation"
            }
          }
        }
      },
      "StartStoredWorkflowLiveVerificationRequest": {
        "description": "Fenced request to execute one saved case input against a specific published revision and deployment.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version",
          "expected_published_version",
          "expected_deployment_id",
          "case_name",
          "confirm_real_actions"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1
          },
          "expected_published_version": {
            "type": "integer",
            "minimum": 1
          },
          "expected_deployment_id": {
            "type": "string"
          },
          "case_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "confirm_real_actions": {
            "type": "boolean",
            "description": "Must be true to authorize real handler and connected-service actions."
          }
        }
      },
      "StoredWorkflowLiveReport": {
        "description": "Payload-free verdict for the frozen live assertions at one terminal run state.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "checked_at",
          "passed",
          "run_status",
          "resume_count",
          "run_updated_at",
          "steps"
        ],
        "properties": {
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "passed": {
            "type": "boolean"
          },
          "issue": {
            "type": "string"
          },
          "run_status": {
            "type": "string"
          },
          "resume_count": {
            "type": "integer",
            "minimum": 0
          },
          "run_updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "steps": {
            "type": "array",
            "maxItems": 128,
            "items": {
              "$ref": "#/components/schemas/StoredWorkflowTestStepResult"
            }
          }
        }
      },
      "StartStoredWorkflowLiveSuiteRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "At most 16 KiB. Bind an ordered selection of saved live case names to the exact saved version, published revision and deployment, with explicit real-action authorization.",
        "required": [
          "expected_version",
          "expected_published_version",
          "expected_deployment_id",
          "cases",
          "confirm_real_actions"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1
          },
          "expected_published_version": {
            "type": "integer",
            "minimum": 1
          },
          "expected_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "cases": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          "confirm_real_actions": {
            "type": "boolean"
          }
        }
      },
      "AdvanceStoredWorkflowLiveSuiteRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Explicit authorization to inspect existing identities and admit at most one remaining case. No target changes, run replacements or uploaded verdicts are accepted.",
        "required": [
          "confirm_real_actions"
        ],
        "properties": {
          "confirm_real_actions": {
            "type": "boolean"
          }
        }
      },
      "SaveStoredWorkflowLiveSuiteRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version",
          "expected_published_version",
          "expected_deployment_id",
          "cases"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1
          },
          "expected_published_version": {
            "type": "integer",
            "minimum": 1
          },
          "expected_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "cases": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/StoredWorkflowLiveSuiteMember"
            }
          }
        },
        "description": "At most 16 KiB. Freeze an ordered saved-case selection and attach existing verification run IDs. No assertions, verdicts, keys or payloads are accepted. Saving never executes or checks a run. Existing run links cannot be replaced or removed."
      },
      "StoredWorkflowLiveSuiteMember": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "description": "One saved live case and its optional existing verification run identity."
      },
      "StoredWorkflowLiveBaselinePolicy": {
        "description": "Version 2 required-case coverage and evidence-age policy reviewed during baseline promotion.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "required_cases",
          "max_candidate_age_seconds"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              2
            ]
          },
          "required_cases": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          "max_candidate_age_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9223372036
          }
        }
      },
      "PromoteStoredWorkflowLiveBaselineRequest": {
        "description": "Explicit target suite, reviewed policy and expected baseline revision for an audited promotion.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "suite_id",
          "expected_revision",
          "expected_version",
          "expected_published_version",
          "expected_deployment_id",
          "policy"
        ],
        "properties": {
          "suite_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9223372036854776000
          },
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "expected_published_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "expected_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "policy": {
            "$ref": "#/components/schemas/StoredWorkflowLiveBaselinePolicy"
          }
        }
      },
      "StoredWorkflowLiveBaseline": {
        "description": "Immutable attributed receipt binding a named baseline revision to its retained suite and reviewed policy.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "promotion_id",
          "app_id",
          "name",
          "baseline_name",
          "revision",
          "actor_account_id",
          "promoted_at",
          "suite",
          "policy",
          "policy_hash",
          "cases_passed",
          "oldest_run_created_at",
          "evidence_age_seconds"
        ],
        "properties": {
          "promotion_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "baseline_name": {
            "type": "string"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "previous_promotion_id": {
            "type": "string",
            "format": "uuid"
          },
          "actor_account_id": {
            "type": "string",
            "format": "uuid"
          },
          "actor_api_key_id": {
            "type": "string",
            "format": "uuid"
          },
          "promoted_at": {
            "type": "string",
            "format": "date-time"
          },
          "suite": {
            "$ref": "#/components/schemas/StoredWorkflowLiveSuiteSummary"
          },
          "policy": {
            "$ref": "#/components/schemas/StoredWorkflowLiveBaselinePolicy"
          },
          "policy_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "cases_passed": {
            "type": "integer",
            "minimum": 1,
            "maximum": 32
          },
          "oldest_run_created_at": {
            "type": "string",
            "format": "date-time"
          },
          "evidence_age_seconds": {
            "type": "number",
            "format": "double",
            "minimum": 0
          }
        }
      },
      "StoredWorkflowLiveBaselineCaseHealth": {
        "description": "Current retained verification availability and renewal readiness for one promoted suite case.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "status"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 128
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "passed",
              "failed",
              "pending",
              "unavailable",
              "not_started"
            ]
          }
        }
      },
      "StoredWorkflowLiveBaselineHealth": {
        "description": "Coherent read-only evidence health observations for a named baseline head.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "baseline",
          "evidence_status",
          "renewal_status",
          "reasons",
          "outdated",
          "cases"
        ],
        "properties": {
          "baseline": {
            "$ref": "#/components/schemas/StoredWorkflowLiveBaseline"
          },
          "evidence_status": {
            "type": "string",
            "enum": [
              "usable",
              "failed",
              "unavailable"
            ],
            "description": "Availability of current recorded reports; not a gate verdict."
          },
          "renewal_status": {
            "type": "string",
            "enum": [
              "passed",
              "failed",
              "inconclusive"
            ],
            "description": "Whether this same suite qualifies for a new promotion now."
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "outdated": {
            "type": "boolean"
          },
          "cases": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/StoredWorkflowLiveBaselineCaseHealth"
            }
          },
          "age_seconds": {
            "type": "number",
            "description": "Oldest original retained run age. Negative values indicate future timestamps."
          },
          "oldest_run_created_at": {
            "type": "string",
            "format": "date-time"
          },
          "max_age_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9223372036
          }
        }
      },
      "ListStoredWorkflowLiveBaselinesResponse": {
        "description": "Bounded sorted catalog of active named baseline heads and their current evidence observations.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "baselines",
          "observed_at"
        ],
        "properties": {
          "baselines": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/StoredWorkflowLiveBaselineHealth"
            }
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "RetireStoredWorkflowLiveBaselineRequest": {
        "description": "Expected positive baseline revision required to permanently retire an active name.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_revision"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9223372036854776000
          }
        }
      },
      "StoredWorkflowLiveBaselineRetirement": {
        "description": "Immutable attributed receipt recording permanent retirement and release of the baseline evidence pin.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "retirement_id",
          "app_id",
          "name",
          "baseline_name",
          "revision",
          "previous_promotion_id",
          "actor_account_id",
          "retired_at"
        ],
        "properties": {
          "retirement_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "baseline_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 2
          },
          "previous_promotion_id": {
            "type": "string",
            "format": "uuid"
          },
          "actor_account_id": {
            "type": "string",
            "format": "uuid"
          },
          "actor_api_key_id": {
            "type": "string",
            "format": "uuid"
          },
          "retired_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "StoredWorkflowLiveBaselineHistory": {
        "description": "Bounded promotion audit history and optional permanent retirement receipt for one baseline name.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "promotions"
        ],
        "properties": {
          "retirement": {
            "$ref": "#/components/schemas/StoredWorkflowLiveBaselineRetirement"
          },
          "promotions": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/StoredWorkflowLiveBaseline"
            }
          }
        }
      },
      "StoredWorkflowLiveSuiteComparison": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "baseline",
          "candidate",
          "baseline_outdated",
          "candidate_outdated",
          "observed_at",
          "summary",
          "cases"
        ],
        "properties": {
          "baseline": {
            "$ref": "#/components/schemas/StoredWorkflowLiveSuiteSummary"
          },
          "candidate": {
            "$ref": "#/components/schemas/StoredWorkflowLiveSuiteSummary"
          },
          "baseline_outdated": {
            "type": "boolean"
          },
          "candidate_outdated": {
            "type": "boolean"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "summary": {
            "$ref": "#/components/schemas/StoredWorkflowLiveSuiteComparisonCounts"
          },
          "cases": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "$ref": "#/components/schemas/StoredWorkflowLiveSuiteCaseComparison"
            }
          }
        },
        "description": "Read-only evidence comparison. Outdated identifies target drift, independently of recorded result validity. Contains no inputs, outputs, assertions or admission keys."
      },
      "StoredWorkflowLiveSuiteComparisonCounts": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "total",
          "regressions",
          "recoveries",
          "unchanged",
          "added",
          "removed",
          "incompatible",
          "unknown"
        ],
        "properties": {
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 64
          },
          "regressions": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "recoveries": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "unchanged": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "added": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "removed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "incompatible": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "unknown": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          }
        },
        "description": "Disjoint case classifications; all categories sum to total. Zero regressions alone is not evidence that the candidate passed."
      },
      "StoredWorkflowLiveSuiteCaseComparison": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "change"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "change": {
            "type": "string",
            "enum": [
              "regression",
              "recovery",
              "unchanged",
              "added",
              "removed",
              "incompatible",
              "unknown"
            ],
            "description": "Equal hashes and current terminal reports are required for regression, recovery or unchanged. Hash mismatch is incompatible even when a report is pending; absent evidence is unknown. Added and removed take precedence when only one suite selected the case."
          },
          "baseline": {
            "$ref": "#/components/schemas/StoredWorkflowLiveSuiteObservation"
          },
          "candidate": {
            "$ref": "#/components/schemas/StoredWorkflowLiveSuiteObservation"
          }
        },
        "description": "A missing side means the case was not selected in that suite. A selected case without a run has a not_started observation."
      },
      "StoredWorkflowLiveSuiteObservation": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "result"
        ],
        "properties": {
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Original linked verification creation time, when retained. Never refreshed by grouping or checking runs."
          },
          "result": {
            "type": "string",
            "enum": [
              "passed",
              "failed",
              "pending",
              "not_started",
              "unavailable"
            ],
            "description": "Result of the original run independently of target drift. Unavailable includes missing runs and terminal runs without a current assertion report."
          }
        },
        "description": "Safe original run identity, creation time and recorded result only."
      },
      "StoredWorkflowLiveSuiteSummary": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "name",
          "version",
          "published_version",
          "deployment_id",
          "created_at",
          "updated_at",
          "case_count",
          "linked_runs"
        ],
        "properties": {
          "managed": {
            "type": "boolean",
            "description": "True for suites with durable server-managed admission. Metadata PUT cannot change these records; continuation requires explicit execution authorization."
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "version": {
            "type": "integer",
            "minimum": 1
          },
          "published_version": {
            "type": "integer",
            "minimum": 1
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "case_count": {
            "type": "integer",
            "minimum": 1,
            "maximum": 32
          },
          "linked_runs": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          }
        },
        "description": "Retained suite identity and linked-run counts. Listing is not an assertion verdict."
      },
      "StoredWorkflowLiveSuiteCase": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "outcome"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "not_started",
              "passed",
              "failed",
              "pending",
              "outdated",
              "unavailable"
            ]
          },
          "verification": {
            "$ref": "#/components/schemas/StoredWorkflowLiveVerification"
          }
        },
        "description": "A server-derived case observation; unavailable records keep their original run identity."
      },
      "StoredWorkflowLiveSuiteCounts": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "selected",
          "passed",
          "failed",
          "pending",
          "not_started",
          "unavailable",
          "outdated"
        ],
        "properties": {
          "selected": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "passed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "failed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "pending": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "not_started": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "unavailable": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "outdated": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          }
        },
        "description": "Current suite case counts, including unstarted and unverifiable members."
      },
      "StoredWorkflowLiveSuite": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "name",
          "version",
          "published_version",
          "deployment_id",
          "created_at",
          "updated_at",
          "case_count",
          "linked_runs",
          "outcome",
          "outdated",
          "observed_at",
          "summary",
          "cases"
        ],
        "properties": {
          "managed": {
            "type": "boolean",
            "description": "True when the suite owns durable server-managed execution and can be continued with explicit real-action confirmation."
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "version": {
            "type": "integer",
            "minimum": 1
          },
          "published_version": {
            "type": "integer",
            "minimum": 1
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "case_count": {
            "type": "integer",
            "minimum": 1,
            "maximum": 32
          },
          "linked_runs": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "outcome": {
            "type": "string",
            "enum": [
              "passed",
              "failed",
              "pending",
              "incomplete",
              "outdated",
              "unavailable"
            ]
          },
          "outdated": {
            "type": "boolean"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "summary": {
            "$ref": "#/components/schemas/StoredWorkflowLiveSuiteCounts"
          },
          "cases": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/StoredWorkflowLiveSuiteCase"
            }
          }
        },
        "description": "Server-derived observation of retained verification records. GET is read-only and never checks assertions or admits work. Missing records remain unavailable with their known IDs. Passed requires every linked case to have a current passing report and an unchanged saved version, published revision and deployment. Not a publication receipt."
      },
      "ListStoredWorkflowLiveSuitesResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "suites"
        ],
        "properties": {
          "suites": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/StoredWorkflowLiveSuiteSummary"
            }
          }
        },
        "description": "Twenty most recently created suites. One hundred recent suites are retained per stored workflow; clearing saved test data clears shared suite history."
      },
      "StoredWorkflowLiveVerification": {
        "description": "Safe provenance and status for one explicitly authorized live verification run.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "run_id",
          "case_name",
          "deployment_id",
          "inputs_hash",
          "run_status",
          "version",
          "published_version",
          "created_at",
          "outdated",
          "report_current"
        ],
        "properties": {
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "case_name": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string"
          },
          "inputs_hash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "run_status": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "minimum": 1
          },
          "published_version": {
            "type": "integer",
            "minimum": 1
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "outdated": {
            "type": "boolean",
            "description": "True when the saved case, published revision, or current default deployment differs from the frozen target."
          },
          "report_current": {
            "type": "boolean",
            "description": "True when the report still matches this run status, resume count and update time; also require outdated=false for current-target evidence."
          },
          "report": {
            "$ref": "#/components/schemas/StoredWorkflowLiveReport"
          }
        }
      },
      "ListStoredWorkflowLiveVerificationsResponse": {
        "description": "Current target identities and the twenty most recent retained live verifications.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "published_version",
          "verifications"
        ],
        "properties": {
          "deployment_id": {
            "type": "string"
          },
          "published_version": {
            "type": "integer",
            "minimum": 0
          },
          "verifications": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/StoredWorkflowLiveVerification"
            }
          }
        }
      },
      "StoredWorkflowTestSuite": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "sample",
          "cases"
        ],
        "properties": {
          "sample": {
            "$ref": "#/components/schemas/StoredWorkflowTestInputs"
          },
          "cases": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/StoredWorkflowTestCase"
            }
          }
        },
        "description": "At most 32 uniquely named cases; sample up to 3 MiB, cases up to 24 MiB combined, suite up to 27 MiB. Data is explicitly persisted, never captured from real runs."
      },
      "SaveStoredWorkflowTestSuiteRequest": {
        "description": "Versioned suite replacement; explicitly sending null removes saved data and results.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version",
          "suite"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "suite": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/StoredWorkflowTestSuite"
              },
              {
                "type": "null"
              }
            ],
            "description": "Null clears saved tests and the retained report. Saving advances the stored workflow version and invalidates earlier publishing receipts."
          }
        }
      },
      "RunStoredWorkflowTestsRequest": {
        "description": "Expected current draft version for simulating its saved test cases.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        }
      },
      "StoredWorkflowTestReport": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "checked_version",
          "checked_at",
          "inputs_hash",
          "passed",
          "cases"
        ],
        "properties": {
          "checked_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "inputs_hash": {
            "type": "string"
          },
          "passed": {
            "type": "boolean"
          },
          "cases": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/StoredWorkflowTestCaseResult"
            }
          }
        },
        "description": "Retained observation, not a publishing receipt. Freshness compares definition and suite content; running does not advance the draft version or perform real actions."
      },
      "StoredWorkflowTestCaseResult": {
        "description": "Safe overall case result and bounded per-step assertion summaries.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "passed",
          "steps"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "passed": {
            "type": "boolean"
          },
          "issue": {
            "type": "string",
            "enum": [
              "invalid_expectations",
              "simulation_rejected",
              "definition_invalid",
              "simulation_incomplete",
              "assertion_failed"
            ]
          },
          "steps_truncated": {
            "type": "boolean"
          },
          "steps": {
            "type": "array",
            "maxItems": 1024,
            "items": {
              "$ref": "#/components/schemas/StoredWorkflowTestStepResult"
            }
          }
        }
      },
      "StoredWorkflowTestStepResult": {
        "description": "One assertion result and observed state, excluding input, output and error data.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "step",
          "passed"
        ],
        "properties": {
          "step": {
            "type": "string"
          },
          "loop": {
            "type": "string"
          },
          "item_index": {
            "type": "integer",
            "minimum": 0
          },
          "state": {
            "type": "string"
          },
          "passed": {
            "type": "boolean"
          },
          "mismatches": {
            "description": "Failed assertion field names only; expected and observed values are omitted.",
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "step",
                "state",
                "reason",
                "when_matched",
                "output",
                "attempt_count",
                "attempts"
              ]
            }
          }
        }
      },
      "StoredWorkflowPublishCheckScenario": {
        "description": "Named simulation and assertions to evaluate against a saved stored workflow draft.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "simulation",
          "expectations"
        ],
        "properties": {
          "live": {
            "description": "Live test configuration carried by the case editor; mock publishing checks do not evaluate it.",
            "anyOf": [
              {
                "$ref": "#/components/schemas/StoredWorkflowLiveTest"
              },
              {
                "type": "null"
              }
            ]
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "simulation": {
            "$ref": "#/components/schemas/SimulateStoredWorkflowRequest"
          },
          "expectations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StoredWorkflowCheckExpectation"
            },
            "minItems": 1,
            "maxItems": 4096
          }
        }
      },
      "CheckStoredWorkflowPublicationRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version",
          "scenarios",
          "exclusions"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "require_coverage": {
            "type": "boolean",
            "default": false
          },
          "scenarios": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StoredWorkflowPublishCheckScenario"
            },
            "minItems": 1,
            "maxItems": 32
          },
          "exclusions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StoredWorkflowCheckExclusion"
            },
            "maxItems": 256
          }
        },
        "description": "Run assertions and coverage on the saved draft on the server; mocks remain hypothetical. At most 24 MiB total and 3 MiB per simulation. Complete, valid traces and passing assertions are required. Coverage policy overrides require_coverage=false."
      },
      "CheckStoredWorkflowPublicationResponse": {
        "description": "Expiring server receipt with safe verified scenario and coverage metadata.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "receipt",
          "expires_at",
          "evidence"
        ],
        "properties": {
          "receipt": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Opaque 30-minute receipt bound to app, name, draft, actor and policy version. Do not log or expose it."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "evidence": {
            "$ref": "#/components/schemas/StoredWorkflowCheckEvidence"
          }
        }
      },
      "StoredWorkflowCheckEvidence": {
        "type": "object",
        "additionalProperties": false,
        "description": "Simulation check metadata. server_verified is set only for server-issued publishing receipts; legacy or plain client evidence is unverified. Bound to the saved draft hash and version. Contains metadata only; no sample inputs, outputs, or failure text. Checked time must be within the past day (five minutes of future clock skew allowed).",
        "required": [
          "definition_hash",
          "checked_version",
          "checked_at",
          "scenarios",
          "coverage_required",
          "coverage_passed",
          "coverage_remaining",
          "exclusions"
        ],
        "properties": {
          "server_verified": {
            "type": "boolean",
            "readOnly": true,
            "description": "True only when publication used a stored server-issued receipt. Clients cannot attest to this flag."
          },
          "definition_hash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "checked_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "scenarios": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/StoredWorkflowCheckScenario"
            }
          },
          "coverage_required": {
            "type": "boolean"
          },
          "coverage_passed": {
            "type": "boolean",
            "description": "True when coverage_remaining is zero; required coverage must pass before publishing."
          },
          "coverage_remaining": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4096
          },
          "exclusions": {
            "type": "array",
            "maxItems": 256,
            "items": {
              "$ref": "#/components/schemas/StoredWorkflowCheckExclusion"
            }
          }
        }
      },
      "StoredWorkflowCheckScenario": {
        "type": "object",
        "additionalProperties": false,
        "description": "A named scenario reported as passing, definition valid, and complete by the publishing client.",
        "required": [
          "name",
          "passed",
          "definition_valid",
          "complete"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "passed": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "definition_valid": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "complete": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        }
      },
      "StoredWorkflowCheckExclusion": {
        "type": "object",
        "additionalProperties": false,
        "description": "An explicitly reviewed coverage exclusion. Reasons are user-authored metadata and should contain no secrets.",
        "required": [
          "step",
          "code",
          "reason"
        ],
        "properties": {
          "step": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "loop": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "code": {
            "type": "string",
            "enum": [
              "guard_match_missing",
              "guard_skip_missing",
              "failure_route_missing",
              "wait_success_missing",
              "wait_timeout_missing",
              "retry_missing",
              "loop_empty_missing",
              "loop_multiple_items_missing"
            ]
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          }
        }
      },
      "StoredWorkflowRevisionResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "definition",
          "definition_hash",
          "recorded_at",
          "legacy_snapshot",
          "published_by_account_id"
        ],
        "properties": {
          "check_evidence": {
            "$ref": "#/components/schemas/StoredWorkflowCheckEvidence"
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Immutable published revision identifier."
          },
          "definition": {
            "$ref": "#/components/schemas/WorkflowSpec"
          },
          "definition_hash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "SHA-256 of the canonical JSON encoding of definition."
          },
          "recorded_at": {
            "type": "string",
            "format": "date-time",
            "description": "When this immutable history record was stored; for legacy snapshots this is the migration time."
          },
          "legacy_snapshot": {
            "type": "boolean",
            "description": "True for the one current publication copied into history during rollout; older history was not retained."
          },
          "published_by_account_id": {
            "type": "string",
            "format": "uuid",
            "description": "Account that published this revision, or owned the legacy snapshot at rollout."
          },
          "published_by_api_key_id": {
            "type": "string",
            "format": "uuid",
            "description": "API key used for the publish when the request used key authentication; omitted for session authentication and legacy snapshots."
          }
        },
        "description": "Immutable published stored workflow definition with actor and rollout provenance."
      },
      "ListStoredWorkflowRevisionsResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "revisions",
          "total",
          "limit",
          "offset"
        ],
        "properties": {
          "revisions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StoredWorkflowRevisionResponse"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "offset": {
            "type": "integer",
            "minimum": 0
          }
        },
        "description": "Newest-first immutable publication history and pagination metadata."
      },
      "RestoreStoredWorkflowRevisionRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Current draft revision for optimistic concurrency; zero creates a draft after deletion."
          }
        },
        "description": "Restores a selected immutable publication into the draft without publishing it."
      },
      "SaveStoredWorkflowDraftRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version",
          "definition"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Saved revision observed by the editor; zero creates the first draft."
          },
          "definition": {
            "$ref": "#/components/schemas/WorkflowSpec"
          }
        },
        "description": "Draft definition and the revision that the caller edited."
      },
      "PublishStoredWorkflowRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version"
        ],
        "properties": {
          "check_receipt": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Server-issued receipt required by scenarios or coverage policy; stale, expired, cross-identity and reused receipts are rejected."
          },
          "check_evidence": {
            "$ref": "#/components/schemas/StoredWorkflowCheckEvidence"
          },
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Current saved draft revision to validate and publish."
          },
          "take_over_manifest": {
            "type": "boolean",
            "default": false
          }
        },
        "description": "Saved draft revision to publish, with explicit YAML takeover when needed."
      },
      "SetStoredWorkflowEnabledRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version",
          "enabled"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Current stored workflow revision to pause or resume."
          },
          "enabled": {
            "type": "boolean"
          }
        },
        "description": "Publication revision and the desired state of automatic starts."
      },
      "SimulateStoredWorkflowRequest": {
        "description": "Sample workflow data and mocked action, event/callback payload or timeout outcomes for a stateless simulation.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "definition"
        ],
        "properties": {
          "definition": {
            "$ref": "#/components/schemas/WorkflowSpec"
          },
          "input": {
            "description": "Workflow input as any JSON value; omission is equivalent to null."
          },
          "mock_outputs": {
            "description": "Successful action outputs keyed by root step name; explicit null is a supplied result.",
            "type": "object",
            "additionalProperties": {}
          },
          "mock_item_outputs": {
            "description": "Ordered successful output prefix keyed by for_each root name; waits and controls cannot be mocked.",
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "maxItems": 128,
              "items": {}
            }
          },
          "mock_item_attempts": {
            "description": "Per-item attempt outcomes keyed by for_each root name and canonical zero-based item index (0..127). Sparse indexes are allowed but must exist in the materialized collection. Cannot be combined with mock_item_outputs for the same loop. Item timeouts require an action timeout and follow its retry policy. Terminal item failures stop later items unless on_item_failure is continue; the loop remains failed or dead, with null placeholders for failed items when continuing.",
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "minProperties": 1,
              "maxProperties": 128,
              "additionalProperties": {
                "type": "array",
                "minItems": 1,
                "maxItems": 25,
                "items": {
                  "$ref": "#/components/schemas/StoredWorkflowSimulationMockAttempt"
                }
              }
            }
          },
          "mock_attempts": {
            "description": "Ordered per-attempt outcomes keyed by action or wait name. Event and callback waits accept exactly one success with the received payload as output, or one timeout with a configured timeout and on_timeout route. Other waits accept timeout only. Successful wait payloads cannot be the reserved timeout sentinel. Action timeouts require on_timeout. Cannot be combined with mock_outputs for the same step.",
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "minItems": 1,
              "maxItems": 25,
              "items": {
                "$ref": "#/components/schemas/StoredWorkflowSimulationMockAttempt"
              }
            }
          }
        }
      },
      "StoredWorkflowSimulationMockAttempt": {
        "description": "One mocked attempt; success requires output, failure requires exactly one of error or non-2xx http_status, and timeout has no additional fields.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "outcome"
        ],
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "success",
              "failure",
              "timeout"
            ]
          },
          "output": {
            "description": "Successful action result or received event/callback payload; any JSON value, including null."
          },
          "error": {
            "type": "string",
            "minLength": 1,
            "description": "Mocked transport or action error message used as failure.message."
          },
          "http_status": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599,
            "description": "Mocked non-2xx response status."
          }
        }
      },
      "SimulateStoredWorkflowResponse": {
        "description": "Definition validity, submitted-definition SHA-256 and deterministic simulated data flow.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "definition_valid",
          "definition_hash",
          "complete",
          "issues",
          "warnings",
          "step_order",
          "trace"
        ],
        "properties": {
          "definition_valid": {
            "type": "boolean",
            "description": "Whether the definition and managed integration bindings passed validation."
          },
          "definition_hash": {
            "type": "string",
            "description": "SHA-256 of the JSON-serialized submitted definition, independent of samples; not a publication revision."
          },
          "complete": {
            "type": "boolean",
            "description": "Every root reached a known terminal outcome under these mocks; false for missing results, unresolved retries, waits or evaluation errors."
          },
          "issues": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "step_order": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "trace": {
            "type": "array",
            "maxItems": 1024,
            "items": {
              "$ref": "#/components/schemas/StoredWorkflowSimulationStep"
            }
          }
        }
      },
      "StoredWorkflowSimulationStep": {
        "description": "One hypothetical root or loop item with resolved data and its control-flow decision.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "step_name",
          "kind",
          "state"
        ],
        "properties": {
          "step_name": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "run",
              "path",
              "outbound",
              "for_each",
              "join",
              "event_wait",
              "callback_wait",
              "duration_wait",
              "condition_wait"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "would_execute",
              "mocked",
              "would_wait",
              "resolved",
              "expanded",
              "skipped",
              "blocked",
              "would_retry",
              "timed_out",
              "failed",
              "dead",
              "error"
            ]
          },
          "reason": {
            "type": "string",
            "description": "Stable decision reason with no referenced customer values."
          },
          "blocked_by": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "when_matched": {
            "type": "boolean"
          },
          "input": {
            "description": "Resolved action input or materialized loop source; any JSON type is preserved."
          },
          "output": {
            "description": "Supplied successful mock, timeout sentinel or control output; omitted when no result is known."
          },
          "attempts": {
            "type": "array",
            "description": "Safe summary of supplied action or wait outcomes; mocked error text is exposed only through eligible failure context.",
            "maxItems": 25,
            "items": {
              "$ref": "#/components/schemas/StoredWorkflowSimulationAttempt"
            }
          },
          "run": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "integration_id": {
            "type": "string"
          },
          "raw_query": {
            "type": "string",
            "maxLength": 4096,
            "description": "Canonically URL-encoded outbound query after resolving sample input and dependency outputs; omitted when empty or unresolved."
          },
          "wait_for": {
            "type": "string"
          },
          "parent_step": {
            "type": "string"
          },
          "item_index": {
            "type": "integer",
            "minimum": 0
          },
          "item_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 128
          }
        }
      },
      "StoredWorkflowSimulationAttempt": {
        "description": "Safe summary of one supplied hypothetical attempt outcome.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "attempt",
          "outcome"
        ],
        "properties": {
          "attempt": {
            "type": "integer",
            "minimum": 1,
            "maximum": 25
          },
          "outcome": {
            "type": "string",
            "enum": [
              "success",
              "failure",
              "timeout"
            ]
          },
          "http_status": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599
          }
        }
      },
      "ValidateStoredWorkflowRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "definition"
        ],
        "properties": {
          "definition": {
            "$ref": "#/components/schemas/WorkflowSpec"
          }
        },
        "description": "Candidate stored workflow definition for a read-only validation."
      },
      "ValidateStoredWorkflowResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "valid",
          "issues",
          "step_order"
        ],
        "properties": {
          "valid": {
            "type": "boolean"
          },
          "issues": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "step_order": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "next_fire_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "description": "Validation issues, execution order and nominal next schedule occurrence."
      },
      "WorkflowScheduleResponse": {
        "description": "Current deployed schedule configuration and its latest durable admission outcome.",
        "type": "object",
        "required": [
          "workflow_name",
          "deployment_id",
          "schedule",
          "timezone",
          "overlap",
          "enabled"
        ],
        "properties": {
          "workflow_name": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "schedule": {
            "type": "string"
          },
          "timezone": {
            "type": "string"
          },
          "overlap": {
            "type": "string",
            "enum": [
              "skip",
              "allow"
            ]
          },
          "catch_up": {
            "type": "string",
            "enum": [
              "skip",
              "latest"
            ],
            "description": "Effective missed-fire policy; defaults to skip."
          },
          "catch_up_window": {
            "type": "string",
            "description": "Effective recovery duration, present only for latest."
          },
          "enabled": {
            "type": "boolean"
          },
          "next_fire_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_evaluated_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_scheduled_for": {
            "type": "string",
            "format": "date-time"
          },
          "last_status": {
            "type": "string",
            "enum": [
              "armed",
              "started",
              "skipped_overlap",
              "skipped_quota"
            ]
          },
          "last_run_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "WorkflowScheduleOccurrenceResponse": {
        "description": "Immutable admission outcome for one due schedule minute, retained independently from the workflow run.",
        "type": "object",
        "required": [
          "id",
          "app_id",
          "workflow_name",
          "deployment_id",
          "scheduled_for",
          "evaluated_at",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "workflow_name": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "scheduled_for": {
            "type": "string",
            "format": "date-time"
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": [
              "started",
              "skipped_overlap",
              "skipped_quota"
            ]
          },
          "run_id": {
            "type": "string",
            "format": "uuid",
            "description": "Present for started outcomes; retained after run expiry."
          },
          "replay_run_id": {
            "type": "string",
            "format": "uuid",
            "description": "Present after a skipped occurrence has been replayed."
          },
          "replayed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ListWorkflowScheduleOccurrencesResponse": {
        "description": "Page of due workflow schedule outcomes ordered by nominal minute, with a cursor for the next page.",
        "type": "object",
        "required": [
          "occurrences"
        ],
        "properties": {
          "occurrences": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowScheduleOccurrenceResponse"
            }
          },
          "next_cursor": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "WorkflowScheduleReplayRequest": {
        "description": "Selection of skipped schedule occurrence IDs to preview or replay.",
        "type": "object",
        "required": [
          "occurrence_ids"
        ],
        "additionalProperties": false,
        "properties": {
          "occurrence_ids": {
            "type": "array",
            "minItems": 1,
            "maxItems": 20,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      },
      "WorkflowScheduleReplayOutcome": {
        "description": "Eligibility or result for replaying one schedule occurrence.",
        "type": "object",
        "required": [
          "occurrence_id",
          "outcome"
        ],
        "properties": {
          "occurrence_id": {
            "type": "string",
            "format": "uuid"
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "workflow_name": {
            "type": "string"
          },
          "scheduled_for": {
            "type": "string",
            "format": "date-time"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "eligible",
              "replayed",
              "already_replayed",
              "occurrence_not_found",
              "not_skipped",
              "history_not_replayable",
              "deployment_changed",
              "definition_changed",
              "schedule_disabled",
              "overlap_active",
              "quota_full",
              "tenant_unavailable",
              "target_unavailable",
              "plan_unavailable"
            ]
          },
          "replay_run_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "WorkflowScheduleReplayResponse": {
        "description": "Per-occurrence results for a controlled schedule replay request.",
        "type": "object",
        "required": [
          "outcomes"
        ],
        "properties": {
          "outcomes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowScheduleReplayOutcome"
            }
          }
        }
      },
      "WorkflowQueuedRunCancelRequest": {
        "description": "Selection of workflow runs for a preview or unstarted cancellation.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "run_ids"
        ],
        "properties": {
          "run_ids": {
            "type": "array",
            "minItems": 1,
            "maxItems": 20,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "workflow_name": {
            "type": "string",
            "maxLength": 128,
            "description": "Optional exact workflow-name guard for the selection."
          }
        }
      },
      "WorkflowQueuedRunCancelOutcome": {
        "description": "Eligibility or result for cancelling one queued workflow run.",
        "type": "object",
        "required": [
          "run_id",
          "outcome"
        ],
        "properties": {
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "workflow_name": {
            "type": "string"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "eligible",
              "cancelled",
              "already_cancelled",
              "not_found",
              "workflow_mismatch",
              "not_queued",
              "already_started"
            ],
            "description": "Preview classification or the final result after the atomic cancellation recheck."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "running",
              "awaiting_event",
              "succeeded",
              "failed",
              "dead"
            ]
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "scheduled_for": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "cancelled_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WorkflowQueuedRunCancelResponse": {
        "description": "Per-run results for a queued cancellation request.",
        "type": "object",
        "required": [
          "outcomes"
        ],
        "properties": {
          "outcomes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowQueuedRunCancelOutcome"
            }
          }
        }
      },
      "ListWorkflowSchedulesResponse": {
        "description": "Deployed workflow schedules with runtime availability and any admission blocker.",
        "type": "object",
        "required": [
          "runtime_enabled",
          "schedules"
        ],
        "properties": {
          "runtime_enabled": {
            "type": "boolean"
          },
          "unavailable_reason": {
            "type": "string",
            "enum": [
              "runtime_disabled",
              "account_inactive",
              "plan_not_allowed",
              "maintenance",
              "tenant_required"
            ]
          },
          "schedules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowScheduleResponse"
            }
          }
        }
      },
      "WorkflowScheduleFirePreview": {
        "type": "object",
        "description": "One canonical fire time with its offset-bearing local representation.",
        "required": [
          "scheduled_for",
          "local_time"
        ],
        "properties": {
          "scheduled_for": {
            "type": "string",
            "format": "date-time",
            "description": "UTC instant used by the scheduler."
          },
          "local_time": {
            "type": "string",
            "format": "date-time",
            "description": "Local wall time including the UTC offset."
          },
          "dst_adjustment": {
            "type": "string",
            "enum": [
              "shifted_forward"
            ],
            "description": "Present when a spring gap moves the configured wall time to the first valid minute."
          }
        }
      },
      "WorkflowScheduleDSTBehavior": {
        "type": "object",
        "description": "Gregale's timezone-transition behavior for fixed wall-time and interval cron expressions.",
        "required": [
          "mode",
          "spring_gap",
          "fall_fold"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "fixed_wall_time",
              "interval"
            ]
          },
          "spring_gap": {
            "type": "string",
            "enum": [
              "shift_to_first_valid_minute",
              "follow_cron_interval"
            ]
          },
          "fall_fold": {
            "type": "string",
            "enum": [
              "run_once_at_first_occurrence",
              "repeat_as_clock_falls_back"
            ]
          }
        }
      },
      "WorkflowScheduleCatchUpPreview": {
        "type": "object",
        "description": "Simulated next evaluator decision. It does not reserve quota or promise worker availability.",
        "required": [
          "policy",
          "outcome",
          "eligible_occurrences",
          "coalesced_occurrences",
          "missed_occurrences_not_recovered",
          "missed_outside_window"
        ],
        "properties": {
          "policy": {
            "type": "string",
            "enum": [
              "skip",
              "latest"
            ]
          },
          "window": {
            "type": "string",
            "description": "Effective maximum age for latest catch-up."
          },
          "outcome": {
            "type": "string",
            "enum": [
              "disabled",
              "first_evaluation_arms",
              "no_new_evaluation",
              "run_current_fire",
              "coalesce_latest",
              "skip_missed",
              "outside_catch_up_window",
              "no_due_occurrence"
            ]
          },
          "since": {
            "type": "string",
            "format": "date-time",
            "description": "Durable or simulated prior evaluator time."
          },
          "eligible_occurrences": {
            "type": "integer",
            "minimum": 0,
            "description": "Candidate occurrences within the latest policy window, or the single current occurrence for skip."
          },
          "coalesced_occurrences": {
            "type": "integer",
            "minimum": 0,
            "description": "Older eligible fires represented by the selected latest occurrence."
          },
          "missed_occurrences_not_recovered": {
            "type": "boolean",
            "description": "True when the skip policy drops earlier fires before the current occurrence."
          },
          "missed_outside_window": {
            "type": "boolean",
            "description": "True when at least one unconsumed fire is older than the latest policy window."
          },
          "selected": {
            "$ref": "#/components/schemas/WorkflowScheduleFirePreview"
          }
        }
      },
      "WorkflowSchedulePreviewResponse": {
        "type": "object",
        "description": "Read-only schedule simulation using the deployed trigger and durable cursor. Upcoming times do not guarantee capacity or execution.",
        "required": [
          "workflow_name",
          "deployment_id",
          "schedule",
          "timezone",
          "overlap",
          "enabled",
          "observed_at",
          "evaluation_at",
          "dst_behavior",
          "upcoming",
          "catch_up"
        ],
        "properties": {
          "workflow_name": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "schedule": {
            "type": "string"
          },
          "timezone": {
            "type": "string",
            "description": "Effective IANA timezone."
          },
          "overlap": {
            "type": "string",
            "enum": [
              "skip",
              "allow"
            ],
            "description": "Configured overlap policy. Active runs may still block admission when overlap is skip."
          },
          "enabled": {
            "type": "boolean"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "evaluation_at": {
            "type": "string",
            "format": "date-time",
            "description": "Actual or hypothetical evaluator time."
          },
          "dst_behavior": {
            "$ref": "#/components/schemas/WorkflowScheduleDSTBehavior"
          },
          "upcoming": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/WorkflowScheduleFirePreview"
            }
          },
          "catch_up": {
            "$ref": "#/components/schemas/WorkflowScheduleCatchUpPreview"
          }
        }
      },
      "TenantWorkflowScheduleResponse": {
        "description": "A tenant's effective cadence for an opted-in published schedule workflow.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "workflow_name",
          "deployment_id",
          "schedule",
          "timezone",
          "overlap",
          "enabled",
          "tenant_configurable",
          "customized",
          "version"
        ],
        "properties": {
          "workflow_name": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "schedule": {
            "type": "string",
            "description": "Five-field cron expression."
          },
          "timezone": {
            "type": "string",
            "description": "Effective IANA timezone inherited from the published workflow."
          },
          "overlap": {
            "type": "string",
            "enum": [
              "skip",
              "allow"
            ]
          },
          "catch_up": {
            "type": "string",
            "enum": [
              "skip",
              "latest"
            ],
            "description": "Inherited owner-controlled recovery policy."
          },
          "catch_up_window": {
            "type": "string",
            "description": "Inherited recovery duration, present only for latest."
          },
          "enabled": {
            "type": "boolean"
          },
          "tenant_configurable": {
            "type": "boolean",
            "const": true
          },
          "customized": {
            "type": "boolean",
            "description": "Whether this tenant has saved an override."
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Zero uses the published defaults; use this value as expected_version when updating."
          }
        }
      },
      "ListTenantWorkflowSchedulesResponse": {
        "description": "Schedule triggers that the app owner opted in to tenant-specific configuration.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schedules"
        ],
        "properties": {
          "schedules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TenantWorkflowScheduleResponse"
            }
          }
        }
      },
      "UpdateTenantWorkflowScheduleRequest": {
        "description": "Tenant-owned schedule settings. Workflow input and workflow steps cannot be changed here.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version",
          "schedule"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Zero creates the first override; otherwise use the latest version returned by list or update."
          },
          "schedule": {
            "type": "string",
            "description": "Cron expression evaluated with the platform's five-field grammar."
          },
          "timezone": {
            "type": "string",
            "description": "IANA timezone; omitted uses the published timezone or UTC."
          },
          "overlap": {
            "type": "string",
            "enum": [
              "skip",
              "allow"
            ],
            "description": "Omitted uses the published overlap behavior or skip."
          },
          "enabled": {
            "type": "boolean",
            "default": true,
            "description": "Whether this tenant's schedule is active."
          }
        }
      },
      "WorkflowCodeSpec": {
        "description": "A code-first workflow's entry handler. Exactly one of run or path. Gregale POSTs the run's journal to it at every durable boundary; the SDKs (@gregale/sdk-node/workflows, faas_sdk.workflows) answer with the operations the code reaches next. A code workflow has an empty steps list.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "run": {
            "type": "string",
            "description": "Handler name; the entry path is /<run>."
          },
          "path": {
            "type": "string",
            "description": "Explicit entry path starting with '/'."
          },
          "timeout": {
            "type": "string",
            "description": "Per-call timeout as a duration string; at most the plan's step timeout. Default 30s.",
            "example": "60s"
          },
          "retry": {
            "$ref": "#/components/schemas/WorkflowRetrySpec"
          }
        }
      },
      "WorkflowRetrySpec": {
        "description": "Retry policy for one workflow step.",
        "type": "object",
        "required": [
          "max_attempts"
        ],
        "properties": {
          "max_attempts": {
            "type": "integer",
            "minimum": 1,
            "maximum": 25
          },
          "backoff": {
            "type": "string",
            "enum": [
              "fixed",
              "exponential"
            ]
          }
        }
      },
      "WorkflowGuardSpec": {
        "description": "Bounded declarative when predicate. Specify exactly one of all, any,\nnot, or ref/op/value. References select input or a direct dependency\noutput using input.foo or steps.lookup.output.body.foo without template\ndelimiters. Equality is type-sensitive and accepts scalar literals only.\nNumeric comparisons are exact; numbers are bounded to 4096 bytes and\nexponent magnitude 4096. Missing paths fail comparisons, including ne;\nexists distinguishes missing from present null. not negates normally.\nAt most 32 predicate nodes, 8 levels and 16 KiB per guard. Guards are\nforbidden on on_failure/on_timeout handler targets. A false guard skips\nits step and propagates through dependencies; skipped paths do not join.\n",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "all": {
            "type": "array",
            "minItems": 1,
            "maxItems": 31,
            "items": {
              "$ref": "#/components/schemas/WorkflowGuardSpec"
            }
          },
          "any": {
            "type": "array",
            "minItems": 1,
            "maxItems": 31,
            "items": {
              "$ref": "#/components/schemas/WorkflowGuardSpec"
            }
          },
          "not": {
            "$ref": "#/components/schemas/WorkflowGuardSpec"
          },
          "ref": {
            "type": "string",
            "minLength": 1,
            "description": "Input path or output path of a declared direct dependency.",
            "example": "steps.lookup.output.body.overdue"
          },
          "op": {
            "type": "string",
            "enum": [
              "eq",
              "ne",
              "gt",
              "gte",
              "lt",
              "lte",
              "exists"
            ]
          },
          "value": {
            "description": "Scalar JSON literal; numeric operators require a number and exists requires a boolean.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "WorkflowStepSpec": {
        "description": "One workflow step. The canonical target is `run`; `path`\nand `method` remain accepted for the existing HTTP wake executor\nduring the runtime migration. Exactly one of `run`, `path`,\n`wait_for_event`, `wait_for_callback`, `wait_for_duration`,\n`wait_for_condition`, `outbound`, `join`, or `for_each` must be supplied.\nSet `managed_operation` on an executable HTTP step to persist its business\nresult transactionally and replay it safely when the workflow retries\nafter an uncertain response.\n",
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "run": {
            "type": "string",
            "description": "Named platform operation to invoke."
          },
          "managed_operation": {
            "type": "boolean",
            "description": "Opt into the managed PostgreSQL operation result protocol for this executable HTTP step. The handler must use the transactional operation SDK."
          },
          "for_each": {
            "$ref": "#/components/schemas/WorkflowForEachSpec"
          },
          "join": {
            "$ref": "#/components/schemas/WorkflowJoinSpec"
          },
          "outbound": {
            "$ref": "#/components/schemas/WorkflowOutboundSpec"
          },
          "input": {
            "description": "JSON input passed to the named operation.",
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": true
              },
              {
                "type": "array",
                "items": {}
              },
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ]
          },
          "path": {
            "type": "string",
            "description": "HTTP wake path, retained for compatibility with the existing executor."
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE",
              "HEAD",
              "OPTIONS"
            ]
          },
          "when": {
            "$ref": "#/components/schemas/WorkflowGuardSpec"
          },
          "depends_on": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "wait_for_event": {
            "type": "string"
          },
          "wait_for_callback": {
            "type": "boolean",
            "description": "Park for one account-authorized callback completion. Requires a wait timeout."
          },
          "wait_for_duration": {
            "type": "string",
            "description": "Durable timer, from 1s up to the plan's 7-day workflow wait limit. Fixed day suffixes such as `3d` mean 24-hour days; no compute is held while waiting.",
            "example": "3d"
          },
          "wait_for_condition": {
            "$ref": "#/components/schemas/WorkflowConditionSpec"
          },
          "timeout": {
            "type": "string",
            "description": "Step or wait timeout in time.ParseDuration form, for example `30s`; workflow also accepts fixed 24-hour day suffixes such as `7d`.",
            "example": "30s"
          },
          "on_timeout": {
            "type": "string"
          },
          "on_failure": {
            "type": "string",
            "description": "Name of the handler step to run after this step reaches a terminal failure."
          },
          "retry": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/WorkflowRetrySpec"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "WorkflowForEachSpec": {
        "description": "Bounded-concurrency action over a JSON array from input or a direct dependency\noutput. Snapshots all items and resolved action inputs before dispatch. At most\n128 items, 1 MiB source/prepared inputs and 1 MiB collected output. Parent names\npermit at most 64 UTF-8 bytes. Omitted or zero max_parallel means one active\nitem; values up to 16 limit active items per batch. Items are admitted in\ninput order within a bounded window, and collected output always follows input\norder. By default no new items start after a terminal item failure; already\nactive items finish and the parent fails. `on_item_failure: continue` attempts\nlater items and still marks the parent unsuccessful if any item failed.\nCompleted items survive recovery. With the default stop policy, output retains\nthe completed prefix. With continue, output includes every input position and\nnull for guarded or unsuccessful items. An empty list succeeds with []. Parent\nconsumes zero attempts; each item has its own ledger.\n",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "items",
          "action"
        ],
        "properties": {
          "items": {
            "type": "string",
            "minLength": 1,
            "description": "Array reference without delimiters, such as input.invoices or steps.lookup.output.items."
          },
          "action": {
            "$ref": "#/components/schemas/WorkflowForEachActionSpec"
          },
          "max_parallel": {
            "type": "integer",
            "minimum": 0,
            "maximum": 16,
            "description": "Maximum active items for this batch. Omit or set 0 for sequential execution."
          },
          "on_item_failure": {
            "type": "string",
            "enum": [
              "continue"
            ],
            "description": "Continue after failed or dead items and mark the parent unsuccessful after all items are attempted. Omit to stop at the first failure."
          }
        }
      },
      "WorkflowForEachActionSpec": {
        "description": "Exactly one of run, path or outbound. No nested iteration, dependencies,\nwaits, joins or exception routes. An optional when guard is evaluated once\nfor each item using input.item, input.index and input.input, plus outputs of\nthe parent's declared dependencies. Omitted input sends the item itself.\nExplicit input templates use the same item context. Inputs and guard decisions\nare snapshotted before dispatch and never reevaluated on retry. Mutating\noutbound retries require provider idempotency support.\n",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "run": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "outbound": {
            "$ref": "#/components/schemas/WorkflowOutboundSpec"
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE",
              "HEAD",
              "OPTIONS"
            ]
          },
          "input": {
            "description": "Typed JSON input template for each item.",
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": true
              },
              {
                "type": "array",
                "items": {}
              },
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ]
          },
          "timeout": {
            "type": "string",
            "description": "Per-item action timeout, bounded by the workflow plan limit.",
            "example": "30s"
          },
          "retry": {
            "$ref": "#/components/schemas/WorkflowRetrySpec"
          },
          "when": {
            "$ref": "#/components/schemas/WorkflowGuardSpec"
          }
        }
      },
      "WorkflowJoinSpec": {
        "description": "Native branch join. Waits for all dependencies to finish and permits only\nskips caused by false guards, including their descendants. Failed,\ncancelled, unknown and exception-route skips cannot activate a join.\nThe first succeeded dependency in output_from order supplies the durable\noutput {source: step name, value: original output}. All inactive branches\nskip the join and its continuation. Consumes zero execution attempts.\nRequires 2-128 dependencies and cannot have input, method, when, timeout,\nretry or exception routes, or be/depend on an exception handler.\n",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "output_from"
        ],
        "properties": {
          "output_from": {
            "type": "array",
            "minItems": 2,
            "maxItems": 128,
            "uniqueItems": true,
            "description": "Every direct dependency exactly once, in explicit selection priority order.",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "WorkflowOutboundSpec": {
        "description": "Call an existing customer managed outbound integration bound to this app.\nCredentials and fixed-origin routing remain with the outbound gateway. Input is a\ntemplated JSON body. Path segments and query values support the workflow\ntemplate syntax; dynamic path values are escaped as one segment. GET and\nHEAD have no body and forbid explicit input.\nOne provider call occurs per workflow attempt. Automatic mutating retries\nrequire explicit provider idempotency support. Workflow outputs contain\nstatus and body; sensitive headers and failed-response bodies are omitted.\n",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "integration_id",
          "method",
          "path"
        ],
        "properties": {
          "integration_id": {
            "type": "string",
            "format": "uuid",
            "description": "Canonical UUID of the customer managed integration bound to the app."
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "HEAD",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ],
            "description": "Provider HTTP method within both integration and app binding permissions."
          },
          "path": {
            "type": "string",
            "maxLength": 2048,
            "description": "Canonical relative provider path. A whole segment may be a template, such as /v1/contacts/{{input.contact_id}}; resolved values are escaped and checked against the bound route policy at execution time.",
            "example": "/v1/contacts/{{input.contact_id}}"
          },
          "query": {
            "type": "object",
            "maxProperties": 32,
            "description": "Optional static query keys with templated scalar values. Values are URL-encoded; the request remains bound to this integration and its route permissions.",
            "propertyNames": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^{}&=#?\\s]+$"
            },
            "additionalProperties": {
              "type": "string",
              "maxLength": 2048
            },
            "example": {
              "email": "{{input.email}}"
            }
          },
          "idempotency_supported": {
            "type": "boolean",
            "default": false,
            "description": "Assert that the provider deduplicates the stable Idempotency-Key for this mutating operation; enables retries and recovery."
          }
        }
      },
      "WorkflowConditionSpec": {
        "description": "Bounded scheduled checker. Each 2xx response must be a JSON object with boolean done. A false response becomes the next check's input; no compute is held between checks.",
        "type": "object",
        "required": [
          "run",
          "interval",
          "max_attempts"
        ],
        "properties": {
          "run": {
            "type": "string",
            "description": "Named app handler that checks the condition."
          },
          "interval": {
            "type": "string",
            "description": "Delay between checks; at least 1m and no more than the plan wait limit.",
            "example": "30m"
          },
          "max_attempts": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000
          }
        }
      },
      "WorkflowSpec": {
        "description": "A named workflow DAG submitted with a deployment. max_concurrent_runs caps active run instances for this workflow; excess admitted runs remain pending until a slot opens, subject to the app plan's run quota. max_concurrent_actions caps active executor steps across runs of this workflow; steps wait in the scheduler queue while all action slots are occupied.",
        "type": "object",
        "required": [
          "name",
          "steps"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "trigger": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/WorkflowTriggerSpec"
              },
              {
                "type": "null"
              }
            ]
          },
          "max_concurrent_runs": {
            "type": "integer",
            "minimum": 0,
            "maximum": 200,
            "default": 0,
            "description": "Maximum active run instances for this workflow. Omit or set 0 to rely only on the app plan limit. Pending runs that have not started are queued and do not consume a slot."
          },
          "max_concurrent_actions": {
            "type": "integer",
            "minimum": 0,
            "maximum": 200,
            "default": 0,
            "description": "Maximum running action and condition-check steps across runs of this workflow. Omit or set 0 for no additional per-workflow action cap. Event, callback, and duration waits do not consume an action slot. Runs use the value from their immutable definition snapshot."
          },
          "steps": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowStepSpec"
            }
          },
          "code": {
            "$ref": "#/components/schemas/WorkflowCodeSpec"
          }
        }
      },
      "PreviewEventRequest": {
        "description": "Event fields to evaluate without persisting or delivering the event.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "source",
          "type",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Optional event id used when filters inspect the CloudEvents id."
          },
          "source": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "time": {
            "type": "string",
            "format": "date-time",
            "description": "Event occurrence time; omitted values use the current time."
          },
          "datacontenttype": {
            "type": "string",
            "enum": [
              "application/json"
            ],
            "default": "application/json"
          },
          "data_content_type": {
            "type": "string",
            "enum": [
              "application/json"
            ],
            "deprecated": true
          },
          "data": {
            "description": "JSON event payload evaluated by subscription filters."
          },
          "schemaversion": {
            "type": "string",
            "maxLength": 64,
            "description": "Validated against the registered JSON Schema when one exists."
          }
        }
      },
      "EventPreviewSubscription": {
        "description": "A bounded sample of an enabled subscription or workflow considered by the event router.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "app_slug",
          "subscription_id",
          "source",
          "type",
          "filter",
          "reason"
        ],
        "properties": {
          "schema_versions": {
            "type": "array",
            "maxItems": 16,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$"
            },
            "description": "Exact case-sensitive schema versions. Empty or omitted accepts all versions; a nonempty selection excludes unversioned events. Selection is captured at publication or backfill creation."
          },
          "app_slug": {
            "type": "string"
          },
          "workflow_name": {
            "type": "string",
            "description": "Present for workflow recipients."
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Acceptance candidate deployment for workflow recipients."
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "source": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "filter": {
            "type": "object",
            "additionalProperties": true,
            "description": "Normalized content filter declared by this subscription."
          },
          "reason": {
            "type": "string",
            "description": "would_deliver, content_filter_mismatch, pattern_mismatch, tenant_mismatch, or an invalid_subscription explanation."
          }
        }
      },
      "PreviewEventResponse": {
        "description": "Read-only event-routing preview; counts cover all candidates while lists are bounded samples.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "event_id",
          "source",
          "type",
          "candidate_count",
          "matched_count",
          "filter_mismatch_count",
          "other_mismatch_count",
          "matches",
          "non_matches",
          "truncated"
        ],
        "properties": {
          "schema_version_mismatch_count": {
            "type": "integer",
            "minimum": 0,
            "description": "Candidates excluded by schema version selection."
          },
          "event_id": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "candidate_count": {
            "type": "integer",
            "minimum": 0,
            "description": "Enabled source/type candidates considered."
          },
          "matched_count": {
            "type": "integer",
            "minimum": 0,
            "description": "Subscriptions that would receive the event."
          },
          "filter_mismatch_count": {
            "type": "integer",
            "minimum": 0,
            "description": "Candidates excluded by their content filters."
          },
          "other_mismatch_count": {
            "type": "integer",
            "minimum": 0,
            "description": "Candidates rejected for another reason, including invalid stored subscription data."
          },
          "matches": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/EventPreviewSubscription"
            }
          },
          "non_matches": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/EventPreviewSubscription"
            }
          },
          "truncated": {
            "type": "boolean",
            "description": "True when either sample omits additional candidates."
          }
        }
      },
      "AppEventPublicationVerification": {
        "type": "object",
        "additionalProperties": false,
        "description": "Snapshot comparison of intended content with an existing retained publication.",
        "required": [
          "app_id",
          "source",
          "event_id",
          "observed_at",
          "status",
          "receipt_url"
        ],
        "properties": {
          "expected_accepted_at": {
            "type": "string",
            "format": "date-time",
            "description": "Optional requested acceptance instant normalized to UTC without precision loss."
          },
          "acceptance": {
            "type": "string",
            "enum": [
              "same_acceptance",
              "replacement_acceptance",
              "unavailable"
            ],
            "description": "Acceptance timestamp comparison present only when the caller supplies a guard."
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "source": {
            "type": "string"
          },
          "event_id": {
            "type": "string"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": [
              "match",
              "conflict",
              "unavailable"
            ],
            "description": "Whether retained normalized type, schema version and JSON data match the supplied intent."
          },
          "reason": {
            "type": "string",
            "enum": [
              "not_retained_or_not_observed"
            ],
            "description": "Verification could not observe a retained identity; nonpublication remains unproven."
          },
          "receipt_url": {
            "type": "string",
            "format": "uri-reference"
          },
          "receipt": {
            "$ref": "#/components/schemas/PublishEventResponse"
          }
        }
      },
      "AppEventPublishStatusResponse": {
        "type": "object",
        "additionalProperties": false,
        "description": "Read-only producer-key reconciliation with retained consumer evidence.",
        "required": [
          "app_id",
          "source",
          "event_id",
          "observed_at",
          "status",
          "receipt_url"
        ],
        "properties": {
          "expected_accepted_at": {
            "type": "string",
            "format": "date-time",
            "description": "Saved acceptance timestamp requested for this status snapshot, emitted in UTC."
          },
          "acceptance": {
            "type": "string",
            "enum": [
              "same_acceptance",
              "replacement_acceptance",
              "unavailable"
            ],
            "description": "Relationship of the retained receipt to the requested acceptance timestamp; absent for unguarded reads."
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "source": {
            "type": "string"
          },
          "event_id": {
            "type": "string"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": [
              "processing",
              "accepted",
              "unavailable"
            ],
            "description": "Routing progress of retained acceptance; never a consumer success claim."
          },
          "reason": {
            "type": "string",
            "enum": [
              "not_retained_or_not_observed"
            ],
            "description": "Missing receipt observation cannot establish nonexecution."
          },
          "receipt_url": {
            "type": "string",
            "format": "uri-reference"
          },
          "receipt": {
            "$ref": "#/components/schemas/PublishEventResponse"
          },
          "evidence": {
            "$ref": "#/components/schemas/EventReceiptResponse"
          }
        }
      },
      "AppPublishEventRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Producer-key event publication with a 1 MiB total body limit.",
        "required": [
          "key",
          "type",
          "data"
        ],
        "properties": {
          "expected_app_id": {
            "type": "string",
            "format": "uuid",
            "description": "Optional canonical application UUID guard; mismatches return 409 before publication or comparison."
          },
          "key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "^[!-~]+$",
            "description": "Stable exact application-scoped producer key; preserve on retry."
          },
          "type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "data": {
            "description": "Event data associated with this producer key."
          },
          "time": {
            "type": "string",
            "format": "date-time",
            "description": "Original occurrence time; defaults to ingress time."
          },
          "schemaversion": {
            "type": "string",
            "maxLength": 64
          }
        }
      },
      "AppPublishEventResponse": {
        "type": "object",
        "additionalProperties": false,
        "description": "Durable app producer-key publication decision.",
        "required": [
          "app_id",
          "source",
          "duplicate",
          "receipt"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "source": {
            "type": "string",
            "description": "Stable app.UUID subscription source."
          },
          "duplicate": {
            "type": "boolean"
          },
          "receipt": {
            "$ref": "#/components/schemas/PublishEventResponse"
          }
        }
      },
      "PublishEventRequest": {
        "description": "Caller-authored envelope for the tenant-scoped internal event router.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "source",
          "type",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Caller-chosen idempotent event identifier."
          },
          "source": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Logical producer or service that emitted the event."
          },
          "type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Event type used by future content-based matching."
          },
          "time": {
            "type": "string",
            "format": "date-time",
            "description": "Event occurrence time; omitted values are stamped at ingress."
          },
          "datacontenttype": {
            "type": "string",
            "enum": [
              "application/json"
            ],
            "default": "application/json"
          },
          "data_content_type": {
            "type": "string",
            "enum": [
              "application/json"
            ],
            "deprecated": true
          },
          "data": {
            "description": "JSON event payload."
          },
          "schemaversion": {
            "type": "string",
            "maxLength": 64,
            "description": "Required once a JSON Schema is registered for this source and type."
          },
          "accountid": {
            "type": "string",
            "format": "uuid",
            "description": "Optional tenancy assertion; must match the bearer account."
          },
          "account_id": {
            "type": "string",
            "format": "uuid",
            "deprecated": true
          }
        }
      },
      "PublishEventResponse": {
        "description": "Durable acceptance receipt for a published internal event.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "accepted_at",
          "account_id",
          "receipt_url"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "client_event_id": {
            "type": "string",
            "description": "Original caller-chosen event identifier when tenant-scoped publication is used."
          },
          "accepted_at": {
            "type": "string",
            "format": "date-time"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "receipt_url": {
            "type": "string",
            "format": "uri-reference",
            "description": "Account-authenticated relative URL for this event receipt."
          }
        }
      },
      "EventRetentionSample": {
        "description": "Receipt nearing or past its nominal retention deadline, without payloads.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "event_source",
          "event_id",
          "accepted_at",
          "retain_until",
          "retained_bytes",
          "status",
          "hold_reason"
        ],
        "properties": {
          "event_source": {
            "type": "string"
          },
          "event_id": {
            "type": "string"
          },
          "accepted_at": {
            "type": "string",
            "format": "date-time"
          },
          "retain_until": {
            "type": "string",
            "format": "date-time"
          },
          "retained_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "status": {
            "type": "string",
            "enum": [
              "held",
              "eligible_for_pruning",
              "expiring"
            ]
          },
          "hold_reason": {
            "type": "string",
            "enum": [
              "",
              "backfill_running",
              "backfill_retryable",
              "recovery_pending"
            ]
          }
        }
      },
      "EventRetentionHealth": {
        "description": "Filtered receipt observations and unfiltered account-wide retained storage utilization.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "observed_at",
          "window_seconds",
          "retained_receipts",
          "retained_bytes",
          "unsettled_receipts",
          "unknown_deadline_receipts",
          "held_receipts",
          "running_backfill_holds",
          "retryable_backfill_holds",
          "recovery_holds",
          "held_due_receipts",
          "eligible_for_pruning",
          "expiring_receipts",
          "storage",
          "storage_count_utilization_pct",
          "storage_bytes_utilization_pct",
          "storage_utilization_pct",
          "sample",
          "sample_truncated"
        ],
        "properties": {
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "window_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 2592000
          },
          "event_source": {
            "type": "string"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "retained_receipts": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "retained_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unknown_deadline_receipts": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Settled receipts missing a settlement timestamp; expiry cannot be determined."
          },
          "unsettled_receipts": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "held_receipts": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "recovery_holds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Settled receipts primarily held by opted-in active recovery jobs with pending items. Backfill holds take precedence."
          },
          "running_backfill_holds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "retryable_backfill_holds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "held_due_receipts": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "eligible_for_pruning": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "expiring_receipts": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "storage": {
            "$ref": "#/components/schemas/EventStorageUsageResponse"
          },
          "storage_count_utilization_pct": {
            "type": "number",
            "minimum": 0
          },
          "storage_bytes_utilization_pct": {
            "type": "number",
            "minimum": 0
          },
          "storage_utilization_pct": {
            "type": "number",
            "minimum": 0
          },
          "sample": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/EventRetentionSample"
            }
          },
          "sample_truncated": {
            "type": "boolean"
          }
        }
      },
      "PublishEventBatchRequest": {
        "description": "Bounded collection of independently accepted event envelopes.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "events"
        ],
        "properties": {
          "events": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/PublishEventRequest"
            }
          }
        }
      },
      "PublishEventBatchResult": {
        "description": "Durable acceptance or failure observation for one batch input position.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "index",
          "status",
          "retryable"
        ],
        "properties": {
          "index": {
            "type": "integer",
            "minimum": 0,
            "description": "Zero-based input position."
          },
          "status": {
            "type": "string",
            "enum": [
              "accepted",
              "duplicate",
              "rejected",
              "unknown"
            ]
          },
          "retryable": {
            "type": "boolean",
            "description": "Retry using exactly the original event identity and content."
          },
          "receipt": {
            "$ref": "#/components/schemas/PublishEventResponse"
          },
          "problem": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "PublishEventBatchResponse": {
        "description": "Per-event outcomes in the original batch input order.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "results"
        ],
        "properties": {
          "results": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/PublishEventBatchResult"
            }
          }
        }
      },
      "PlatformTenantPublishEventResponse": {
        "description": "Durable acceptance receipt for a tenant-scoped published event.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "client_event_id",
          "accepted_at",
          "receipt_url"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Canonical event id scoped by tenant, app, and source."
          },
          "client_event_id": {
            "type": "string",
            "description": "Caller-chosen event identifier."
          },
          "accepted_at": {
            "type": "string",
            "format": "date-time"
          },
          "receipt_url": {
            "type": "string",
            "format": "uri-reference",
            "description": "Tenant-authenticated relative URL for this event receipt."
          }
        }
      },
      "EventRecipientBlockerBatchRequest": {
        "type": "object",
        "description": "Bounded exact-recipient queries, each guarded by the original acceptance instant.",
        "additionalProperties": false,
        "required": [
          "queries"
        ],
        "properties": {
          "queries": {
            "type": "array",
            "minItems": 1,
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/EventRecipientBlockerQuery"
            }
          }
        }
      },
      "EventRecipientBlockerBatchItem": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "query"
        ],
        "description": "Exactly one of result or error is returned.",
        "properties": {
          "query": {
            "$ref": "#/components/schemas/EventRecipientBlockerQuery"
          },
          "result": {
            "$ref": "#/components/schemas/EventRecipientBlockerResponse"
          },
          "error": {
            "type": "string",
            "enum": [
              "read_error",
              "read_timeout"
            ]
          }
        }
      },
      "EventRecipientBlockerBatchResponse": {
        "type": "object",
        "description": "Ordered independent observations for the requested recipient queries.",
        "additionalProperties": false,
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "minItems": 1,
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/EventRecipientBlockerBatchItem"
            }
          }
        }
      },
      "EventRecipientBlockerQuery": {
        "type": "object",
        "description": "Event and consumer identity with the original acceptance instant for a read-only lookup.",
        "additionalProperties": false,
        "required": [
          "source",
          "id",
          "subscription_id",
          "expected_accepted_at"
        ],
        "properties": {
          "source": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "subscription_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "expected_accepted_at": {
            "type": "string",
            "description": "Nonzero RFC3339 timestamp with its original fractional precision (up to nanoseconds)."
          }
        }
      },
      "EventRecipientBlockerResponse": {
        "type": "object",
        "description": "Current retained routing evidence for one acceptance-guarded consumer query.",
        "additionalProperties": false,
        "required": [
          "query",
          "observed_at",
          "status"
        ],
        "properties": {
          "query": {
            "$ref": "#/components/schemas/EventRecipientBlockerQuery"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": [
              "available",
              "not_waiting",
              "unavailable",
              "acceptance_replaced"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "receipt_unavailable",
              "snapshot_unavailable",
              "recipient_unavailable",
              "routing_evidence_unavailable",
              "acceptance_replaced"
            ]
          },
          "routing_state": {
            "type": "string",
            "description": "Retained routing state; never an invocation state."
          },
          "recipient": {
            "$ref": "#/components/schemas/EventBacklogRecipient"
          }
        }
      },
      "EventBacklogResponse": {
        "example": {
          "observed_at": "2026-10-05T12:00:00Z",
          "window_at": "2026-10-05T12:00:00Z",
          "coverage": "captured_and_backfill_recipients",
          "recipients": [],
          "consumers": [],
          "unattributed_receipts": 0
        },
        "type": "object",
        "additionalProperties": false,
        "description": "Live waiting recipients and exact matching counts, with an anchored acceptance window.",
        "required": [
          "observed_at",
          "window_at",
          "coverage",
          "recipients",
          "consumers",
          "unattributed_receipts"
        ],
        "properties": {
          "observed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time of this live observation."
          },
          "window_at": {
            "type": "string",
            "format": "date-time",
            "description": "First-page time anchoring acceptance and minimum-age cutoff across pages."
          },
          "coverage": {
            "type": "string",
            "const": "captured_and_backfill_recipients"
          },
          "recipients": {
            "type": "array",
            "maxItems": 200,
            "items": {
              "$ref": "#/components/schemas/EventBacklogRecipient"
            }
          },
          "consumers": {
            "type": "array",
            "maxItems": 200,
            "items": {
              "$ref": "#/components/schemas/EventBacklogConsumer"
            }
          },
          "unattributed_receipts": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Account-wide unresolved receipts without a captured snapshot; only the age/acceptance window applies."
          },
          "next_after": {
            "type": "string",
            "description": "Opaque continuation for the recipient page."
          },
          "next_consumers_after": {
            "type": "string",
            "description": "Opaque continuation for the consumer page."
          }
        }
      },
      "EventBacklogRecipient": {
        "type": "object",
        "additionalProperties": false,
        "description": "One application or workflow event recipient awaiting routing, without envelope data.",
        "required": [
          "event_source",
          "event_id",
          "event_type",
          "accepted_at",
          "app_id",
          "app_slug",
          "target_available",
          "subscription_id",
          "consumer_kind",
          "origin",
          "routing_mode",
          "state",
          "attempts",
          "capacity_deferrals",
          "pending_age_seconds",
          "waiting_reason",
          "receipt_url"
        ],
        "properties": {
          "event_source": {
            "type": "string"
          },
          "event_id": {
            "type": "string"
          },
          "event_type": {
            "type": "string"
          },
          "accepted_at": {
            "type": "string",
            "format": "date-time"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_slug": {
            "type": "string",
            "description": "Empty when the captured app is no longer owned by this account."
          },
          "target_available": {
            "type": "boolean"
          },
          "subscription_id": {
            "type": "string"
          },
          "consumer_kind": {
            "type": "string",
            "enum": [
              "application",
              "workflow"
            ]
          },
          "origin": {
            "type": "string",
            "enum": [
              "acceptance",
              "backfill"
            ],
            "description": "Whether this recipient was captured at publication or added by historical backfill."
          },
          "workflow_name": {
            "type": "string",
            "description": "Captured workflow trigger name; present for workflow consumers."
          },
          "routing_mode": {
            "type": "string",
            "enum": [
              "event",
              "recipient"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "processing"
            ]
          },
          "capacity_scope": {
            "type": "string",
            "enum": [
              "consumer",
              "app",
              "account"
            ],
            "description": "Last recorded capacity scope for a currently pending recipient."
          },
          "attempts": {
            "type": "integer",
            "minimum": 0
          },
          "capacity_deferrals": {
            "type": "integer",
            "minimum": 0
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "lease_until": {
            "type": "string",
            "format": "date-time",
            "description": "Recipient lease or shared whole-receipt lease."
          },
          "pending_age_seconds": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "description": "Age from acceptance at observed_at, not time spent at the latest capacity scope."
          },
          "waiting_reason": {
            "type": "string",
            "enum": [
              "circuit_open",
              "circuit_probe_wait",
              "circuit_recovery_rate_limited",
              "subscription_paused",
              "subscription_rate_limited",
              "ordering_blocked",
              "capacity_consumer",
              "capacity_app",
              "capacity_account",
              "routing_in_progress",
              "receipt_processing",
              "retry_backoff",
              "workflow_routing",
              "ready"
            ],
            "description": "Active routing and shared receipt leases take precedence; subscription controls precede ordering, recorded capacity and retry backoff."
          },
          "receipt_url": {
            "type": "string",
            "format": "uri-reference"
          },
          "ordering_blocker": {
            "$ref": "#/components/schemas/EventOrderingBlocker"
          },
          "fanout_history_url": {
            "type": "string",
            "format": "uri-reference",
            "description": "Present for application subscriptions whose captured target still belongs to the account. Workflow admission is visible through the receipt. History coverage is independently bounded."
          }
        }
      },
      "EventSubscriptionResumeRequest": {
        "description": "Resume settings for a paused subscription, including the continuing routing admission rate.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "rate_per_second": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "default": 10,
            "description": "Maximum new routing admissions in a one-second window; zero removes pacing. This limit continues to apply to new publications after the backlog drains."
          }
        }
      },
      "EventAcknowledgmentRecordingCoverage": {
        "type": "object",
        "additionalProperties": false,
        "description": "Capability and heartbeat verification against the exhaustive deployment-declared writer roster; not automatic discovery of unlisted processes or proof of metric data integrity.",
        "required": [
          "verified",
          "reason",
          "observed_at",
          "expected_writers",
          "active_writers",
          "capability_version",
          "heartbeat_lease_seconds"
        ],
        "properties": {
          "verified": {
            "type": "boolean",
            "description": "All declared slots have one live compatible session and a continuous heartbeat watermark."
          },
          "reason": {
            "type": "string",
            "description": "Bounded coverage diagnostic such as verified or missing_writer or inventory_unconfigured or warming_up."
          },
          "observed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Database clock used to assess writer leases in the metric read snapshot."
          },
          "continuous_since": {
            "type": "string",
            "format": "date-time",
            "description": "Conservative continuity boundary reset by observed membership changes or heartbeat gaps."
          },
          "verified_through": {
            "type": "string",
            "format": "date-time",
            "description": "Least recent live writer heartbeat; no later minute is considered verified."
          },
          "inventory_revision": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Opaque hash of the common canonical declared inventory without exposing slots or sessions."
          },
          "expected_writers": {
            "type": "integer",
            "minimum": 0,
            "maximum": 128,
            "description": "Declared members when a usable inventory is available."
          },
          "active_writers": {
            "type": "integer",
            "minimum": 0,
            "maximum": 257,
            "description": "Bounded live session count; 257 denotes evidence exceeding the scan limit."
          },
          "capability_version": {
            "type": "integer",
            "const": 1,
            "description": "Required deferred metric recording capability protocol."
          },
          "heartbeat_lease_seconds": {
            "type": "integer",
            "const": 30,
            "description": "Writer heartbeat lease horizon assessed using database time."
          }
        }
      },
      "EventAcknowledgmentWindowHealth": {
        "type": "object",
        "additionalProperties": false,
        "description": "Recorded renewal and expiry operations in full UTC minute buckets with optional verification of deployment-declared writer continuity.",
        "required": [
          "window_start",
          "window_end",
          "bucket_seconds",
          "retention_seconds",
          "coverage",
          "renewal_successes",
          "renewal_rejections",
          "renewal_attempts",
          "lease_expiries",
          "saturated"
        ],
        "properties": {
          "window_start": {
            "type": "string",
            "format": "date-time",
            "description": "Inclusive boundary of full minutes wholly inside the requested processing window."
          },
          "recording_coverage": {
            "$ref": "#/components/schemas/EventAcknowledgmentRecordingCoverage"
          },
          "window_end": {
            "type": "string",
            "format": "date-time",
            "description": "Exclusive completed-minute boundary capped by the verified writer heartbeat watermark when available."
          },
          "bucket_seconds": {
            "type": "integer",
            "const": 60,
            "description": "Fixed width of each durable operation bucket."
          },
          "retention_seconds": {
            "type": "integer",
            "const": 172800,
            "description": "Metric retention measured from bucket start independently of invocation pruning."
          },
          "coverage": {
            "type": "string",
            "enum": [
              "recorded_full_minute_buckets"
            ],
            "description": "Only instrumented writers contribute; inspect recording_coverage for declared-inventory continuity and no pre-upgrade activity is reconstructed."
          },
          "renewal_successes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Explicit successful renewals recorded in selected complete buckets."
          },
          "renewal_rejections": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Current-token renewal conflicts recorded after token and attempt verification."
          },
          "renewal_attempts": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Sum of recorded successful and rejected renewals used as the fraction denominator."
          },
          "lease_expiries": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Recorded deferred-awaiting scheduler expiry transitions in these minutes."
          },
          "saturated": {
            "type": "boolean",
            "description": "At least one bucket overflowed its saturating counter; totals are lower bounds and rate fields are omitted."
          },
          "renewal_rejection_fraction": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "Recorded rejected renewals divided by recorded renewal attempts; absent without samples or complete minutes or after saturation."
          },
          "lease_expiry_rate_per_second": {
            "type": "number",
            "minimum": 0,
            "description": "Recorded lease expiry transitions divided by the effective window duration; absent for an empty or saturated window."
          }
        }
      },
      "EventConsumerProcessingHealth": {
        "type": "object",
        "additionalProperties": false,
        "description": "Current retained deferred invocation gauges, retained completion latency and optional durable full-minute renewal metrics with independent coverage.",
        "required": [
          "app_id",
          "subscription_id",
          "observed_at",
          "window_start",
          "coverage",
          "complete",
          "waiting",
          "delivering",
          "processing",
          "expired",
          "completed",
          "dead_lettered",
          "failed",
          "other",
          "near_expiry",
          "near_expiry_seconds",
          "oldest_processing_age_seconds",
          "acknowledgment_samples",
          "acknowledgment_latency_max_seconds",
          "renewal_failure_coverage"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid",
            "description": "Application owning this processing summary."
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid",
            "description": "Consumer subscription selected for the retained processing aggregate."
          },
          "observed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Database snapshot clock for processing gauges."
          },
          "window_start": {
            "type": "string",
            "format": "date-time",
            "description": "Start of the retained acknowledgment completion window."
          },
          "coverage": {
            "type": "string",
            "enum": [
              "retained_deferred_invocations"
            ],
            "description": "Coverage is limited to currently retained opted-in invocations."
          },
          "complete": {
            "type": "boolean",
            "description": "All matching retained invocations were aggregated without sampling; this is not historical completeness."
          },
          "waiting": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Deferred invocations currently pending dispatch."
          },
          "delivering": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Live deferred dispatches not yet handed off."
          },
          "processing": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Unexpired matching leases handed off after HTTP 202."
          },
          "expired": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Expired dispatching leases before recovery sweeps."
          },
          "completed": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Retained opted-in invocations completed by callback or ordinary success."
          },
          "dead_lettered": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Retained deferred invocations in dead letters."
          },
          "failed": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Retained deferred invocations permanently failed."
          },
          "other": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Other terminal states including cancellation and supersession and work-policy expiry."
          },
          "near_expiry": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Active handed-off leases in their final third; the risk horizon is capped by near_expiry_seconds."
          },
          "near_expiry_seconds": {
            "type": "integer",
            "minimum": 1,
            "description": "Maximum lease risk horizon in seconds; each claim uses the smaller of this cap and one third of its lease duration."
          },
          "oldest_processing_offered_at": {
            "type": "string",
            "format": "date-time",
            "description": "Oldest token issue time among live handed-off claims; includes initial dispatch time."
          },
          "oldest_processing_age_seconds": {
            "type": "number",
            "minimum": 0,
            "description": "Age since oldest active processing token issue; zero when absent."
          },
          "acknowledgment_samples": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Retained matching explicit completions whose completion time falls inside the window."
          },
          "acknowledgment_latency_max_seconds": {
            "type": "number",
            "minimum": 0,
            "description": "Maximum token-issue-to-completion seconds among acknowledgment samples; zero requires inspecting sample count."
          },
          "renewal_failure_coverage": {
            "type": "string",
            "enum": [
              "not_recorded"
            ],
            "deprecated": true,
            "description": "Legacy non-windowed coverage marker retained for older clients; use renewal_window for durable recorded operation counts."
          },
          "renewal_window": {
            "$ref": "#/components/schemas/EventAcknowledgmentWindowHealth"
          }
        }
      },
      "EventConsumerDeliveryHealth": {
        "type": "object",
        "additionalProperties": false,
        "description": "Independent live routing, retained execution, and oldest-first pending reads. No overall healthy verdict is inferred from incomplete coverage.",
        "required": [
          "started_at",
          "observed_at",
          "routing",
          "execution",
          "pending_sample"
        ],
        "properties": {
          "processing": {
            "$ref": "#/components/schemas/EventConsumerProcessingHealth"
          },
          "capacity_pressure": {
            "$ref": "#/components/schemas/EventConsumerCapacityPressure"
          },
          "waiting_reasons": {
            "$ref": "#/components/schemas/EventConsumerWaitingReasons"
          },
          "capacity_waits": {
            "$ref": "#/components/schemas/EventConsumerCapacityWaits"
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "routing": {
            "$ref": "#/components/schemas/EventConsumerHealth"
          },
          "execution": {
            "$ref": "#/components/schemas/EventConsumerExecutionHealth"
          },
          "pending_sample": {
            "$ref": "#/components/schemas/EventConsumerPendingSample"
          }
        }
      },
      "EventConsumerWaitingReasons": {
        "type": "object",
        "additionalProperties": false,
        "description": "Complete mutually exclusive effective waiting reasons across retained pending application recipients in the backlog snapshot. Counts sum to pending_recipients when complete, independently of recipient pagination. Missing evidence from older servers is unavailable, not zero.",
        "required": [
          "app_id",
          "subscription_id",
          "observed_at",
          "window_at",
          "coverage",
          "complete",
          "pending_recipients",
          "counts"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "window_at": {
            "type": "string",
            "format": "date-time",
            "description": "Acceptance cutoff used by the backlog query."
          },
          "coverage": {
            "type": "string",
            "enum": [
              "all_pending_application_recipients"
            ]
          },
          "complete": {
            "type": "boolean"
          },
          "pending_recipients": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "counts": {
            "type": "object",
            "description": "Counts for circuit_open, circuit_probe_wait, circuit_recovery_rate_limited, subscription_paused, subscription_rate_limited, ordering_blocked, capacity_consumer, capacity_app, capacity_account, routing_in_progress, receipt_processing, retry_backoff, workflow_routing, and ready. Known reasons include zero counts; processing recipients are excluded.",
            "additionalProperties": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          }
        }
      },
      "EventConsumerCapacityPressure": {
        "type": "object",
        "additionalProperties": false,
        "description": "Read-only current live slot usage and effective capacity waiting reasons from one owned subscription snapshot. Independent of the other delivery-health reads and history window. Recorded waits may remain after capacity drains. Age is since event acceptance, not continuous capacity-wait duration. No capacity reservation or delivery-order guarantee.",
        "required": [
          "app_id",
          "subscription_id",
          "observed_at",
          "coverage",
          "complete",
          "blocking_scope",
          "configured_max_pending_deliveries",
          "plan_max_pending_deliveries",
          "scopes"
        ],
        "properties": {
          "capacity_command_budget": {
            "$ref": "#/components/schemas/EventSubscriptionCapacityCommandBudget",
            "description": "Optional receipt budget from the same snapshot and observed_at as this pressure. Absent on older servers; absence does not mean slots are available."
          },
          "plan_max_pending_deliveries": {
            "type": "integer",
            "minimum": 1,
            "description": "Current plan consumer ceiling before applying the saved subscription setting; used to validate proposed capacity changes."
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "coverage": {
            "type": "string",
            "enum": [
              "live_slots_and_all_pending_application_recipients"
            ]
          },
          "complete": {
            "type": "boolean",
            "description": "All trusted live slots and retained pending application recipients in this scope were assessed; not inferred from a bounded sample."
          },
          "blocking_scope": {
            "type": "string",
            "enum": [
              "",
              "consumer",
              "app",
              "account"
            ],
            "description": "Current first full admission ceiling in consumer then app then account order; empty means none observed. Not inferred from recorded waits."
          },
          "configured_max_pending_deliveries": {
            "type": "integer",
            "minimum": 0,
            "description": "Saved subscription ceiling; zero uses the current plan default."
          },
          "scopes": {
            "type": "array",
            "minItems": 3,
            "maxItems": 3,
            "description": "Consumer, app and account scopes in admission priority order. Waiting counts refer only to this subscription; live app/account counts include sibling deliveries in those scopes.",
            "items": {
              "$ref": "#/components/schemas/EventConsumerCapacityScope"
            }
          }
        }
      },
      "EventConsumerCapacityScope": {
        "type": "object",
        "additionalProperties": false,
        "description": "Current usage and ceiling together with this subscription's effective recorded waits for this scope. Advice is informational and never initiates recovery or changes controls.",
        "required": [
          "scope",
          "live_deliveries",
          "effective_limit",
          "at_limit",
          "waiting_recipients",
          "oldest_waiting_age_seconds",
          "advice"
        ],
        "properties": {
          "scope": {
            "type": "string",
            "enum": [
              "consumer",
              "app",
              "account"
            ]
          },
          "live_deliveries": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Trusted pending plus dispatching delivery slots, including replay descendants; excludes untagged legacy invocations."
          },
          "effective_limit": {
            "type": "integer",
            "minimum": 1,
            "description": "Current plan ceiling, clamped by a configured subscription ceiling for consumer scope."
          },
          "at_limit": {
            "type": "boolean",
            "description": "Live usage is greater than or equal to the effective ceiling."
          },
          "waiting_recipients": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "This subscription's retained pending application recipients whose effective reason is capacity at this scope. Precedence follows the existing backlog pause, circuit, ordering and routing-state rules."
          },
          "oldest_waiting_accepted_at": {
            "type": "string",
            "format": "date-time",
            "description": "Acceptance timestamp of the oldest such recipient; absent when no recipients wait at this scope."
          },
          "oldest_waiting_age_seconds": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "description": "Age since acceptance at observed_at, not continuous capacity-wait duration; zero when none wait."
          },
          "advice": {
            "type": "string",
            "description": "Suggested read-only investigation or operator review based on current scope pressure."
          }
        }
      },
      "EventConsumerCapacityWaits": {
        "type": "object",
        "additionalProperties": false,
        "description": "Complete counts of effective capacity waiting reasons among retained pending application recipients in one backlog snapshot. Independent of recipient pagination. Missing or incomplete evidence cannot clear capacity alerts.",
        "required": [
          "app_id",
          "subscription_id",
          "observed_at",
          "coverage",
          "complete",
          "pending_recipients",
          "consumer",
          "app",
          "account"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "coverage": {
            "type": "string",
            "enum": [
              "all_pending_application_recipients"
            ]
          },
          "complete": {
            "type": "boolean"
          },
          "pending_recipients": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "consumer": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "app": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "account": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "EventConsumerPendingSample": {
        "type": "object",
        "additionalProperties": false,
        "description": "Up to 50 oldest pending application recipients, ordered by acceptance time with stable outbox and subscription ties. Waiting reason counts cover only these recipients.",
        "required": [
          "observed_at",
          "coverage",
          "truncated",
          "waiting_reasons",
          "recipients"
        ],
        "properties": {
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "coverage": {
            "type": "string",
            "enum": [
              "oldest_pending_recipients"
            ]
          },
          "truncated": {
            "type": "boolean",
            "description": "More pending recipients existed in this read."
          },
          "waiting_reasons": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          "recipients": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/EventBacklogRecipient"
            }
          }
        }
      },
      "ControlEventExecutionLineageCaseBackfillRequest": {
        "description": "Original scan creation guard for pausing, resuming, or cancelling a retained diagnostic backfill.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_created_at"
        ],
        "properties": {
          "expected_created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Exact original created_at of the reviewed retained scan."
          }
        }
      },
      "RequestEventExecutionLineageCaseBackfillRequest": {
        "description": "Idempotent request identity and previous-scan guard for a bounded diagnostic backfill.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "request_id"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_previous_request_id": {
            "type": "string",
            "format": "uuid",
            "description": "Omit for the first request; otherwise use the latest completed, cancelled or expired request UUID. Repeated submissions preserve their original guard."
          }
        }
      },
      "EventExecutionLineageCaseBackfill": {
        "description": "Retained diagnostic scan status, durable cursor, and repair counters for one subscription.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "subscription_id",
          "app_id",
          "status",
          "through_outbox_id",
          "cursor",
          "scanned",
          "recorded",
          "existing",
          "associated",
          "unresolved",
          "conflicts"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "previous_request_id": {
            "type": "string",
            "format": "uuid"
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "not_requested",
              "pending",
              "waiting_for_retry_jobs",
              "paused",
              "cancelled",
              "completed",
              "expired"
            ]
          },
          "through_outbox_id": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cursor": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "scanned": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "recorded": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "existing": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "associated": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unresolved": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "conflicts": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "retain_until": {
            "type": "string",
            "format": "date-time",
            "description": "Work deadline; latest scan metadata remains available while its coverage row exists."
          }
        }
      },
      "CancelEventExecutionLineageRetryJobRequest": {
        "description": "Original job creation guard and optional command identity for cancelling bulk lineage retries.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_created_at"
        ],
        "properties": {
          "command_id": {
            "type": "string",
            "format": "uuid",
            "description": "Optional nonzero command UUID; reuse with the original cancel action and creation guard after a lost response."
          },
          "expected_created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Exact original created_at from the reviewed retained job; fences a replacement after expiry."
          }
        }
      },
      "EventExecutionLineageRetrySelection": {
        "description": "One reviewed lineage case with its revision and optional diagnostic incarnation guard.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "outbox_id",
          "expected_revision",
          "accepted_at"
        ],
        "properties": {
          "expected_diagnostic_id": {
            "type": "string",
            "format": "uuid",
            "description": "Required when the reviewed case has diagnostic_id; omit for legacy cases."
          },
          "outbox_id": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "accepted_at": {
            "type": "string",
            "format": "date-time",
            "description": "Exact original acceptance timestamp from the reviewed case."
          }
        }
      },
      "CreateEventExecutionLineageRetryJobRequest": {
        "description": "Fixed bounded selection and submission UUID for a durable bulk lineage retry job.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "request_id",
          "cases"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "cases": {
            "type": "array",
            "minItems": 1,
            "maxItems": 200,
            "description": "Unique outbox identities; server normalizes ascending order for idempotency.",
            "items": {
              "$ref": "#/components/schemas/EventExecutionLineageRetrySelection"
            }
          }
        }
      },
      "EventExecutionLineageRetryJobItem": {
        "description": "Retained evaluation status and guarded retry result for one selected case in a bulk job.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "selection",
          "status"
        ],
        "properties": {
          "selection": {
            "$ref": "#/components/schemas/EventExecutionLineageRetrySelection"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "cancelled",
              "changed",
              "unavailable",
              "unresolved",
              "conflict",
              "repaired",
              "already_associated"
            ]
          },
          "reason": {
            "type": "string"
          },
          "result": {
            "$ref": "#/components/schemas/EventExecutionLineageCase"
          }
        }
      },
      "ControlEventExecutionLineageRetryJobRequest": {
        "description": "Original job creation guard and optional idempotency UUID for a pause or resume command.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_created_at"
        ],
        "properties": {
          "command_id": {
            "type": "string",
            "format": "uuid",
            "description": "Optional nonzero command UUID; reuse it with the original action and creation guard after a lost response."
          },
          "expected_created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Original nonzero creation timestamp from the reviewed job. Context: Control Event Execution Lineage Retry Job Request."
          }
        }
      },
      "EventExecutionLineageRetryJobControlReceipt": {
        "description": "Immutable original successful control outcome with command identity, progress, and trusted actor attribution.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "command_id",
          "sequence",
          "job_request_id",
          "subscription_id",
          "app_id",
          "action",
          "expected_created_at",
          "result_status",
          "processed",
          "selected",
          "job_updated_at",
          "recorded_at",
          "retain_until"
        ],
        "properties": {
          "actor_kind": {
            "type": "string",
            "enum": [
              "account",
              "credential",
              "internal"
            ],
            "description": "Server-resolved original command actor; absent on legacy receipts."
          },
          "actor_id": {
            "type": "string",
            "description": "Account UUID for a session, credential UUID for a bearer, or store for an internal call. Never a token value or session ID."
          },
          "credential_type": {
            "type": "string",
            "enum": [
              "session",
              "api_key",
              "deploy_token",
              "platform_tenant_token",
              "internal"
            ],
            "description": "Original server-resolved authentication type; absent on legacy receipts."
          },
          "command_id": {
            "type": "string",
            "format": "uuid"
          },
          "sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 128
          },
          "job_request_id": {
            "type": "string",
            "format": "uuid"
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "action": {
            "type": "string",
            "enum": [
              "pause",
              "resume",
              "cancel"
            ]
          },
          "expected_created_at": {
            "type": "string",
            "format": "date-time"
          },
          "result_status": {
            "type": "string",
            "enum": [
              "pending",
              "paused",
              "completed",
              "cancelled"
            ],
            "description": "Immutable job state observed by the original command."
          },
          "processed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 200
          },
          "selected": {
            "type": "integer",
            "minimum": 1,
            "maximum": 200
          },
          "job_updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "recorded_at": {
            "type": "string",
            "format": "date-time"
          },
          "retain_until": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EventExecutionLineageRetryJobControlFilters": {
        "description": "Exact action and original actor filters applied before control-receipt pagination.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "",
              "pause",
              "resume",
              "cancel"
            ]
          },
          "actor_id": {
            "type": "string",
            "description": "Exact actor UUID in hyphenated form or store for an internal caller. Empty means no filter."
          },
          "credential_type": {
            "type": "string",
            "enum": [
              "",
              "session",
              "api_key",
              "deploy_token",
              "platform_tenant_token",
              "internal"
            ]
          }
        }
      },
      "EventExecutionLineageRetryJobControls": {
        "description": "Observed scoped page of retained bulk-job control receipts and its continuation cursor.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "controls"
        ],
        "properties": {
          "controls": {
            "type": "array",
            "maxItems": 200,
            "items": {
              "$ref": "#/components/schemas/EventExecutionLineageRetryJobControlReceipt"
            }
          },
          "next_after": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 128
          }
        }
      },
      "EventExecutionLineageRetryJobSummary": {
        "description": "Retained bulk retry job identity, creation guards, lifecycle status, and progress summary.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "request_id",
          "subscription_id",
          "app_id",
          "status",
          "selected",
          "processed",
          "created_at",
          "updated_at",
          "retain_until"
        ],
        "properties": {
          "last_progress_at": {
            "type": "string",
            "format": "date-time",
            "description": "Last known committed evaluation or skip; absent for unevaluated or legacy jobs."
          },
          "attention": {
            "$ref": "#/components/schemas/EventExecutionLineageRetryJobHealthSample"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "paused",
              "completed",
              "cancelled"
            ]
          },
          "selected": {
            "type": "integer",
            "minimum": 1,
            "maximum": 200
          },
          "processed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 200,
            "description": "Cases evaluated or skipped; cancelled items are not counted."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "retain_until": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EventExecutionLineageRetryJobAttentionOptions": {
        "description": "Warning filter selecting retained retry jobs with inactivity or retention pressure.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "attention": {
            "type": "string",
            "enum": [
              "",
              "any",
              "stalled",
              "retention_risk"
            ]
          }
        }
      },
      "EventExecutionLineageRetryJobAttentionPage": {
        "type": "object",
        "additionalProperties": false,
        "description": "Current matching-page observations; no total count or frozen membership is promised.",
        "required": [
          "coverage",
          "filter",
          "observed_at",
          "has_more",
          "inactivity_warning_seconds",
          "retention_warning_seconds"
        ],
        "properties": {
          "coverage": {
            "type": "string",
            "enum": [
              "live_matching_retry_jobs_page"
            ]
          },
          "filter": {
            "type": "string",
            "enum": [
              "any",
              "stalled",
              "retention_risk"
            ]
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "has_more": {
            "type": "boolean",
            "description": "Another matching row was observed after this page; consistent with next_after."
          },
          "inactivity_warning_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "retention_warning_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "EventExecutionLineageRetryJobs": {
        "description": "Scoped live page of retained bulk lineage retry job summaries.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "jobs"
        ],
        "properties": {
          "attention": {
            "$ref": "#/components/schemas/EventExecutionLineageRetryJobAttentionPage"
          },
          "jobs": {
            "type": "array",
            "maxItems": 200,
            "items": {
              "$ref": "#/components/schemas/EventExecutionLineageRetryJobSummary"
            }
          },
          "next_after": {
            "type": "string",
            "maxLength": 128,
            "description": "Continuation cursor; omitted when no further page was observed."
          }
        }
      },
      "EventExecutionLineageRetryJob": {
        "description": "Durable bulk lineage retry status, original selection, per-case results, and optional command receipt.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "request_id",
          "subscription_id",
          "app_id",
          "status",
          "processed",
          "items",
          "created_at",
          "updated_at",
          "retain_until"
        ],
        "properties": {
          "last_progress_at": {
            "type": "string",
            "format": "date-time",
            "description": "Last committed evaluation or skip recorded by upgraded workers. Absent before the first evaluation or for older snapshots; controls do not change it."
          },
          "control_receipt": {
            "description": "Immutable command outcome accompanying a UUID-keyed control response; outer job fields are current observations.",
            "allOf": [
              {
                "$ref": "#/components/schemas/EventExecutionLineageRetryJobControlReceipt"
              }
            ]
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "paused",
              "completed",
              "cancelled"
            ]
          },
          "processed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 200,
            "description": "Cases evaluated or skipped before cancellation; cancelled items are not counted."
          },
          "items": {
            "type": "array",
            "maxItems": 200,
            "items": {
              "$ref": "#/components/schemas/EventExecutionLineageRetryJobItem"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "retain_until": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EventExecutionLineageCase": {
        "description": "Retained reason-coded lineage diagnostic with revision and incarnation guards for reevaluation.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "subscription_id",
          "app_id",
          "outbox_id",
          "accepted_at",
          "status",
          "reason",
          "revision",
          "retry_count",
          "recorded_at",
          "retain_until"
        ],
        "properties": {
          "diagnostic_id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique incarnation of a diagnostically created case; required in its retry guards."
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "outbox_id": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "accepted_at": {
            "type": "string",
            "format": "date-time"
          },
          "root_invocation_id": {
            "type": "string",
            "format": "uuid"
          },
          "root_created_at": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": [
              "unresolved",
              "conflict",
              "repaired",
              "already_associated"
            ]
          },
          "reason": {
            "type": "string"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "retry_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "recorded_at": {
            "type": "string",
            "format": "date-time"
          },
          "retain_until": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EventExecutionLineageCases": {
        "description": "Scoped page of retained execution-lineage diagnostics with a continuation boundary.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "cases"
        ],
        "properties": {
          "cases": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventExecutionLineageCase"
            }
          },
          "next_after": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        }
      },
      "RetryEventExecutionLineageCaseRequest": {
        "description": "Idempotent reevaluation identity and reviewed revision guard for a single lineage case.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "request_id",
          "expected_revision"
        ],
        "properties": {
          "expected_diagnostic_id": {
            "type": "string",
            "format": "uuid",
            "description": "Required when the reviewed case has diagnostic_id; omit for legacy cases. Context: Retry Event Execution Lineage Case Request."
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        }
      },
      "EventExecutionReconciliation": {
        "description": "Subscription execution-coverage status and durable progress of forward reconciliation and legacy repair.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "subscription_id",
          "app_id",
          "status",
          "unattributed_execution_present",
          "repair_scanned",
          "repair_repaired",
          "repair_unresolved",
          "repair_conflicts"
        ],
        "properties": {
          "repair_scanned": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Cumulative retained receipt candidates examined by this request."
          },
          "repair_repaired": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Newly associated authoritative roots; existing associations are not counted."
          },
          "repair_unresolved": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Examined candidates with missing or incompatible execution evidence; not a live blocker count."
          },
          "repair_conflicts": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Examined candidates with competing acceptance or incompatible existing lineage; not a live blocker count."
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "not_requested",
              "waiting_for_lineage",
              "completed",
              "not_required"
            ]
          },
          "requested_at": {
            "type": "string",
            "format": "date-time"
          },
          "collection_started_at": {
            "type": "string",
            "format": "date-time"
          },
          "unattributed_execution_present": {
            "type": "boolean",
            "description": "A retained app invocation lacks authoritative ledger lineage; unrelated app invocations can conservatively block reconciliation."
          }
        }
      },
      "EventExecutionLineageRetryJobHealth": {
        "type": "object",
        "additionalProperties": false,
        "description": "Bounded retained pending and paused lineage retry jobs at observed_at. Independent of the execution window and handler outcome completeness. Earliest retention deadlines are observed first. When counts_complete is false counts are lower bounds and oldest/next timestamps describe only observed jobs. Stalled pending is an advisory inactivity warning; pause/resume activity can reset inactivity without changing last progress. Legacy evaluated jobs without a progress timestamp report unknown progress. No handler payloads or case selections are included.",
        "required": [
          "coverage",
          "counts_complete",
          "job_limit",
          "inactivity_warning_seconds",
          "retention_warning_seconds",
          "observed_jobs",
          "pending_jobs",
          "paused_jobs",
          "remaining_cases",
          "pending_remaining_cases",
          "paused_remaining_cases",
          "stalled_pending_jobs",
          "retention_risk_jobs",
          "unknown_progress_jobs",
          "jobs"
        ],
        "properties": {
          "coverage": {
            "type": "string",
            "enum": [
              "bounded_retained_active_lineage_retry_jobs"
            ]
          },
          "counts_complete": {
            "type": "boolean"
          },
          "job_limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          },
          "inactivity_warning_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "retention_warning_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "observed_jobs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "pending_jobs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "paused_jobs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "remaining_cases": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "pending_remaining_cases": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "paused_remaining_cases": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "stalled_pending_jobs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "retention_risk_jobs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unknown_progress_jobs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "oldest_pending_activity_at": {
            "type": "string",
            "format": "date-time"
          },
          "next_retain_until": {
            "type": "string",
            "format": "date-time"
          },
          "jobs": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/EventExecutionLineageRetryJobHealthSample"
            }
          }
        }
      },
      "EventExecutionLineageRetryJobHealthSample": {
        "description": "Bounded active-job diagnostic with inactivity, expiry, progress evidence, and original creation guards.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "request_id",
          "status",
          "processed",
          "selected",
          "remaining",
          "created_at",
          "last_activity_at",
          "inactivity_age_seconds",
          "progress_known",
          "stalled_pending",
          "retention_risk",
          "retain_until",
          "retention_seconds"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "paused"
            ]
          },
          "processed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 200
          },
          "selected": {
            "type": "integer",
            "minimum": 1,
            "maximum": 200
          },
          "remaining": {
            "type": "integer",
            "minimum": 1,
            "maximum": 200
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Original job incarnation guard for operator controls."
          },
          "last_activity_at": {
            "type": "string",
            "format": "date-time",
            "description": "Authoritative job update timestamp; includes progress and state changes."
          },
          "inactivity_age_seconds": {
            "type": "number",
            "minimum": 0
          },
          "last_progress_at": {
            "type": "string",
            "format": "date-time",
            "description": "Last committed case evaluation or skip; absent for unevaluated or legacy jobs."
          },
          "progress_age_seconds": {
            "type": "number",
            "minimum": 0,
            "description": "Age since known last progress or creation before the first evaluation. Absent for legacy evaluated jobs without progress evidence."
          },
          "progress_known": {
            "type": "boolean"
          },
          "stalled_pending": {
            "type": "boolean",
            "description": "Pending with no job activity for at least 15 minutes; paused jobs never match. Advisory and not proof of scheduler failure."
          },
          "retention_risk": {
            "type": "boolean",
            "description": "Active job expires within 24 hours; includes deliberately paused work."
          },
          "retain_until": {
            "type": "string",
            "format": "date-time"
          },
          "retention_seconds": {
            "type": "number",
            "minimum": 0
          }
        }
      },
      "EventConsumerExecutionHealth": {
        "type": "object",
        "additionalProperties": false,
        "description": "Current retained execution states for admitted application event deliveries and retained handler replays. Attempts and successful completion latency use an immutable, per-subscription outcome ledger with 30-day retention. Window evidence survives source deletion and is independent of retained execution-state truncation. Counts are bounded observations, include backfills, and are not unique event counts. Version filtering and routing failures are excluded. History completeness is established only for fully covered windows of newly instrumented subscriptions; legacy baselines remain unknown and evidence loss is partial.",
        "required": [
          "subscription_id",
          "app_id",
          "observed_at",
          "window_start",
          "coverage",
          "history_complete",
          "truncated",
          "retained_roots",
          "missing_roots",
          "executions",
          "queued",
          "running",
          "retrying",
          "succeeded",
          "failed",
          "expired",
          "dead_lettered",
          "cancelled",
          "superseded",
          "unknown",
          "successful_attempts",
          "failed_attempts",
          "unknown_attempts",
          "window_completions",
          "window_dead_letters",
          "handler_failure_pct",
          "dead_letter_rate_per_second",
          "completion_latency_p95_seconds"
        ],
        "properties": {
          "lineage_retry_jobs": {
            "$ref": "#/components/schemas/EventExecutionLineageRetryJobHealth"
          },
          "window_coverage": {
            "type": "string",
            "enum": [
              "durable_execution_outcomes"
            ],
            "description": "Evidence scope for attempt rates and completion latency; current invocation states retain their separate bounded scope."
          },
          "window_history_complete": {
            "type": "boolean",
            "description": "True when the requested ledger window has a known baseline and no lost, expired or unknown outcomes."
          },
          "window_history_status": {
            "type": "string",
            "enum": [
              "complete",
              "partial",
              "unknown"
            ]
          },
          "window_history_reason": {
            "type": "string",
            "description": "Explanation of ledger window eligibility."
          },
          "window_coverage_started_at": {
            "type": "string",
            "format": "date-time",
            "description": "Ledger collection start; windows beginning earlier cannot qualify."
          },
          "window_coverage_lost_through_at": {
            "type": "string",
            "format": "date-time",
            "description": "Evidence-loss high-water mark for this subscription. Eligible windows must begin strictly after it."
          },
          "window_evidence_retain_until": {
            "type": "string",
            "format": "date-time",
            "description": "Earliest expiry of retained evidence in this window; absent for an empty window."
          },
          "window_evidence_retention_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Configured ledger retention independently of source receipt and result retention."
          },
          "latest_successful_completion_at": {
            "type": "string",
            "format": "date-time",
            "description": "Latest valid successful completion among the bounded retained executions; absent when no such completion is retained. Not an all-time watermark and not restricted to the attempt window."
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "coverage": {
            "type": "string",
            "enum": [
              "bounded_retained_execution_roots"
            ]
          },
          "history_complete": {
            "type": "boolean",
            "description": "True only for an instrumented, fully covered window with intact evidence and no truncation or unknown outcomes."
          },
          "history_status": {
            "type": "string",
            "enum": [
              "complete",
              "partial",
              "unknown"
            ]
          },
          "history_reason": {
            "type": "string",
            "description": "Stable explanation of coverage eligibility or evidence loss."
          },
          "coverage_started_at": {
            "type": "string",
            "format": "date-time",
            "description": "Durable collection start; absent when no coverage record exists."
          },
          "coverage_lost_at": {
            "type": "string",
            "format": "date-time",
            "description": "First persisted evidence loss; loss is not automatically cleared."
          },
          "truncated": {
            "type": "boolean",
            "description": "More than 1000 retained delivery roots or 5000 linked invocations existed."
          },
          "retained_roots": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "missing_roots": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "executions": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "queued": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "running": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "retrying": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "succeeded": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "failed": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "expired": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "dead_lettered": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cancelled": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "superseded": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unknown": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "successful_attempts": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "failed_attempts": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unknown_attempts": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "window_completions": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "window_dead_letters": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "handler_failure_pct": {
            "type": "number",
            "format": "double",
            "minimum": 0
          },
          "dead_letter_rate_per_second": {
            "type": "number",
            "format": "double",
            "minimum": 0
          },
          "completion_latency_p95_seconds": {
            "type": "number",
            "format": "double",
            "minimum": 0
          }
        }
      },
      "EventConsumerHealth": {
        "type": "object",
        "additionalProperties": false,
        "description": "Current subscription backlog and bounded recorded routing outcomes. History compaction can remove outcomes; rates then represent retained samples. Latency runs from event acceptance to successful routing admission.",
        "required": [
          "subscription_id",
          "app_id",
          "paused",
          "rate_per_second",
          "pending_recipients",
          "processing_recipients",
          "oldest_age_seconds",
          "observed_at",
          "window_start",
          "coverage",
          "paused_seconds",
          "retry_scheduled",
          "successful_routes",
          "terminal_failures",
          "retry_rate_per_second",
          "terminal_failure_pct",
          "routing_latency_p95_seconds",
          "drain_rate_per_second",
          "history_compacted"
        ],
        "properties": {
          "expired_deliveries": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Recorded delivery_expired outcomes in the observation window; included in terminal_failures."
          },
          "circuit_breaker": {
            "$ref": "#/components/schemas/EventCircuitBreakerResponse"
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "paused": {
            "type": "boolean"
          },
          "rate_per_second": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "pending_recipients": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "processing_recipients": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "oldest_pending_at": {
            "type": "string",
            "format": "date-time"
          },
          "oldest_age_seconds": {
            "type": "number",
            "format": "double",
            "minimum": 0
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Absent until an operator sets a control."
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "coverage": {
            "type": "string",
            "enum": [
              "bounded_recorded_outcomes"
            ]
          },
          "paused_seconds": {
            "type": "number",
            "format": "double",
            "minimum": 0
          },
          "retry_scheduled": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "successful_routes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "terminal_failures": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "retry_rate_per_second": {
            "type": "number",
            "format": "double",
            "minimum": 0
          },
          "terminal_failure_pct": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 100
          },
          "routing_latency_p95_seconds": {
            "type": "number",
            "format": "double",
            "minimum": 0
          },
          "drain_rate_per_second": {
            "type": "number",
            "format": "double",
            "minimum": 0
          },
          "history_compacted": {
            "type": "boolean"
          }
        }
      },
      "EventCircuitBreakerPolicy": {
        "type": "object",
        "additionalProperties": false,
        "description": "Opt-in routing circuit breaker. Omitted properties use defaults. Failures and successful admissions form the sample; capacity waits and filtered events are excluded. Retained history must cover the observation window.",
        "properties": {
          "failure_threshold_pct": {
            "type": "number",
            "format": "double",
            "exclusiveMinimum": 0,
            "maximum": 100,
            "default": 50
          },
          "min_samples": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 10000,
            "default": 20
          },
          "window_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 3600,
            "default": 300
          },
          "cooldown_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 3600,
            "default": 60
          },
          "probe_successes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20,
            "default": 3
          },
          "recovery_max_rate_per_second": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 10
          },
          "recovery_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 3600,
            "default": 60
          }
        }
      },
      "EventCircuitBreakerResponse": {
        "description": "Captured circuit policy and current breaker state for one application event subscription.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "subscription_id",
          "enabled",
          "state",
          "probe_in_flight",
          "successful_probes",
          "recovery_rate_per_second",
          "history_incomplete",
          "manual_paused"
        ],
        "properties": {
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "enabled": {
            "type": "boolean"
          },
          "policy": {
            "$ref": "#/components/schemas/EventCircuitBreakerPolicy"
          },
          "state": {
            "type": "string",
            "enum": [
              "disabled",
              "closed",
              "open",
              "half_open",
              "draining"
            ]
          },
          "reason": {
            "type": "string",
            "description": "Reason for the last durable transition."
          },
          "changed_at": {
            "type": "string",
            "format": "date-time"
          },
          "cooldown_until": {
            "type": "string",
            "format": "date-time"
          },
          "probe_in_flight": {
            "type": "boolean"
          },
          "successful_probes": {
            "type": "integer",
            "minimum": 0
          },
          "recovery_rate_per_second": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "history_incomplete": {
            "type": "boolean",
            "description": "Compacted history prevents automatic threshold decisions or completion of recovery."
          },
          "manual_paused": {
            "type": "boolean"
          }
        }
      },
      "EventRoutingRetryPolicy": {
        "type": "object",
        "additionalProperties": false,
        "description": "Routing policy before invocation admission. Duration budgets include routing attempt time and scheduled retry delays. Admission waits add no budget cost. API replacement accepts explicit settings; manifests and CLI default configured policies to jitter enabled.",
        "required": [
          "max_attempts",
          "initial_backoff_ms",
          "max_backoff_ms"
        ],
        "properties": {
          "max_delivery_age_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 2592000000,
            "default": 0,
            "description": "Wall-clock age from platform acceptance before routing admission. Includes pauses, capacity, backoff, and circuit waits. Zero disables expiry. Rejected for strictly ordered subscriptions."
          },
          "max_attempts": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 12
          },
          "max_retry_duration_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 604800000,
            "default": 0,
            "description": "Zero disables the duration bound. Another retry is scheduled only when its entire delay fits within the remaining budget."
          },
          "initial_backoff_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 3600000,
            "default": 5000
          },
          "max_backoff_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 3600000,
            "default": 300000,
            "description": "Must be at least initial_backoff_ms."
          },
          "jitter": {
            "type": "boolean",
            "default": false,
            "description": "Deterministic full jitter between one millisecond and the capped exponential delay."
          }
        }
      },
      "EventSubscriptionSchemaVersionsRequest": {
        "description": "Replacement schema-version selection for future subscription publications and backfills.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schema_versions"
        ],
        "properties": {
          "schema_versions": {
            "type": "array",
            "maxItems": 16,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$"
            },
            "description": "Schema versions in the event subscription schema versions request: exact case-sensitive schema versions. Empty or omitted accepts all versions; a nonempty selection excludes unversioned events. Selection is captured at publication or backfill creation."
          }
        }
      },
      "EventSubscriptionSchemaVersionsResponse": {
        "description": "Current exact schema-version selection associated with one subscription.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "subscription_id",
          "schema_versions"
        ],
        "properties": {
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "schema_versions": {
            "type": "array",
            "maxItems": 16,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$"
            },
            "description": "Schema versions in the event subscription schema versions response: exact case-sensitive schema versions. Empty or omitted accepts all versions; a nonempty selection excludes unversioned events. Selection is captured at publication or backfill creation."
          }
        }
      },
      "EventRoutingRetryPolicyResponse": {
        "description": "Configured routing retry policy for an application event subscription, or its default policy.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "subscription_id",
          "configured",
          "policy"
        ],
        "properties": {
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "configured": {
            "type": "boolean"
          },
          "policy": {
            "$ref": "#/components/schemas/EventRoutingRetryPolicy"
          }
        }
      },
      "EventSubscriptionCapacityGuard": {
        "type": "object",
        "additionalProperties": false,
        "description": "Value preconditions checked atomically before changing subscription capacity. Both fields are required. Checks saved configuration and the current plan allowance; live usage is not reserved.",
        "required": [
          "max_pending_deliveries",
          "plan_max_pending_deliveries"
        ],
        "properties": {
          "max_pending_deliveries": {
            "type": "integer",
            "minimum": 0,
            "description": "Expected saved setting, including zero for plan default; may exceed a downgraded plan ceiling."
          },
          "plan_max_pending_deliveries": {
            "type": "integer",
            "minimum": 1,
            "description": "Expected current plan consumer ceiling before applying a subscription override."
          }
        }
      },
      "EventSubscriptionCapacityRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Explicit per-subscription live-delivery ceiling. Zero restores the plan default; positive values must not exceed the current plan ceiling. Requires deploy write or admin scope and MFA.",
        "required": [
          "max_pending_deliveries"
        ],
        "properties": {
          "command_id": {
            "type": "string",
            "format": "uuid",
            "description": "Optional nonzero command UUID scoped to this owned subscription. Repeat the same value and expectations while its 30-day receipt remains retained; repeats return the original receipt without applying again, even after later settings or plan changes. Different normalized inputs conflict. No guarantee after expiry or deletion."
          },
          "expected": {
            "$ref": "#/components/schemas/EventSubscriptionCapacityGuard"
          },
          "max_pending_deliveries": {
            "type": "integer",
            "minimum": 0,
            "description": "Maximum pending plus dispatching deliveries; zero restores the current plan default."
          }
        }
      },
      "EventSubscriptionCapacityCommands": {
        "type": "object",
        "required": [
          "app_id",
          "subscription_id",
          "outcome",
          "observed_at",
          "receipts",
          "has_more"
        ],
        "description": "One fresh page of retained original command evidence. History order does not establish execution order or current configuration.",
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid",
            "description": "Owned application identifier."
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid",
            "description": "Owned subscription or retained control identifier."
          },
          "outcome": {
            "type": "string",
            "enum": [
              "any",
              "applied",
              "unchanged"
            ],
            "description": "Normalized original-outcome filter for this page."
          },
          "observed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Logical observation time shared by this page."
          },
          "receipts": {
            "type": "array",
            "maxItems": 100,
            "description": "Matching unexpired original receipts in descending recorded_at and command UUID order. An accessible empty history returns an empty array.",
            "items": {
              "$ref": "#/components/schemas/EventSubscriptionCapacityCommandReceipt"
            }
          },
          "has_more": {
            "type": "boolean",
            "description": "Whether another matching retained receipt existed at this observation."
          },
          "next_after": {
            "type": "string",
            "maxLength": 512,
            "description": "Opaque scope-bound boundary for the next page. Present only when has_more is true."
          }
        }
      },
      "EventSubscriptionCapacityCommandBudget": {
        "type": "object",
        "additionalProperties": false,
        "description": "Complete scoped advisory observation of all unexpired successful capacity-command receipts. Neither reserves receipt slots nor modifies retention. Known unchanged-input command repeats remain available when full; commands without UUIDs have no idempotent receipt evidence.",
        "required": [
          "app_id",
          "subscription_id",
          "observed_at",
          "complete",
          "retained_receipts",
          "limit",
          "remaining_slots",
          "full",
          "advice"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid",
            "description": "Owned application identifier. Context: Event Subscription Capacity Command Budget."
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid",
            "description": "Owned subscription or retained control identifier. Context: Event Subscription Capacity Command Budget."
          },
          "observed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Logical observation time used for receipt expiry."
          },
          "complete": {
            "type": "boolean",
            "description": "All matching unexpired receipts were counted rather than sampled from a history page."
          },
          "retained_receipts": {
            "type": "integer",
            "minimum": 0,
            "maximum": 128,
            "description": "Successful applied and unchanged command receipts whose retention deadline is after observed_at."
          },
          "limit": {
            "type": "integer",
            "enum": [
              128
            ],
            "description": "Maximum retained receipts per subscription."
          },
          "remaining_slots": {
            "type": "integer",
            "minimum": 0,
            "maximum": 128,
            "description": "Limit minus retained receipts at the observation. Concurrent writes may consume slots."
          },
          "full": {
            "type": "boolean",
            "description": "Whether no slots for new command UUIDs were available at the observation."
          },
          "earliest_expiry_at": {
            "type": "string",
            "format": "date-time",
            "description": "Earliest retained receipt deadline that could free a slot. Omitted when no receipts remain. Logical expiry frees quota without waiting for physical pruning."
          },
          "advice": {
            "type": "string",
            "description": "Advisory guidance without a reservation or write authorization guarantee."
          }
        }
      },
      "EventSubscriptionCapacityCommandReceipt": {
        "type": "object",
        "additionalProperties": false,
        "description": "Immutable acknowledgment of a successful capacity command. The surrounding control response reports current state; this receipt preserves the original outcome. Retained for 30 days without extension on repeat. No event payloads or credentials.",
        "required": [
          "command_id",
          "app_id",
          "subscription_id",
          "requested_max_pending_deliveries",
          "previous_max_pending_deliveries",
          "plan_max_pending_deliveries",
          "effective_max_pending_deliveries",
          "outcome",
          "recorded_at",
          "retain_until"
        ],
        "properties": {
          "command_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "requested_max_pending_deliveries": {
            "type": "integer",
            "minimum": 0
          },
          "expected": {
            "$ref": "#/components/schemas/EventSubscriptionCapacityGuard"
          },
          "previous_max_pending_deliveries": {
            "type": "integer",
            "minimum": 0
          },
          "plan_max_pending_deliveries": {
            "type": "integer",
            "minimum": 1
          },
          "effective_max_pending_deliveries": {
            "type": "integer",
            "minimum": 1
          },
          "outcome": {
            "type": "string",
            "enum": [
              "applied",
              "unchanged"
            ],
            "description": "Whether the original successful command changed the saved setting; both consume a receipt slot."
          },
          "recorded_at": {
            "type": "string",
            "format": "date-time"
          },
          "retain_until": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EventSubscriptionRatePreviewRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Proposed bucket settings for a preview only; this request has no command UUID or mutation guard.",
        "required": [
          "enabled",
          "interval_millis",
          "burst"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "interval_millis": {
            "type": "integer",
            "format": "int64",
            "minimum": 10,
            "maximum": 3600000
          },
          "burst": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 100
          }
        }
      },
      "EventSubscriptionDeadlineRecipient": {
        "type": "object",
        "description": "Payload-free identity, effective deadline and observed waiting reason of a retained pending delivery. The expiry flag uses the current page observation, not the fixed status-filter window.",
        "required": [
          "event_source",
          "event_id",
          "accepted_at",
          "deadline_at",
          "expired",
          "waiting_reason"
        ],
        "properties": {
          "event_source": {
            "type": "string"
          },
          "event_id": {
            "type": "string"
          },
          "accepted_at": {
            "type": "string",
            "format": "date-time"
          },
          "deadline_at": {
            "type": "string",
            "format": "date-time"
          },
          "expired": {
            "type": "boolean"
          },
          "waiting_reason": {
            "type": "string",
            "enum": [
              "circuit_open",
              "circuit_probe_wait",
              "circuit_recovery_rate_limited",
              "subscription_paused",
              "subscription_rate_limited",
              "ordering_blocked",
              "capacity_consumer",
              "capacity_app",
              "capacity_account",
              "routing_in_progress",
              "receipt_processing",
              "retry_backoff",
              "workflow_routing",
              "ready"
            ]
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "lease_until": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EventSubscriptionDeadlinePage": {
        "type": "object",
        "description": "One read-only live page ordered by effective deadline, acceptance time and internal receipt identity. No aggregate health or frozen membership is implied. Empty recipients are not proof of successful delivery.",
        "required": [
          "coverage",
          "app_id",
          "subscription_id",
          "observed_at",
          "window_at",
          "read_only",
          "recipients",
          "has_more"
        ],
        "properties": {
          "coverage": {
            "type": "string",
            "enum": [
              "retained_captured_pending_application_deadlines"
            ]
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "window_at": {
            "type": "string",
            "format": "date-time"
          },
          "read_only": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "recipients": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/EventSubscriptionDeadlineRecipient"
            }
          },
          "has_more": {
            "type": "boolean",
            "description": "A lookahead row existed in this page snapshot; later pages can still be empty as routing state changes."
          },
          "next_cursor": {
            "type": "string",
            "maxLength": 4096,
            "description": "Present only when has_more is true. Carries no authorization."
          }
        }
      },
      "EventSubscriptionDeadlineWindow": {
        "type": "object",
        "description": "Complete, disjoint deadline cohorts with the full pending summary from one read-only snapshot. Upcoming means observed_at < deadline < window_end_at; expired means deadline <= observed_at. Incomplete summary coverage invalidates all counts for alert confirmation.",
        "required": [
          "coverage",
          "summary",
          "within_millis",
          "window_end_at",
          "upcoming_recipients",
          "upcoming_waiting_reasons",
          "expired_waiting_reasons"
        ],
        "properties": {
          "coverage": {
            "type": "string",
            "enum": [
              "all_retained_captured_pending_application_deadline_window"
            ]
          },
          "summary": {
            "$ref": "#/components/schemas/EventSubscriptionPendingSummary"
          },
          "within_millis": {
            "type": "integer",
            "format": "int64",
            "minimum": 100,
            "maximum": 86400000
          },
          "window_end_at": {
            "type": "string",
            "format": "date-time"
          },
          "upcoming_recipients": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "earliest_upcoming_deadline_at": {
            "type": "string",
            "format": "date-time",
            "description": "Omitted exactly when upcoming_recipients is zero."
          },
          "upcoming_waiting_reasons": {
            "type": "object",
            "description": "Exact partition of upcoming_recipients over every known backlog waiting reason, including explicit zero keys. Labels do not establish unique causes.",
            "additionalProperties": {
              "type": "integer",
              "format": "int64",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          "expired_waiting_reasons": {
            "type": "object",
            "description": "Exact partition of summary.already_expired_count over every known backlog waiting reason, including explicit zero keys.",
            "additionalProperties": {
              "type": "integer",
              "format": "int64",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          }
        }
      },
      "EventSubscriptionPendingSummary": {
        "type": "object",
        "description": "Full retained captured pending application-recipient counts from one read-only snapshot. No payloads, identities or modeled completion estimates. Incomplete evidence cannot establish health or recovery.",
        "required": [
          "coverage",
          "app_id",
          "subscription_id",
          "observed_at",
          "read_only",
          "complete",
          "pending_recipients",
          "deadline_recipients",
          "already_expired_count",
          "current",
          "paused",
          "legacy_rate_per_second",
          "circuit_state",
          "capacity_blocking_scopes",
          "constraints"
        ],
        "properties": {
          "coverage": {
            "type": "string",
            "enum": [
              "all_retained_captured_pending_application_recipients"
            ]
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "read_only": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "complete": {
            "type": "boolean",
            "description": "False for unusable clocks; incomplete counts must not drive alert recovery."
          },
          "pending_recipients": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "deadline_recipients": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "already_expired_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "earliest_deadline_at": {
            "type": "string",
            "format": "date-time",
            "description": "Earliest effective deadline, including expired rows; omitted when no pending recipients have deadlines."
          },
          "current": {
            "$ref": "#/components/schemas/EventSubscriptionRateLimit"
          },
          "paused": {
            "type": "boolean"
          },
          "legacy_rate_per_second": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "circuit_state": {
            "type": "string",
            "enum": [
              "closed",
              "open",
              "half_open",
              "draining"
            ]
          },
          "capacity_blocking_scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "consumer",
                "app",
                "account"
              ]
            }
          },
          "constraints": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "subscription_paused",
                "legacy_rate_limit",
                "circuit_open",
                "circuit_half_open",
                "circuit_draining",
                "capacity_consumer",
                "capacity_app",
                "capacity_account",
                "active_leases",
                "scheduled_retries",
                "clock_uncertain"
              ]
            }
          }
        }
      },
      "EventSubscriptionRatePreview": {
        "type": "object",
        "additionalProperties": false,
        "description": "One snapshot of current controls and a hypothetical rate-only admission model. The deterministic oldest-first model is not an ordering guarantee, completion ETA or deadline-safety certificate. Full pending coverage excludes processing, unattributed receipts and future arrivals.",
        "required": [
          "coverage",
          "app_id",
          "subscription_id",
          "observed_at",
          "advisory",
          "read_only",
          "expected_revision",
          "current",
          "projected",
          "paused",
          "legacy_rate_per_second",
          "circuit_state",
          "capacity_blocking_scopes",
          "constraints",
          "sample_limit",
          "sampled_pending",
          "complete",
          "truncated",
          "deadline_risk_count",
          "already_expired_count",
          "deadline_risks",
          "risks_truncated"
        ],
        "properties": {
          "deadline_coverage": {
            "type": "string",
            "enum": [
              "sampled_effective_pending_deadlines"
            ],
            "description": "Explicit evidence marker for earliest-deadline monitoring; absent on older responses."
          },
          "deadline_recipients": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000,
            "description": "Sampled pending recipients with an effective delivery deadline, including expired rows."
          },
          "earliest_deadline_at": {
            "type": "string",
            "format": "date-time",
            "description": "Earliest effective deadline in the sampled pending rows, independent of modeled admission risk; omitted when deadline_recipients is zero."
          },
          "coverage": {
            "type": "string",
            "enum": [
              "retained_captured_pending_application_recipients"
            ]
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "advisory": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "read_only": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Reviewed bucket revision for the subsequent mutation; other controls and backlog can change independently."
          },
          "current": {
            "$ref": "#/components/schemas/EventSubscriptionRateLimit"
          },
          "projected": {
            "$ref": "#/components/schemas/EventSubscriptionRateLimit",
            "description": "Hypothetical capacity immediately after applying the proposal. Revision remains the reviewed baseline because no mutation occurred."
          },
          "paused": {
            "type": "boolean"
          },
          "legacy_rate_per_second": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "circuit_state": {
            "type": "string"
          },
          "capacity_blocking_scopes": {
            "type": "array",
            "maxItems": 3,
            "items": {
              "type": "string",
              "enum": [
                "consumer",
                "app",
                "account"
              ]
            }
          },
          "constraints": {
            "type": "array",
            "description": "Current pause, circuit, capacity, lease, scheduled-retry, clock and sampling constraints. An empty list does not promise future readiness.",
            "items": {
              "type": "string"
            }
          },
          "sample_limit": {
            "type": "integer",
            "enum": [
              1000
            ]
          },
          "sampled_pending": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000
          },
          "complete": {
            "type": "boolean",
            "description": "Captured pending sample is untruncated with usable timestamps; not evidence of eventual delivery."
          },
          "truncated": {
            "type": "boolean"
          },
          "rate_only_drain_millis": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Modeled admission span for the sample, assuming all unexpired sampled recipients are admitted once, no new arrivals, oldest-first order and no blocking from pause/circuit/capacity/leases or execution. Includes scheduled times and legacy pacing. Missing when clocks or duration are unusable. Truncated samples never estimate the full backlog."
          },
          "deadline_risk_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000
          },
          "already_expired_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000
          },
          "deadline_risks": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/EventSubscriptionRateDeadlineRisk"
            }
          },
          "risks_truncated": {
            "type": "boolean"
          }
        }
      },
      "EventSubscriptionRateDeadlineRisk": {
        "type": "object",
        "additionalProperties": false,
        "description": "Payload-free identity of an expired or model-at-risk sampled recipient. Absence from the sample is not evidence that its deadline is safe.",
        "required": [
          "event_source",
          "event_id",
          "accepted_at",
          "deadline_at",
          "reason"
        ],
        "properties": {
          "event_source": {
            "type": "string"
          },
          "event_id": {
            "type": "string"
          },
          "accepted_at": {
            "type": "string",
            "format": "date-time"
          },
          "deadline_at": {
            "type": "string",
            "format": "date-time"
          },
          "modeled_admission_at": {
            "type": "string",
            "format": "date-time"
          },
          "reason": {
            "type": "string",
            "enum": [
              "already_expired",
              "modeled_deadline_risk"
            ]
          }
        }
      },
      "EventSubscriptionRateRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Explicit guarded command for per-subscription token-bucket pacing. Disabled retains configuration without enforcing the bucket.",
        "required": [
          "command_id",
          "expected_revision",
          "enabled",
          "interval_millis",
          "burst"
        ],
        "properties": {
          "command_id": {
            "type": "string",
            "format": "uuid",
            "description": "Nonzero command UUID; retained for 30 days, at most 128 per subscription."
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Current bucket revision, initially zero. Mismatch records a rejected receipt."
          },
          "enabled": {
            "type": "boolean"
          },
          "interval_millis": {
            "type": "integer",
            "format": "int64",
            "minimum": 10,
            "maximum": 3600000
          },
          "burst": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 100
          }
        }
      },
      "EventSubscriptionRateLimit": {
        "type": "object",
        "additionalProperties": false,
        "description": "Projected token-bucket capacity at observed_at. Read-only metadata reserves no tokens. Missing rate_limit on older responses means unknown.",
        "required": [
          "enabled",
          "revision",
          "interval_millis",
          "burst",
          "available_tokens",
          "rate_limited",
          "observed_at"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "interval_millis": {
            "type": "integer",
            "format": "int64",
            "minimum": 10,
            "maximum": 3600000
          },
          "burst": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 100
          },
          "available_tokens": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "rate_limited": {
            "type": "boolean"
          },
          "next_available_at": {
            "type": "string",
            "format": "date-time"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EventSubscriptionRateCommandReceipt": {
        "type": "object",
        "additionalProperties": false,
        "description": "Historical idempotent command outcome; rejected commands preserve configuration. Look up after an uncertain mutation before submitting a new UUID.",
        "required": [
          "command_id",
          "app_id",
          "subscription_id",
          "sequence",
          "outcome",
          "result",
          "recorded_at",
          "retain_until"
        ],
        "properties": {
          "command_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "outcome": {
            "type": "string",
            "enum": [
              "applied",
              "rejected"
            ]
          },
          "result": {
            "$ref": "#/components/schemas/EventSubscriptionRateLimit"
          },
          "recorded_at": {
            "type": "string",
            "format": "date-time"
          },
          "retain_until": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EventSubscriptionRateCommands": {
        "type": "object",
        "additionalProperties": false,
        "description": "Bounded retained rate command history in increasing sequence order; expiry can leave sequence gaps. Pages are fresh observations.",
        "required": [
          "receipts"
        ],
        "properties": {
          "receipts": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/EventSubscriptionRateCommandReceipt"
            }
          },
          "next_after": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Exclusive cursor for the next page when another retained receipt exists."
          }
        }
      },
      "EventSubscriptionDeliveryControl": {
        "type": "object",
        "additionalProperties": false,
        "description": "Live operator controls for a captured application subscription. Pending and processing counts include publication and historical backfill recipients retained in the backlog.",
        "required": [
          "subscription_id",
          "app_id",
          "paused",
          "rate_per_second",
          "pending_recipients",
          "processing_recipients",
          "oldest_age_seconds",
          "max_pending_deliveries",
          "effective_max_pending_deliveries",
          "live_deliveries"
        ],
        "properties": {
          "rate_limit": {
            "$ref": "#/components/schemas/EventSubscriptionRateLimit",
            "description": "Optional token-bucket observation; absent on older responses."
          },
          "capacity_command_budget": {
            "$ref": "#/components/schemas/EventSubscriptionCapacityCommandBudget",
            "description": "Optional complete receipt budget in read-only delivery-control status. Mutation responses may omit it; absence means unknown."
          },
          "capacity_command_receipt": {
            "$ref": "#/components/schemas/EventSubscriptionCapacityCommandReceipt"
          },
          "max_pending_deliveries": {
            "type": "integer",
            "minimum": 0,
            "description": "Configured live-delivery ceiling; zero uses the current plan limit."
          },
          "effective_max_pending_deliveries": {
            "type": "integer",
            "minimum": 1,
            "description": "Effective ceiling after applying the current plan limit."
          },
          "live_deliveries": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Current pending plus dispatching invocations with trusted delivery slots; excludes untagged legacy work."
          },
          "circuit_breaker": {
            "$ref": "#/components/schemas/EventCircuitBreakerResponse"
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "paused": {
            "type": "boolean"
          },
          "rate_per_second": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "pending_recipients": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "processing_recipients": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "oldest_pending_at": {
            "type": "string",
            "format": "date-time"
          },
          "oldest_age_seconds": {
            "type": "number",
            "format": "double",
            "minimum": 0
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Updated at in the event subscription delivery control: absent until an operator sets a control."
          }
        }
      },
      "EventRecoveryRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Select routing failures (default) or the latest replayable retained execution per application event consumer. With parent_job_id, saved parent failures remain selectable even when execution or receipt evidence has disappeared; admission skips changes rather than following newer work. Ordinary execution mode includes publication and materialized backfill recipients, excludes workflows and object notifications, and requires retained admission and execution records. Native workflow mode requires explicit workflow_runs and never selects event recipients. Creation freezes its own selection; preview is advisory.",
        "properties": {
          "workflow_runs": {
            "$ref": "#/components/schemas/WorkflowRunRecoveryPlan"
          },
          "workflow_routing": {
            "$ref": "#/components/schemas/EventWorkflowRecoveryPlan"
          },
          "parent_job_id": {
            "type": "string",
            "format": "uuid",
            "description": "Select saved failed/dead-lettered execution items or saved failed native workflow items from a retained terminal recovery in the same account/app. Native workflow retries require explicit parent_position and the saved resume count for every target, and the same workflow name. Changed runs are rejected at creation or skipped at admission. Does not follow newer replays."
          },
          "request_id": {
            "type": "string",
            "format": "uuid",
            "description": "Required for workflow_runs, workflow_routing and on child creation; optional on child preview. Account-scoped durable idempotency while the job is retained. Repeating the normalized selection returns its existing job; different selection/app with the same UUID conflicts. Only allowed with parent_job_id, workflow_runs or workflow_routing. Operator reason is excluded from comparison and the original audit reason wins."
          },
          "reason": {
            "type": "string",
            "maxLength": 512,
            "description": "Optional operator reason, limited to 512 UTF-8 bytes without control characters. Stored only in audit history; omitted from frozen selection. Preview does not record it."
          },
          "mode": {
            "type": "string",
            "enum": [
              "routing",
              "execution",
              "workflow"
            ],
            "default": "routing"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "failed",
              "dead_letter"
            ],
            "description": "Execution mode only; omitted selects both replayable outcomes."
          },
          "subscription_id": {
            "type": "string",
            "maxLength": 256
          },
          "event_source": {
            "type": "string",
            "maxLength": 256
          },
          "event_type": {
            "type": "string",
            "maxLength": 256
          },
          "failure_code": {
            "type": "string",
            "maxLength": 256
          },
          "min_age_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 31536000,
            "default": 0,
            "description": "Minimum age of the recorded terminal failure."
          },
          "protect_receipts": {
            "type": "boolean",
            "default": false,
            "description": "Hold selected retained receipts from pruning while their items are pending and the job is active and unexpired. Pausing does not extend the existing 24-hour lifetime. Preview acquires no holds. Held receipts still count toward account storage limits."
          },
          "include_non_retryable": {
            "type": "boolean",
            "default": false
          },
          "rate_per_second": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "default": 10,
            "description": "Maximum recipients processed per job in a one-second window; zero uses the default. Actual throughput depends on scheduler load."
          }
        }
      },
      "WorkflowRecoveryExecutionAttention": {
        "type": "object",
        "description": "Generation-fenced advisory execution monitoring. Capacity and scheduled wait counters describe underlying waits and may overlap deadline exceeded counts. Only the first attention event per job is captured. Detection never cancels or retries work.",
        "required": [
          "observed_at",
          "deadline_seconds",
          "stall_seconds",
          "stalled_count",
          "deadline_exceeded_count",
          "capacity_waiting_count",
          "scheduled_waiting_count",
          "unknown_count",
          "needs_attention",
          "notification_captured",
          "targets"
        ],
        "properties": {
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "deadline_seconds": {
            "type": "integer"
          },
          "stall_seconds": {
            "type": "integer"
          },
          "stalled_count": {
            "type": "integer"
          },
          "deadline_exceeded_count": {
            "type": "integer"
          },
          "capacity_waiting_count": {
            "type": "integer"
          },
          "scheduled_waiting_count": {
            "type": "integer"
          },
          "unknown_count": {
            "type": "integer"
          },
          "needs_attention": {
            "type": "boolean"
          },
          "notification_captured": {
            "type": "boolean"
          },
          "targets": {
            "type": "array",
            "maxItems": 25,
            "items": {
              "$ref": "#/components/schemas/WorkflowRecoveryExecutionAttentionTarget"
            }
          }
        }
      },
      "WorkflowRecoveryExecutionAttentionTarget": {
        "description": "Advisory observation of one admitted native workflow generation with run and diagnostics links.",
        "type": "object",
        "required": [
          "position",
          "run_id",
          "resume_count",
          "status",
          "run_url",
          "diagnostics_url"
        ],
        "properties": {
          "position": {
            "type": "integer",
            "format": "int64"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "resume_count": {
            "type": "integer"
          },
          "status": {
            "type": "string",
            "enum": [
              "unknown",
              "queued",
              "running",
              "capacity_wait",
              "scheduled_wait",
              "stalled",
              "deadline_exceeded"
            ]
          },
          "wait_reason": {
            "type": "string"
          },
          "admitted_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_progress_at": {
            "type": "string",
            "format": "date-time"
          },
          "deadline_at": {
            "type": "string",
            "format": "date-time"
          },
          "run_url": {
            "type": "string"
          },
          "diagnostics_url": {
            "type": "string"
          }
        }
      },
      "WorkflowRecoveryExecutionAttentionWebhookPayload": {
        "description": "First execution attention signal captured for a native recovery job with frozen notification receivers.",
        "type": "object",
        "required": [
          "event_id",
          "job_id",
          "app_id",
          "observed_at",
          "attention",
          "items_url"
        ],
        "properties": {
          "event_id": {
            "type": "string",
            "format": "uuid"
          },
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "attention": {
            "$ref": "#/components/schemas/WorkflowRecoveryExecutionAttention"
          },
          "items_url": {
            "type": "string"
          }
        }
      },
      "WorkflowRecoveryResponsePlan": {
        "type": "object",
        "description": "Saved reviewed actions pinned to an app and parent recovery job. Explicit apply uses stable per-action identifiers. Actions commit independently.",
        "required": [
          "version",
          "app",
          "app_id",
          "job_id",
          "key",
          "created_at",
          "actions"
        ],
        "properties": {
          "version": {
            "type": "integer"
          },
          "app": {
            "type": "string"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "key": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "actions": {
            "type": "array",
            "minItems": 1,
            "maxItems": 25,
            "items": {
              "$ref": "#/components/schemas/WorkflowRecoveryResponseAction"
            }
          }
        }
      },
      "WorkflowRecoveryResponseAction": {
        "type": "object",
        "description": "One explicit cancellation or saved-failure retry target. Exactly one action request matches the kind and frozen identity.",
        "required": [
          "kind",
          "position",
          "run_id"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "cancel",
              "retry"
            ]
          },
          "position": {
            "type": "integer",
            "format": "int64"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "cancellation": {
            "$ref": "#/components/schemas/WorkflowRecoveryCancellationRequest"
          },
          "retry": {
            "$ref": "#/components/schemas/EventRecoveryRequest"
          }
        }
      },
      "WorkflowRecoveryPolicy": {
        "type": "object",
        "description": "Explicit app recovery policy. Preview prepares parent-job plans and worker-discovered initial-failure reviews. initial_failure requires explicit failure statuses. Opt-in automatic_retry requires saved_failure only; automatic_initial requires initial_failure only. Both require explicit workflow and failure-status filters and execution limits. Resume count caps the absolute generation; preparation and execution budgets are separate. Cancellation remains manual.",
        "required": [
          "enabled",
          "mode",
          "workflow_names",
          "triggers",
          "failure_statuses",
          "max_resume_count",
          "cooldown_seconds",
          "hourly_action_budget",
          "rate_per_second",
          "reason"
        ],
        "properties": {
          "health_alerts": {
            "$ref": "#/components/schemas/WorkflowRecoveryHealthAlertPolicy"
          },
          "hourly_execution_budget": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Required 1..100 for either automatic mode; zero or omitted in preview. Counts automatic job creation across policy versions and automatic modes",
            "separately from preparation.": null
          },
          "pause_after_failures": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10,
            "description": "Required 1..10 for either automatic mode; zero or omitted in preview. Consecutive proven failures pause automatic execution."
          },
          "enabled": {
            "type": "boolean"
          },
          "mode": {
            "type": "string",
            "enum": [
              "preview",
              "automatic_retry",
              "automatic_initial"
            ]
          },
          "workflow_names": {
            "type": "array",
            "maxItems": 10,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          "triggers": {
            "type": "array",
            "minItems": 1,
            "maxItems": 4,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "saved_failure",
                "stalled",
                "deadline_exceeded",
                "initial_failure"
              ]
            }
          },
          "failure_statuses": {
            "type": "array",
            "maxItems": 2,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "failed",
                "dead"
              ]
            }
          },
          "max_resume_count": {
            "type": "integer",
            "minimum": 1,
            "maximum": 16
          },
          "cooldown_seconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 604800
          },
          "hourly_action_budget": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "rate_per_second": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          }
        }
      },
      "WorkflowRecoveryPollingWebhookPayload": {
        "type": "object",
        "additionalProperties": false,
        "description": "Historical stored_workflow.recovery_polling_status event. Three consecutive deterministic polling failures trigger failed; unchanged code and policy version stay quiet. Recovered proves a successful poll, independently of workflow outcome. Recipients and payload are frozen at capture; use event_id for deduplication.",
        "required": [
          "event_id",
          "app_id",
          "app",
          "scope",
          "policy_version",
          "sequence",
          "state",
          "code",
          "attempts",
          "observed_at",
          "inspection_url",
          "monitoring_only"
        ],
        "properties": {
          "event_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "app": {
            "type": "string"
          },
          "scope": {
            "type": "string",
            "enum": [
              "manual_initial",
              "automatic_policy"
            ]
          },
          "review_id": {
            "type": "string",
            "format": "uuid"
          },
          "policy_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "state": {
            "type": "string",
            "enum": [
              "failed",
              "recovered"
            ]
          },
          "code": {
            "type": "string",
            "enum": [
              "invalid_recovery_identity",
              "invalid_observation_data",
              "invalid_policy_authority",
              "invalid_polling_data"
            ]
          },
          "attempts": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "retry_at": {
            "type": "string",
            "format": "date-time"
          },
          "inspection_url": {
            "type": "string"
          },
          "monitoring_only": {
            "type": "boolean",
            "description": "Always true; successful polling does not prove successful workflow execution."
          }
        }
      },
      "WorkflowRecoveryPollingNotification": {
        "type": "object",
        "additionalProperties": false,
        "description": "Last captured polling alert receipt. queued means durable outbox admission; no_receivers never replays to later subscribers. Successful polling retains the recovered receipt separately from the cleared error metadata.",
        "required": [
          "payload",
          "status",
          "captured_at",
          "receiver_webhook_ids"
        ],
        "properties": {
          "payload": {
            "$ref": "#/components/schemas/WorkflowRecoveryPollingWebhookPayload"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "no_receivers"
            ]
          },
          "captured_at": {
            "type": "string",
            "format": "date-time"
          },
          "receiver_webhook_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      },
      "WorkflowRecoveryAutomaticPollingFailure": {
        "type": "object",
        "additionalProperties": false,
        "description": "Last deterministic automatic polling error. A committed deferral rolls back execution writes and retries with bounded backoff. Successful polling or policy update clears it; raw database messages are never stored.",
        "required": [
          "code",
          "attempts",
          "failed_at",
          "retry_at"
        ],
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "invalid_policy_authority",
              "invalid_polling_data",
              "invalid_recovery_identity"
            ]
          },
          "attempts": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 32
          },
          "failed_at": {
            "type": "string",
            "format": "date-time"
          },
          "retry_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WorkflowRecoveryPolicyAutomaticExecution": {
        "type": "object",
        "description": "Durable consecutive failure counter and automatic execution pause for the current policy version. Updating the policy explicitly clears this pause.",
        "required": [
          "consecutive_failures",
          "pause_reason"
        ],
        "properties": {
          "polling_failure": {
            "$ref": "#/components/schemas/WorkflowRecoveryAutomaticPollingFailure"
          },
          "consecutive_failures": {
            "type": "integer"
          },
          "paused_at": {
            "type": "string",
            "format": "date-time"
          },
          "pause_reason": {
            "type": "string"
          }
        }
      },
      "SuppressWorkflowRecoveryAutomaticActionRequest": {
        "type": "object",
        "description": "Version-fenced suppression of a pending automatic retry intent, requiring an operator reason.",
        "required": [
          "expected_policy_version",
          "reason"
        ],
        "properties": {
          "expected_policy_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          }
        }
      },
      "WorkflowRecoveryAutomaticSuppression": {
        "type": "object",
        "description": "Immutable operator suppression audit retained with the automatic retry intent.",
        "required": [
          "reason",
          "actor_kind",
          "actor_id",
          "suppressed_at"
        ],
        "properties": {
          "reason": {
            "type": "string"
          },
          "actor_kind": {
            "type": "string"
          },
          "actor_id": {
            "type": "string"
          },
          "suppressed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WorkflowRecoveryAutomaticBlockedNotification": {
        "type": "object",
        "description": "Latest blocked or recovered evidence capture for a retry or initial-recovery review. Retry sequence increases only on a changed evidence diagnosis or proven clearance. Receivers are frozen at capture; queued identifies ledger admission rather than successful delivery. No receivers prevents historical replay to later subscribers.",
        "required": [
          "event_id",
          "status",
          "reason",
          "captured_at",
          "receiver_webhook_ids"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "blocked",
              "recovered"
            ]
          },
          "sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "evidence_kind": {
            "type": "string",
            "enum": [
              "parent",
              "child",
              "initial"
            ]
          },
          "diagnosis_reason": {
            "type": "string"
          },
          "event_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "no_receivers"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "evidence_unknown",
              "terminal_outcome_not_saved",
              "execution_quota",
              "job_paused",
              "blocker_cleared"
            ]
          },
          "captured_at": {
            "type": "string",
            "format": "date-time"
          },
          "receiver_webhook_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      },
      "WorkflowRecoveryQueueBlockedWebhookPayload": {
        "type": "object",
        "description": "Historical stored_workflow.recovery_queue_blocked event. Saved-failure retries capture changes in exact parent or child evidence diagnosis and proven clearance, with diagnosis URL and CLI guidance. Initial automatic recovery identifies initial_failure_id. Unchanged blockers stay quiet; recovery identifies cleared evidence rather than successful execution. Capturing this event does not finalize a child, release its execution slot, or authorize another retry. Delivery may occur after the block resolves; stable identity and frozen recipients support receiver deduplication.",
        "required": [
          "event_id",
          "app_id",
          "app",
          "review_id",
          "action_id",
          "policy_version",
          "position",
          "status",
          "reason",
          "observed_at",
          "queue_url",
          "review_status_url"
        ],
        "properties": {
          "evidence_kind": {
            "type": "string",
            "enum": [
              "parent",
              "child",
              "initial"
            ]
          },
          "diagnosis_reason": {
            "type": "string"
          },
          "evidence_url": {
            "type": "string"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "resume_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "repairable": {
            "type": "boolean"
          },
          "cli_command": {
            "type": "string"
          },
          "initial_failure_id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "blocked",
              "recovered"
            ]
          },
          "previous_reason": {
            "type": "string"
          },
          "operator_action": {
            "type": "string"
          },
          "job_url": {
            "type": "string"
          },
          "event_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "app": {
            "type": "string"
          },
          "review_id": {
            "type": "string",
            "format": "uuid"
          },
          "action_id": {
            "type": "string",
            "format": "uuid"
          },
          "policy_version": {
            "type": "integer",
            "format": "int64"
          },
          "position": {
            "type": "integer",
            "format": "int64"
          },
          "child_job_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "applied"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "evidence_unknown",
              "terminal_outcome_not_saved",
              "execution_quota",
              "job_paused",
              "blocker_cleared"
            ]
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "queue_url": {
            "type": "string"
          },
          "review_status_url": {
            "type": "string"
          }
        }
      },
      "WorkflowRecoveryAutomaticEvaluation": {
        "type": "object",
        "description": "Last committed worker evaluation, never refreshed by reads or notification capture. Waiting_since is the first observation of this consecutive wait reason and resets when the reason changes. Absent for legacy or unevaluated intents. Pausing preserves historical evidence.",
        "required": [
          "evaluated_at",
          "reason"
        ],
        "properties": {
          "evaluated_at": {
            "type": "string",
            "format": "date-time"
          },
          "reason": {
            "type": "string",
            "enum": [
              "hourly_budget",
              "cooldown",
              "execution_quota",
              "evidence_unknown",
              "outstanding_retry",
              "admission_wait",
              "execution_wait",
              "retry_running",
              "inspection_error",
              "child_created",
              "result_recorded",
              "suppressed",
              "hourly_execution_budget",
              "execution_cooldown",
              "outstanding_recovery",
              "recovery_running",
              "terminal_outcome_not_saved",
              "job_paused",
              "automatic_paused",
              "expired",
              "policy_changed",
              "policy_disabled",
              "changed"
            ]
          },
          "waiting_since": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WorkflowRecoveryAutomaticAction": {
        "type": "object",
        "description": "Durable automatic retry intent and application receipt. Applied identifies child creation; its final result requires retained generation proof. Suppressed actions never run automatically.",
        "required": [
          "action_id",
          "position",
          "status",
          "reason"
        ],
        "properties": {
          "last_evaluation": {
            "$ref": "#/components/schemas/WorkflowRecoveryAutomaticEvaluation"
          },
          "suppression": {
            "$ref": "#/components/schemas/WorkflowRecoveryAutomaticSuppression"
          },
          "blocked_notification": {
            "$ref": "#/components/schemas/WorkflowRecoveryAutomaticBlockedNotification"
          },
          "action_id": {
            "type": "string",
            "format": "uuid"
          },
          "position": {
            "type": "integer",
            "format": "int64"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "applied",
              "suppressed"
            ]
          },
          "reason": {
            "type": "string"
          },
          "child_job_id": {
            "type": "string",
            "format": "uuid"
          },
          "applied_at": {
            "type": "string",
            "format": "date-time"
          },
          "result": {
            "$ref": "#/components/schemas/WorkflowRecoveryReviewActionStatus"
          }
        }
      },
      "WorkflowRecoveryReviewAutomaticExecution": {
        "type": "object",
        "description": "Automatic retry execution records for the frozen review plan. Manual application is recorded through the existing keyed child receipts and is not charged to automatic execution budgets.",
        "required": [
          "actions"
        ],
        "properties": {
          "actions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowRecoveryAutomaticAction"
            }
          }
        }
      },
      "WorkflowRecoveryPolicyPausedWebhookPayload": {
        "type": "object",
        "description": "Historical stored_workflow.recovery_policy_paused event emitted once per policy version after repeated proven automatic retry failures. Frozen receivers and stable event identity survive retries and later policy updates.",
        "required": [
          "event_id",
          "app_id",
          "app",
          "policy_version",
          "paused_at",
          "consecutive_failures",
          "reason",
          "policy_url"
        ],
        "properties": {
          "event_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "app": {
            "type": "string"
          },
          "policy_version": {
            "type": "integer",
            "format": "int64"
          },
          "paused_at": {
            "type": "string",
            "format": "date-time"
          },
          "consecutive_failures": {
            "type": "integer"
          },
          "reason": {
            "type": "string"
          },
          "policy_url": {
            "type": "string"
          }
        }
      },
      "ControlWorkflowRecoveryPolicyRequest": {
        "type": "object",
        "description": "Operational pause or resume using the last observed policy and pause state. Omit expected_paused_at when the observed policy was unpaused. Every accepted control updates updated_at and records a trusted audit actor and reason without changing the policy version. A retry using stale state returns conflict.",
        "required": [
          "expected_version",
          "expected_updated_at",
          "operation",
          "reason"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "expected_updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "expected_paused_at": {
            "type": "string",
            "format": "date-time"
          },
          "operation": {
            "type": "string",
            "enum": [
              "pause",
              "resume"
            ]
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          }
        }
      },
      "WorkflowRecoveryHealthAlertPolicy": {
        "type": "object",
        "additionalProperties": false,
        "description": "Opt-in recovery health incident notifications with explicit scheduler evaluation and sustained unhealthy duration thresholds. Settings are replaced with the full recovery policy. Read-only health query thresholds remain request-local.",
        "required": [
          "enabled",
          "stall_after_seconds",
          "alert_after_seconds"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "stall_after_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 86400
          },
          "alert_after_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 86400
          }
        }
      },
      "WorkflowRecoveryHealthNotification": {
        "type": "object",
        "description": "Frozen health notification identity and receiver set; no_receivers is terminal for this transition and does not replay to late receivers.",
        "required": [
          "event_id",
          "status",
          "captured_at",
          "receiver_webhook_ids"
        ],
        "properties": {
          "event_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "no_receivers"
            ]
          },
          "captured_at": {
            "type": "string",
            "format": "date-time"
          },
          "receiver_webhook_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      },
      "WorkflowRecoveryHealthIncident": {
        "type": "object",
        "description": "Latest retained health incident per app across policy versions. Reason changes do not create repeated alerts. Unknown snapshots defer initial capture and cannot declare recovery. Disabling alerts closes silently; healthy or inactive observations close with recovery only after alert capture. Historical webhook payloads remain immutable.",
        "required": [
          "episode_id",
          "opened_at",
          "candidate_since",
          "observed_at",
          "status",
          "reason"
        ],
        "properties": {
          "episode_id": {
            "type": "string",
            "format": "uuid"
          },
          "opened_at": {
            "type": "string",
            "format": "date-time"
          },
          "candidate_since": {
            "type": "string",
            "format": "date-time"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": [
              "healthy",
              "inactive",
              "paused",
              "blocked",
              "stalled",
              "unknown"
            ]
          },
          "reason": {
            "type": "string"
          },
          "closed_at": {
            "type": "string",
            "format": "date-time"
          },
          "alert_notification": {
            "$ref": "#/components/schemas/WorkflowRecoveryHealthNotification"
          },
          "recovery_notification": {
            "$ref": "#/components/schemas/WorkflowRecoveryHealthNotification"
          }
        }
      },
      "WorkflowRecoveryHealthWebhookPayload": {
        "type": "object",
        "description": "Historical stored_workflow.recovery_health_alert or stored_workflow.recovery_health_recovered transition with stable event and incident identities. Recovery targets only original alert receivers still enabled and subscribed to recovery at capture. Delivery can occur after the observed condition changes and does not authorize retries or release slots.",
        "required": [
          "event_id",
          "episode_id",
          "app_id",
          "app",
          "policy_version",
          "status",
          "reason",
          "opened_at",
          "observed_at",
          "pending",
          "outstanding",
          "queue_truncated",
          "health_url"
        ],
        "properties": {
          "event_id": {
            "type": "string",
            "format": "uuid"
          },
          "episode_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "app": {
            "type": "string"
          },
          "policy_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "healthy",
              "inactive",
              "paused",
              "blocked",
              "stalled",
              "unknown"
            ]
          },
          "reason": {
            "type": "string"
          },
          "opened_at": {
            "type": "string",
            "format": "date-time"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "pending": {
            "type": "integer",
            "minimum": 0
          },
          "outstanding": {
            "type": "integer",
            "minimum": 0
          },
          "queue_truncated": {
            "type": "boolean"
          },
          "health_url": {
            "type": "string"
          }
        }
      },
      "WorkflowRecoveryReport": {
        "type": "object",
        "description": "Observed recovery counts with explicit retention and scan coverage limitations.",
        "required": [
          "observed_at",
          "created_after",
          "created_before",
          "scanned_entries",
          "durable_entries",
          "truncated",
          "coverage_notes",
          "totals",
          "groups",
          "blockers",
          "evidence"
        ],
        "properties": {
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_after": {
            "type": "string",
            "format": "date-time"
          },
          "created_before": {
            "type": "string",
            "format": "date-time"
          },
          "scanned_entries": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          },
          "durable_entries": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          },
          "truncated": {
            "type": "boolean"
          },
          "coverage_notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "totals": {
            "$ref": "#/components/schemas/WorkflowRecoveryReportTotals"
          },
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowRecoveryReportGroup"
            }
          },
          "blockers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowRecoveryReportBlocker"
            }
          },
          "evidence": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/WorkflowRecoveryHistoryEntry"
            }
          }
        }
      },
      "WorkflowRecoveryReportTotals": {
        "description": "Observed event-window counts and matched retry timing, without causal or live-state inference.",
        "type": "object",
        "required": [
          "attempts",
          "succeeded",
          "failed",
          "cancelled",
          "other_results",
          "without_observed_result",
          "pauses",
          "timed_results"
        ],
        "properties": {
          "attempts": {
            "type": "integer",
            "minimum": 0
          },
          "succeeded": {
            "type": "integer",
            "minimum": 0
          },
          "failed": {
            "type": "integer",
            "minimum": 0
          },
          "cancelled": {
            "type": "integer",
            "minimum": 0
          },
          "other_results": {
            "type": "integer",
            "minimum": 0
          },
          "without_observed_result": {
            "type": "integer",
            "minimum": 0,
            "description": "Attempts without a result observed in this window; not a live unresolved-child count."
          },
          "pauses": {
            "type": "integer",
            "minimum": 0
          },
          "timed_results": {
            "type": "integer",
            "minimum": 0
          },
          "mean_retry_result_seconds": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "description": "Mean application-to-recorded-result time for matched child IDs with ordered timestamps; absent without timing samples."
          }
        }
      },
      "WorkflowRecoveryReportGroup": {
        "description": "Recovery counts for one workflow association and policy configuration version.",
        "type": "object",
        "required": [
          "workflow",
          "policy_version",
          "totals"
        ],
        "properties": {
          "workflow": {
            "type": "string"
          },
          "policy_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "totals": {
            "$ref": "#/components/schemas/WorkflowRecoveryReportTotals"
          }
        }
      },
      "WorkflowRecoveryReportBlocker": {
        "description": "Distinct actions affected by an observed worker blocker with bounded source evidence.",
        "type": "object",
        "required": [
          "reason",
          "actions",
          "evidence"
        ],
        "properties": {
          "reason": {
            "type": "string"
          },
          "actions": {
            "type": "integer",
            "minimum": 0
          },
          "evidence": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/WorkflowRecoveryHistoryEntry"
            }
          }
        }
      },
      "WorkflowRecoveryHistory": {
        "description": "A bounded page of retained recovery evidence with a fixed observation window.",
        "type": "object",
        "required": [
          "observed_at",
          "created_after",
          "created_before",
          "entries",
          "retained_observations"
        ],
        "properties": {
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_after": {
            "type": "string",
            "format": "date-time"
          },
          "created_before": {
            "type": "string",
            "format": "date-time"
          },
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowRecoveryHistoryEntry"
            }
          },
          "next_after": {
            "type": "string"
          },
          "retained_observations": {
            "type": "boolean",
            "description": "True indicates retained evidence rather than a complete immutable audit log."
          }
        }
      },
      "WorkflowRecoveryCandidateEvidence": {
        "type": "object",
        "description": "Immutable policy-review candidate facts, captured prospectively without execution inputs or outputs.",
        "required": [
          "review_id",
          "app_id",
          "job_id",
          "policy_version",
          "policy",
          "observed_at",
          "decisions"
        ],
        "properties": {
          "review_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "policy_version": {
            "type": "integer",
            "format": "int64"
          },
          "policy": {
            "$ref": "#/components/schemas/WorkflowRecoveryPolicy"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "decisions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowRecoveryPolicyDecision"
            }
          }
        }
      },
      "WorkflowRecoveryHistoryEntry": {
        "description": "A retained event or latest observation linked to its available recovery evidence.",
        "type": "object",
        "required": [
          "id",
          "occurred_at",
          "kind",
          "outcome",
          "reason"
        ],
        "properties": {
          "polling_notification": {
            "$ref": "#/components/schemas/WorkflowRecoveryPollingNotification"
          },
          "initial_failure_id": {
            "type": "string",
            "format": "uuid"
          },
          "evidence_kind": {
            "type": "string",
            "enum": [
              "parent",
              "child",
              "initial"
            ]
          },
          "resume_count": {
            "type": "integer",
            "minimum": 1
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "notification_event_id": {
            "type": "string",
            "format": "uuid"
          },
          "diagnosis_reason": {
            "type": "string"
          },
          "review_url": {
            "type": "string"
          },
          "evidence_url": {
            "type": "string"
          },
          "job_url": {
            "type": "string"
          },
          "candidate_evidence": {
            "$ref": "#/components/schemas/WorkflowRecoveryCandidateEvidence"
          },
          "durable": {
            "type": "boolean",
            "description": "True for an immutable event recorded prospectively with a state mutation; absent for retained source observations."
          },
          "evaluation_reason": {
            "type": "string",
            "description": "Worker transition classification; suppression reason remains in reason."
          },
          "episode_id": {
            "type": "string",
            "format": "uuid",
            "description": "Health incident episode association preserved across later incidents."
          },
          "policy": {
            "$ref": "#/components/schemas/WorkflowRecoveryPolicy",
            "description": "Frozen configuration on policy_changed events; excludes workflow execution inputs and outputs."
          },
          "id": {
            "type": "string"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "kind": {
            "type": "string"
          },
          "outcome": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "policy_version": {
            "type": "integer",
            "format": "int64"
          },
          "workflow": {
            "type": "string"
          },
          "run_id": {
            "type": "string"
          },
          "review_id": {
            "type": "string"
          },
          "action_id": {
            "type": "string"
          },
          "job_id": {
            "type": "string"
          },
          "child_job_id": {
            "type": "string"
          },
          "actor_kind": {
            "type": "string"
          },
          "actor_id": {
            "type": "string"
          }
        }
      },
      "WorkflowRecoveryPolicyHealth": {
        "type": "object",
        "description": "Advisory recovery automation health with bounded queue evidence. Status precedence is paused, stalled, observed blockers, current budget or cooldown, incomplete sample, then inactive or healthy. Sample progress is only from retained queue entries and is not a durable app-wide last-success timestamp. Healthy means no blocker observed in this snapshot, not scheduler or platform liveness.",
        "required": [
          "status",
          "reason",
          "stall_after_seconds",
          "queue"
        ],
        "properties": {
          "overview": {
            "$ref": "#/components/schemas/WorkflowRecoveryOverview"
          },
          "status": {
            "type": "string",
            "enum": [
              "healthy",
              "inactive",
              "paused",
              "blocked",
              "stalled",
              "unknown"
            ]
          },
          "reason": {
            "type": "string"
          },
          "stall_after_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 86400
          },
          "sample_last_progress_at": {
            "type": "string",
            "format": "date-time"
          },
          "queue": {
            "$ref": "#/components/schemas/WorkflowRecoveryAutomaticQueue"
          }
        }
      },
      "WorkflowRecoveryOverview": {
        "type": "object",
        "description": "Read-only retained recovery observations from one snapshot. Covers manual initial reviews, manual retry disposition/completion observations and the automatic queue, not all workflow outcomes or scheduler liveness. Counts are exact; issues are bounded. Delivery covers the last retained polling alert only.",
        "required": [
          "status",
          "monitoring_status",
          "observed_at",
          "monitoring_only",
          "manual_awaiting_approval",
          "manual_unresolved",
          "manual_polling_failures",
          "manual_attention",
          "truncated",
          "issues"
        ],
        "properties": {
          "manual_retry_awaiting_review": {
            "type": "integer",
            "minimum": 0,
            "description": "Undecided current enabled preview retry plans requiring a live status inspection; no freshness or readiness guarantee."
          },
          "manual_retry_unresolved": {
            "type": "integer",
            "minimum": 0,
            "description": "Approved retry reviews without a saved completion observation, including unapplied plans and reviews from older policy versions."
          },
          "status": {
            "type": "string",
            "enum": [
              "healthy",
              "waiting",
              "paused",
              "needs_attention",
              "inactive",
              "unknown"
            ]
          },
          "monitoring_status": {
            "type": "string",
            "enum": [
              "no_observed_failure",
              "failing",
              "unknown"
            ]
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "monitoring_only": {
            "type": "boolean"
          },
          "manual_awaiting_approval": {
            "type": "integer",
            "minimum": 0
          },
          "manual_unresolved": {
            "type": "integer",
            "minimum": 0
          },
          "manual_polling_failures": {
            "type": "integer",
            "minimum": 0
          },
          "manual_attention": {
            "type": "integer",
            "minimum": 0
          },
          "truncated": {
            "type": "boolean"
          },
          "issues": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/WorkflowRecoveryOverviewIssue"
            }
          },
          "last_alert": {
            "$ref": "#/components/schemas/WorkflowRecoveryOverviewAlert"
          }
        }
      },
      "WorkflowRecoveryOverviewIssue": {
        "description": "One recovery issue with evidence and the next available operator action.",
        "type": "object",
        "required": [
          "scope",
          "reason",
          "policy_version",
          "inspection_url"
        ],
        "properties": {
          "scope": {
            "type": "string",
            "enum": [
              "automatic_policy",
              "automatic_queue",
              "manual_initial",
              "manual_retry"
            ]
          },
          "reason": {
            "type": "string"
          },
          "policy_version": {
            "type": "integer",
            "format": "int64"
          },
          "review_id": {
            "type": "string",
            "format": "uuid"
          },
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "retry_at": {
            "type": "string",
            "format": "date-time"
          },
          "inspection_url": {
            "type": "string"
          }
        }
      },
      "WorkflowRecoveryOverviewAlert": {
        "type": "object",
        "description": "Delivery observations for frozen receipt receivers. Missing deliveries without an outbox entry are unknown. No receivers is not delivered.",
        "required": [
          "notification",
          "delivery_status",
          "expected",
          "pending",
          "in_flight",
          "succeeded",
          "failed",
          "dead",
          "missing",
          "relay_pending"
        ],
        "properties": {
          "notification": {
            "$ref": "#/components/schemas/WorkflowRecoveryPollingNotification"
          },
          "delivery_status": {
            "type": "string",
            "enum": [
              "no_receivers",
              "relay_pending",
              "pending",
              "delivered",
              "failed",
              "unknown"
            ]
          },
          "expected": {
            "type": "integer",
            "minimum": 0
          },
          "pending": {
            "type": "integer",
            "minimum": 0
          },
          "in_flight": {
            "type": "integer",
            "minimum": 0
          },
          "succeeded": {
            "type": "integer",
            "minimum": 0
          },
          "failed": {
            "type": "integer",
            "minimum": 0
          },
          "dead": {
            "type": "integer",
            "minimum": 0
          },
          "missing": {
            "type": "integer",
            "minimum": 0
          },
          "relay_pending": {
            "type": "boolean"
          }
        }
      },
      "WorkflowRecoveryPolicyEvaluationRequest": {
        "type": "object",
        "description": "Proposed policy and bounded historical review window, fenced against the current configuration version.",
        "required": [
          "expected_version",
          "policy"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "policy": {
            "$ref": "#/components/schemas/WorkflowRecoveryPolicy"
          },
          "workflow": {
            "type": "string",
            "maxLength": 256
          },
          "created_after": {
            "type": "string",
            "format": "date-time",
            "description": "Inclusive evaluation start; defaults to seven days before the end."
          },
          "created_before": {
            "type": "string",
            "format": "date-time",
            "description": "Inclusive evaluation end; defaults to observation time. Maximum window is 30 days and future bounds are rejected."
          }
        }
      },
      "WorkflowRecoveryPolicyAssessment": {
        "type": "object",
        "description": "Eligibility from preserved facts, conditional preparation result and lower-bound pressure from observed applications.",
        "required": [
          "eligibility",
          "reason",
          "preparation",
          "execution_pressure"
        ],
        "properties": {
          "eligibility": {
            "type": "string",
            "enum": [
              "qualifies",
              "excluded",
              "unknown"
            ]
          },
          "reason": {
            "type": "string"
          },
          "preparation": {
            "type": "string",
            "enum": [
              "would_prepare",
              "excluded",
              "unknown",
              "cooldown",
              "hourly_budget",
              "already_prepared"
            ]
          },
          "execution_pressure": {
            "type": "string",
            "enum": [
              "not_evaluated",
              "not_enabled",
              "observed_hourly_budget",
              "observed_cooldown",
              "insufficient_history"
            ]
          }
        }
      },
      "WorkflowRecoveryFailureEligibility": {
        "type": "object",
        "description": "Latest retained-state retry checks, observed after the original failure. No inputs or outputs are retained; this is not failure-time proof or an admission guarantee.",
        "required": [
          "observed_at",
          "reason",
          "blockers"
        ],
        "properties": {
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "parent_job_id": {
            "type": "string",
            "format": "uuid"
          },
          "parent_position": {
            "type": "integer",
            "format": "int64"
          },
          "reason": {
            "type": "string"
          },
          "blockers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "WorkflowRecoveryFailureEligibilityAssessment": {
        "type": "object",
        "description": "Policy filters applied to a separately timed later observation. Checks expire after 15 minutes; preparation and execution remain unproven. Historical totals never consume these observations.",
        "required": [
          "observation",
          "freshness",
          "current",
          "proposed"
        ],
        "properties": {
          "observation": {
            "$ref": "#/components/schemas/WorkflowRecoveryFailureEligibility"
          },
          "freshness": {
            "type": "string",
            "enum": [
              "fresh",
              "stale"
            ]
          },
          "current": {
            "$ref": "#/components/schemas/WorkflowRecoveryPolicyAssessment"
          },
          "proposed": {
            "$ref": "#/components/schemas/WorkflowRecoveryPolicyAssessment"
          }
        }
      },
      "WorkflowRecoveryPolicyEvaluationCandidate": {
        "type": "object",
        "description": "One retained historical decision with current and proposed settings applied to the same captured evidence.",
        "required": [
          "evidence_source",
          "run_id",
          "workflow",
          "observed_at",
          "resume_count",
          "trigger",
          "recorded_outcome",
          "historical_failure_statuses",
          "observed_hourly_executions",
          "execution_evidence_ids",
          "current",
          "proposed"
        ],
        "properties": {
          "later_eligibility": {
            "$ref": "#/components/schemas/WorkflowRecoveryFailureEligibilityAssessment"
          },
          "evidence_source": {
            "type": "string",
            "enum": [
              "policy_review",
              "failure_inventory"
            ],
            "description": "Source of historical candidate facts."
          },
          "failure_evidence_id": {
            "type": "string",
            "description": "Stable identifier for a captured policy-independent failure."
          },
          "candidate_evidence_id": {
            "type": "string",
            "description": "Durable history event containing the candidate facts when available."
          },
          "review_id": {
            "type": "string",
            "format": "uuid"
          },
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "workflow": {
            "type": "string"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "policy_version": {
            "type": "integer",
            "format": "int64"
          },
          "position": {
            "type": "integer",
            "format": "int64"
          },
          "resume_count": {
            "type": "integer"
          },
          "trigger": {
            "type": "string"
          },
          "recorded_outcome": {
            "type": "string"
          },
          "historical_failure_statuses": {
            "type": "array",
            "description": "Exact observed status as a singleton when captured; otherwise the legacy policy filter represents a possible status set. Empty means unrestricted and unrecorded.",
            "items": {
              "type": "string"
            }
          },
          "observed_hourly_executions": {
            "type": "integer",
            "minimum": 0
          },
          "last_observed_execution_at": {
            "type": "string",
            "format": "date-time"
          },
          "execution_evidence_ids": {
            "type": "array",
            "maxItems": 5,
            "description": "Bounded application proof identifiers from recovery history, including last known cooldown evidence when older than one hour.",
            "items": {
              "type": "string"
            }
          },
          "current": {
            "$ref": "#/components/schemas/WorkflowRecoveryPolicyAssessment"
          },
          "proposed": {
            "$ref": "#/components/schemas/WorkflowRecoveryPolicyAssessment"
          }
        }
      },
      "WorkflowRecoveryPolicyEvaluationTotals": {
        "type": "object",
        "description": "Counts of conditional preparation decisions and observed application pressure for the sampled candidates.",
        "required": [
          "candidates",
          "would_prepare",
          "excluded",
          "unknown",
          "cooldown",
          "preparation_budget",
          "deduplicated",
          "execution_budget_pressure",
          "execution_cooldown_pressure"
        ],
        "properties": {
          "candidates": {
            "type": "integer",
            "minimum": 0
          },
          "would_prepare": {
            "type": "integer",
            "minimum": 0
          },
          "excluded": {
            "type": "integer",
            "minimum": 0
          },
          "unknown": {
            "type": "integer",
            "minimum": 0
          },
          "cooldown": {
            "type": "integer",
            "minimum": 0
          },
          "preparation_budget": {
            "type": "integer",
            "minimum": 0
          },
          "deduplicated": {
            "type": "integer",
            "minimum": 0
          },
          "execution_budget_pressure": {
            "type": "integer",
            "minimum": 0
          },
          "execution_cooldown_pressure": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "WorkflowRecoveryFailureCoverage": {
        "type": "object",
        "description": "Coverage of the bounded policy-independent terminal-failure sample in the requested workflow/time window, before policy filters. Counts are sample counts; partial capture and pruning never establish that no other failures occurred. Review correlation uses the sampled reviews.",
        "required": [
          "capture_started_at",
          "coverage",
          "captured_failures",
          "reviewed_failures",
          "unreviewed_failures",
          "missing_eligibility_evidence",
          "truncated"
        ],
        "properties": {
          "capture_started_at": {
            "type": "string",
            "format": "date-time"
          },
          "coverage": {
            "type": "string",
            "enum": [
              "partial"
            ],
            "description": "Prospective capture and retention limits prevent a claim of complete historical coverage."
          },
          "captured_failures": {
            "type": "integer",
            "minimum": 0,
            "maximum": 500
          },
          "reviewed_failures": {
            "type": "integer",
            "minimum": 0,
            "maximum": 500
          },
          "unreviewed_failures": {
            "type": "integer",
            "minimum": 0,
            "maximum": 500
          },
          "missing_eligibility_evidence": {
            "type": "integer",
            "minimum": 0,
            "maximum": 500,
            "description": "Sampled failures without historical retry preflight proof."
          },
          "truncated": {
            "type": "boolean"
          }
        }
      },
      "WorkflowRecoveryPolicyEvaluation": {
        "type": "object",
        "description": "Historical comparison under stated replay assumptions, with retained-evidence gaps and every bounded sample truncation disclosed.",
        "required": [
          "failure_coverage",
          "current",
          "proposed",
          "observed_at",
          "created_after",
          "created_before",
          "inspected_reviews",
          "reviews_truncated",
          "candidates_truncated",
          "executions_truncated",
          "observed_executions",
          "current_totals",
          "proposed_totals",
          "candidates",
          "coverage_notes"
        ],
        "properties": {
          "failure_coverage": {
            "$ref": "#/components/schemas/WorkflowRecoveryFailureCoverage"
          },
          "current": {
            "$ref": "#/components/schemas/WorkflowRecoveryPolicyResponse"
          },
          "proposed": {
            "$ref": "#/components/schemas/WorkflowRecoveryPolicy"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_after": {
            "type": "string",
            "format": "date-time"
          },
          "created_before": {
            "type": "string",
            "format": "date-time"
          },
          "inspected_reviews": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "reviews_truncated": {
            "type": "boolean"
          },
          "candidates_truncated": {
            "type": "boolean"
          },
          "executions_truncated": {
            "type": "boolean"
          },
          "observed_executions": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          },
          "current_totals": {
            "$ref": "#/components/schemas/WorkflowRecoveryPolicyEvaluationTotals"
          },
          "proposed_totals": {
            "$ref": "#/components/schemas/WorkflowRecoveryPolicyEvaluationTotals"
          },
          "candidates": {
            "type": "array",
            "maxItems": 500,
            "items": {
              "$ref": "#/components/schemas/WorkflowRecoveryPolicyEvaluationCandidate"
            }
          },
          "coverage_notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "WorkflowRecoveryPolicyChangeEntry": {
        "type": "object",
        "description": "Retained automatic queue entry and the effect of replacing its policy configuration.",
        "required": [
          "entry",
          "effect"
        ],
        "properties": {
          "entry": {
            "$ref": "#/components/schemas/WorkflowRecoveryAutomaticQueueEntry"
          },
          "effect": {
            "type": "string",
            "enum": [
              "would_suppress",
              "retain_slot"
            ]
          }
        }
      },
      "WorkflowRecoveryPolicyChangeCandidate": {
        "type": "object",
        "description": "Matching retained native target, with preparation eligibility simulated under proposed settings and retained deduplication. Would_prepare never creates a plan and does not guarantee execution quota or admission. Policy_disabled means an eligible target would not be prepared while disabled.",
        "required": [
          "job_id",
          "decision"
        ],
        "properties": {
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "decision": {
            "$ref": "#/components/schemas/WorkflowRecoveryPolicyDecision"
          }
        }
      },
      "WorkflowRecoveryPolicyChangePreview": {
        "type": "object",
        "description": "Consistent read-only snapshot of a proposed full replacement. Budget and cooldown observations retain spent charges and preparation targets across versions. Replacement clears automatic pause and failure streak; current contains that historical state. Remaining budgets describe proposed settings even when disabled. Serial slots, inspection errors and execution quota can still prevent progress. No update is authorized by this response; apply the same expected version with deploy write access and MFA. Queue and evidence may change without changing the configuration version.",
        "required": [
          "current",
          "proposed",
          "observed_at",
          "next_version",
          "pending_suppressed",
          "outstanding_retained",
          "entries",
          "entries_truncated",
          "automatic_execution_enabled",
          "hourly_executions",
          "remaining_execution_budget",
          "hourly_prepared_actions",
          "remaining_preparation_budget",
          "inspected_jobs",
          "jobs_truncated",
          "candidates",
          "candidates_truncated"
        ],
        "properties": {
          "initial_failures": {
            "$ref": "#/components/schemas/WorkflowRecoveryInitialPolicyChangePreview"
          },
          "current": {
            "$ref": "#/components/schemas/WorkflowRecoveryPolicyResponse"
          },
          "proposed": {
            "$ref": "#/components/schemas/WorkflowRecoveryPolicy"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "next_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "pending_suppressed": {
            "type": "integer",
            "minimum": 0
          },
          "outstanding_retained": {
            "type": "integer",
            "minimum": 0
          },
          "entries": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/WorkflowRecoveryPolicyChangeEntry"
            }
          },
          "entries_truncated": {
            "type": "boolean"
          },
          "automatic_execution_enabled": {
            "type": "boolean"
          },
          "hourly_executions": {
            "type": "integer",
            "minimum": 0
          },
          "remaining_execution_budget": {
            "type": "integer",
            "minimum": 0
          },
          "execution_cooldown_until": {
            "type": "string",
            "format": "date-time"
          },
          "hourly_prepared_actions": {
            "type": "integer",
            "minimum": 0
          },
          "remaining_preparation_budget": {
            "type": "integer",
            "minimum": 0
          },
          "preparation_cooldown_until": {
            "type": "string",
            "format": "date-time"
          },
          "inspected_jobs": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5
          },
          "jobs_truncated": {
            "type": "boolean"
          },
          "candidates": {
            "type": "array",
            "maxItems": 25,
            "items": {
              "$ref": "#/components/schemas/WorkflowRecoveryPolicyChangeCandidate"
            }
          },
          "candidates_truncated": {
            "type": "boolean"
          }
        }
      },
      "WorkflowRecoveryInitialPolicyChangeCandidate": {
        "type": "object",
        "additionalProperties": false,
        "description": "Read-only initial-failure decision for a proposed next policy version. Eligibility reports policy filters and fresh safety diagnostics. Preparation reports duplicate, review-retention, cooldown or action-budget pressure. Execution reports whether that prepared candidate would be submitted automatically, including durable execution budget, cooldown, unresolved app recovery and native account quota. Target is advisory and omitted for excluded or unsafe failures; it grants no execution authority.",
        "required": [
          "failure",
          "eligibility",
          "preparation",
          "execution",
          "blockers"
        ],
        "properties": {
          "failure": {
            "$ref": "#/components/schemas/WorkflowInitialFailure"
          },
          "eligibility": {
            "type": "string"
          },
          "preparation": {
            "type": "string"
          },
          "execution": {
            "type": "string"
          },
          "blockers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "target": {
            "$ref": "#/components/schemas/WorkflowRunRecoveryTarget"
          }
        }
      },
      "WorkflowRecoveryInitialPolicyChangePreview": {
        "type": "object",
        "additionalProperties": false,
        "description": "Bounded read-only sample of retained generation-zero failures, present for preview policies with initial_failure and automatic_initial proposals. Matching workflow and failure-status filters sort first, then ascending failure ID; at most five are inspected. Coverage is always partial and counts describe only this sample. Candidate preparation and submission simulate processing the sample in order, after sampled parent-job preparations; later candidates can hit simulated cooldown or slot pressure. Quota and unresolved fields report the current snapshot before simulation. Applying the proposal clears the current pause but retains charges and unresolved work. Actual workers rescan and repeat admission checks. No policy, review, cursor, evidence, job or notification is written or pruned.",
        "required": [
          "coverage",
          "inspected_failures",
          "truncated",
          "eligible",
          "excluded",
          "safety_blocked",
          "would_prepare",
          "would_submit",
          "retained_reviews",
          "remaining_review_capacity",
          "active_recovery_jobs",
          "remaining_recovery_job_capacity",
          "unresolved_recovery",
          "candidates"
        ],
        "properties": {
          "coverage": {
            "type": "string",
            "enum": [
              "partial"
            ]
          },
          "inspected_failures": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5
          },
          "truncated": {
            "type": "boolean"
          },
          "eligible": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5,
            "description": "Sampled failures passing policy filters and fresh safety diagnostics; preparation or execution pressure can still block them."
          },
          "excluded": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5,
            "description": "Sampled failures excluded by policy settings, including disabled proposals."
          },
          "safety_blocked": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5,
            "description": "Sampled policy-matching failures blocked by live safety or changed evidence."
          },
          "would_prepare": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5
          },
          "would_submit": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5
          },
          "retained_reviews": {
            "type": "integer",
            "minimum": 0,
            "description": "Initial reviews that count after normal history pruning, plus unresolved automatic submissions retained indefinitely. Preview does not perform that pruning."
          },
          "remaining_review_capacity": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000
          },
          "active_recovery_jobs": {
            "type": "integer",
            "minimum": 0,
            "description": "Active native or routing recovery jobs across the account, including paused jobs."
          },
          "remaining_recovery_job_capacity": {
            "type": "integer",
            "minimum": 0,
            "maximum": 3
          },
          "unresolved_recovery": {
            "type": "boolean",
            "description": "Current app has unresolved automatic or native recovery work that blocks a new automatic first submission."
          },
          "runtime_available": {
            "type": "boolean",
            "description": "HTTP server runtime availability. When false, automatic submission decisions report workflow_runtime_disabled."
          },
          "candidates": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/WorkflowRecoveryInitialPolicyChangeCandidate"
            }
          }
        }
      },
      "WorkflowRecoveryQueueEvidence": {
        "type": "object",
        "description": "Read-only exact-generation diagnosis for a returned retry queue entry; never a worker evaluation or admission grant. Parent repairability also requires the exact live generation to remain retained. Omitted for initial recoveries, which use their separate evidence endpoints.",
        "required": [
          "diagnosis",
          "evidence_url",
          "cli_command"
        ],
        "properties": {
          "diagnosis": {
            "$ref": "#/components/schemas/WorkflowRetryEvidenceDiagnosis"
          },
          "evidence_url": {
            "type": "string"
          },
          "cli_command": {
            "type": "string"
          }
        }
      },
      "WorkflowRecoveryInitialQueueEvidence": {
        "type": "object",
        "description": "Read-only initial recovery evidence. Prepared identifies a planned generation with no submitted recovery job and is never repairable; submitted uses exact-generation proof from the initial evidence endpoint. Neither stage grants execution authority.",
        "required": [
          "stage",
          "diagnosis",
          "evidence_url",
          "cli_command"
        ],
        "properties": {
          "stage": {
            "type": "string",
            "enum": [
              "prepared",
              "submitted"
            ]
          },
          "diagnosis": {
            "$ref": "#/components/schemas/WorkflowInitialEvidenceDiagnosis"
          },
          "evidence_url": {
            "type": "string"
          },
          "cli_command": {
            "type": "string"
          }
        }
      },
      "WorkflowRecoveryAutomaticQueueEntry": {
        "type": "object",
        "description": "One pending or unresolved applied automatic retry. Queued_at is the frozen review preparation time. Ages are whole nonnegative seconds relative to the queue observed_at. Waiting age is omitted until the worker records a wait; the saved reason may be historical.",
        "required": [
          "review_id",
          "policy_version",
          "action",
          "queued_at",
          "queued_age_seconds"
        ],
        "properties": {
          "initial_evidence": {
            "$ref": "#/components/schemas/WorkflowRecoveryInitialQueueEvidence"
          },
          "evidence": {
            "$ref": "#/components/schemas/WorkflowRecoveryQueueEvidence"
          },
          "evidence_unavailable_reason": {
            "type": "string",
            "enum": [
              "review_not_retained",
              "plan_changed"
            ]
          },
          "wait_category": {
            "type": "string",
            "enum": [
              "worker",
              "policy",
              "budget",
              "cooldown",
              "evidence",
              "execution"
            ]
          },
          "wait_reason": {
            "type": "string",
            "description": "Current pending policy pause/disable reason or the last saved worker reason; evidence diagnosis has its own observation time."
          },
          "review_id": {
            "type": "string",
            "format": "uuid"
          },
          "policy_version": {
            "type": "integer",
            "format": "int64"
          },
          "queued_at": {
            "type": "string",
            "format": "date-time"
          },
          "queued_age_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "waiting_age_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "action": {
            "$ref": "#/components/schemas/WorkflowRecoveryAutomaticAction"
          }
        }
      },
      "WorkflowRecoveryAutomaticQueue": {
        "type": "object",
        "description": "Informational automatic retry queue snapshot. Outstanding means a child has been created but final proof has not been recorded; it does not assert the child is currently running. Pending counts current policy intents only. Charges survive review pruning and policy replacement. Paused policies retain their queue and committed children continue. Missing evidence is unresolved, never success or failure.",
        "required": [
          "policy",
          "observed_at",
          "pending",
          "outstanding",
          "hourly_executions",
          "remaining_budget",
          "entries",
          "truncated"
        ],
        "properties": {
          "health_incident": {
            "$ref": "#/components/schemas/WorkflowRecoveryHealthIncident"
          },
          "policy": {
            "$ref": "#/components/schemas/WorkflowRecoveryPolicyResponse"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "pending": {
            "type": "integer",
            "minimum": 0
          },
          "outstanding": {
            "type": "integer",
            "minimum": 0
          },
          "hourly_executions": {
            "type": "integer",
            "minimum": 0
          },
          "remaining_budget": {
            "type": "integer",
            "minimum": 0
          },
          "cooldown_until": {
            "type": "string",
            "format": "date-time"
          },
          "entries": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/WorkflowRecoveryAutomaticQueueEntry"
            }
          },
          "truncated": {
            "type": "boolean"
          }
        }
      },
      "SetWorkflowRecoveryPolicyRequest": {
        "type": "object",
        "description": "Explicit full policy replacement fenced to its observed version. A first configuration uses version zero.",
        "required": [
          "expected_version",
          "policy"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "policy": {
            "$ref": "#/components/schemas/WorkflowRecoveryPolicy"
          }
        }
      },
      "WorkflowRecoveryPolicyResponse": {
        "type": "object",
        "description": "Current recovery policy with trusted update actor and scheduler status. A versioned policy replacement resets its automatic failure pause and suppresses older pending automatic actions.",
        "required": [
          "app_id",
          "version",
          "policy",
          "updated_at",
          "actor_kind",
          "actor_id",
          "status"
        ],
        "properties": {
          "polling_notification": {
            "$ref": "#/components/schemas/WorkflowRecoveryPollingNotification"
          },
          "automatic_execution": {
            "$ref": "#/components/schemas/WorkflowRecoveryPolicyAutomaticExecution"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "version": {
            "type": "integer",
            "format": "int64"
          },
          "policy": {
            "$ref": "#/components/schemas/WorkflowRecoveryPolicy"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "actor_kind": {
            "type": "string"
          },
          "actor_id": {
            "type": "string"
          },
          "last_evaluation_at": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": [
              "disabled",
              "monitoring",
              "review_limit",
              "paused"
            ]
          }
        }
      },
      "WorkflowRecoveryPolicyDecision": {
        "type": "object",
        "description": "Frozen per-target explanation including eligibility refusals and policy suppression. The resume count identifies the reviewed admitted generation.",
        "required": [
          "position",
          "run_id",
          "resume_count",
          "trigger",
          "action",
          "outcome"
        ],
        "properties": {
          "failure_status": {
            "type": "string",
            "description": "Exact run status observed at candidate evaluation when available."
          },
          "preflight_outcome": {
            "type": "string",
            "description": "Eligibility result before policy preparation limits."
          },
          "preflight_blockers": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Frozen preflight blocker codes."
          },
          "position": {
            "type": "integer",
            "format": "int64"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "resume_count": {
            "type": "integer"
          },
          "trigger": {
            "type": "string"
          },
          "action": {
            "type": "string"
          },
          "outcome": {
            "type": "string"
          }
        }
      },
      "WorkflowRecoveryReviewNotification": {
        "type": "object",
        "description": "One durable review notification capture. Delivery outcomes are in the webhook delivery ledger; queued capture does not prove HTTP acknowledgement. Frozen receiver identifiers prevent replay to newly configured subscriptions.",
        "required": [
          "event_id",
          "status",
          "reason",
          "captured_at",
          "receiver_webhook_ids"
        ],
        "properties": {
          "event_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "no_receivers",
              "suppressed"
            ]
          },
          "reason": {
            "type": "string"
          },
          "captured_at": {
            "type": "string",
            "format": "date-time"
          },
          "receiver_webhook_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      },
      "WorkflowRecoveryReviewReadyWebhookPayload": {
        "type": "object",
        "description": "Payload of stored_workflow.recovery_review_ready. Carries frozen prepared targets and review commands; approval and application remain explicit. Retries reuse the event identifier and delivery ledger.",
        "required": [
          "event_id",
          "review_id",
          "app_id",
          "app",
          "policy_version",
          "prepared_at",
          "observed_at",
          "targets",
          "review_url",
          "status_url",
          "review_command",
          "export_command"
        ],
        "properties": {
          "initial_failure_id": {
            "type": "string",
            "format": "uuid",
            "description": "Captured initial failure for parentless reviews. Parent-job reviews carry job_id instead."
          },
          "event_id": {
            "type": "string",
            "format": "uuid"
          },
          "review_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "app": {
            "type": "string"
          },
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "policy_version": {
            "type": "integer",
            "format": "int64"
          },
          "prepared_at": {
            "type": "string",
            "format": "date-time"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "targets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowRecoveryPolicyDecision"
            }
          },
          "review_url": {
            "type": "string"
          },
          "status_url": {
            "type": "string"
          },
          "review_command": {
            "type": "string"
          },
          "export_command": {
            "type": "string"
          }
        }
      },
      "WorkflowRecoveryReviewCompletionNotification": {
        "type": "object",
        "description": "Immutable final plan result and completion receiver capture. Queued means a durable event was prepared; HTTP acknowledgement is recorded separately in the delivery ledger.",
        "required": [
          "event_id",
          "status",
          "captured_at",
          "receiver_webhook_ids",
          "result"
        ],
        "properties": {
          "event_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "no_receivers"
            ]
          },
          "captured_at": {
            "type": "string",
            "format": "date-time"
          },
          "receiver_webhook_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "result": {
            "$ref": "#/components/schemas/WorkflowRecoveryReviewStatus"
          }
        }
      },
      "WorkflowRecoveryReviewFinishedWebhookPayload": {
        "type": "object",
        "description": "Payload of stored_workflow.recovery_review_finished. All actions have proven final outcomes for their frozen generations. This historical result remains valid after review decisions or later retries; receivers deduplicate by event_id.",
        "required": [
          "event_id",
          "review_id",
          "app_id",
          "app",
          "job_id",
          "policy_version",
          "captured_at",
          "result",
          "review_url",
          "status_url",
          "status_command"
        ],
        "properties": {
          "event_id": {
            "type": "string",
            "format": "uuid"
          },
          "review_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "app": {
            "type": "string"
          },
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "policy_version": {
            "type": "integer",
            "format": "int64"
          },
          "captured_at": {
            "type": "string",
            "format": "date-time"
          },
          "result": {
            "$ref": "#/components/schemas/WorkflowRecoveryReviewStatus"
          },
          "review_url": {
            "type": "string"
          },
          "status_url": {
            "type": "string"
          },
          "status_command": {
            "type": "string"
          }
        }
      },
      "WorkflowRecoveryReviewDecisionRequest": {
        "type": "object",
        "description": "Final review decision and required audit reason. Does not apply actions.",
        "required": [
          "decision",
          "reason"
        ],
        "properties": {
          "decision": {
            "type": "string",
            "enum": [
              "approved",
              "dismissed"
            ]
          },
          "reason": {
            "type": "string"
          }
        }
      },
      "WorkflowRecoveryReviewDecision": {
        "type": "object",
        "description": "Immutable review decision with trusted authenticated actor identity.",
        "required": [
          "decision",
          "reason",
          "decided_at",
          "actor_kind",
          "actor_id"
        ],
        "properties": {
          "decision": {
            "type": "string",
            "enum": [
              "approved",
              "dismissed"
            ]
          },
          "reason": {
            "type": "string"
          },
          "decided_at": {
            "type": "string",
            "format": "date-time"
          },
          "actor_kind": {
            "type": "string"
          },
          "actor_id": {
            "type": "string"
          }
        }
      },
      "WorkflowRecoveryReviewActionStatus": {
        "type": "object",
        "description": "Application freshness and execution outcome for one frozen action. A retry is complete only with saved terminal generation evidence or a terminal admission refusal.",
        "required": [
          "position",
          "kind",
          "status",
          "reason",
          "outcome",
          "complete",
          "run_id",
          "resume_count",
          "run_url"
        ],
        "properties": {
          "position": {
            "type": "integer",
            "format": "int64"
          },
          "kind": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "unknown",
              "pending",
              "running",
              "succeeded",
              "failed",
              "cancelled"
            ]
          },
          "complete": {
            "type": "boolean"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "resume_count": {
            "type": "integer",
            "description": "Exact execution generation; retry targets the next admitted generation."
          },
          "run_url": {
            "type": "string"
          },
          "child_job_id": {
            "type": "string",
            "format": "uuid"
          },
          "items_url": {
            "type": "string"
          },
          "evidence_source": {
            "type": "string"
          },
          "recorded_at": {
            "type": "string",
            "format": "date-time"
          },
          "outcome_reason": {
            "type": "string"
          }
        }
      },
      "WorkflowRecoveryReviewStatus": {
        "type": "object",
        "description": "Application status and aggregate execution outcome. Complete requires final proof for every action; retained completion snapshots take precedence over later generations and pruned execution rows.",
        "required": [
          "review_id",
          "observed_at",
          "status",
          "actions",
          "outcome",
          "complete"
        ],
        "properties": {
          "review_id": {
            "type": "string",
            "format": "uuid"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "no_plan",
              "unknown",
              "pending",
              "running",
              "succeeded",
              "failed",
              "cancelled",
              "completed"
            ]
          },
          "complete": {
            "type": "boolean"
          },
          "actions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowRecoveryReviewActionStatus"
            }
          }
        }
      },
      "WorkflowRecoveryPolicyReview": {
        "type": "object",
        "description": "Immutable policy evaluation with its settings snapshot and optional prepared response plan. Repeated unchanged decisions are deduplicated; retained reviews are capped at 1000 per app.",
        "required": [
          "id",
          "app_id",
          "job_id",
          "policy_version",
          "policy",
          "observed_at",
          "decisions"
        ],
        "properties": {
          "parent_evidence_repairs": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/WorkflowInitialEvidenceRepairReceipt"
            }
          },
          "evidence_repairs": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/WorkflowInitialEvidenceRepairReceipt"
            }
          },
          "automatic_execution": {
            "$ref": "#/components/schemas/WorkflowRecoveryReviewAutomaticExecution"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "policy_version": {
            "type": "integer",
            "format": "int64"
          },
          "policy": {
            "$ref": "#/components/schemas/WorkflowRecoveryPolicy"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "decisions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowRecoveryPolicyDecision"
            }
          },
          "plan": {
            "$ref": "#/components/schemas/WorkflowRecoveryResponsePlan"
          },
          "review_decision": {
            "$ref": "#/components/schemas/WorkflowRecoveryReviewDecision"
          },
          "notification": {
            "$ref": "#/components/schemas/WorkflowRecoveryReviewNotification"
          },
          "completion_notification": {
            "$ref": "#/components/schemas/WorkflowRecoveryReviewCompletionNotification"
          }
        }
      },
      "WorkflowRecoveryPolicyReviews": {
        "type": "object",
        "description": "One identifier-ordered page of retained recovery policy reviews.",
        "required": [
          "reviews"
        ],
        "properties": {
          "reviews": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowRecoveryPolicyReview"
            }
          },
          "next_after": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "WorkflowRecoveryActionReceipt": {
        "type": "object",
        "description": "Durable cancellation decision retained for the lifetime of its recovery job. The same action identifier returns the original outcome even after the run advances. Operator identity is resolved from authentication.",
        "required": [
          "request",
          "response",
          "captured_at",
          "actor_kind",
          "actor_id"
        ],
        "properties": {
          "request": {
            "$ref": "#/components/schemas/WorkflowRecoveryCancellationRequest"
          },
          "response": {
            "$ref": "#/components/schemas/WorkflowRecoveryCancellationResponse"
          },
          "captured_at": {
            "type": "string",
            "format": "date-time"
          },
          "actor_kind": {
            "type": "string"
          },
          "actor_id": {
            "type": "string"
          }
        }
      },
      "WorkflowRecoveryCancellationRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Exact admitted recovery item and generation reviewed by an operator. Preview is advisory and commit rechecks eligibility. Operator identity is resolved from authentication.",
        "required": [
          "position",
          "expected_resume_count",
          "reason"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid",
            "description": "Optional stable action identifier. Apply retains the original outcome including refusals; reusing it with changed arguments conflicts. Preview never writes a receipt."
          },
          "position": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 25
          },
          "expected_resume_count": {
            "type": "integer",
            "minimum": 1,
            "maximum": 16
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512,
            "description": "Nonblank UTF-8 reason without control characters. Limited to 512 bytes."
          }
        }
      },
      "WorkflowRecoveryCancellationResponse": {
        "type": "object",
        "description": "Read-only preview or cancellation result. Only eligible generations can be cancelled. Repeating a cancellation against the same cancelled generation does not append another history entry.",
        "required": [
          "job_id",
          "position",
          "resume_count",
          "outcome",
          "preview"
        ],
        "properties": {
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "position": {
            "type": "integer",
            "format": "int64"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "resume_count": {
            "type": "integer"
          },
          "status": {
            "type": "string"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "not_admitted",
              "changed",
              "unknown",
              "operation_owned",
              "already_cancelled",
              "already_terminal",
              "eligible",
              "cancelled"
            ]
          },
          "preview": {
            "type": "boolean"
          }
        }
      },
      "WorkflowRunRecoveryPlan": {
        "type": "object",
        "additionalProperties": false,
        "description": "Explicit reviewed native workflow runs. Requires workflow mode and request_id; excludes event selections and receipt protection. Each resume checks the original count and eligibility atomically with its job outcome. Concurrency pressure leaves the item pending; changed or unsafe targets are skipped. Queued means a resume was admitted, not execution success. No new runs are selected. The original normalized request returns the retained job on retry; changes conflict.",
        "required": [
          "name",
          "runs"
        ],
        "properties": {
          "execution_deadline_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 604800,
            "description": "Advisory deadline from each admission. Zero disables it; nonzero values must be at least 60 seconds."
          },
          "execution_stall_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 604800,
            "description": "No observable progress threshold. Zero uses 900 seconds; nonzero values must be at least 60 seconds. Scheduled and capacity waits do not trigger stalled alerts."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "runs": {
            "type": "array",
            "minItems": 1,
            "maxItems": 25,
            "items": {
              "$ref": "#/components/schemas/WorkflowRunRecoveryTarget"
            }
          }
        }
      },
      "WorkflowInitialRecoveryReviewRequest": {
        "description": "Parameters for preparing a durable initial recovery review.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_policy_version"
        ],
        "properties": {
          "expected_policy_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        }
      },
      "WorkflowInitialRecoveryReviewDecisionRequest": {
        "description": "Decision and policy version for submitting an initial recovery review.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "decision",
          "reason"
        ],
        "properties": {
          "decision": {
            "type": "string",
            "enum": [
              "submit",
              "cancel"
            ]
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          }
        }
      },
      "WorkflowInitialRecoveryReviewEvent": {
        "description": "Notification carrying an initial recovery review and its captured evidence.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "status",
          "reason",
          "occurred_at",
          "actor_kind",
          "actor_id"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "prepared",
              "submitted",
              "cancelled",
              "expired",
              "stale"
            ]
          },
          "reason": {
            "type": "string"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "actor_kind": {
            "type": "string"
          },
          "actor_id": {
            "type": "string"
          }
        }
      },
      "WorkflowInitialEvidenceRepairRequest": {
        "description": "Policy-fenced request to repair retained initial recovery evidence.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "request_id",
          "reason"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          }
        }
      },
      "WorkflowInitialEvidenceRepairReceipt": {
        "description": "Recorded result of an initial recovery evidence repair.",
        "type": "object",
        "required": [
          "request_id",
          "reason",
          "actor_kind",
          "actor_id",
          "repaired_at",
          "outcome"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "reason": {
            "type": "string"
          },
          "actor_kind": {
            "type": "string"
          },
          "actor_id": {
            "type": "string"
          },
          "repaired_at": {
            "type": "string",
            "format": "date-time"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "succeeded",
              "failed",
              "cancelled"
            ]
          }
        }
      },
      "WorkflowInitialEvidenceDiagnosis": {
        "description": "Consistent diagnosis of retained evidence for an initial recovery review.",
        "type": "object",
        "required": [
          "review_id",
          "run_id",
          "resume_count",
          "observed_at",
          "reason",
          "repairable"
        ],
        "properties": {
          "review_id": {
            "type": "string",
            "format": "uuid"
          },
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "resume_count": {
            "type": "integer"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "reason": {
            "type": "string"
          },
          "repairable": {
            "type": "boolean"
          },
          "execution": {
            "$ref": "#/components/schemas/EventRecoveryExecution"
          },
          "repair": {
            "$ref": "#/components/schemas/WorkflowInitialEvidenceRepairReceipt"
          }
        }
      },
      "WorkflowRetryEvidenceDiagnosis": {
        "description": "Consistent diagnosis of retained evidence for a frozen retry action.",
        "type": "object",
        "required": [
          "action_id",
          "review_id",
          "run_id",
          "resume_count",
          "observed_at",
          "reason",
          "repairable"
        ],
        "properties": {
          "evidence_kind": {
            "type": "string",
            "enum": [
              "parent",
              "child"
            ]
          },
          "item_position": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "action_id": {
            "type": "string",
            "format": "uuid"
          },
          "review_id": {
            "type": "string",
            "format": "uuid"
          },
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "resume_count": {
            "type": "integer"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "reason": {
            "type": "string"
          },
          "repairable": {
            "type": "boolean"
          },
          "execution": {
            "$ref": "#/components/schemas/EventRecoveryExecution"
          },
          "repair": {
            "$ref": "#/components/schemas/WorkflowInitialEvidenceRepairReceipt"
          }
        }
      },
      "WorkflowInitialRecoveryAttention": {
        "type": "object",
        "description": "Latest committed observation of a submitted manual initial recovery. Reads do not update it. Notification receipts describe captured historical transitions.",
        "required": [
          "reason",
          "sequence",
          "observed_at"
        ],
        "properties": {
          "reason": {
            "type": "string"
          },
          "block_reason": {
            "type": "string"
          },
          "sequence": {
            "type": "integer",
            "format": "int64"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "diagnosis": {
            "$ref": "#/components/schemas/WorkflowInitialEvidenceDiagnosis"
          },
          "operator_action": {
            "type": "string"
          },
          "evidence_url": {
            "type": "string"
          },
          "cli_command": {
            "type": "string"
          },
          "notification": {
            "$ref": "#/components/schemas/WorkflowRecoveryAutomaticBlockedNotification"
          }
        }
      },
      "WorkflowInitialObservationFailure": {
        "type": "object",
        "additionalProperties": false,
        "description": "Last deterministic manual observation failure. Retry uses bounded backoff; a successful observation clears this metadata. Codes never include database error messages.",
        "required": [
          "code",
          "attempts",
          "failed_at",
          "retry_at"
        ],
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "invalid_recovery_identity",
              "invalid_observation_data"
            ]
          },
          "attempts": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 32
          },
          "failed_at": {
            "type": "string",
            "format": "date-time"
          },
          "retry_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WorkflowInitialRecoveryReview": {
        "type": "object",
        "additionalProperties": false,
        "description": "Immutable failure and policy snapshot with durable transition history. Pending reviews expire after 24 hours. Fresh read status is advisory; submission and pending native admission repeat checks. Preparation and preview-mode manual submission each enforce the policy cooldown and hourly action budget; preparation shares the existing parent-review budget. Retained for 30 days with at most 1000 initial reviews per app; unresolved automatic submissions remain retained until proven final. automatic_initial submission reserves the separate hourly execution budget and one unresolved recovery slot per app. Automatic outcomes require saved terminal generation evidence or final admission refusal. Submitted job completion and notifications use the native recovery job lifecycle.",
        "required": [
          "id",
          "app_id",
          "app",
          "failure",
          "target",
          "policy_version",
          "policy",
          "status",
          "reason",
          "prepared_at",
          "expires_at",
          "observed_at",
          "events"
        ],
        "properties": {
          "polling_notification": {
            "$ref": "#/components/schemas/WorkflowRecoveryPollingNotification"
          },
          "evidence_repair": {
            "$ref": "#/components/schemas/WorkflowInitialEvidenceRepairReceipt"
          },
          "automatic_block_reason": {
            "type": "string"
          },
          "automatic_block_sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "automatic_block_notification": {
            "$ref": "#/components/schemas/WorkflowRecoveryAutomaticBlockedNotification"
          },
          "observation_failure": {
            "$ref": "#/components/schemas/WorkflowInitialObservationFailure"
          },
          "attention": {
            "$ref": "#/components/schemas/WorkflowInitialRecoveryAttention"
          },
          "result": {
            "$ref": "#/components/schemas/WorkflowRecoveryReviewActionStatus",
            "description": "Verified completion of a manually approved initial recovery."
          },
          "automatic_result": {
            "$ref": "#/components/schemas/WorkflowRecoveryReviewActionStatus"
          },
          "automatic_evaluation": {
            "$ref": "#/components/schemas/WorkflowRecoveryAutomaticEvaluation"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "app": {
            "type": "string"
          },
          "failure": {
            "$ref": "#/components/schemas/WorkflowInitialFailure"
          },
          "target": {
            "$ref": "#/components/schemas/WorkflowRunRecoveryTarget"
          },
          "policy_version": {
            "type": "integer",
            "format": "int64"
          },
          "policy": {
            "$ref": "#/components/schemas/WorkflowRecoveryPolicy"
          },
          "status": {
            "type": "string",
            "enum": [
              "prepared",
              "submitted",
              "cancelled",
              "expired",
              "stale"
            ]
          },
          "reason": {
            "type": "string"
          },
          "prepared_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "submitted_at": {
            "type": "string",
            "format": "date-time"
          },
          "notification": {
            "$ref": "#/components/schemas/WorkflowRecoveryReviewNotification"
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowInitialRecoveryReviewEvent"
            }
          }
        }
      },
      "WorkflowInitialRecoveryReviews": {
        "description": "Page of durable initial recovery reviews.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "reviews"
        ],
        "properties": {
          "reviews": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowInitialRecoveryReview"
            }
          },
          "next_after": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "WorkflowInitialFailure": {
        "description": "One captured generation-zero workflow failure.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "app_id",
          "run_id",
          "workflow",
          "failure_status",
          "observed_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "workflow": {
            "type": "string"
          },
          "failure_status": {
            "type": "string",
            "enum": [
              "failed",
              "dead"
            ]
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WorkflowInitialFailures": {
        "description": "Page of captured initial workflow failures.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "observed_at",
          "coverage",
          "items"
        ],
        "properties": {
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "coverage": {
            "type": "string",
            "enum": [
              "partial"
            ]
          },
          "items": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/WorkflowInitialFailure"
            }
          },
          "next_after": {
            "type": "string"
          }
        }
      },
      "WorkflowInitialRecoveryPreview": {
        "description": "Safety preview for creating the first recovery job from a captured failure.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "failure",
          "observed_at",
          "reason",
          "blockers"
        ],
        "properties": {
          "failure": {
            "$ref": "#/components/schemas/WorkflowInitialFailure"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "reason": {
            "type": "string",
            "description": "Stable diagnostic reason such as eligible, changed, run_not_retained, capacity or resume_ineligible."
          },
          "blockers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "target": {
            "$ref": "#/components/schemas/WorkflowRunRecoveryTarget"
          }
        }
      },
      "WorkflowRunRecoveryTarget": {
        "description": "One reviewed workflow run and resume count. Retry children identify the saved parent item. Initial failure targets may identify retained generation-zero evidence, which is checked again at creation and admission.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "run_id",
          "expected_resume_count"
        ],
        "properties": {
          "failure_evidence_id": {
            "type": "string",
            "format": "uuid",
            "description": "Optional captured initial failure identity. Requires expected_resume_count zero and no recovery parent. Must match retained app, workflow, run and failure status."
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_resume_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 16
          },
          "parent_position": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 25,
            "description": "Required only with parent_job_id. Unique position of the queued parent item whose saved failed outcome matches this run and resume count."
          }
        }
      },
      "EventWorkflowRecoveryPlan": {
        "type": "object",
        "additionalProperties": false,
        "description": "Explicit reviewed workflow acceptance recipients. Routing mode only, requires request_id and excludes parent and backlog filters. Creation freezes the exact selection. Before each admission the worker atomically compares published version, replay count and routing generation; changes are skipped. Repeated request_id returns the retained job, even after completion; a different normalized plan or rate conflicts. Preview and preflight are advisory; workflow fence eligibility is unknown in preflight. Queued means routing recovery was admitted, not workflow completion.",
        "required": [
          "name",
          "published_version",
          "source",
          "events"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "published_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "source": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "events": {
            "type": "array",
            "minItems": 1,
            "maxItems": 25,
            "items": {
              "$ref": "#/components/schemas/EventWorkflowRecoveryTarget"
            }
          }
        }
      },
      "EventWorkflowRecoveryTarget": {
        "type": "object",
        "additionalProperties": false,
        "description": "One captured workflow recipient; event IDs must be distinct. Generation is required for independent recipient routing and omitted for legacy receipts. Replay count also fences legacy recovery cycles. No delivery-age override is supported.",
        "required": [
          "event_id",
          "subscription_id",
          "replay_count"
        ],
        "properties": {
          "event_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "subscription_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "replay_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "EventRecoveryExecution": {
        "type": "object",
        "additionalProperties": false,
        "description": "Read-only observation of the exact admitted replay or workflow resume. Invocation mode prefers saved confirmed terminal results, retained with the recovery job. Workflow mode prefers saved terminal results for the admitted resume, then live retained run and resume evidence. Missing evidence without a saved result is unknown. Native failed/dead runs both report failed. Pending and running workflow states report queued and running; awaiting_event also reports running. Without a saved result, later native resumes report superseded with no completion time. Saved native results survive workflow-history pruning for the recovery job retention period; the first confirmed terminal result wins across later resumes. Omitted for routing recovery and items not admitted.",
        "required": [
          "observed_at",
          "state",
          "source",
          "attempts"
        ],
        "properties": {
          "recorded_at": {
            "type": "string",
            "format": "date-time",
            "description": "When terminal evidence was saved; present only for recovery_result."
          },
          "evidence_source": {
            "type": "string",
            "enum": [
              "invocation",
              "attempt_history",
              "workflow_run"
            ],
            "description": "Original source of a saved terminal result; present only for recovery_result."
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "state": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "retrying",
              "succeeded",
              "failed",
              "dead_lettered",
              "expired",
              "cancelled",
              "superseded",
              "unknown"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "invocation",
              "attempt_history",
              "recovery_result",
              "workflow_run",
              "unavailable"
            ]
          },
          "attempts": {
            "type": "integer",
            "minimum": 0,
            "description": "Recorded dispatch attempt count for the tracked invocation generation; zero for workflow-run observations."
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Recorded terminal completion time when available."
          }
        }
      },
      "EventRecoveryExecutionSummary": {
        "type": "object",
        "additionalProperties": false,
        "description": "Observations of admitted execution- or workflow-mode items. Both modes prefer the first saved terminal result, then live evidence of the exact admitted generation. Later native resumes report superseded only without an earlier saved terminal result. Missing evidence without a saved result is unknown. Native failed/dead runs count as failed. Counts sum to tracked_count and are separate from job admission state. Omitted for routing recovery. Saved results in both modes share recovery job retention.",
        "required": [
          "observed_at",
          "tracked_count",
          "saved_results",
          "queued",
          "running",
          "retrying",
          "succeeded",
          "failed",
          "dead_lettered",
          "expired",
          "cancelled",
          "superseded",
          "unknown"
        ],
        "properties": {
          "saved_results": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 10000,
            "description": "Subset of tracked_count with saved confirmed terminal evidence. Not an additional state bucket."
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "tracked_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 10000
          },
          "queued": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "running": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "retrying": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "succeeded": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "failed": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "dead_lettered": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "expired": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cancelled": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "superseded": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unknown": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "EventRecoveryItem": {
        "type": "object",
        "additionalProperties": false,
        "description": "Metadata-only selected recipient. In execution mode invocation_id identifies the selected failure. Queued means replay was admitted, not that the handler succeeded.",
        "required": [
          "position",
          "event_source",
          "event_id",
          "event_type",
          "subscription_id",
          "failed_at",
          "failure_code",
          "retryable",
          "state"
        ],
        "properties": {
          "workflow_run_id": {
            "type": "string",
            "format": "uuid",
            "description": "Native workflow target; event identity fields are empty for these items."
          },
          "expected_resume_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 16,
            "description": "Original reviewed count; queued means the next resume was admitted."
          },
          "parent_job_id": {
            "type": "string",
            "format": "uuid",
            "description": "Parent recovery job identity for a child selection; retained as historical lineage even if the parent job is pruned."
          },
          "parent_position": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 10000,
            "description": "Selected item position in the parent recovery."
          },
          "invocation_id": {
            "type": "string",
            "format": "uuid"
          },
          "replay_invocation_id": {
            "type": "string",
            "format": "uuid",
            "description": "Exact replay admitted by this job; omitted for routing recovery and legacy items."
          },
          "replay_generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Frozen admitted generation including zero for new replay children."
          },
          "execution": {
            "$ref": "#/components/schemas/EventRecoveryExecution"
          },
          "position": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "event_source": {
            "type": "string"
          },
          "event_id": {
            "type": "string"
          },
          "event_type": {
            "type": "string"
          },
          "subscription_id": {
            "type": "string"
          },
          "failed_at": {
            "type": "string",
            "format": "date-time"
          },
          "failure_code": {
            "type": "string"
          },
          "retryable": {
            "type": "boolean"
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "queued",
              "skipped",
              "cancelled"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "changed",
              "receipt_expired",
              "target_unavailable",
              "cancelled",
              "expired"
            ]
          }
        }
      },
      "EventRecoveryPreview": {
        "description": "Bounded selection preview for a proposed durable event recovery job.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "observed_at",
          "coverage",
          "matched_count",
          "exceeds_job_limit",
          "sample"
        ],
        "properties": {
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "coverage": {
            "type": "string",
            "enum": [
              "captured_application_recipients",
              "retained_application_executions",
              "reviewed_workflow_runs"
            ]
          },
          "matched_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 10001,
            "description": "Exact up to the job limit; a lower bound when exceeds_job_limit is true."
          },
          "exceeds_job_limit": {
            "type": "boolean"
          },
          "sample": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/EventRecoveryItem"
            }
          }
        }
      },
      "EventRecoveryRateRequest": {
        "description": "Replacement admission rate and optional audit reason for an existing recovery job.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "rate_per_second"
        ],
        "properties": {
          "reason": {
            "type": "string",
            "maxLength": 512,
            "description": "Reason in the event recovery rate request: optional operator reason, limited to 512 UTF-8 bytes without control characters. Stored only in audit history; omitted from frozen selection. Preview does not record it."
          },
          "rate_per_second": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "description": "Maximum items per second. Does not reset spent permits or existing admission waits."
          }
        }
      },
      "EventRecoveryJob": {
        "description": "Durable recovery job identity, frozen selection, pacing state and admission progress counters.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "rate_per_second",
          "app_id",
          "coverage",
          "selection",
          "state",
          "selected_count",
          "pending_count",
          "queued_count",
          "skipped_count",
          "cancelled_count",
          "created_at",
          "updated_at",
          "expires_at"
        ],
        "properties": {
          "execution_finished_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time the scheduler captured confirmed terminal results for all queued deliveries of an eligible new execution recovery. Omitted while unresolved or for historical jobs; does not imply success or webhook acknowledgement."
          },
          "rate_per_second": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "description": "Current admission rate; selection.rate_per_second retains the original requested rate."
          },
          "paused_at": {
            "type": "string",
            "format": "date-time",
            "description": "Start time of the current pause; present only while paused."
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "execution": {
            "$ref": "#/components/schemas/EventRecoveryExecutionSummary"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "coverage": {
            "type": "string",
            "enum": [
              "captured_application_recipients",
              "retained_application_executions",
              "reviewed_workflow_runs"
            ]
          },
          "selection": {
            "$ref": "#/components/schemas/EventRecoveryRequest"
          },
          "state": {
            "type": "string",
            "enum": [
              "running",
              "paused",
              "completed",
              "cancelled"
            ]
          },
          "selected_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 10000
          },
          "pending_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "queued_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "skipped_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cancelled_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EventRecoveryPreflightItem": {
        "description": "Sampled pending recovery eligibility or a saved native workflow retry target, with current wait and skip diagnostics.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "position",
          "status",
          "reason"
        ],
        "properties": {
          "workflow_run_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_resume_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 17,
            "description": "Original reviewed count for pending native items; admitted parent count for retry targets. Non-admitted items may exceed the resume limit and are never selectable."
          },
          "saved_outcome": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "retrying",
              "succeeded",
              "failed",
              "dead_lettered",
              "expired",
              "cancelled",
              "superseded",
              "unknown"
            ]
          },
          "blockers": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Safe resume blocker codes without workflow payloads or provider errors."
          },
          "receipt_retain_until": {
            "type": "string",
            "format": "date-time",
            "description": "Nominal receipt retention boundary when routing has settled."
          },
          "receipt_retention_held": {
            "type": "boolean",
            "description": "Current backfill or recovery hold; ends when its owning job or item releases it."
          },
          "position": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "eligible",
              "waiting",
              "likely_skipped",
              "unknown"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "eligible",
              "capacity",
              "legacy_claim",
              "changed",
              "expired",
              "target_unavailable",
              "receipt_expired",
              "unknown",
              "not_admitted",
              "outcome_not_saved",
              "outcome_not_failed",
              "run_not_retained",
              "resume_ineligible",
              "resume_limit_reached"
            ]
          },
          "capacity_scope": {
            "type": "string",
            "enum": [
              "account",
              "app",
              "consumer"
            ]
          }
        }
      },
      "EventRecoveryPreflight": {
        "description": "Read-only eligibility and capacity for pending recovery items or saved native retry outcomes. Timing fields always describe the parent job; observations do not reserve capacity.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "job_id",
          "observed_at",
          "state",
          "active",
          "pending_count",
          "eligible_count",
          "waiting_count",
          "likely_skipped_count",
          "unknown_count",
          "reason_counts",
          "capacity_scopes",
          "rate_per_second",
          "remaining_lifetime_seconds",
          "minimum_drain_seconds",
          "earliest_drain_at",
          "fits_before_expiry",
          "assumes_immediate_resume",
          "sample"
        ],
        "properties": {
          "review_mode": {
            "type": "string",
            "enum": [
              "workflow_retry"
            ],
            "description": "Present only for the saved native retry view."
          },
          "app_id": {
            "type": "string",
            "format": "uuid",
            "description": "Native recovery application scope."
          },
          "workflow_name": {
            "type": "string",
            "description": "Native recovery workflow scope."
          },
          "reviewed_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 25,
            "description": "Number of saved parent items reviewed in retry mode. Pending count remains zero; status counters partition this count and sample includes every item."
          },
          "receipt_protection_until": {
            "type": "string",
            "format": "date-time",
            "description": "This opted-in active job protects pending receipts until admission or this existing job expiry. Omitted after expiry or terminal state; does not protect execution history or extend delivery deadlines."
          },
          "receipt_retention_warning_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Pending items with unheld receipt deadlines at or before the later of 24 hours from observation and optimistic drain."
          },
          "receipt_retention_held_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Pending items with known nominal deadlines currently held by backfill or recovery."
          },
          "earliest_unheld_retain_until": {
            "type": "string",
            "format": "date-time"
          },
          "minimum_drain_crosses_receipt_retention": {
            "type": "boolean",
            "description": "Rate-only optimistic drain reaches or exceeds the earliest currently unheld receipt boundary; false is not a retention guarantee."
          },
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "state": {
            "type": "string",
            "enum": [
              "running",
              "paused",
              "completed",
              "cancelled",
              "expired"
            ]
          },
          "active": {
            "type": "boolean",
            "description": "Running or paused and not expired at the observation time."
          },
          "pending_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 10000
          },
          "eligible_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "waiting_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "likely_skipped_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unknown_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "reason_counts": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          "capacity_scopes": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          "rate_per_second": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "remaining_lifetime_seconds": {
            "type": "number",
            "minimum": 0
          },
          "minimum_drain_seconds": {
            "type": "number",
            "minimum": 0,
            "description": "Optimistic delay until the last pending item can spend an admission permit, respecting the current fixed-window budget and schedule. Does not include handler execution or future waits."
          },
          "earliest_drain_at": {
            "type": "string",
            "format": "date-time"
          },
          "fits_before_expiry": {
            "type": "boolean",
            "description": "Active job and optimistic earliest drain strictly precedes expiry; true is not a guarantee of completion."
          },
          "assumes_immediate_resume": {
            "type": "boolean"
          },
          "sample": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/EventRecoveryPreflightItem"
            }
          }
        }
      },
      "EventRecoveryCapacityWait": {
        "description": "Current capacity-wait episode with limiting scope and observation timestamps.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "scope",
          "gate",
          "explanation",
          "started_at",
          "observed_at",
          "age_seconds"
        ],
        "properties": {
          "scope": {
            "type": "string",
            "enum": [
              "account",
              "app",
              "consumer",
              "unknown"
            ]
          },
          "gate": {
            "type": "string",
            "enum": [
              "pending_delivery_limit",
              "unknown"
            ]
          },
          "explanation": {
            "type": "string",
            "description": "Safe explanation of the observed admission gate; does not include payloads or resolved work keys."
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "age_seconds": {
            "type": "number",
            "minimum": 0
          }
        }
      },
      "EventRecoveryJobHealth": {
        "description": "Retained recovery job progress, expiry risk and capacity-wait observations.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "job_id",
          "mode",
          "state",
          "status",
          "pending_count",
          "rate_per_second",
          "progress_age_seconds",
          "progress_known",
          "next_attempt_at",
          "eligible_at",
          "overdue_seconds",
          "expires_at",
          "expiring"
        ],
        "properties": {
          "capacity_wait": {
            "$ref": "#/components/schemas/EventRecoveryCapacityWait",
            "description": "Latest tracked capacity episode. Omitted when no diagnostics have been observed. Preserved while paused; cleared on resume or item progress. Use eligible_at for the next eligible retry."
          },
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "mode": {
            "type": "string",
            "enum": [
              "routing",
              "execution",
              "workflow"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "running",
              "paused"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "running",
              "paused",
              "finishing",
              "expired",
              "stalled",
              "capacity_wait",
              "legacy_claim_wait",
              "paced"
            ]
          },
          "pending_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "rate_per_second": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "last_progress_at": {
            "type": "string",
            "format": "date-time",
            "description": "Last committed item admission or skip; control changes and capacity deferrals do not advance this timestamp. Omitted when no tracked progress exists."
          },
          "progress_age_seconds": {
            "type": "number",
            "minimum": 0,
            "description": "Age of last tracked progress; falls back to job creation when progress_known is false. This fallback does not reconstruct historical progress."
          },
          "progress_known": {
            "type": "boolean"
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "eligible_at": {
            "type": "string",
            "format": "date-time",
            "description": "Later of the scheduled attempt and the end of a spent rate window. Eligibility is ignored while paused."
          },
          "overdue_seconds": {
            "type": "number",
            "minimum": 0
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "expiring": {
            "type": "boolean",
            "description": "Pending work exists and expiry is within one hour or already overdue. Paused jobs retain this signal separately."
          },
          "wait_reason": {
            "type": "string",
            "enum": [
              "capacity",
              "legacy_claim"
            ],
            "description": "Most recently recorded admission wait; cleared on tracked progress."
          }
        }
      },
      "EventRecoveryNotificationRetryDecisionSummary": {
        "type": "object",
        "description": "Original retry request counts and decision time with current outcomes for its queued generations, observed at the history response timestamp.",
        "required": [
          "request_id",
          "decided_at",
          "target_count",
          "queued_count",
          "skipped_count",
          "succeeded_count",
          "failed_count",
          "pending_count",
          "unknown_count",
          "status",
          "evidence_complete"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "decided_at": {
            "type": "string",
            "format": "date-time"
          },
          "target_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "queued_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "skipped_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "succeeded_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "failed_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "pending_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "unknown_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "status": {
            "type": "string",
            "enum": [
              "succeeded",
              "failed",
              "pending",
              "inconclusive"
            ],
            "description": "Aggregate outcome for original queued generations. Known failure takes precedence, then unknown evidence or no queued targets, then pending; success requires every queued target succeeded."
          },
          "evidence_complete": {
            "type": "boolean",
            "description": "True when every queued target has a known outcome and complete retained attempt sequence. All-skipped requests have complete empty evidence but are inconclusive."
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Latest terminal attempt finish time, present only when every queued target has a retained terminal outcome and at least one target was queued."
          }
        }
      },
      "EventRecoveryNotificationRetryBacklog": {
        "type": "object",
        "description": "App-wide notification retry evidence from a bounded job page. Counts cover scanned jobs before filtering and never imply whole-app totals across unseen pages.",
        "required": [
          "app_id",
          "observed_at",
          "jobs_scanned",
          "counts_scope",
          "totals",
          "matched_count",
          "requests"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "jobs_scanned": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10
          },
          "counts_scope": {
            "type": "string",
            "enum": [
              "job_page"
            ]
          },
          "totals": {
            "$ref": "#/components/schemas/EventRecoveryNotificationRetryBacklogTotals"
          },
          "matched_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000
          },
          "next_cursor": {
            "type": "string"
          },
          "requests": {
            "type": "array",
            "maxItems": 1000,
            "items": {
              "$ref": "#/components/schemas/EventRecoveryNotificationRetryBacklogRequest"
            }
          }
        }
      },
      "EventRecoveryNotificationRetryBacklogTotals": {
        "type": "object",
        "description": "Counts of every saved retry request in the inspected app job page before filtering. Request statuses partition request_count and incomplete evidence overlaps those statuses.",
        "required": [
          "request_count",
          "succeeded_count",
          "failed_count",
          "pending_count",
          "inconclusive_count",
          "incomplete_evidence_count"
        ],
        "properties": {
          "request_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000
          },
          "succeeded_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000
          },
          "failed_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000
          },
          "pending_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000
          },
          "inconclusive_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000
          },
          "incomplete_evidence_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000
          }
        }
      },
      "EventRecoveryNotificationRetryBacklogRequest": {
        "type": "object",
        "description": "One saved retry request found in an owned retained app recovery job, with original-generation outcome summary and metadata-only inspection paths.",
        "required": [
          "job_id",
          "job_created_at",
          "summary",
          "detail_path",
          "retry_preview_path"
        ],
        "properties": {
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "job_created_at": {
            "type": "string",
            "format": "date-time"
          },
          "summary": {
            "$ref": "#/components/schemas/EventRecoveryNotificationRetryDecisionSummary"
          },
          "detail_path": {
            "type": "string"
          },
          "retry_preview_path": {
            "type": "string"
          }
        }
      },
      "EventRecoveryNotificationRetryHistoryTotals": {
        "type": "object",
        "description": "Counts of all retained retry requests in the owned job before status filtering, observed at the enclosing history timestamp. Request status counts sum to request_count; evidence gaps are counted separately.",
        "required": [
          "request_count",
          "succeeded_count",
          "failed_count",
          "pending_count",
          "inconclusive_count",
          "incomplete_evidence_count"
        ],
        "properties": {
          "request_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "succeeded_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "failed_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "pending_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "inconclusive_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "incomplete_evidence_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          }
        }
      },
      "EventRecoveryNotificationRetryHistory": {
        "type": "object",
        "description": "Retained explicit retry decisions for one recovery job, optionally filtered by status and newest first. The job stores at most 100 decisions and pruning removes this history.",
        "required": [
          "job_id",
          "app_id",
          "observed_at",
          "decisions",
          "matched_count",
          "totals"
        ],
        "properties": {
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "matched_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Number of returned request summaries matching the optional status filter."
          },
          "totals": {
            "$ref": "#/components/schemas/EventRecoveryNotificationRetryHistoryTotals"
          },
          "decisions": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/EventRecoveryNotificationRetryDecisionSummary"
            }
          }
        }
      },
      "EventRecoveryNotificationRetryDecision": {
        "type": "object",
        "description": "Immutable original receiver decision alongside current retained delivery status. An unavailable current row does not rewrite or invalidate the original result.",
        "required": [
          "target",
          "state",
          "current_delivery_status",
          "retry_outcome",
          "retained_attempt_count",
          "attempt_count_complete"
        ],
        "properties": {
          "target": {
            "$ref": "#/components/schemas/EventRecoveryNotificationRetryTarget"
          },
          "state": {
            "type": "string",
            "enum": [
              "queued",
              "skipped"
            ]
          },
          "reason": {
            "type": "string"
          },
          "replay_generation": {
            "type": "integer",
            "minimum": 0
          },
          "current_delivery_status": {
            "type": "string"
          },
          "current_replay_generation": {
            "type": "integer",
            "minimum": 0
          },
          "retry_outcome": {
            "type": "string",
            "enum": [
              "not_applicable",
              "pending",
              "succeeded",
              "failed",
              "unknown"
            ],
            "description": "Outcome of the originally queued generation. Retained terminal attempts prove success or failure; matching active delivery proves pending. Missing evidence is unknown and skipped decisions are not applicable."
          },
          "retained_attempt_count": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of retained completed attempts for the originally queued generation, excluding other generations and in-flight attempts."
          },
          "attempt_count_complete": {
            "type": "boolean",
            "description": "True when retained attempt numbers form a complete sequence through the known outcome; unknown outcomes always report false. Not applicable decisions have a complete zero count."
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Finish time of the retained terminal attempt for the originally queued generation, present only for succeeded or failed outcomes."
          }
        }
      },
      "EventRecoveryNotificationRetryDecisionDetail": {
        "type": "object",
        "description": "Saved per receiver decision for one retry request, with a separate timestamp for the read of current retained delivery state.",
        "required": [
          "job_id",
          "app_id",
          "request_id",
          "decided_at",
          "current_status_observed_at",
          "decisions"
        ],
        "properties": {
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "decided_at": {
            "type": "string",
            "format": "date-time"
          },
          "current_status_observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "decisions": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/EventRecoveryNotificationRetryDecision"
            }
          }
        }
      },
      "EventRecoveryNotificationRetryTarget": {
        "type": "object",
        "additionalProperties": false,
        "description": "Exact receiver selection and expected delivery generation copied from a recovery notification retry preview. Repeated delivery IDs are rejected.",
        "required": [
          "kind",
          "webhook_id",
          "delivery_id",
          "expected_replay_generation"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "admission",
              "execution",
              "attention"
            ]
          },
          "webhook_id": {
            "type": "string",
            "format": "uuid"
          },
          "delivery_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_replay_generation": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483646
          }
        }
      },
      "EventRecoveryNotificationRetryRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Explicit retry intent with a canonical nonzero UUID request identity. Target order is ignored for idempotency; target fields are immutable under this identity.",
        "required": [
          "request_id",
          "targets"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "targets": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/EventRecoveryNotificationRetryTarget"
            }
          }
        }
      },
      "EventRecoveryNotificationRetryPreview": {
        "type": "object",
        "description": "Advisory current receiver eligibility for a retained recovery job. Admission and execution entries remain separate. Missing evidence cannot create a receiver or authorize replay.",
        "required": [
          "job_id",
          "app_id",
          "observed_at",
          "counts_complete",
          "receivers"
        ],
        "properties": {
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "counts_complete": {
            "type": "boolean"
          },
          "receivers": {
            "type": "array",
            "maxItems": 200,
            "items": {
              "$ref": "#/components/schemas/EventRecoveryNotificationRetryCandidate"
            }
          }
        }
      },
      "EventRecoveryNotificationRetryCandidate": {
        "type": "object",
        "description": "One observed receiver with its current generation and eligibility. Missing delivery identity prevents selecting this receiver for retry.",
        "required": [
          "kind",
          "webhook_id",
          "replay_generation",
          "status",
          "eligible"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "admission",
              "execution",
              "attention"
            ]
          },
          "webhook_id": {
            "type": "string",
            "format": "uuid"
          },
          "delivery_id": {
            "type": "string",
            "format": "uuid"
          },
          "replay_generation": {
            "type": "integer",
            "minimum": 0
          },
          "status": {
            "type": "string"
          },
          "eligible": {
            "type": "boolean"
          },
          "reason": {
            "type": "string"
          }
        }
      },
      "EventRecoveryNotificationRetryResult": {
        "type": "object",
        "description": "Frozen decision for an explicitly requested receiver. Queued starts a new delivery generation; skipped preserves delivery state and explains the reason.",
        "required": [
          "target",
          "state"
        ],
        "properties": {
          "target": {
            "$ref": "#/components/schemas/EventRecoveryNotificationRetryTarget"
          },
          "state": {
            "type": "string",
            "enum": [
              "queued",
              "skipped"
            ]
          },
          "reason": {
            "type": "string"
          },
          "replay_generation": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "EventRecoveryNotificationRetryResponse": {
        "type": "object",
        "description": "Durable metadata-only receiver decisions, sorted by delivery ID and retained with the owning recovery job. Retrying identical intent returns this original response, including skipped decisions and decision time.",
        "required": [
          "job_id",
          "app_id",
          "request_id",
          "decided_at",
          "results"
        ],
        "properties": {
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "decided_at": {
            "type": "string",
            "format": "date-time"
          },
          "results": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/EventRecoveryNotificationRetryResult"
            }
          }
        }
      },
      "EventRecoveryNotificationsHealth": {
        "type": "object",
        "description": "Bounded retained notification candidates, oldest admission completion first. Candidate-set completeness is separate from phase evidence completeness. Counts describe jobs and can overlap; reads do not capture or retry notifications.",
        "required": [
          "coverage",
          "observed_jobs",
          "counts_complete",
          "job_limit",
          "overdue_grace_seconds",
          "admission",
          "execution",
          "jobs"
        ],
        "properties": {
          "coverage": {
            "type": "string",
            "enum": [
              "bounded_retained_notification_jobs"
            ]
          },
          "observed_jobs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "counts_complete": {
            "type": "boolean"
          },
          "job_limit": {
            "type": "integer",
            "enum": [
              50
            ]
          },
          "overdue_grace_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "admission": {
            "$ref": "#/components/schemas/EventRecoveryNotificationHealthCounts"
          },
          "execution": {
            "$ref": "#/components/schemas/EventRecoveryNotificationHealthCounts"
          },
          "jobs": {
            "type": "array",
            "maxItems": 3,
            "items": {
              "$ref": "#/components/schemas/EventRecoveryNotificationJobHealth"
            }
          }
        }
      },
      "EventRecoveryNotificationHealthCounts": {
        "type": "object",
        "description": "Per-phase notification job counts. Incomplete evidence or candidate truncation makes these lower bounds; partial observations cannot clear alerts and can only trigger satisfied greater-than comparisons.",
        "required": [
          "counts_complete",
          "overdue_jobs",
          "dead_jobs",
          "unknown_jobs",
          "no_receivers_jobs"
        ],
        "properties": {
          "counts_complete": {
            "type": "boolean"
          },
          "overdue_jobs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "dead_jobs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unknown_jobs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "no_receivers_jobs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "EventRecoveryNotificationJobHealth": {
        "type": "object",
        "description": "Diagnostic notification sample. Overdue requires a known unacknowledged receiver and a capture timestamp at least fifteen minutes old. Missing receiver history does not prove delivery failure.",
        "required": [
          "job_id",
          "kind",
          "capture_status",
          "acknowledgement_status",
          "evidence_source",
          "overdue",
          "dead",
          "unknown",
          "no_receivers"
        ],
        "properties": {
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "admission",
              "execution",
              "attention"
            ]
          },
          "event": {
            "type": "string"
          },
          "capture_status": {
            "type": "string"
          },
          "acknowledgement_status": {
            "type": "string"
          },
          "evidence_source": {
            "type": "string"
          },
          "captured_at": {
            "type": "string",
            "format": "date-time"
          },
          "unacknowledged_age_seconds": {
            "type": "number",
            "minimum": 0
          },
          "overdue": {
            "type": "boolean"
          },
          "dead": {
            "type": "boolean"
          },
          "unknown": {
            "type": "boolean"
          },
          "no_receivers": {
            "type": "boolean"
          }
        }
      },
      "EventRecoveryExecutionHealth": {
        "type": "object",
        "description": "Oldest retained admission jobs including active native recovery jobs still missing exact saved execution results. Counts overlap and are lower bounds when counts_complete is false. Reads do not capture results or notifications.",
        "required": [
          "coverage",
          "observed_jobs",
          "waiting_jobs",
          "prolonged_wait_jobs",
          "unknown_jobs",
          "retention_risk_jobs",
          "counts_complete",
          "job_limit",
          "wait_warning_seconds",
          "retention_warning_seconds",
          "jobs"
        ],
        "properties": {
          "coverage": {
            "type": "string",
            "enum": [
              "bounded_retained_execution_jobs"
            ]
          },
          "observed_jobs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "stalled_jobs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "deadline_exceeded_jobs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "waiting_jobs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "prolonged_wait_jobs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unknown_jobs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "retention_risk_jobs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "counts_complete": {
            "type": "boolean"
          },
          "job_limit": {
            "type": "integer",
            "enum": [
              50
            ]
          },
          "wait_warning_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "retention_warning_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "jobs": {
            "type": "array",
            "maxItems": 3,
            "items": {
              "$ref": "#/components/schemas/EventRecoveryExecutionJobHealth"
            }
          }
        }
      },
      "EventRecoveryExecutionJobHealth": {
        "type": "object",
        "description": "Wait age starts at admission completion or creation while admission is active; prolonged waits do not assert scheduler or handler failure. retain_until is the nominal job retention boundary. Unknown includes admitted items without replay identity. Awaiting saved results counts known terminal observations without saved confirmation.",
        "required": [
          "job_id",
          "state",
          "status",
          "completed_at",
          "wait_age_seconds",
          "retain_until",
          "prolonged_wait",
          "retention_risk",
          "notification_pending",
          "queued_count",
          "untracked_count",
          "unknown_count",
          "unresolved_count",
          "awaiting_saved_results_count",
          "execution"
        ],
        "properties": {
          "attention": {
            "$ref": "#/components/schemas/WorkflowRecoveryExecutionAttention"
          },
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "parent_job_id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "running",
              "paused",
              "completed",
              "cancelled",
              "expired"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "stalled",
              "deadline_exceeded",
              "capacity_wait",
              "scheduled_wait",
              "waiting",
              "prolonged_wait",
              "unknown",
              "retention_risk"
            ]
          },
          "completed_at": {
            "description": "Admission completion time or job creation time while admission is active.",
            "type": "string",
            "format": "date-time"
          },
          "wait_age_seconds": {
            "type": "number",
            "minimum": 0
          },
          "retain_until": {
            "type": "string",
            "format": "date-time"
          },
          "prolonged_wait": {
            "type": "boolean"
          },
          "retention_risk": {
            "type": "boolean"
          },
          "notification_pending": {
            "type": "boolean"
          },
          "queued_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "untracked_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unknown_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unresolved_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "awaiting_saved_results_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "execution": {
            "$ref": "#/components/schemas/EventRecoveryExecutionSummary"
          }
        }
      },
      "EventRecoveryNotifications": {
        "type": "object",
        "additionalProperties": false,
        "description": "Metadata-only recovery notification report. A captured event does not imply acknowledgement. Reads do not capture events, relay the outbox or retry deliveries. Missing or pruned receiver evidence remains unknown.",
        "required": [
          "job_id",
          "app_id",
          "app_slug",
          "observed_at",
          "receiver_limit",
          "notifications"
        ],
        "properties": {
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_slug": {
            "type": "string"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "receiver_limit": {
            "type": "integer",
            "enum": [
              100
            ]
          },
          "notifications": {
            "type": "array",
            "minItems": 2,
            "maxItems": 3,
            "items": {
              "$ref": "#/components/schemas/EventRecoveryNotification"
            }
          }
        }
      },
      "EventRecoveryNotification": {
        "type": "object",
        "additionalProperties": false,
        "description": "Receiver selection is frozen at capture, including an empty selection. Retained deliveries alone cannot prove the complete selection. Counts describe observed receivers and may be lower bounds. Unknown receivers prevent acknowledged status; no_receivers is distinct from acknowledgement. Pending captures have no receiver selection yet.",
        "required": [
          "kind",
          "capture_status",
          "evidence_source",
          "recipients_known",
          "counts_complete",
          "acknowledgement_status",
          "pending_count",
          "in_flight_count",
          "succeeded_count",
          "failed_count",
          "dead_count",
          "awaiting_relay_count",
          "unknown_count",
          "receivers"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "admission",
              "execution",
              "attention"
            ]
          },
          "event": {
            "type": "string",
            "enum": [
              "event_recovery.completed",
              "event_recovery.cancelled",
              "event_recovery.expired",
              "event_recovery.execution_finished",
              "event_recovery.execution_attention"
            ]
          },
          "event_id": {
            "type": "string",
            "format": "uuid"
          },
          "capture_status": {
            "type": "string",
            "enum": [
              "pending",
              "captured",
              "not_applicable",
              "unknown"
            ]
          },
          "captured_at": {
            "type": "string",
            "format": "date-time"
          },
          "evidence_source": {
            "type": "string",
            "enum": [
              "capture_snapshot",
              "retained_outbox",
              "retained_deliveries",
              "unavailable"
            ]
          },
          "recipients_known": {
            "type": "boolean"
          },
          "selected_recipient_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "counts_complete": {
            "type": "boolean"
          },
          "acknowledgement_status": {
            "type": "string",
            "enum": [
              "unacknowledged",
              "acknowledged",
              "no_receivers",
              "unknown",
              "not_applicable"
            ]
          },
          "pending_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "in_flight_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "succeeded_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "failed_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "dead_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "awaiting_relay_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unknown_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "receivers": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/EventRecoveryNotificationReceiver"
            }
          }
        }
      },
      "EventRecoveryNotificationReceiver": {
        "type": "object",
        "additionalProperties": false,
        "description": "A receiver from the frozen selection or retained delivery evidence. awaiting_relay requires a retained outbox; otherwise absent delivery evidence is unknown. Attempt counts reset on manual retry; replay_generation distinguishes budgets. No payloads, target URLs, errors, headers or secrets are included.",
        "required": [
          "webhook_id",
          "receiver_available",
          "status",
          "attempt",
          "replay_generation",
          "last_response_code"
        ],
        "properties": {
          "webhook_id": {
            "type": "string",
            "format": "uuid"
          },
          "receiver_available": {
            "type": "boolean",
            "description": "The selected subscription still exists in this account and app; this does not assert that it is enabled or its target is reachable."
          },
          "delivery_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "in_flight",
              "succeeded",
              "failed",
              "dead",
              "awaiting_relay",
              "unknown"
            ]
          },
          "attempt": {
            "type": "integer",
            "minimum": 0
          },
          "replay_generation": {
            "type": "integer",
            "minimum": 0
          },
          "last_response_code": {
            "type": "integer",
            "minimum": 0
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "delivered_at": {
            "type": "string",
            "format": "date-time"
          },
          "attempts_path": {
            "type": "string",
            "description": "Relative path to existing paginated attempt history, when the delivery and subscription are retained."
          },
          "retry_path": {
            "type": "string",
            "description": "Relative POST path for existing independent dead-letter retry, when available. Reporting never invokes it."
          }
        }
      },
      "EventRecoveryHealth": {
        "description": "Application admission health and bounded unresolved execution health with sampled actionable jobs.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "capacity_wait_warning_seconds",
          "capacity_waiting_jobs",
          "prolonged_capacity_wait_jobs",
          "app_id",
          "observed_at",
          "stall_grace_seconds",
          "expiry_warning_seconds",
          "running_jobs",
          "paused_jobs",
          "stalled_jobs",
          "expiring_jobs",
          "paused_expiring_jobs",
          "jobs"
        ],
        "properties": {
          "notifications": {
            "$ref": "#/components/schemas/EventRecoveryNotificationsHealth"
          },
          "execution": {
            "$ref": "#/components/schemas/EventRecoveryExecutionHealth"
          },
          "capacity_wait_warning_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "capacity_waiting_jobs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Running capacity-wait jobs observed within the five-minute freshness grace."
          },
          "prolonged_capacity_wait_jobs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Fresh running capacity episodes lasting at least fifteen minutes; excludes paused and expired jobs and scheduler stalls."
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "stall_grace_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "expiry_warning_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "running_jobs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "paused_jobs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "stalled_jobs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "expiring_jobs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Running jobs with pending work approaching expiry; excludes paused jobs."
          },
          "paused_expiring_jobs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "jobs": {
            "type": "array",
            "maxItems": 3,
            "items": {
              "$ref": "#/components/schemas/EventRecoveryJobHealth"
            }
          }
        }
      },
      "EventRecoveryFinishedWebhookPayload": {
        "type": "object",
        "additionalProperties": false,
        "description": "Frozen terminal recovery admission metadata. Completed means recovery admission finished; admitted handler executions and routing retries can continue. Expired uses stored cancelled state with distinct expired outcome. JSON delivery nests this payload under payload.data; CloudEvents uses data. The event_id is stable across receivers and attempts, independently of each receiver delivery ID.",
        "required": [
          "event_id",
          "job_id",
          "app_id",
          "mode",
          "state",
          "outcome",
          "selected_count",
          "pending_count",
          "queued_count",
          "skipped_count",
          "cancelled_count",
          "created_at",
          "expires_at",
          "completed_at"
        ],
        "properties": {
          "event_id": {
            "type": "string",
            "format": "uuid"
          },
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "mode": {
            "type": "string",
            "enum": [
              "routing",
              "execution",
              "workflow"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "completed",
              "cancelled"
            ]
          },
          "outcome": {
            "type": "string",
            "enum": [
              "completed",
              "cancelled",
              "expired"
            ]
          },
          "selected_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 10000
          },
          "pending_count": {
            "type": "integer",
            "format": "int64",
            "enum": [
              0
            ]
          },
          "queued_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 10000
          },
          "skipped_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 10000
          },
          "cancelled_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 10000
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EventRecoveryExecutionFinishedWebhookPayload": {
        "type": "object",
        "additionalProperties": false,
        "description": "Frozen confirmed terminal execution results for all queued invocation deliveries or workflow resumes after admission finishes. Unknown outcomes block capture. Separate from event_recovery.completed; does not imply every execution succeeded or any receiver acknowledged.",
        "required": [
          "event_id",
          "job_id",
          "app_id",
          "mode",
          "state",
          "outcome",
          "selected_count",
          "pending_count",
          "queued_count",
          "skipped_count",
          "cancelled_count",
          "created_at",
          "expires_at",
          "completed_at",
          "execution",
          "execution_finished_at",
          "unresolved_count"
        ],
        "properties": {
          "event_id": {
            "type": "string",
            "format": "uuid"
          },
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "mode": {
            "type": "string",
            "enum": [
              "execution",
              "workflow"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "completed",
              "cancelled",
              "expired"
            ]
          },
          "outcome": {
            "type": "string",
            "enum": [
              "all_succeeded",
              "finished_with_non_success"
            ]
          },
          "selected_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 10000
          },
          "pending_count": {
            "type": "integer",
            "format": "int64",
            "enum": [
              0
            ]
          },
          "queued_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 10000
          },
          "skipped_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 10000
          },
          "cancelled_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 10000
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          },
          "execution": {
            "$ref": "#/components/schemas/EventRecoveryExecutionSummary"
          },
          "execution_finished_at": {
            "type": "string",
            "format": "date-time"
          },
          "items_url": {
            "type": "string",
            "format": "uri-reference",
            "description": "Authenticated relative API link to paginated recovery items and their invocation/run identifiers."
          },
          "unresolved_count": {
            "type": "integer",
            "format": "int64",
            "enum": [
              0
            ],
            "description": "Unknown or nonterminal queued deliveries; capture requires zero."
          }
        }
      },
      "EventRecoveryControlRequest": {
        "description": "Optional audit reason attached to a recovery pause, resume or cancellation.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "reason": {
            "type": "string",
            "maxLength": 512,
            "description": "Optional operator reason, at most 512 UTF-8 bytes without control characters."
          }
        }
      },
      "EventRecoveryHistoryEntry": {
        "description": "Immutable recovery lifecycle or control action with actor identity and previous settings.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "occurred_at",
          "action",
          "actor_kind",
          "actor_id",
          "previous_state",
          "state",
          "previous_rate",
          "rate"
        ],
        "properties": {
          "target_position": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 25
          },
          "target_run_id": {
            "type": "string",
            "format": "uuid"
          },
          "target_resume_count": {
            "type": "integer",
            "minimum": 1,
            "maximum": 16
          },
          "id": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "action": {
            "type": "string",
            "enum": [
              "created",
              "paused",
              "resumed",
              "rate_changed",
              "cancelled",
              "expired",
              "workflow_cancelled"
            ]
          },
          "actor_kind": {
            "type": "string",
            "enum": [
              "account",
              "api_key",
              "internal",
              "system"
            ]
          },
          "actor_id": {
            "type": "string",
            "description": "Authenticated account or API key ID, or an internal/system identifier. No credential values."
          },
          "reason": {
            "type": "string",
            "maxLength": 512
          },
          "previous_state": {
            "type": "string",
            "enum": [
              "",
              "running",
              "paused",
              "completed",
              "cancelled"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "running",
              "paused",
              "completed",
              "cancelled"
            ]
          },
          "previous_rate": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "rate": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          }
        }
      },
      "EventRecoveryHistory": {
        "description": "Paginated chronological audit history for a retained recovery job.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "job_id",
          "entries"
        ],
        "properties": {
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "entries": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/EventRecoveryHistoryEntry"
            }
          },
          "next_after": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Exclusive last ID for the next page; omitted on the final page."
          }
        }
      },
      "EventRecoveryJobs": {
        "description": "Paginated retained recovery jobs with admission progress and account-bound discovery cursor.",
        "type": "object",
        "required": [
          "jobs"
        ],
        "properties": {
          "jobs": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/EventRecoveryJob"
            }
          },
          "next_cursor": {
            "type": "string",
            "description": "Omitted on the final page. Preserve the same app and filters; page size may change."
          }
        }
      },
      "EventRecoveryItems": {
        "description": "Paginated frozen recovery items and their individual admission outcomes.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "job_id",
          "items"
        ],
        "properties": {
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "items": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/EventRecoveryItem"
            }
          },
          "next_after": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Last item position for the next page; absent on the final page."
          }
        }
      },
      "EventOrderingBlocker": {
        "type": "object",
        "additionalProperties": false,
        "description": "Earliest unresolved routing recipient in the captured ordered lane; excludes event data and resolved work keys.",
        "required": [
          "event_source",
          "event_id",
          "subscription_id",
          "accepted_at",
          "state",
          "age_seconds",
          "receipt_url"
        ],
        "properties": {
          "event_source": {
            "type": "string"
          },
          "event_id": {
            "type": "string"
          },
          "subscription_id": {
            "type": "string"
          },
          "accepted_at": {
            "type": "string",
            "format": "date-time"
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "processing"
            ]
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "age_seconds": {
            "type": "number",
            "format": "double",
            "minimum": 0
          },
          "receipt_url": {
            "type": "string",
            "format": "uri-reference"
          }
        }
      },
      "EventBacklogConsumer": {
        "type": "object",
        "additionalProperties": false,
        "description": "Exact counts over all matching waiting recipients for one app/subscription/consumer kind, independent of recipient pagination.",
        "required": [
          "app_id",
          "app_slug",
          "target_available",
          "subscription_id",
          "consumer_kind",
          "waiting_recipients",
          "pending_recipients",
          "processing_recipients",
          "capacity_waiting_recipients",
          "ordering_waiting_recipients",
          "oldest_accepted_at",
          "oldest_age_seconds"
        ],
        "properties": {
          "pending_waiting_reasons": {
            "type": "object",
            "description": "Exact mutually exclusive effective waiting-reason counts over matching pending recipients, including zero values for known reasons. Independent of recipient pagination.",
            "additionalProperties": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          "capacity_consumer_waiting_recipients": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Complete count with effective capacity_consumer waiting reason."
          },
          "capacity_app_waiting_recipients": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Complete count with effective capacity_app waiting reason."
          },
          "capacity_account_waiting_recipients": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Complete count with effective capacity_account waiting reason."
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_slug": {
            "type": "string"
          },
          "target_available": {
            "type": "boolean"
          },
          "subscription_id": {
            "type": "string"
          },
          "consumer_kind": {
            "type": "string",
            "enum": [
              "application",
              "workflow"
            ]
          },
          "waiting_recipients": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "pending_recipients": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "processing_recipients": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "capacity_waiting_recipients": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "ordering_waiting_recipients": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "oldest_accepted_at": {
            "type": "string",
            "format": "date-time"
          },
          "oldest_age_seconds": {
            "type": "number",
            "format": "double",
            "minimum": 0
          }
        }
      },
      "EventStorageUsageResponse": {
        "description": "Retained customer event counts, logical JSON bytes, pending age and current account budgets.",
        "example": {
          "retained_events": 0,
          "retained_bytes": 0,
          "pending_events": 0,
          "oldest_pending_at": null,
          "limits": {
            "retained_events": 131072,
            "retained_bytes": 268435456,
            "settled_retention_seconds": 259200
          }
        },
        "type": "object",
        "additionalProperties": false,
        "required": [
          "retained_events",
          "retained_bytes",
          "pending_events",
          "oldest_pending_at",
          "limits"
        ],
        "properties": {
          "retained_events": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "retained_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "pending_events": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "oldest_pending_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "limits": {
            "example": {
              "retained_events": 131072,
              "retained_bytes": 268435456,
              "settled_retention_seconds": 259200
            },
            "type": "object",
            "additionalProperties": false,
            "required": [
              "retained_events",
              "retained_bytes"
            ],
            "properties": {
              "retained_events": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "retained_bytes": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "settled_retention_seconds": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "How long a settled receipt is kept on the plan; it bounds duplicate acceptance, recovery and replay ranges. Absent from servers that predate per-plan windows."
              }
            }
          }
        }
      },
      "RegisterEventSchemaRequest": {
        "description": "Immutable event schema registration request.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "source",
          "type",
          "version",
          "schema"
        ],
        "properties": {
          "source": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "version": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$"
          },
          "schema": {
            "description": "Draft 2020-12 JSON Schema, at most 64 KiB, without external references."
          }
        }
      },
      "RegisterEventSchemaResponse": {
        "description": "Receipt for an immutable event schema version.",
        "type": "object",
        "required": [
          "source",
          "type",
          "version",
          "created"
        ],
        "properties": {
          "source": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "created": {
            "type": "boolean"
          }
        }
      },
      "EventSchemaRolloutRequest": {
        "description": "Candidate event schema and bounded retained-event sample settings for a read-only rollout preview.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "source",
          "type",
          "version"
        ],
        "properties": {
          "source": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Concrete event source; wildcard patterns are not allowed."
          },
          "type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Concrete event type; wildcard patterns are not allowed."
          },
          "version": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$"
          },
          "schema": {
            "description": "Proposed Draft 2020-12 JSON Schema, at most 64 KiB; external references are forbidden. Omit to use the registered version. It is never registered by this request."
          },
          "samples": {
            "type": "array",
            "maxItems": 20,
            "description": "Event data values to validate, at most 64 KiB each. No event envelopes are required.",
            "items": {}
          },
          "from": {
            "type": "string",
            "format": "date-time",
            "description": "Optional inclusive platform acceptance time; requires until."
          },
          "until": {
            "type": "string",
            "format": "date-time",
            "description": "Optional exclusive acceptance time; requires from. Cut off at observed_at when in the future."
          },
          "retained_limit": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "default": 0,
            "description": "Requires a retained range when nonzero. Zero or omitted checks up to 100 matching payloads when a range is supplied."
          }
        }
      },
      "EventSchemaRolloutConsumer": {
        "description": "Application consumer selection and schema-version compatibility in a rollout preview.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "subscription_id",
          "app_id",
          "source",
          "type",
          "schema_versions",
          "accepts_version",
          "content_filter_present"
        ],
        "properties": {
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "source": {
            "type": "string",
            "description": "Subscription source pattern."
          },
          "type": {
            "type": "string",
            "description": "Subscription type pattern."
          },
          "schema_versions": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "type": "string"
            },
            "description": "Empty accepts every version."
          },
          "accepts_version": {
            "type": "boolean",
            "description": "Version selection only; no content filter evaluation or delivery guarantee."
          },
          "content_filter_present": {
            "type": "boolean"
          }
        }
      },
      "EventSchemaRolloutValidation": {
        "description": "Candidate schema validation results for bounded retained event content.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "valid"
        ],
        "properties": {
          "sample_index": {
            "type": "integer",
            "minimum": 0,
            "maximum": 19,
            "description": "Zero-based index for caller-supplied samples."
          },
          "event_id": {
            "type": "string",
            "description": "Identity for retained sample results."
          },
          "accepted_at": {
            "type": "string",
            "format": "date-time"
          },
          "valid": {
            "type": "boolean"
          },
          "reason": {
            "type": "string",
            "description": "Bounded validation category or unreadable_envelope; no payload values are returned."
          },
          "field": {
            "type": "string",
            "maxLength": 256,
            "description": "First failing field path, bounded to 256 UTF-8 bytes."
          }
        }
      },
      "EventSchemaRolloutRetained": {
        "description": "Retained sample coverage and compatibility observations for the candidate event schema.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requested",
          "scanned_count",
          "examined_count",
          "valid_count",
          "invalid_count",
          "unreadable_count",
          "truncated",
          "history_complete",
          "results"
        ],
        "properties": {
          "requested": {
            "type": "boolean"
          },
          "from": {
            "type": "string",
            "format": "date-time"
          },
          "until": {
            "type": "string",
            "format": "date-time"
          },
          "cutoff_at": {
            "type": "string",
            "format": "date-time"
          },
          "scanned_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000,
            "description": "Account receipts scanned, including unrelated sources and types."
          },
          "examined_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "valid_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "invalid_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "unreadable_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Oversized, malformed, or invalid retained envelopes excluded from validation."
          },
          "truncated": {
            "type": "boolean",
            "description": "Account scan, matching payload limit, or byte budget prevented checking all candidates."
          },
          "history_complete": {
            "type": "boolean",
            "enum": [
              false
            ],
            "description": "Retention and bounded sampling never certify complete history."
          },
          "results": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/EventSchemaRolloutValidation"
            }
          }
        }
      },
      "EventSchemaRolloutResponse": {
        "description": "Read-only event schema rollout assessment combining validation, consumer selection and retained coverage.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "source",
          "type",
          "version",
          "schema_origin",
          "schema_digest",
          "observed_at",
          "consumer_count",
          "accepting_count",
          "excluding_count",
          "consumers_truncated",
          "consumers",
          "sample_valid_count",
          "sample_invalid_count",
          "samples",
          "retained"
        ],
        "properties": {
          "source": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "schema_origin": {
            "type": "string",
            "enum": [
              "proposed",
              "registered"
            ]
          },
          "schema_digest": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "SHA-256 of the schema bytes checked."
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "consumer_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000,
            "description": "Observed matching enabled application subscriptions; a lower bound when truncated."
          },
          "accepting_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000
          },
          "excluding_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000
          },
          "consumers_truncated": {
            "type": "boolean"
          },
          "consumers": {
            "type": "array",
            "maxItems": 1000,
            "items": {
              "$ref": "#/components/schemas/EventSchemaRolloutConsumer"
            }
          },
          "sample_valid_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 20
          },
          "sample_invalid_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 20
          },
          "samples": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/EventSchemaRolloutValidation"
            }
          },
          "retained": {
            "$ref": "#/components/schemas/EventSchemaRolloutRetained"
          }
        }
      },
      "EventSchema": {
        "description": "One registered account-scoped event schema version.",
        "type": "object",
        "required": [
          "account_id",
          "source",
          "type",
          "version",
          "schema",
          "created_at"
        ],
        "properties": {
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "source": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "schema": {
            "description": "Immutable Draft 2020-12 JSON Schema."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SendAppMessageRequest": {
        "description": "A CloudEvents-compatible application-inbox message.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type",
          "data"
        ],
        "properties": {
          "environment": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{0,31}[a-z0-9])?$",
            "description": "Registered project environment. Requires an enabled environment-owned queue binding; omitted uses the default environment and legacy shared queues."
          },
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Generated when omitted."
          },
          "source": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "default": "gregale.send"
          },
          "type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "time": {
            "type": "string",
            "format": "date-time",
            "description": "Server time when omitted."
          },
          "datacontenttype": {
            "type": "string",
            "enum": [
              "application/json"
            ],
            "default": "application/json"
          },
          "data_content_type": {
            "type": "string",
            "enum": [
              "application/json"
            ],
            "deprecated": true
          },
          "data": {
            "description": "Any valid JSON value delivered inside the CloudEvents envelope."
          },
          "flag_context": {
            "type": "string",
            "maxLength": 12288,
            "description": "Optional bounded Gregale Flags context. The platform validates the envelope, binds it to its active customer, and restores it on the queued request."
          },
          "queue_name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "retry_policy": {
            "$ref": "#/components/schemas/RetryPolicyDTO"
          },
          "work": {
            "allOf": [
              {
                "$ref": "#/components/schemas/InvokeWork"
              }
            ],
            "description": "Optional application-keyed policy. Environment-owned queue bindings require a scoped policy adapter and currently reject this option."
          }
        }
      },
      "SendAppMessageResponse": {
        "description": "Durable receipt for a queued app-to-app message.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "event_id",
          "target_app",
          "status",
          "status_url"
        ],
        "properties": {
          "environment": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{0,31}[a-z0-9])?$",
            "description": "Deployment scope captured when the message was accepted."
          },
          "queue_binding_id": {
            "type": "string",
            "description": "Immutable captured queue binding identity; omitted for legacy unbound work."
          },
          "id": {
            "type": "string",
            "description": "Durable invocation identifier."
          },
          "event_id": {
            "type": "string"
          },
          "target_app": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending"
            ]
          },
          "status_url": {
            "type": "string"
          },
          "trace_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          }
        }
      },
      "EventReplayPreviewMatch": {
        "type": "object",
        "description": "Matching retained-event metadata and original recipient membership.",
        "required": [
          "event_id",
          "event_source",
          "event_type",
          "accepted_at",
          "original_recipient",
          "receipt_url",
          "delivery_expired"
        ],
        "properties": {
          "delivery_expired": {
            "type": "boolean",
            "description": "Age limit of the current subscription is exceeded at observation time; historical backfill requires an explicit override to admit it."
          },
          "delivery_deadline_at": {
            "type": "string",
            "format": "date-time"
          },
          "event_id": {
            "type": "string"
          },
          "event_source": {
            "type": "string"
          },
          "event_type": {
            "type": "string"
          },
          "schema_version": {
            "type": "string"
          },
          "accepted_at": {
            "type": "string",
            "format": "date-time"
          },
          "original_recipient": {
            "type": "string",
            "enum": [
              "captured",
              "not_captured",
              "unknown"
            ],
            "description": "Membership of the immutable original recipient snapshot; unknown indicates a legacy receipt without a snapshot. This does not indicate handler completion or replay eligibility."
          },
          "receipt_url": {
            "type": "string"
          }
        }
      },
      "EventReplayPreviewRetention": {
        "type": "object",
        "description": "Existing receipt retention information without a complete archive guarantee.",
        "required": [
          "settled_retention_seconds",
          "history_complete"
        ],
        "properties": {
          "settled_retention_seconds": {
            "type": "integer",
            "format": "int64",
            "description": "The plan's retention duration after routing settlement (86400, 259200, 604800 or 1209600 seconds on Free, Hobby, Pro and Scale); unresolved receipts may survive longer."
          },
          "earliest_retained_at": {
            "type": "string",
            "format": "date-time",
            "description": "Account-wide earliest surviving acceptance, independent of target, range and filter; absent when none survive. Does not establish coverage."
          },
          "history_complete": {
            "type": "boolean",
            "enum": [
              false
            ],
            "description": "Always false because retained receipts are not a guaranteed complete archive."
          }
        }
      },
      "EventReplayPreviewResponse": {
        "type": "object",
        "description": "Read-only current-subscription preview of one bounded retained-event page.",
        "required": [
          "app_slug",
          "subscription",
          "subscription_revision",
          "from",
          "until",
          "cutoff_at",
          "observed_at",
          "coverage",
          "retention",
          "scanned_count",
          "matched_count",
          "filter_mismatch_count",
          "pattern_mismatch_count",
          "already_captured_count",
          "matches"
        ],
        "properties": {
          "schema_version_mismatch_count": {
            "type": "integer",
            "minimum": 0,
            "description": "Schema version mismatch count in the event replay preview response: candidates excluded by schema version selection."
          },
          "expired_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Matching retained events exceeding the current subscription age limit."
          },
          "app_slug": {
            "type": "string"
          },
          "subscription": {
            "$ref": "#/components/schemas/EventSubscriptionResponse"
          },
          "subscription_revision": {
            "type": "string",
            "description": "Opaque fingerprint of the current subscription declaration."
          },
          "from": {
            "type": "string",
            "format": "date-time"
          },
          "until": {
            "type": "string",
            "format": "date-time"
          },
          "cutoff_at": {
            "type": "string",
            "format": "date-time",
            "description": "Fixed exclusive acceptance cutoff anchored on the first page."
          },
          "observed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Observation time for this page."
          },
          "coverage": {
            "type": "string",
            "enum": [
              "retained_envelopes"
            ]
          },
          "retention": {
            "$ref": "#/components/schemas/EventReplayPreviewRetention"
          },
          "scanned_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Envelopes examined on this page."
          },
          "matched_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "filter_mismatch_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "pattern_mismatch_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "already_captured_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Matching events whose original snapshot contains this target."
          },
          "matches": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/EventReplayPreviewMatch"
            }
          },
          "next_after": {
            "type": "string",
            "description": "Continue even if this page has no matches; absent when no more currently retained candidates follow."
          }
        }
      },
      "WorkflowEventReplayPreviewMatch": {
        "type": "object",
        "description": "A retained event whose captured workflow trigger matched, with routing and durable admission state.",
        "required": [
          "event_id",
          "event_source",
          "event_type",
          "accepted_at",
          "original_recipient",
          "routing_state",
          "filter_matched",
          "admission_recorded",
          "receipt_url"
        ],
        "properties": {
          "event_id": {
            "type": "string"
          },
          "event_source": {
            "type": "string"
          },
          "event_type": {
            "type": "string"
          },
          "schema_version": {
            "type": "string"
          },
          "accepted_at": {
            "type": "string",
            "format": "date-time"
          },
          "original_recipient": {
            "type": "string",
            "enum": [
              "captured"
            ],
            "description": "The immutable event snapshot contains this workflow recipient."
          },
          "routing_state": {
            "type": "string",
            "enum": [
              "pending",
              "processing",
              "filtered",
              "enqueued",
              "failed"
            ],
            "description": "Latest retained routing checkpoint for this captured workflow recipient."
          },
          "filter_matched": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "The captured workflow trigger filter matches the retained envelope."
          },
          "admission_recorded": {
            "type": "boolean",
            "description": "A durable workflow admission receipt exists. This is the event/recipient deduplication key even if its run was later pruned."
          },
          "workflow_run_id": {
            "type": "string",
            "format": "uuid",
            "description": "Run ID while the linked workflow run remains retained."
          },
          "workflow_run_status": {
            "type": "string",
            "description": "Current retained workflow run state when the run still exists."
          },
          "receipt_url": {
            "type": "string"
          }
        }
      },
      "WorkflowEventReplayPreviewResponse": {
        "type": "object",
        "description": "Read-only, bounded preview of captured workflow event recipients; potential admissions do not guarantee future workflow admission.",
        "required": [
          "app_slug",
          "workflow_name",
          "from",
          "until",
          "cutoff_at",
          "observed_at",
          "coverage",
          "retention",
          "scanned_count",
          "captured_count",
          "matched_count",
          "filter_mismatch_count",
          "not_captured_count",
          "unknown_recipient_count",
          "already_admitted_count",
          "potential_admission_count",
          "matches"
        ],
        "properties": {
          "app_slug": {
            "type": "string"
          },
          "workflow_name": {
            "type": "string"
          },
          "from": {
            "type": "string",
            "format": "date-time"
          },
          "until": {
            "type": "string",
            "format": "date-time"
          },
          "cutoff_at": {
            "type": "string",
            "format": "date-time",
            "description": "Acceptance-time upper bound carried forward from the first page."
          },
          "observed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Server timestamp when this workflow preview page was assembled."
          },
          "coverage": {
            "type": "string",
            "enum": [
              "retained_envelopes"
            ]
          },
          "retention": {
            "$ref": "#/components/schemas/EventReplayPreviewRetention"
          },
          "scanned_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Retained envelopes examined on this page."
          },
          "captured_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Envelopes whose original snapshot contains the named app workflow."
          },
          "matched_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Captured recipients whose immutable trigger filter matches the event."
          },
          "filter_mismatch_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "not_captured_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Envelopes with a captured snapshot that excludes this workflow recipient."
          },
          "unknown_recipient_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Legacy envelopes without an original recipient snapshot."
          },
          "already_admitted_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Matching recipients with a durable admission receipt; these are deduplicated."
          },
          "potential_admission_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Matching recipients without an admission receipt; not a guarantee of future quota or target eligibility."
          },
          "matches": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/WorkflowEventReplayPreviewMatch"
            }
          },
          "next_after": {
            "type": "string",
            "description": "Continue even if this page has no matches; absent when no more currently retained envelopes follow."
          }
        }
      },
      "EventReplayBackfillRequest": {
        "description": "Acceptance-time range for a durable subscription event backfill.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "from",
          "until"
        ],
        "properties": {
          "allow_expired": {
            "type": "boolean",
            "default": false,
            "description": "Explicitly override delivery age for this replay generation or historical backfill job. Preserves deterministic invocation identity and manual controls."
          },
          "from": {
            "type": "string",
            "format": "date-time",
            "description": "Inclusive platform acceptance-time lower bound."
          },
          "until": {
            "type": "string",
            "format": "date-time",
            "description": "Exclusive upper bound; future values are capped at creation time. The range may not exceed the plan's settled-receipt window."
          }
        }
      },
      "WorkflowEventReplayBackfillRequest": {
        "description": "Current event-triggered workflow and acceptance-time range for a durable historical run-admission job.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "workflow_name",
          "from",
          "until"
        ],
        "properties": {
          "workflow_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Workflow in the app's preferred live default deployment; its definition is pinned when the job is created."
          },
          "from": {
            "type": "string",
            "format": "date-time",
            "description": "Inclusive lower bound on platform event acceptance."
          },
          "until": {
            "type": "string",
            "format": "date-time",
            "description": "Exclusive acceptance upper bound; future values stop at job creation. The range may not exceed the plan's settled-receipt window."
          }
        }
      },
      "EventReplayBackfillRetryRequest": {
        "description": "Bound for the number of failed routing recipients requeued in this call.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 100,
            "description": "Maximum failed routing recipients to requeue in this call."
          }
        }
      },
      "EventReplayBackfillItemResponse": {
        "description": "Metadata-only outcome for one envelope included in a durable backfill.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "event_source",
          "event_id",
          "event_type",
          "accepted_at",
          "state",
          "attempts",
          "retryable",
          "updated_at"
        ],
        "properties": {
          "event_source": {
            "type": "string"
          },
          "event_id": {
            "type": "string"
          },
          "event_type": {
            "type": "string"
          },
          "schema_version": {
            "type": "string"
          },
          "accepted_at": {
            "type": "string",
            "format": "date-time"
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "processing",
              "enqueued",
              "filtered",
              "failed",
              "skipped_captured",
              "skipped_unknown",
              "skipped_existing",
              "skipped_unsettled",
              "cancelled"
            ]
          },
          "attempts": {
            "type": "integer",
            "minimum": 0
          },
          "failure_code": {
            "type": "string"
          },
          "last_error": {
            "type": "string",
            "description": "Routing diagnostic clipped to at most 1024 UTF-8 bytes."
          },
          "details_truncated": {
            "type": "boolean",
            "description": "Whether the failure code or routing diagnostic was clipped."
          },
          "retryable": {
            "type": "boolean"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "receipt_url": {
            "type": "string",
            "format": "uri-reference",
            "description": "Account-authenticated receipt inspection; omitted after the original receipt expires."
          },
          "attempt_history_url": {
            "type": "string",
            "format": "uri-reference",
            "description": "Handler attempt history for this consumer; omitted when retained delivery provenance or current app ownership is unavailable."
          },
          "workflow_run_id": {
            "type": "string",
            "format": "uuid",
            "description": "Retained workflow run admitted for this item, when still present."
          },
          "workflow_run_status": {
            "type": "string",
            "description": "Current state of the retained workflow run, when still present."
          }
        }
      },
      "EventReplayBackfillItemsResponse": {
        "description": "Stable acceptance-ordered page of per-envelope outcomes for one backfill job.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "job_id",
          "items"
        ],
        "properties": {
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "items": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/EventReplayBackfillItemResponse"
            }
          },
          "next_after": {
            "type": "string",
            "description": "Continue with the same job and state filter; absent when the page is final."
          }
        }
      },
      "EventReplayBackfillProgress": {
        "description": "Durable scan outcomes and current routing state for a backfill job.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "scanned",
          "matched",
          "filtered",
          "pending",
          "processing",
          "enqueued",
          "failed",
          "retryable_failed",
          "skipped_captured",
          "skipped_unknown",
          "skipped_existing",
          "skipped_unsettled"
        ],
        "properties": {
          "scanned": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "matched": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "filtered": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "pending": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "processing": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "enqueued": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Routing admitted an invocation; handler completion is separate."
          },
          "failed": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "retryable_failed": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Failed recipient deliveries eligible for the retry-failed operation."
          },
          "skipped_captured": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "skipped_unknown": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "skipped_existing": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "skipped_unsettled": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cancelled": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Deliveries the job dropped undelivered when it ended early."
          }
        }
      },
      "EventReplayBackfillJobResponse": {
        "description": "Progress and immutable selection details for one durable event backfill.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "app_slug",
          "consumer_kind",
          "from",
          "until",
          "cutoff_at",
          "history_complete",
          "duplicate_policy",
          "state",
          "scan_complete",
          "progress",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_slug": {
            "type": "string"
          },
          "consumer_kind": {
            "type": "string",
            "enum": [
              "application",
              "workflow"
            ]
          },
          "workflow_name": {
            "type": "string",
            "description": "Workflow name for workflow jobs."
          },
          "workflow_revision": {
            "type": "string",
            "description": "Fingerprint of the captured workflow recipient definition for workflow jobs."
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid",
            "description": "Ordinary subscription ID for application jobs."
          },
          "subscription_revision": {
            "type": "string",
            "description": "Fingerprint of the subscription declaration snapshotted when an application job was created."
          },
          "from": {
            "type": "string",
            "format": "date-time"
          },
          "until": {
            "type": "string",
            "format": "date-time"
          },
          "cutoff_at": {
            "type": "string",
            "format": "date-time",
            "description": "Fixed exclusive acceptance cutoff."
          },
          "earliest_retained_at": {
            "type": "string",
            "format": "date-time",
            "description": "Account-wide earliest event surviving when the job was created; does not establish complete coverage."
          },
          "history_complete": {
            "type": "boolean",
            "enum": [
              false
            ],
            "description": "Always false; retained receipts are not an archive."
          },
          "duplicate_policy": {
            "type": "string",
            "enum": [
              "skip_existing"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "running",
              "completed",
              "completed_with_failures",
              "cancelled",
              "expired",
              "failed"
            ],
            "description": "cancelled: ended by a cancel request. expired: no progress for 24 hours. failed: processing failed ten times in a row; see last_failure."
          },
          "last_failure": {
            "type": "string",
            "enum": [
              "conflict",
              "invalid_job",
              "timeout",
              "internal"
            ],
            "description": "Class of the most recent processing failure while the job backs off or after it failed."
          },
          "scan_complete": {
            "type": "boolean",
            "description": "Whether the retained range has been fully examined."
          },
          "progress": {
            "$ref": "#/components/schemas/EventReplayBackfillProgress"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EventReplayBackfillRetryResponse": {
        "description": "Number of failed deliveries retried and the resulting job status.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "retried_count",
          "remaining_retryable_count",
          "job"
        ],
        "properties": {
          "retried_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "remaining_retryable_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Failed routing items that can still be requeued from this job."
          },
          "job": {
            "$ref": "#/components/schemas/EventReplayBackfillJobResponse"
          }
        }
      },
      "EventSubscriptionResponse": {
        "description": "One manifest-declared event subscription reconciled for an app.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "app_id",
          "source",
          "type",
          "filter",
          "enabled",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "schema_versions": {
            "type": "array",
            "maxItems": 16,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$"
            },
            "description": "Schema versions in the event subscription response: exact case-sensitive schema versions. Empty or omitted accepts all versions; a nonempty selection excludes unversioned events. Selection is captured at publication or backfill creation."
          },
          "routing_retry_policy": {
            "$ref": "#/components/schemas/EventRoutingRetryPolicy"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "source": {
            "type": "string",
            "description": "Event source pattern, including supported wildcard forms."
          },
          "type": {
            "type": "string",
            "description": "Event type pattern, including supported wildcard forms."
          },
          "filter": {
            "type": "object",
            "additionalProperties": true,
            "description": "Normalized JSON filter evaluated by the event matcher."
          },
          "work_policy": {
            "type": "string",
            "description": "Named app policy for keyed event deliveries, when configured."
          },
          "work_key": {
            "type": "string",
            "description": "Dot selector into the CloudEvents envelope for the work key."
          },
          "work_fairness_key": {
            "type": "string",
            "description": "Optional dot selector for an application fairness group; defaults to work_key."
          },
          "work_action": {
            "type": "string",
            "enum": [
              "invoke",
              "cancel_pending"
            ],
            "description": "Action taken on a matching event."
          },
          "ordered": {
            "type": "boolean",
            "description": "Whether this subscription waits for earlier matching keyed deliveries before routing."
          },
          "enabled": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EventSubscriptionListResponse": {
        "description": "App-scoped event subscriptions reconciled from the manifest.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "app_slug",
          "subscriptions"
        ],
        "properties": {
          "app_slug": {
            "type": "string"
          },
          "subscriptions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventSubscriptionResponse"
            }
          }
        }
      },
      "EventDeliveryResponse": {
        "description": "Metadata-only lifecycle projection for one event-triggered invocation or its replay.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "invocation_id",
          "invocation_source",
          "event_id",
          "event_source",
          "event_type",
          "state",
          "attempts",
          "created_at"
        ],
        "properties": {
          "invocation_id": {
            "type": "string",
            "format": "uuid"
          },
          "invocation_source": {
            "type": "string",
            "enum": [
              "async_invoke",
              "replay"
            ],
            "description": "Whether this is the original event invocation or an operator replay."
          },
          "event_id": {
            "type": "string"
          },
          "event_source": {
            "type": "string"
          },
          "event_type": {
            "type": "string"
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "dispatching",
              "completed",
              "failed",
              "cancelled",
              "dead_letter",
              "superseded",
              "expired"
            ]
          },
          "attempts": {
            "type": "integer",
            "minimum": 0
          },
          "last_error": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "EventFanoutFailureResponse": {
        "description": "A terminal subscription routing failure before an invocation was created.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "event_id",
          "event_source",
          "event_type",
          "subscription_id",
          "state",
          "attempts",
          "last_error",
          "created_at",
          "failed_at"
        ],
        "properties": {
          "event_id": {
            "type": "string"
          },
          "event_source": {
            "type": "string"
          },
          "event_type": {
            "type": "string"
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "failed"
            ]
          },
          "attempts": {
            "type": "integer",
            "minimum": 1
          },
          "failure_code": {
            "type": "string",
            "enum": [
              "unknown",
              "invalid_subscription",
              "target_unavailable",
              "target_lookup_failed",
              "invocation_enqueue_failed",
              "internal_error"
            ],
            "description": "Stable routing failure category; unknown covers failures recorded before classification was available. Optional for responses from older the API versions during rollout."
          },
          "retryable": {
            "type": "boolean",
            "description": "True when the failure was caused by a transient lookup or enqueue error and replay may succeed without changing subscription configuration. Optional for responses from older the API versions during rollout."
          },
          "last_error": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event was accepted."
          },
          "failed_at": {
            "type": "string",
            "format": "date-time",
            "description": "When recipient routing became terminal."
          }
        }
      },
      "EventFanoutAttemptResponse": {
        "description": "Immutable routing outcome or explicit operator replay request for one event recipient.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "subscription_id",
          "action",
          "state",
          "attempt_number",
          "retryable",
          "occurred_at"
        ],
        "properties": {
          "filter_reason": {
            "type": "string",
            "enum": [
              "schema_version_mismatch"
            ],
            "description": "Why routing was filtered without consuming a routing attempt."
          },
          "retry_stop_reason": {
            "type": "string",
            "enum": [
              "non_retryable",
              "max_attempts",
              "max_duration",
              "delivery_expired"
            ],
            "description": "Why automatic routing retries stopped; failure_code retains the underlying cause."
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "action": {
            "type": "string",
            "enum": [
              "fanout_attempt",
              "operator_replay"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "filtered",
              "enqueued",
              "failed"
            ]
          },
          "attempt_number": {
            "type": "integer",
            "minimum": 0
          },
          "failure_code": {
            "type": "string",
            "enum": [
              "unknown",
              "invalid_subscription",
              "target_unavailable",
              "target_lookup_failed",
              "invocation_enqueue_failed",
              "internal_error"
            ]
          },
          "retryable": {
            "type": "boolean"
          },
          "last_error": {
            "type": "string"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "capacity_scope": {
            "type": "string",
            "enum": [
              "consumer",
              "app",
              "account"
            ],
            "description": "Capacity wait scope for this immutable observation."
          },
          "capacity_deferrals": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Cumulative deferrals at this observation; summaries provide the current total."
          },
          "details_truncated": {
            "type": "boolean",
            "description": "Error or failure code detail was truncated to its UTF-8 byte ceiling."
          }
        }
      },
      "EventFanoutAttemptHistoryResponse": {
        "description": "Bounded recorded routing outcomes with durable recipient summaries. Repeated capacity waits coalesce; details have row and logical byte caps and thirty-day retention independent of receipt settlement. Latest outcome, failure and replay evidence is prioritized. Summaries describe gaps, not an exhaustive historical audit. IDs remain immutable and cursors remain valid after pruning. Summaries are current observations across the identity, independent of the detail page cursor.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "app_slug",
          "event_source",
          "event_id",
          "history"
        ],
        "properties": {
          "app_slug": {
            "type": "string"
          },
          "event_source": {
            "type": "string"
          },
          "event_id": {
            "type": "string"
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "history": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventFanoutAttemptResponse"
            }
          },
          "next_before": {
            "type": "string",
            "description": "Opaque cursor bound to the app, event identity, and optional recipient filter."
          },
          "coverage": {
            "type": "string",
            "enum": [
              "bounded_recorded_outcomes"
            ],
            "description": "Recorded observations only; pre-migration transitions and compacted details are unavailable."
          },
          "summaries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventFanoutHistorySummaryResponse"
            }
          }
        }
      },
      "EventFanoutHistorySummaryResponse": {
        "description": "Durable recipient counters and detail coverage for the retained receipt.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "subscription_id",
          "observed_outcomes",
          "capacity_deferrals",
          "coalesced_outcomes",
          "compacted_outcomes",
          "retained_records",
          "retained_bytes"
        ],
        "properties": {
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "observed_outcomes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Recorded routing and replay observations including coalesced waits."
          },
          "capacity_deferrals": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Highest durable cumulative recipient deferral checkpoint."
          },
          "coalesced_outcomes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Repeated waits represented by counters instead of detail rows."
          },
          "compacted_outcomes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Detail rows removed by retention or budgets."
          },
          "compacted_through_id": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Highest removed detail ID; protected older rows can remain, so this is not a contiguous missing prefix."
          },
          "compacted_through_at": {
            "type": "string",
            "format": "date-time",
            "description": "Latest occurrence time among removed detail rows."
          },
          "first_capacity_wait_at": {
            "type": "string",
            "format": "date-time",
            "description": "First recorded capacity wait after summary rollout."
          },
          "last_capacity_wait_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_capacity_scope": {
            "type": "string",
            "enum": [
              "consumer",
              "app",
              "account"
            ],
            "description": "Most recent recorded capacity scope, also retained after recovery."
          },
          "retained_records": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "retained_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Logical detail bytes including a fixed per-row allowance; excludes physical storage and indexes."
          }
        }
      },
      "EventReceiptResponse": {
        "description": "Acceptance and routing evidence with a bounded page of captured and backfilled consumers; execution is a separate lifecycle.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "event_id",
          "event_source",
          "event_type",
          "accepted_at",
          "snapshot_captured",
          "routing_mode",
          "recipient_count",
          "routing_summary",
          "recipients"
        ],
        "properties": {
          "event_id": {
            "type": "string"
          },
          "client_event_id": {
            "type": "string",
            "description": "Original caller-chosen identifier for tenant-scoped events."
          },
          "event_source": {
            "type": "string"
          },
          "event_type": {
            "type": "string"
          },
          "schema_version": {
            "type": "string"
          },
          "accepted_at": {
            "type": "string",
            "format": "date-time",
            "description": "First durable acceptance time, preserved on identical retries."
          },
          "routing_settled_at": {
            "type": "string",
            "format": "date-time",
            "description": "All routing candidates settled, including filtered and failed outcomes; absent while routing is active."
          },
          "retain_until": {
            "type": "string",
            "format": "date-time",
            "description": "Settled receipt retention boundary: the settled-receipt window of the plan after routing settled. Absent for active routing."
          },
          "snapshot_captured": {
            "type": "boolean",
            "description": "False means legacy recipient membership is unknown, rather than an empty matching set."
          },
          "routing_mode": {
            "type": "string",
            "enum": [
              "event",
              "recipient"
            ],
            "description": "Whole-event legacy routing or independent recipient leases."
          },
          "recipient_count": {
            "type": "integer",
            "minimum": 0,
            "description": "Total captured candidates across all pages; unknown when snapshot_captured=false."
          },
          "routing_summary": {
            "description": "Counts across all captured recipients by current routing checkpoint state.",
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "minimum": 0
            }
          },
          "backfill_recipient_count": {
            "type": "integer",
            "minimum": 0,
            "description": "Additional backfilled consumers across all pages; excluded from recipient_count."
          },
          "backfill_routing_summary": {
            "description": "Counts across added backfill consumers, separate from the immutable acceptance snapshot.",
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "minimum": 0
            }
          },
          "recipients": {
            "type": "array",
            "maxItems": 200,
            "items": {
              "$ref": "#/components/schemas/EventReceiptRecipientResponse"
            }
          },
          "next_after": {
            "type": "string",
            "description": "Opaque cursor for captured recipients followed by append-only backfill additions. Delivery order is not guaranteed."
          }
        }
      },
      "EventReceiptRecipientResponse": {
        "description": "One captured or backfilled recipient with independent routing, original execution or cancellation evidence, and retained generic replay recovery.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "subscription_id",
          "app_id",
          "routing",
          "recovery_actions"
        ],
        "properties": {
          "origin": {
            "type": "string",
            "enum": [
              "acceptance",
              "backfill"
            ],
            "description": "Captured at acceptance or added by a historical backfill."
          },
          "backfill_job_id": {
            "type": "string",
            "format": "uuid",
            "description": "Originating backfill job while its metadata is retained."
          },
          "backfill_job_url": {
            "type": "string",
            "format": "uri-reference",
            "description": "Account-authenticated backfill job inspection while the job and current target are available."
          },
          "subscription_id": {
            "type": "string",
            "description": "Immutable captured subscription or notification identifier."
          },
          "workflow_name": {
            "type": "string",
            "description": "Published workflow captured as an event recipient."
          },
          "workflow_run_id": {
            "type": "string",
            "format": "uuid",
            "description": "Durable run id after event-trigger admission."
          },
          "workflow_run_status": {
            "type": "string",
            "description": "Current workflow run status when retained."
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_slug": {
            "type": "string",
            "description": "Current slug when the target still belongs to the authenticated account."
          },
          "routing": {
            "$ref": "#/components/schemas/EventReceiptRoutingResponse"
          },
          "execution": {
            "$ref": "#/components/schemas/EventReceiptExecutionResponse"
          },
          "recovery": {
            "$ref": "#/components/schemas/EventReceiptRecoveryResponse"
          },
          "cancellation": {
            "$ref": "#/components/schemas/EventReceiptCancellationResponse"
          },
          "execution_unavailable": {
            "type": "string",
            "enum": [
              "not_enqueued",
              "record_unavailable",
              "cancel_pending"
            ],
            "description": "No original invocation was found; record_unavailable after enqueue may reflect independent retention and is not a success claim."
          },
          "recovery_actions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventReceiptRecoveryAction"
            },
            "description": "Applicable selective recovery requests; empty when no action is currently eligible. Authorization and state are checked again on POST."
          },
          "fanout_history_url": {
            "type": "string",
            "format": "uri-reference",
            "description": "Account-authenticated routing and replay history for this recipient."
          },
          "attempt_history_url": {
            "type": "string",
            "format": "uri-reference",
            "description": "Account-authenticated handler attempt history including trusted replays."
          }
        }
      },
      "EventReceiptRoutingResponse": {
        "description": "Recipient routing checkpoint and lifetime attempts; execution attempts are separate.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "state",
          "attempts",
          "retryable",
          "replay_count"
        ],
        "properties": {
          "delivery_deadline_at": {
            "type": "string",
            "format": "date-time",
            "description": "Captured wall-clock routing deadline."
          },
          "delivery_age_override": {
            "type": "boolean",
            "description": "Explicit operator override recorded for the current replay generation or backfill."
          },
          "routing_retry_policy": {
            "$ref": "#/components/schemas/EventRoutingRetryPolicy"
          },
          "filter_reason": {
            "type": "string",
            "enum": [
              "schema_version_mismatch"
            ],
            "description": "Filter reason in the event receipt routing response: why routing was filtered without consuming a routing attempt."
          },
          "retry_stop_reason": {
            "type": "string",
            "enum": [
              "non_retryable",
              "max_attempts",
              "max_duration",
              "delivery_expired"
            ],
            "description": "Retry stop reason in the event receipt routing response: why automatic routing retries stopped; failure_code retains the underlying cause."
          },
          "retry_spent_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Current replay generation duration budget spent on routing attempts and scheduled delays."
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "processing",
              "filtered",
              "enqueued",
              "failed"
            ]
          },
          "attempts": {
            "type": "integer",
            "minimum": 0,
            "description": "Lifetime routing attempts, including replay generations."
          },
          "generation_capacity_deferrals": {
            "type": "integer",
            "minimum": 0,
            "description": "Capacity waits in this independent routing generation; subtract from generation_attempts for failure-budget use."
          },
          "capacity_deferrals": {
            "type": "integer",
            "minimum": 0,
            "description": "Lifetime capacity waits; excluded from the routing failure budget."
          },
          "capacity_scope": {
            "type": "string",
            "enum": [
              "consumer",
              "app",
              "account"
            ],
            "description": "Active capacity wait reason; absent after admission."
          },
          "pending_age_seconds": {
            "type": "number",
            "minimum": 0,
            "description": "Age since event acceptance while routing is pending or processing."
          },
          "generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Independent routing generation; absent on legacy whole-event receipts."
          },
          "generation_attempts": {
            "type": "integer",
            "minimum": 0,
            "description": "Claims in the current independent generation, including capacity waits; subtract generation_capacity_deferrals for failure-budget use."
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time",
            "description": "Scheduled pending routing retry, not a dispatch guarantee."
          },
          "lease_until": {
            "type": "string",
            "format": "date-time",
            "description": "Independent routing claim expiry; no claim token is exposed."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_error": {
            "type": "string"
          },
          "failure_code": {
            "type": "string"
          },
          "retryable": {
            "type": "boolean"
          },
          "replay_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "last_replayed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EventReceiptExecutionResponse": {
        "description": "Current retained invocation state. The recipient execution is the original deterministic invocation; recovery and history contain trusted generic replay invocations.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "invocation_id",
          "state",
          "attempts",
          "replay_generation",
          "created_at"
        ],
        "properties": {
          "invocation_id": {
            "type": "string",
            "format": "uuid"
          },
          "replayed_from_invocation_id": {
            "type": "string",
            "format": "uuid",
            "description": "Trusted immediate parent for a generic replay; its execution record may have expired."
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "dispatching",
              "completed",
              "failed",
              "cancelled",
              "superseded",
              "expired",
              "dead_letter"
            ]
          },
          "attempts": {
            "type": "integer",
            "minimum": 0
          },
          "replay_generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "This invocation's budget generation, updated by in-place dead-letter replay."
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time",
            "description": "Next pending invocation due time; dispatch may be delayed by admission."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_error": {
            "type": "string"
          }
        }
      },
      "EventReceiptRecoveryResponse": {
        "description": "Latest retained generic replay and history; original execution remains separate. Completed means this latest replay recovered; counts may decrease as execution records expire. Absence does not prove that no historical replay occurred.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "retained_replay_count",
          "latest_replay",
          "history_url"
        ],
        "properties": {
          "retained_replay_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "latest_replay": {
            "$ref": "#/components/schemas/EventReceiptExecutionResponse"
          },
          "history_url": {
            "type": "string",
            "format": "uri-reference",
            "description": "Account-authenticated paginated replay history for this recipient."
          }
        }
      },
      "EventReceiptReplayHistoryResponse": {
        "description": "A page of retained generic replay executions for one captured event consumer.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "event_source",
          "event_id",
          "subscription_id",
          "original_invocation_id",
          "replays"
        ],
        "properties": {
          "event_source": {
            "type": "string"
          },
          "event_id": {
            "type": "string"
          },
          "subscription_id": {
            "type": "string"
          },
          "original_invocation_id": {
            "type": "string",
            "format": "uuid",
            "description": "Deterministic root delivery ID; its execution record may have expired."
          },
          "replays": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventReceiptExecutionResponse"
            }
          },
          "next_after": {
            "type": "string",
            "description": "Opaque cursor for the next older page; omit after when starting a fresh history read."
          }
        }
      },
      "InvocationAttemptResponse": {
        "description": "Recorded invocation claim and its eventual dispatch outcome within one replay generation.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "invocation_id",
          "replay_generation",
          "attempt",
          "started_at",
          "outcome",
          "retain_until"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "invocation_id": {
            "type": "string",
            "format": "uuid"
          },
          "replay_generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "attempt": {
            "type": "integer",
            "minimum": 1
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": "string",
            "format": "date-time"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "running",
              "succeeded",
              "retry",
              "failed",
              "dead_letter",
              "cancelled",
              "unknown"
            ],
            "description": "Dispatch evidence; unknown does not prove whether the handler ran."
          },
          "error_detail": {
            "type": "string",
            "maxLength": 1024
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "retain_until": {
            "type": "string",
            "format": "date-time",
            "description": "Closed attempts can expire earlier if their invocation is deleted; running attempts are not pruned."
          }
        }
      },
      "EventReceiptAttemptHistoryResponse": {
        "description": "Retained dispatch attempts for the original application event delivery and its trusted replay descendants.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "event_source",
          "event_id",
          "subscription_id",
          "original_invocation_id",
          "coverage",
          "attempts"
        ],
        "properties": {
          "event_source": {
            "type": "string"
          },
          "event_id": {
            "type": "string"
          },
          "subscription_id": {
            "type": "string"
          },
          "original_invocation_id": {
            "type": "string",
            "format": "uuid"
          },
          "coverage": {
            "type": "string",
            "enum": [
              "recorded_attempts_only"
            ],
            "description": "History is not backfilled and may be pruned; absence is not proof of no delivery."
          },
          "attempts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvocationAttemptResponse"
            }
          },
          "next_after": {
            "type": "string",
            "description": "Opaque cursor for the next page of older dispatch attempts for this recipient."
          }
        }
      },
      "EventReceiptCancellationResponse": {
        "description": "Durable work-policy cancel_pending operation receipt, which creates no handler invocation.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "receipt_id",
          "cancelled_count",
          "created_at"
        ],
        "properties": {
          "receipt_id": {
            "type": "string",
            "format": "uuid"
          },
          "cancelled_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EventReceiptRecoveryAction": {
        "description": "Selective recovery request through an existing authorized endpoint. GET receipt inspection never performs this action.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "kind",
          "method",
          "url"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "routing_replay",
              "handler_replay",
              "keyed_handler_replay",
              "dead_letter_replay"
            ]
          },
          "method": {
            "type": "string",
            "enum": [
              "POST"
            ]
          },
          "url": {
            "type": "string",
            "format": "uri-reference"
          },
          "body": {
            "$ref": "#/components/schemas/ReplayEventFanoutFailureRequest"
          }
        }
      },
      "EventDeliveryListResponse": {
        "description": "App-scoped event invocation and fanout failure history, each ordered newest first.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "app_slug",
          "deliveries"
        ],
        "properties": {
          "app_slug": {
            "type": "string"
          },
          "deliveries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventDeliveryResponse"
            }
          },
          "next_before": {
            "type": "string",
            "description": "Opaque cursor bound to the app and event identity and state filters."
          },
          "fanout_failures": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventFanoutFailureResponse"
            },
            "description": "Terminal recipient routing failures; empty when none exist."
          },
          "next_fanout_before": {
            "type": "string",
            "description": "Opaque cursor for the next older page of pre-invocation failures."
          }
        }
      },
      "EventRoutingRecoveryExpectation": {
        "description": "Reviewed acceptance-time stored workflow routing state. All comparisons occur in the replay transaction; mismatches return 409 event_recovery_changed without queuing a replay. Generation must be supplied for recipient routing and omitted for legacy routing. Does not bypass admission rules.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "workflow_name",
          "published_version",
          "replay_count"
        ],
        "properties": {
          "workflow_name": {
            "type": "string",
            "minLength": 1
          },
          "published_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "replay_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ReplayEventFanoutFailureRequest": {
        "description": "Identity of one terminal fanout failure to replay. Use either acceptance and generation guards or recovery_expectation; combining the guard formats is invalid.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "event_id",
          "event_source",
          "subscription_id"
        ],
        "properties": {
          "expected_generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Optional routing generation. Requires expected_accepted_at; checked with failed state under the recipient row lock. A changed generation returns 409 event_replay_generation_changed without mutation."
          },
          "expected_accepted_at": {
            "type": "string",
            "format": "date-time",
            "description": "Optional exact original acceptance instant. Checked under the receipt row lock in the replay transaction; replacement returns 409 without mutation. Guarded replay targets the original acceptance snapshot, not backfills."
          },
          "recovery_expectation": {
            "$ref": "#/components/schemas/EventRoutingRecoveryExpectation"
          },
          "allow_expired": {
            "type": "boolean",
            "default": false,
            "description": "Allow expired in the replay event fanout failure request: explicitly override delivery age for this replay generation or historical backfill job. Preserves deterministic invocation identity and manual controls."
          },
          "event_id": {
            "type": "string"
          },
          "event_source": {
            "type": "string"
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "ReplayEventFanoutFailureResponse": {
        "description": "One recipient requeued from its acceptance-time event snapshot.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "event_id",
          "event_source",
          "subscription_id",
          "state"
        ],
        "properties": {
          "event_id": {
            "type": "string"
          },
          "event_source": {
            "type": "string"
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "pending"
            ]
          }
        }
      },
      "ReplayRetryableEventFanoutFailuresRequest": {
        "description": "Bounded app-scoped replay of failures classified as retryable.",
        "type": "object",
        "additionalProperties": false,
        "required": [],
        "properties": {
          "event_source": {
            "type": "string",
            "description": "Optional exact event source filter; must be paired with event_id."
          },
          "event_id": {
            "type": "string",
            "description": "Optional exact event ID filter; must be paired with event_source."
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 100,
            "description": "Maximum recipients to requeue in this call."
          }
        }
      },
      "ReplayRetryableEventFanoutFailuresResponse": {
        "description": "Summary of one bounded app-scoped replay request.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "app_slug",
          "replayed_count",
          "has_more"
        ],
        "properties": {
          "app_slug": {
            "type": "string"
          },
          "replayed_count": {
            "type": "integer",
            "minimum": 0
          },
          "has_more": {
            "type": "boolean",
            "description": "True when more retryable failures remain for a later request."
          }
        }
      },
      "ResumeWorkflowRunRequest": {
        "description": "Optimistic continuation request; send the resume_count from the inspected run.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_resume_count"
        ],
        "properties": {
          "expected_resume_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 16
          }
        }
      },
      "WorkflowResumeResponse": {
        "description": "Immutable record of one accepted continuation request.",
        "type": "object",
        "required": [
          "run_id",
          "resume_number",
          "account_id",
          "previous_status",
          "resumed_steps",
          "created_at"
        ],
        "properties": {
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "resume_number": {
            "type": "integer",
            "minimum": 1,
            "maximum": 16
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "previous_status": {
            "type": "string",
            "enum": [
              "failed",
              "dead"
            ]
          },
          "previous_error": {
            "type": "string"
          },
          "resumed_steps": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ListWorkflowResumesResponse": {
        "description": "Bounded continuation history for an owned workflow run.",
        "type": "object",
        "required": [
          "resumes"
        ],
        "properties": {
          "resumes": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/WorkflowResumeResponse"
            }
          }
        }
      },
      "WorkflowRunDiagnosticsResponse": {
        "type": "object",
        "description": "Read-only durable state and recovery preview. No execution or capacity reservation. Steps are bounded by existing workflow and iteration limits.",
        "required": [
          "run_id",
          "workflow_name",
          "status",
          "observed_at",
          "legacy_unpinned",
          "state_reason",
          "due_age_seconds",
          "stale_lease",
          "steps",
          "resume"
        ],
        "properties": {
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "workflow_name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "running",
              "awaiting_event",
              "succeeded",
              "failed",
              "dead"
            ]
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Original code pin retained across continuation. Omitted for legacy unpinned runs."
          },
          "legacy_unpinned": {
            "type": "boolean"
          },
          "state_reason": {
            "type": "string",
            "enum": [
              "ready",
              "scheduled",
              "retry_backoff",
              "parked_wait",
              "app_capacity",
              "tenant_capacity",
              "workflow_capacity",
              "running",
              "succeeded",
              "failed",
              "dead",
              "cancelled"
            ],
            "description": "Durable state or dispatch admission reason at observation. Ready does not imply immediate execution or runtime availability. Inspect step kinds for parked wait details."
          },
          "next_wake_at": {
            "type": "string",
            "format": "date-time",
            "description": "Next intentional wake or scheduling deadline when it is in the future."
          },
          "due_age_seconds": {
            "type": "number",
            "minimum": 0,
            "description": "Age since eligibility including capacity-blocked work and expired leases; zero for future waits and live claims."
          },
          "stale_lease": {
            "type": "boolean"
          },
          "steps": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowDiagnosticStep"
            }
          },
          "resume": {
            "$ref": "#/components/schemas/WorkflowResumePreview"
          }
        }
      },
      "WorkflowDiagnosticStep": {
        "type": "object",
        "description": "Persisted step status and action kind without customer values.",
        "required": [
          "step_name",
          "status",
          "kind",
          "attempt",
          "retry_base"
        ],
        "properties": {
          "retry_eligible": {
            "type": "boolean",
            "description": "Advisory manual HTTP step retry eligibility using the captured graph and current quota. Absent means unavailable or ineligible. Actual retry rechecks state and quota."
          },
          "retry_reopened_steps": {
            "type": "array",
            "description": "Skipped dependency descendants that would reopen with this manual retry. Omitted when empty or ineligible.",
            "items": {
              "type": "string"
            }
          },
          "step_name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "running",
              "awaiting_event",
              "succeeded",
              "failed",
              "dead",
              "skipped"
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "action",
              "for_each",
              "join",
              "timer",
              "event",
              "callback",
              "condition",
              "unknown"
            ]
          },
          "attempt": {
            "type": "integer",
            "minimum": 0
          },
          "retry_base": {
            "type": "integer",
            "minimum": 0
          },
          "next_retry_at": {
            "type": "string",
            "format": "date-time"
          },
          "next_check_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WorkflowResumePreview": {
        "type": "object",
        "description": "A continuation plan based on the current run generation and recovery admission checks.",
        "required": [
          "eligible",
          "expected_resume_count",
          "reopened_steps",
          "preserved_steps",
          "blockers"
        ],
        "properties": {
          "eligible": {
            "type": "boolean",
            "description": "Advisory eligibility at observation. Actual resume rechecks state and quotas."
          },
          "expected_resume_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 16,
            "description": "Observed generation for a subsequent resume request; stale generations are rejected."
          },
          "reopened_steps": {
            "type": "array",
            "description": "Structurally eligible steps that would reopen even if a temporary admission blocker prevents continuation. Empty when recovery planning is unsafe.",
            "items": {
              "type": "string"
            }
          },
          "preserved_steps": {
            "type": "array",
            "description": "Persisted steps whose current state is retained including completed actions and untaken branches. Sorted by name as are reopened_steps and diagnostic steps.",
            "items": {
              "type": "string"
            }
          },
          "blockers": {
            "type": "array",
            "description": "First deterministic planner blocker plus independent admission blockers. Empty only when eligible. Codes omit private values.",
            "items": {
              "$ref": "#/components/schemas/WorkflowDiagnosticBlocker"
            }
          }
        }
      },
      "WorkflowDiagnosticBlocker": {
        "type": "object",
        "description": "A stable recovery reason with a fixed explanation and optional affected step.",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "run_not_failed",
              "resume_limit_reached",
              "cancelled",
              "invalid_definition",
              "code_workflow",
              "incomplete_step_state",
              "active_step",
              "handler_executed",
              "failed_control_step",
              "failure_before_dispatch",
              "unsafe_mutation",
              "no_failed_actions",
              "active_attempt",
              "account_inactive",
              "plan_not_allowed",
              "app_deleted",
              "maintenance",
              "tenant_required",
              "tenant_unavailable",
              "deployment_unavailable",
              "pinned_deployment_unavailable",
              "integration_unavailable",
              "active_run_quota",
              "runtime_disabled"
            ]
          },
          "message": {
            "type": "string",
            "description": "Fixed explanation without private values."
          },
          "step_name": {
            "type": "string",
            "description": "Affected step when the planner blocker is step-specific."
          }
        }
      },
      "WorkflowRunResponse": {
        "description": "A persisted durable workflow run.",
        "type": "object",
        "required": [
          "id",
          "app_id",
          "workflow_name",
          "status",
          "scheduled_for",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "resume_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 16,
            "description": "Number of accepted resumptions; send this value when requesting continuation."
          },
          "cancelled_at": {
            "type": "string",
            "format": "date-time"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Immutable deployment used by this run's app handlers. Absent for legacy unpinned runs."
          },
          "platform_tenant_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Platform tenant authorized for this workflow run, when present."
          },
          "workflow_name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "running",
              "awaiting_event",
              "succeeded",
              "failed",
              "dead"
            ]
          },
          "current_step": {
            "type": [
              "string",
              "null"
            ]
          },
          "input": {},
          "output": {},
          "scheduled_for": {
            "type": "string",
            "format": "date-time"
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ListWorkflowRunsResponse": {
        "description": "A paginated list of durable workflow runs.",
        "type": "object",
        "required": [
          "runs",
          "total"
        ],
        "properties": {
          "runs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowRunResponse"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "WorkflowStepResponse": {
        "description": "A step attempt within a durable workflow run.",
        "type": "object",
        "required": [
          "step_name",
          "status",
          "attempt",
          "created_at"
        ],
        "properties": {
          "retry_base": {
            "type": "integer",
            "minimum": 0,
            "description": "Attempt number at the latest resume; attempts since this number consume the current retry budget."
          },
          "for_each_parent": {
            "type": "string",
            "description": "Parent step name for a persisted iteration item."
          },
          "for_each_index": {
            "type": "integer",
            "minimum": 0,
            "maximum": 127,
            "description": "Stable zero-based index within the snapshotted list."
          },
          "for_each_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 128,
            "description": "Snapshotted item count on an initialized parent; zero is an empty batch."
          },
          "step_name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "running",
              "awaiting_event",
              "succeeded",
              "failed",
              "dead",
              "skipped"
            ]
          },
          "attempt": {
            "type": "integer",
            "minimum": 0
          },
          "input": {},
          "output": {},
          "when_matched": {
            "type": "boolean",
            "description": "Persisted guard decision; absent when the guard has not run or a dependency was skipped."
          },
          "when_evaluated_at": {
            "type": "string",
            "format": "date-time"
          },
          "skip_reason": {
            "type": "string",
            "enum": [
              "when_false",
              "dependency_skipped",
              "dependency_failed",
              "route_not_taken"
            ],
            "description": "Why a pending step was skipped; contains no referenced customer values."
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "next_check_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "next_retry_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ListWorkflowStepsResponse": {
        "description": "The ordered steps for a durable workflow run.",
        "type": "object",
        "required": [
          "steps"
        ],
        "properties": {
          "steps": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowStepResponse"
            }
          }
        }
      },
      "WorkflowStepAttemptResponse": {
        "description": "One durable executor invocation for a workflow step.",
        "type": "object",
        "required": [
          "attempt",
          "status",
          "started_at"
        ],
        "properties": {
          "attempt": {
            "type": "integer",
            "minimum": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "running",
              "retrying",
              "succeeded",
              "failed"
            ]
          },
          "http_status": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 100,
            "maximum": 599
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "next_attempt_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "effects": {
            "type": "array",
            "description": "Accepted operation webhook effects and their delivery status.",
            "items": {
              "$ref": "#/components/schemas/OperationEffectRecord"
            }
          }
        }
      },
      "ListWorkflowStepAttemptsResponse": {
        "description": "The ordered executor-attempt history for one workflow step.",
        "type": "object",
        "required": [
          "attempts"
        ],
        "properties": {
          "attempts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowStepAttemptResponse"
            }
          }
        }
      },
      "InjectWorkflowEventResponse": {
        "description": "Acknowledgement that an external workflow event was recorded.",
        "type": "object",
        "required": [
          "status",
          "event_name"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "received"
            ]
          },
          "event_name": {
            "type": "string"
          }
        }
      },
      "InjectWorkflowEventRequest": {
        "description": "An external event supplied to resume an awaiting workflow step.",
        "type": "object",
        "required": [
          "event_name"
        ],
        "properties": {
          "event_name": {
            "type": "string"
          },
          "payload": {}
        }
      },
      "WorkflowCallbackResponse": {
        "description": "Account-authorized handle for one callback wait step.",
        "type": "object",
        "required": [
          "id",
          "step_name"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "step_name": {
            "type": "string"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "Present after the wait activates."
          }
        }
      },
      "ListWorkflowCallbacksResponse": {
        "description": "Callback handles declared in this run's workflow snapshot.",
        "type": "object",
        "required": [
          "callbacks"
        ],
        "properties": {
          "callbacks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowCallbackResponse"
            }
          }
        }
      },
      "CompleteWorkflowCallbackResponse": {
        "description": "Receipt for an initial or repeated callback completion.",
        "type": "object",
        "required": [
          "status",
          "duplicate"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "received"
            ]
          },
          "duplicate": {
            "type": "boolean"
          }
        }
      },
      "CreateWorkflowCallbackWebhookBindingRequest": {
        "description": "Exact Stripe event/object correlation for one callback on an existing signed inbound endpoint.",
        "type": "object",
        "required": [
          "endpoint_id",
          "event_type",
          "object_id"
        ],
        "properties": {
          "endpoint_id": {
            "type": "string",
            "format": "uuid"
          },
          "event_type": {
            "type": "string",
            "maxLength": 256,
            "pattern": "^[a-z][a-z0-9_.]*$",
            "example": "payment_intent.succeeded"
          },
          "object_id": {
            "type": "string",
            "maxLength": 256,
            "pattern": "^[A-Za-z0-9_-]+$",
            "example": "pi_123"
          }
        }
      },
      "WorkflowCallbackWebhookBindingResponse": {
        "description": "Persisted binding metadata without the endpoint's URL or secret.",
        "type": "object",
        "required": [
          "id",
          "run_id",
          "step_name",
          "endpoint_id",
          "event_type",
          "object_id",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "step_name": {
            "type": "string"
          },
          "endpoint_id": {
            "type": "string",
            "format": "uuid"
          },
          "event_type": {
            "type": "string"
          },
          "object_id": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WorkflowCallbackWebhookReceiptResponse": {
        "description": "Acknowledgement after a verified webhook completes or cannot change a callback.",
        "type": "object",
        "required": [
          "callback_id",
          "status",
          "duplicate"
        ],
        "properties": {
          "callback_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "received",
              "ignored"
            ]
          },
          "duplicate": {
            "type": "boolean"
          }
        }
      },
      "AppReleaseReview": {
        "description": "Atomic app configuration and serving-deployment identities used to fence release admission.",
        "type": "object",
        "required": [
          "app_id",
          "configuration_hash",
          "latest_deployment_id",
          "serving_deployment_ids"
        ],
        "properties": {
          "scope": {
            "type": "string"
          },
          "project_id": {
            "type": "string"
          },
          "environment_id": {
            "type": "string"
          },
          "workload_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "workload_config_hash": {
            "type": "string"
          },
          "protected": {
            "type": "boolean"
          },
          "app_id": {
            "type": "string"
          },
          "configuration_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "latest_deployment_id": {
            "type": "string"
          },
          "serving_deployment_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "CreateDeploymentRequest": {
        "description": "Two content-types accepted (see operation description): prebuilt OCI image reference, or multipart source upload. The optional `overrides` object lets a customer redeploy the same digest-pinned image with a different entrypoint / cmd / env / env_secrets / port / startup healthcheck / readiness_probe / liveness_probe without rebuilding the image. The optional `companions` array attaches bounded helper workloads such as an OpenTelemetry collector, database proxy, or reverse proxy. The deprecated `sidecars` spelling remains accepted for existing clients.",
        "type": "object",
        "properties": {
          "native_rollout": {
            "type": "string",
            "enum": [
              "service",
              "worker"
            ],
            "description": "Reviewed native activation. Requires expected_review, matching target execution mode, an unprotected environment and omitted traffic_percent. Services switch through readiness, routing acknowledgement and drain barriers. Workers activate the newest live generation; this is not zero-traffic staging."
          },
          "expected_review": {
            "$ref": "#/components/schemas/AppReleaseReview",
            "description": "Atomically require this review before zero-traffic image staging or native_rollout activation in the reviewed default or named environment. A changed review returns 409 release_review_changed."
          },
          "image": {
            "type": "string",
            "description": "registry.gregale.dev/...@sha256:... — digest-pinned OCI reference."
          },
          "overrides": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CreateDeploymentOverrides"
              },
              {
                "type": "null"
              }
            ],
            "description": "Deploy-time overrides (entrypoint, cmd, env, env_secrets, port, healthcheck, readiness_probe, liveness_probe). nil/omitted = deploy the image as-is."
          },
          "require_signed": {
            "description": "Per-deploy signature-enforcement opt-in. nil = inherit the app's effective signature policy; *true is a no-op when enforcement is already on; *false is rejected with 403 deploy_signature_invalid when apps.require_signed is on or security_policy=enforce (operator policy wins).",
            "type": [
              "boolean",
              "null"
            ],
            "example": true
          },
          "companions": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/Sidecar"
            },
            "description": "Preferred field. Up to 5 stateless helpers total (one init helper and up to four long-running companions); managed presets may omit image. Do not set together with sidecars."
          },
          "sidecars": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/Sidecar"
            },
            "deprecated": true,
            "description": "Deprecated spelling of companions. Do not set both fields."
          },
          "workflows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowSpec"
            },
            "description": "Workflow DAG definitions for this deployment. Paid-plan only; persisted with the deployment and snapshotted at run start."
          },
          "traffic_percent": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 100,
            "description": "Per-deployment traffic-split weight. nil = server default 100; explicit 0..100 = opt into canary (Pro/Scale only).",
            "example": 10
          },
          "scope": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$",
            "description": "Top-level per-deployment env scope. Lowercase alnum + dash, 1..40 chars, no leading/trailing dash. nil/omitted = `default`.",
            "example": "prod"
          },
          "environment": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$",
            "description": "Registered project environment to resolve to the deployment scope. Requires the app to belong to the project; omitted preserves legacy scope behavior."
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 280,
            "description": "Free-form operator note. DB CHECK enforces length(reason) <= 280."
          },
          "tag": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              null,
              "incident_recovery",
              "hotfix",
              "scheduled_maintenance",
              "compliance_hold",
              "partner_request"
            ],
            "description": "Closed-set annotation tag. DB CHECK (deployments_tag_set_chk) enforces the same vocabulary."
          },
          "deployed_by": {
            "type": [
              "string",
              "null"
            ],
            "description": "Operator label. CLI auto-captures from `git config user.name`; the GitHub integration stamps pusher.name; Action defaults to ${{ github.actor }}."
          },
          "pr_number": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "description": "PR number (when known). 0 / NULL collapses to NULL on the row (DB CHECK rejects 0)."
          },
          "canary": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CanaryPresetSpec"
              },
              {
                "type": "null"
              }
            ],
            "description": "Per-deployment canary ladder. nil/omitted = server default 'none'. For preset='custom', stages carries the customer ladder."
          },
          "rollback_on_5xx": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Create-time opt-in for first-wake 5xx auto-rollback; Pro/Scale only, with omitted or null defaulting to false."
          },
          "mcp_task_migration_override": {
            "type": "boolean",
            "description": "One-use operator override to allow this deployment to cut over while outstanding MCP tasks still need handler versions it does not provide."
          },
          "override_freeze": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Release this deployment to production while a deploy freeze is active; the reason is audited with the freezes it overrode."
          },
          "release_at": {
            "type": "string",
            "format": "date-time",
            "description": "Build this deployment now, keep it live without traffic, and start its production rollout at this time; deploy freezes are checked at that time."
          },
          "release_notify": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "description": "Slack or email notification channels told when this deployment, scheduled with release_at, starts or cannot start."
          },
          "disable_startup_cpu_boost": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Opt this deployment out of temporary startup CPU headroom. Omitted or null preserves the default boost."
          },
          "full_rootfs_allow_auto": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Whether to auto-fallback to a self-contained rootfs for images without a Gregale runtime base. Omitted uses the plan default."
          },
          "full_rootfs_override": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Tri-state full-rootfs override: null uses the plan default, true forces full-rootfs, false forces the shared-base path."
          }
        }
      },
      "CreateDeploymentOverrides": {
        "description": "Deploy-time override object on `POST /v1/apps/{slug}/deployments`. Unknown fields 400 the request; each supported\nfield has an explicit persistence and runtime contract.\n\n- `entrypoint` replaces the OCI image's ENTRYPOINT/CMD argv at exec time.\n- `cmd` is appended to `entrypoint` (mirrors the OCI runtime contract).\n- `env` is plaintext; env-var keys must match `^[A-Z][A-Z0-9_]*$`; per-value\n  byte cap = plan `EnvValueMaxBytes`.\n- `env_secrets` carries `secret:NAME` REFS — the runtime resolver\n  strips the prefix and looks up `NAME` against the existing `app_secrets`\n  table. The ref name must match `^[A-Z][A-Z0-9_]*$`.\n- `env` + `env_secrets` share the plan `EnvVarsMax` quota — no bypass by\n  mixing the two surfaces.\n- `port` is per-deployment (1..65535; 0 = absent / fall back to image default).\n- `healthcheck` configures startup readiness admission.\n- `readiness_probe` is an optional recurring traffic gate, independent of\n  the one-shot startup check and VM liveness policy.\n- `main_depends_on` gates the primary workload on named long-running\n  companions; init companions already run before the primary workload.\n",
        "type": "object",
        "properties": {
          "entrypoint": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "minItems": 1,
            "description": "Replaces the OCI image's ENTRYPOINT/CMD argv. Each element must be non-empty."
          },
          "cmd": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "minItems": 1,
            "description": "Appended to entrypoint at exec time (OCI runtime contract). Each element must be non-empty."
          },
          "env": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Plaintext env map applied at boot. Keys: `^[A-Z][A-Z0-9_]*$`. Per-value byte cap = plan EnvValueMaxBytes."
          },
          "env_secrets": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "pattern": "^secret:[A-Z][A-Z0-9_]*$"
            },
            "description": "Sealed-secret-ref env map. Each VALUE is `secret:NAME`; the runtime resolver looks up `NAME` against `app_secrets` at wake. Counts against the shared `EnvVarsMax` cap with `env`."
          },
          "port": {
            "type": "integer",
            "minimum": 0,
            "maximum": 65535,
            "description": "Listen port; 0 = absent / fall back to image default (today 8080)."
          },
          "healthcheck": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DeploymentHealthcheck"
              },
              {
                "type": "null"
              }
            ],
            "description": "Startup readiness-probe shape. The selected action gates instance startup before it becomes available."
          },
          "readiness_probe": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DeploymentReadinessProbe"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional recurring primary-app traffic gate. Failed probes withdraw a running instance from routing; successful probes restore it without restarting the VM."
          },
          "main_depends_on": {
            "type": "array",
            "maxItems": 6,
            "items": {
              "$ref": "#/components/schemas/WorkloadDependency"
            },
            "description": "Companions that must reach the specified lifecycle condition before the primary workload starts. Targets must be declared long-running companions; init companions already gate startup."
          },
          "liveness_probe": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DeploymentLivenessProbe"
              },
              {
                "type": "null"
              }
            ],
            "description": "Liveness-probe override. The host\npolls the guest's vsock 1028 STREAM on every `interval_s`; after\n`consecutive_failures` consecutive non-2xx (or timeout / conn-refused)\nresponses, the VM is destroyed and the scheduler cold-boots it from rootfs\n(never snapshot-restore). 3 restarts in 300 s\npark the deployment.\n\nPer-plan gates: Free is locked out (Plan.LivenessAllowed\nreturns false; the API handler rejects with\n`plan_liveness_probe_not_allowed` BEFORE the DB is touched); Hobby,\nPro, Scale inherit the 5 s / 3 consecutive / 60 s cooldown / 3 in 300 s\ndefaults. Pro and Scale may select standard gRPC health.v1 Check\non the runtime port; Free and Hobby remain HTTP-only for liveness.\n"
          },
          "scope": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$",
            "description": "Override-object per-deployment env scope. Lowercase alnum + dash, 1..40 chars, no leading/trailing dash. nil/omitted = inherit top-level scope or `default`.",
            "example": "staging"
          }
        }
      },
      "CustomStage": {
        "description": "One stage of a customer-supplied canary ladder\n(production-leveling\nStream F). Percent is the traffic share this stage moves\nto (0..100, terminal stage must be 100). Duration is the\nwall-clock dwell time at this stage in time.ParseDuration\nform (e.g. \"30s\", \"2m\", \"0s\" for the terminal hop).\n",
        "type": "object",
        "required": [
          "percent",
          "duration"
        ],
        "properties": {
          "percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Traffic share this stage moves to (0..100). The terminal stage must be 100."
          },
          "duration": {
            "type": "string",
            "description": "Wall-clock dwell at this stage, in time.ParseDuration form (e.g. '30s', '2m'). '0s' for the terminal hop.",
            "example": "2m"
          },
          "mirror_clean": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MirrorCleanCondition"
              },
              {
                "type": "null"
              }
            ],
            "description": "Require a clean traffic-mirror window before advancing out of this stage. Any status, schema, body, or crash diff aborts the rollout."
          }
        }
      },
      "MirrorCleanCondition": {
        "description": "Mirror quality gate for a canary stage.",
        "type": "object",
        "required": [
          "min_invocations",
          "window_s"
        ],
        "properties": {
          "min_invocations": {
            "type": "integer",
            "minimum": 1,
            "description": "Minimum completed mirror comparisons required in the window.",
            "example": 100
          },
          "window_s": {
            "type": "integer",
            "minimum": 1,
            "description": "Trailing mirror-summary window in seconds.",
            "example": 300
          }
        }
      },
      "CanaryPresetSpec": {
        "description": "The canary ladder a customer asks for on a deploy (A + production-leveling\nStream F). Preset is the catalog name (none/slow/balanced/aggressive/1-10-50-100/adaptive/\ncustom). When Preset is 'custom', Stages is the\ncustomer-supplied ladder (each entry is percent +\nduration string in time.ParseDuration form, e.g.\n\"1% at 30s, 10% at 2m, 100% at 0s\").\nThe wire-format change (StepDurations removed, Stages\nadded) is additive on the consumer side because the\nprior StepDurations field was declared-but-dead — no\npre-PR client ever sent it.\n",
        "type": "object",
        "required": [
          "preset"
        ],
        "properties": {
          "preset": {
            "type": "string",
            "enum": [
              "none",
              "slow",
              "balanced",
              "aggressive",
              "1-10-50-100",
              "adaptive",
              "custom"
            ],
            "description": "Catalog preset name. 'none' = no canary (server stamps canary_preset='none', canary_total_steps=0). 'custom' requires Stages to be non-empty.",
            "example": "balanced"
          },
          "stages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomStage"
            },
            "description": "Per-stage ladder. Required when preset='custom' (the API handler 422s otherwise); ignored for catalog presets (the catalog resolution runs server-side)."
          }
        }
      },
      "DeploymentAuditResponse": {
        "description": "One row of the deployment_audit timeline (E.2 + production-leveling Stream\nA). Data is the verbatim jsonb payload at emit time;\nkind-specific shape — DeployTrafficChanged carries\n{from_percent, to_percent, actor_kind}, DeployRolledBack\ncarries {target_deployment_id, reason}.\n",
        "type": "object",
        "required": [
          "at",
          "kind",
          "actor"
        ],
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "RFC3339Nano UTC timestamp at which the row was emitted. Sequence-pointed — sorting by (at DESC) gives the canonical timeline order.",
            "example": "2026-08-27T14:23:19.482Z"
          },
          "kind": {
            "type": "string",
            "enum": [
              "deploy.created",
              "deploy.traffic_changed",
              "deploy.rolled_back",
              "deploy.rolled_forward",
              "deploy.stuck",
              "deploy.recovered",
              "deploy.mcp_admission",
              "deploy.source_ref",
              "deploy.local_tarball",
              "deploy.health_probe_failed",
              "deploy.health_recovered",
              "deploy.removed",
              "deploy.rollout_started",
              "deploy.rollout_completed",
              "deploy.rollout_aborted",
              "deploy.canary_step_advanced",
              "deploy.alert_rule_fired",
              "deploy.scan_regressed",
              "deploy.mcp_task_held",
              "deploy.mcp_task_retry_requested",
              "deploy.mcp_task_retry_started",
              "deploy.mcp_task_retry_completed",
              "deploy.mcp_task_recovered",
              "deploy.mcp_task_hold_cancelled",
              "deploy.worker_drain_started",
              "deploy.worker_drain_completed"
            ],
            "description": "Deployment audit event kind. Includes the current deployment_audit CHECK values and retained legacy SDK spellings."
          },
          "actor": {
            "type": "string",
            "description": "Service-account UUID or operator CLI sentinel (`operator:cli:recover_rollout`, `meterd:safedeploy`, `meterd:canary_progression`). Operators identify who did what from this column.",
            "example": "meterd:safedeploy"
          },
          "data": {
            "description": "Verbatim jsonb payload at emit time. For deploy.mcp_admission, mcp_admission contains MCPAdmissionEvidence: a committed or rejected traffic decision with policy digests and gateway replay metadata. No private JWT actions or credentials are retained."
          },
          "account_id": {
            "type": "string",
            "description": "Owning account UUID (cross-tenant IDOR posture)."
          },
          "alert_rule_id": {
            "type": "string",
            "format": "uuid",
            "description": "When the audit row was stamped by an alert-rule-fired action (e.g. auto-rollback via the metering service ActionDispatcher), this carries the alert_rules.id UUID. nil for non-rule-triggered rows. Wire-additive — null for all older rows.",
            "example": "abcdef0123456789abcdef0123456789"
          }
        }
      },
      "ListDeploymentAuditResponse": {
        "description": "Paginated wrapper for `GET /v1/deployments/{id}/audit`\n(E.2 + production-\nleveling Stream A). Limit is echoed back so a paging\nconsumer can distinguish \"limit was clamped\" from \"no\nmore rows\" — both yield Items of length < limit, but the\nclamping is observable via this field.\n",
        "type": "object",
        "required": [
          "items",
          "limit"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeploymentAuditResponse"
            }
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 500,
            "description": "Echo of the server-applied limit (query param ?limit= clamps here)."
          }
        }
      },
      "DeploymentHealthcheck": {
        "description": "Startup healthcheck shape on the deploy-time override object. Exactly one of `path` (HTTP) or `grpc` (standard gRPC health\nCheck) selects the startup admission action. The gRPC probe uses the\napp's published port; an empty service checks overall server health.\n\nValidation rules (enforced):\n- Exactly one of `path` and `grpc` must be set.\n- `path`, when set, must start with `/`.\n- `grpc.service` is optional and limited to 256 characters.\n- `interval_s`, `timeout_s`, `retries` must be `>= 0`.\n- Missing tuning fields default to 0; the host readiness deadline is\n  resolved separately from the app's plan and startup policy.\n\nOCI `test` argv and `start_period_s` remain deploy metadata; the host\nreadiness gate uses only the selected HTTP path or gRPC health RPC.\n",
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "pattern": "^/",
            "description": "HTTP readiness path requested from the guest; must start with `/` (e.g. `/healthz`). Set exactly one of path or grpc."
          },
          "grpc": {
            "$ref": "#/components/schemas/DeploymentGRPCHealthcheck",
            "description": "Use the standard gRPC health.v1 Check RPC. Set exactly one of path or grpc."
          },
          "interval_s": {
            "type": "integer",
            "minimum": 0,
            "description": "Probe interval in seconds; 0 = use image default."
          },
          "timeout_s": {
            "type": "integer",
            "minimum": 0,
            "description": "Probe timeout in seconds; 0 = use image default."
          },
          "retries": {
            "type": "integer",
            "minimum": 0,
            "description": "Consecutive failures before the instance is considered unhealthy; 0 = use image default."
          },
          "test": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Argv of the OCI HEALTHCHECK command, prefixed by \"CMD\", \"CMD-SHELL\", or \"NONE\". Surfaces onto AppManifest.Healthcheck.Test at apply_overrides time."
          },
          "start_period_s": {
            "type": "integer",
            "minimum": 0,
            "description": "Startup grace during which probe failures don't count (Docker 17.05+, default 0s). Surfaces onto AppManifest.Healthcheck.StartPeriodS."
          }
        }
      },
      "DeploymentGRPCHealthcheck": {
        "type": "object",
        "description": "Standard gRPC health.v1 readiness probe. An omitted or empty service checks overall server health.",
        "properties": {
          "service": {
            "type": "string",
            "maxLength": 256,
            "description": "Service passed to the health.v1 Check request; omit it to query the server rather than a named service."
          }
        }
      },
      "DeploymentReadinessProbe": {
        "description": "Continuous primary-app readiness policy. It is evaluated only after\nstartup readiness succeeds. Once `failure_threshold` consecutive checks\nfail, the running instance is removed from request routing. A successful\ncheck restores routing; readiness failures never restart the VM.\n\nDefaults are period 5 seconds, timeout 2 seconds, and failure threshold\n3. Zero means use the corresponding default. Exactly one of `path`\n(HTTP) and `grpc` (standard gRPC health.v1 Check) is required.\n",
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "pattern": "^/",
            "description": "HTTP path requested on the app's runtime port; must start with `/`. Set exactly one of path or grpc."
          },
          "grpc": {
            "$ref": "#/components/schemas/DeploymentGRPCHealthcheck",
            "description": "Use standard gRPC health.v1 Check. Set exactly one of path or grpc."
          },
          "period_s": {
            "type": "integer",
            "minimum": 0,
            "maximum": 60,
            "description": "Probe interval in seconds; 0 = default (5)."
          },
          "timeout_s": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5,
            "description": "Per-probe timeout in seconds; 0 = default (2)."
          },
          "failure_threshold": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10,
            "description": "Consecutive failures before traffic is withdrawn; 0 = default (3). A passing probe immediately restores routing."
          }
        }
      },
      "DeploymentLivenessProbe": {
        "description": "Liveness-probe shape on the deploy-time override object.\nThe probe is the Cloud-Run-parity primitive that asks \"is the VM still\nresponding?\" — a wedged guest (busy-loop, leaked fd, deadlocked runner)\nsits resident billing RAM-hours while serving 5xx until the idle\nreaper eventually fires. The liveness probe replaces that wait with the\nshort, customer-visible path: 3 consecutive failures → destroy →\ncold-boot from rootfs (never snapshot-restore).\n\nDistinct from `DeploymentHealthcheck`: readiness is \"accept traffic?\",\nliveness is \"still alive?\". A passing readiness but failing liveness\nis the canonical \"wake succeeded, then the runtime died\" failure mode\nthat this primitive is designed to catch.\n\nValidation rules (enforced):\n- Exactly one of `path` (HTTP) or `grpc` (standard gRPC health Check) must be set.\n  The server enforces this mutual-exclusion rule.\n- `path`, when set, must start with `/`.\n- `grpc.service` is optional and limited to 256 characters.\n- `interval_s` ∈ [0, 60] (0 = inherit per-plan default; Hobby/Pro/Scale → 5 s).\n- `timeout_s` ∈ [0, 5] (0 = inherit 2 s) for either probe action.\n- `consecutive_failures` ∈ [0, 10] (0 = inherit per-plan default; Hobby/Pro/Scale → 3).\n- `cooldown_s` ∈ [10, 600] (cooldown gate enforced by the VM manager-side\n  probe loop after a destroy fires —; 0 = no cooldown, the\n  legacy Free-plan behaviour).\n\nPer-deployment overrides of `interval_s` / `timeout_s` / `consecutive_failures` / `cooldown_s`\nare clamped to the bounds above. The counter resets to 0 on the first 2xx\nand survives an intermittent 5xx across the consecutive window (AC #2:\nflaky app does NOT oscillate). The cooldown gate short-circuits the\ncounter when a probe fires inside the previous destroy's window so the\ncold-boot replacement instance has a grace period to settle.\n",
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "pattern": "^/",
            "description": "HTTP path the probe requests from the guest; must start with `/` (e.g. `/healthz`). Reuses the runner's existing listener — no runner changes. Set exactly one of path or grpc."
          },
          "grpc": {
            "$ref": "#/components/schemas/DeploymentGRPCLivenessProbe",
            "description": "Use the standard gRPC health.v1 Check RPC. Set exactly one of path or grpc; Pro and Scale plans only."
          },
          "interval_s": {
            "type": "integer",
            "minimum": 0,
            "maximum": 60,
            "description": "Per-plan poll cadence in seconds; 0 = inherit per-plan default (Hobby/Pro/Scale → 5 s). Clamped to [MinLivenessPeriodSeconds=1, MaxLivenessPeriodSeconds=60]."
          },
          "timeout_s": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5,
            "description": "Per-probe HTTP or gRPC timeout in seconds; 0 = inherit 2 s default. A timeout is treated identically to a non-2xx response by the failure counter."
          },
          "consecutive_failures": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10,
            "description": "N at which DestroyForLivenessFailure fires; 0 = inherit per-plan default (Hobby/Pro/Scale → 3). The counter is reset to 0 on the first 2xx and survives an intermittent 5xx across the consecutive window (AC #2 — flaky app does NOT oscillate)."
          },
          "cooldown_s": {
            "type": "integer",
            "minimum": 0,
            "maximum": 600,
            "description": "Cooldown window in seconds after a liveness-driven destroy fires. While inside the window the VM manager-side probe loop short-circuits the failure counter so the cold-boot replacement has time to settle (closure). 0 = no cooldown (Free-plan / legacy behaviour); clamped to [MinLivenessCooldownSeconds=10, MaxLivenessCooldownSeconds=600] when the field is populated by a Pro/Scale deployment override."
          }
        }
      },
      "DeploymentGRPCLivenessProbe": {
        "type": "object",
        "description": "Standard gRPC health.v1 liveness probe. An omitted or empty service checks overall server health.",
        "properties": {
          "service": {
            "type": "string",
            "maxLength": 256,
            "description": "Service passed to the health.v1 Check request; omit it to query overall server health."
          }
        }
      },
      "ScanResult": {
        "description": "Per-deploy grype CVE scan result. Surfaced on\nGET /v1/deployments/{id} (additive DeploymentResponse.Scan field) and\non GET /v1/deployments/{id}/scan (the dedicated drill-down route).\nThe dashboard renders the severity counts and the top 10 CVEs;\n`gregale deployment <id> --show-scan` prints the full payload.\nSurface for off/warn apps. With security_policy=enforce, the\ndeployment is promoted only after a complete, digest-matched scan\nwith no HIGH, CRITICAL, or UNKNOWN findings.\n",
        "type": "object",
        "required": [
          "status",
          "severity_counts",
          "vulnerabilities"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "complete",
              "failed",
              "skipped"
            ],
            "description": "Closed enum mirroring the deployments.scan_status column.\n`pending` = grype run started, not finished yet;\n`complete` = grype run finished, scan carries the findings;\n`failed` = grype run errored after the 1-retry backoff, scan carries the last error in `error`;\n`skipped` = pre-feature row (the migration backfilled this on every row that predates 00135).\n"
          },
          "scanned_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Wall clock the grype run completed (RFC 3339 UTC). Empty when status != \"complete\". Distinct from deployments.created_at — the deploy ships before the scan lands (AC #1: scan within 5 min of status: live, not at the same instant). Enforce mode rejects evidence older than 5 minutes."
          },
          "scanner_version": {
            "type": [
              "string",
              "null"
            ],
            "description": "Grype binary version from the descriptor of the run that produced the scan (e.g. \"0.78.0\"). Enforce mode requires this identity to be present."
          },
          "artifact_digest": {
            "type": [
              "string",
              "null"
            ],
            "description": "SHA-256 digest of the exact ext4 artifact selected for the Grype run. Enforce mode requires the digest and verifies it is unchanged before and after scanning."
          },
          "image_digest": {
            "type": [
              "string",
              "null"
            ],
            "description": "OCI image reference recorded at the time of the scan. In security_policy=enforce, this must exactly match deployments.image_digest before promotion. Empty on the pre-feature backfill (status = \"skipped\" with no image to stamp)."
          },
          "scanner_db_status": {
            "type": [
              "string",
              "null"
            ],
            "description": "Status Grype reported for its vulnerability database. Enforce mode requires `valid`."
          },
          "scanner_db_version": {
            "type": [
              "string",
              "null"
            ],
            "description": "Vulnerability database version from the Grype descriptor."
          },
          "scanner_db_built_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Vulnerability database build timestamp from the Grype descriptor. Enforce mode rejects databases older than 30 days."
          },
          "severity_counts": {
            "$ref": "#/components/schemas/SeverityCounts"
          },
          "vulnerabilities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Vulnerability"
            },
            "description": "Full CVE list, ordered by Grype's natural output (most-severe-first). The dashboard's \"top 10\" view sorts+truncates client-side. The /scan route returns the full list."
          },
          "error": {
            "type": [
              "string",
              "null"
            ],
            "description": "Grype runner's last error message on a failed scan (status = \"failed\"). Empty on every other status. The sink captures the message after the 1-retry backoff is exhausted."
          }
        }
      },
      "SeverityCounts": {
        "description": "Per-bucket count of CVEs in Grype's closed vocabulary\n(CRITICAL|HIGH|MEDIUM|LOW|UNKNOWN). Negligible collapses into LOW\n(the image scanner's severity convention). All fields present without omitempty so the JSON shape\nis uniform — the dashboard reads counts without nil checks.\n",
        "type": "object",
        "required": [
          "critical",
          "high",
          "medium",
          "low",
          "unknown"
        ],
        "properties": {
          "critical": {
            "type": "integer",
            "minimum": 0
          },
          "high": {
            "type": "integer",
            "minimum": 0
          },
          "medium": {
            "type": "integer",
            "minimum": 0
          },
          "low": {
            "type": "integer",
            "minimum": 0
          },
          "unknown": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "Vulnerability": {
        "description": "One row in the scan's CVE list.",
        "type": "object",
        "required": [
          "id",
          "severity",
          "package",
          "version"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "CVE id (e.g. CVE-2024-1234)."
          },
          "severity": {
            "type": "string",
            "enum": [
              "CRITICAL",
              "HIGH",
              "MEDIUM",
              "LOW",
              "UNKNOWN"
            ]
          },
          "package": {
            "type": "string",
            "description": "Vulnerable package name (e.g. openssl)."
          },
          "version": {
            "type": "string",
            "description": "Installed package version (e.g. 1.1.1k-7)."
          },
          "fixed_in": {
            "type": [
              "string",
              "null"
            ],
            "description": "Upstream version the fix landed in. Empty when no fix is available (e.g. disputed CVE) — the dashboard renders 'no fix' for empty."
          },
          "paths": {
            "type": "array",
            "description": "Per-file paths within the scanned image where the vulnerable\npackage was located. Sourced from\ngrype's `artifact.locations[].path`. Many CVEs match against a\npackage without per-file locations (deb/apt-style CVE matches);\nempty / null for those rows. The dashboard's \"Path\" column\nrenders \"—\" on null.\n",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "WorkloadDependency": {
        "description": "Dependency on another workload in the same deployment.",
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "Workload name: main or another sidecar name."
          },
          "condition": {
            "type": "string",
            "enum": [
              "started",
              "healthy",
              "completed_successfully"
            ],
            "default": "started",
            "description": "Lifecycle condition required before the dependent workload starts."
          }
        }
      },
      "Sidecar": {
        "description": "One entry in the deploy request's preferred `companions` array\n(legacy name: `sidecars`). Up to 5 helpers per app (1 init\n+ up to 4 long-running sidecars; total cardinality is capped\nat the API, runtime, and database layers).\nStateless only — stateful base images (Postgres, Redis,\nMySQL, MongoDB, etc.) are rejected at the API gate\nwith 403 `sidecar_stateful_denied` and again at the image service. Image references must be digest-pinned\n(`repo@sha256:...`); tag references are rejected with\n400 `sidecar_invalid_image`. Env values are\nenvelope-sealed at rest via secretbox (namespace\n`\"sidecar_env\"`); the wire shape is plaintext, the\ncolumn is sealed ciphertext.\n`env_secrets` grants this workload only the same-named\napp secrets selected by explicit `secret:KEY` references.\nReferences resolve in the deployment's scope at each wake;\nsidecars do not inherit main-workload secrets. Secret rotation\nreaches sidecars through a restart by default; a long-running\nsidecar image may opt into runtime projection and signal delivery.\n\n- `name` matches RFC 1123 label (lowercase alphanumeric\n  + dash, 1..63 chars, starts with [a-z0-9]). Unique\n  within a single request.\n- `preset` selects a platform-managed helper. A preset may omit\n  `image`; the API resolves an operator-pinned immutable digest.\n- `image` is required for a custom helper and must be a\n  digest-pinned OCI reference. Tag references are rejected.\n- `type` ∈ {`init`, `sidecar`}. At most one init helper and\n  up to four long-running sidecars per deployment.\n- `cmd` is the argv (image's ENTRYPOINT unchanged; CMD\n  overridden). Every element non-empty.\n- `env` is plaintext on the wire, sealed at rest. Keys\n  per `^[A-Z][A-Z0-9_]*$`; per-value byte cap = plan\n  `EnvValueMaxBytes`. Plaintext values NEVER appear in\n  any log, audit, or error.\n- `env_secrets` is a per-sidecar positive allowlist, for example\n  `{DATABASE_URL: \"secret:DATABASE_URL\"}`. The environment key\n  and referenced app-secret name must match. Missing secrets fail\n  the wake; an empty/omitted map grants no app secrets to this\n  sidecar. Values refresh on cold boot or restart by default;\n  long-running sidecars can also opt into runtime projection and\n  signal delivery through their image metadata.\n- `port` ∈ {0, 1..65535}. 0 = absent.\n- `primary_ingress` routes the application's normal hostname and\n  custom domains through this long-running helper. It requires port.\n- `ram_mb` ∈ {0, 32..512}. 0 = inherit plan RAM.\n- `scratch_mb` ∈ {0, 16..512}. 0 = platform default; explicit values cap the sidecar's writable `/tmp` tmpfs.\n- `cpu_millicores` ∈ {0, 250, 500, 1000}. 0 = inherit app CPU quota.\n- `disk_io_profile` ∈ {`low`, `standard`, `high`}. Omit to inherit the guest default; profiles map to per-workload cgroup I/O weights.\n- `essential` defaults to true. If true and the workload\n  exits non-zero, the dependency set fails\n  (`failure_class=user_error`) and essential long-running\n  sidecars restart-loop. If false, the failure is logged\n  and the other workloads continue.\n- `startup_probe` gates healthy dependency state and supports exec,\n  HTTP GET, and TCP probes. Omit it to use the image OCI `HEALTHCHECK`.\n- `liveness_probe` independently monitors a running sidecar; when\n  omitted, the effective startup probe is reused for compatibility.\n- `readiness_probe` is valid only on the `primary_ingress` sidecar. It\n  gates initial traffic and temporarily withdraws/resumes routing\n  without restarting the companion.\n- `depends_on` optionally gates this workload on `main` or\n  another sidecar. Conditions are `started`, `healthy`, and\n  `completed_successfully`; omitted condition means `started`.\n  Init workloads are implicit prerequisites of main and long-running\n  sidecars. Cycles and unknown workload names are rejected.\n",
        "type": "object",
        "required": [
          "name",
          "type"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$",
            "minLength": 1,
            "maxLength": 63,
            "description": "RFC 1123 label (lowercase alphanumeric + dash, 1..63 chars, starts with [a-z0-9])."
          },
          "image": {
            "type": "string",
            "pattern": "^[A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])?(\\.[A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])?)*(:[0-9]+)?/[A-Za-z0-9_./-]+@sha256:[0-9a-f]{64}$",
            "description": "Digest-pinned OCI reference (repo@sha256:...). Tag references rejected with 400 `sidecar_invalid_image`."
          },
          "preset": {
            "type": "string",
            "enum": [
              "opentelemetry",
              "sentry",
              "datadog-dogstatsd"
            ],
            "description": "Platform-managed companion preset. The installation must configure an immutable image digest."
          },
          "type": {
            "type": "string",
            "enum": [
              "init",
              "sidecar"
            ],
            "description": "`init` runs once before the main workload (DB migrator shape). `sidecar` runs alongside (metrics scraper shape)."
          },
          "cmd": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "description": "Argv. Image's ENTRYPOINT unchanged; CMD overridden. Every element non-empty."
          },
          "env": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Plaintext env map (sealed at rest). Keys `^[A-Z][A-Z0-9_]*$`; per-value byte cap = plan EnvValueMaxBytes."
          },
          "env_secrets": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "pattern": "^secret:[A-Z][A-Z0-9_]*$"
            },
            "description": "Per-sidecar positive allowlist of same-named app secrets, resolved in the deployment scope. Values refresh on restart by default; long-running sidecars can additionally opt into runtime projection and signal delivery through their image metadata. Sidecars never inherit main secrets."
          },
          "port": {
            "type": "integer",
            "minimum": 0,
            "maximum": 65535,
            "description": "Listen port. 0 = absent / fall back to image default."
          },
          "primary_ingress": {
            "type": "boolean",
            "default": false,
            "description": "Route the app's primary public hostname through this long-running companion. Requires an explicit port."
          },
          "ram_mb": {
            "type": "integer",
            "minimum": 0,
            "maximum": 512,
            "description": "Cgroup memory ceiling for this sidecar. 0 = inherit plan RAM; 32..512 enforced at the API."
          },
          "scratch_mb": {
            "type": "integer",
            "minimum": 0,
            "maximum": 512,
            "description": "Writable /tmp tmpfs ceiling for this sidecar in MB. 0 = platform default; explicit values must be 16..512."
          },
          "cpu_millicores": {
            "type": "integer",
            "enum": [
              0,
              250,
              500,
              1000
            ],
            "default": 0,
            "description": "Sustained cgroup CPU allowance in millicores. 0 = inherit app CPU quota."
          },
          "disk_io_profile": {
            "type": "string",
            "enum": [
              "low",
              "standard",
              "high"
            ],
            "description": "Per-workload guest cgroup I/O scheduling policy. Omit to inherit the guest default."
          },
          "essential": {
            "type": "boolean",
            "description": "Defaults to true. Essential workload failure fails the set; non-essential failure is logged and contained."
          },
          "startup_probe": {
            "$ref": "#/components/schemas/SidecarProbe"
          },
          "liveness_probe": {
            "$ref": "#/components/schemas/SidecarProbe"
          },
          "readiness_probe": {
            "$ref": "#/components/schemas/SidecarProbe"
          },
          "depends_on": {
            "type": "array",
            "maxItems": 3,
            "description": "Optional workload lifecycle dependencies. Init workloads are implicit prerequisites of main and long-running sidecars.",
            "items": {
              "$ref": "#/components/schemas/WorkloadDependency"
            }
          }
        }
      },
      "DeploymentPreviewURL": {
        "description": "Per-deployment preview URL read seam response.\nMirrors the api.DeploymentPreviewURL struct.\n",
        "type": "object",
        "required": [
          "deployment_id",
          "app_id",
          "alive"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Echoed from the path so a batch caller can correlate."
          },
          "app_id": {
            "type": "string",
            "format": "uuid",
            "description": "Resolved parent app id."
          },
          "host": {
            "type": "string",
            "description": "Per-deployment preview hostname (`deploy-{N}-{slug}.gregale.dev`). Empty when alive=false OR when wire.DeployWildcardSuffix is \"\" (zone disabled).",
            "example": "deploy-3-url-happy.gregale.dev"
          },
          "url": {
            "type": "string",
            "description": "Full request URL (`https://<host>`). Empty when host is empty.",
            "example": "https://deploy-3-url-happy.gregale.dev"
          },
          "alive": {
            "type": "boolean",
            "description": "True iff the deployment exists, belongs to the caller, and has a status in {pending, building, imaging, snapshotting, live} (the same predicate as state.Deployment.DeploymentPreviewActive the cert allowlist consults)."
          },
          "last_checked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When certmagic last validated the cert under host. Null for never-touched hostnames. NOT a latency probe — the cert NotAfter is the load-bearing expiry."
          }
        }
      },
      "SetDeploymentAliasRequest": {
        "description": "Request to point one named alias at an exact immutable deployment row.",
        "type": "object",
        "required": [
          "deployment_id"
        ],
        "additionalProperties": false,
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Exact immutable deployment row to associate with this alias."
          }
        }
      },
      "DeploymentAliasResponse": {
        "description": "A customer's named pointer to one per-app deployment revision, including its stable host when the platform apps domain is configured.",
        "type": "object",
        "required": [
          "name",
          "deployment_id",
          "revision",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "minimum": 1,
            "description": "Per-app revision number; rendered in CLI output as vN."
          },
          "deployment_status": {
            "type": "string",
            "description": "Lifecycle status of the target deployment. An alias whose deployment is not live (superseded by a rollback or redeploy, or failed) no longer serves traffic and answers 409."
          },
          "host": {
            "type": "string",
            "description": "Stable one-label hostname for this alias. It is keyed by an immutable app identifier and remains stable if the app slug is renamed."
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "HTTPS URL for the alias host; omitted when the platform apps domain is not configured."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DeploymentAliasListResponse": {
        "description": "The per-app list of named deployment aliases.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeploymentAliasResponse"
            }
          }
        }
      },
      "InstanceResponse": {
        "description": "Read-only instance view: id, deployment, state (waking/running/...), lease uid, and host-side internal endpoint (loopback only).",
        "type": "object",
        "required": [
          "id",
          "app_id",
          "deployment_id",
          "state",
          "ram_mb",
          "resident"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "deployment_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "state": {
            "type": "string"
          },
          "host_ip": {
            "type": [
              "string",
              "null"
            ]
          },
          "ram_mb": {
            "type": "integer",
            "example": 256
          },
          "resident": {
            "type": "boolean",
            "description": "True when this instance currently holds host memory. Historical parked, stopped, and failed rows report false."
          },
          "wake_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_request_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "parked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "min_instances_target": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "execution_mode": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "normal",
              "mirror",
              "worker",
              "service",
              "job",
              null
            ],
            "description": "Closed-set execution mode for this instance.",
            "example": "normal"
          },
          "lifecycle_failure_reason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "startup_fail",
              "readiness_fail",
              "liveness_fail",
              "crash_loop",
              "oom",
              "clean_exit",
              "error_exit",
              null
            ],
            "description": "Reason for the most recent terminal transition. null when still running.",
            "example": null
          }
        }
      },
      "MCPInstanceHealthProbeResponse": {
        "description": "Bounded /healthz response from one exact replica with identity stamped by the platform.",
        "type": "object",
        "required": [
          "app_id",
          "deployment_id",
          "instance_id",
          "http_status",
          "health_body"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "instance_id": {
            "type": "string",
            "format": "uuid"
          },
          "http_status": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599,
            "description": "HTTP status returned by the workload's /healthz handler."
          },
          "health_body": {
            "type": "string",
            "maxLength": 65536,
            "description": "UTF-8 body returned by the workload's /healthz handler."
          },
          "health_body_too_large": {
            "type": "boolean",
            "description": "True when the workload response exceeded the 64 KiB probe limit and health_body contains only its bounded prefix."
          }
        }
      },
      "MCPInstanceProtocolProbeRequest": {
        "description": "One bounded, read-only MCP JSON-RPC request to an exact replica.",
        "type": "object",
        "required": [
          "host",
          "endpoint",
          "protocol_version",
          "rpc_request"
        ],
        "properties": {
          "host": {
            "type": "string",
            "maxLength": 255,
            "description": "Deployment preview hostname and optional port."
          },
          "endpoint": {
            "type": "string",
            "maxLength": 1024,
            "pattern": "^/(?:[A-Za-z0-9._~-]+(?:/[A-Za-z0-9._~-]+)*/?)?$",
            "description": "Literal absolute MCP endpoint path without query, fragment, escapes, empty interior segments, or route patterns."
          },
          "protocol_version": {
            "type": "string",
            "enum": [
              "2026-07-28",
              "2025-11-25"
            ]
          },
          "rpc_request": {
            "$ref": "#/components/schemas/MCPProbeRPCRequest"
          }
        }
      },
      "MCPProbeRPCRequest": {
        "description": "Single MCP JSON-RPC initialize, initialized notification, discovery, or catalog-list request. Mutating and data-reading methods are rejected.",
        "type": "object",
        "required": [
          "jsonrpc",
          "method"
        ],
        "properties": {
          "jsonrpc": {
            "type": "string",
            "const": "2.0"
          },
          "id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              }
            ]
          },
          "method": {
            "type": "string",
            "enum": [
              "initialize",
              "notifications/initialized",
              "server/discover",
              "tools/list",
              "resources/list",
              "resources/templates/list",
              "prompts/list"
            ]
          },
          "params": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "additionalProperties": false
      },
      "MCPInstanceProtocolProbeResponse": {
        "description": "Bounded MCP response from one exact replica with platform-stamped identity.",
        "type": "object",
        "required": [
          "app_id",
          "deployment_id",
          "instance_id",
          "http_status",
          "body"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "instance_id": {
            "type": "string",
            "format": "uuid"
          },
          "http_status": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599
          },
          "content_type": {
            "type": "string",
            "maxLength": 128
          },
          "protocol_version": {
            "type": "string",
            "maxLength": 64
          },
          "session_id": {
            "type": "string",
            "maxLength": 1024
          },
          "session_id_present": {
            "type": "boolean",
            "description": "True when the workload returned an MCP-Session-Id header, including when its value exceeded the response header cap."
          },
          "body": {
            "type": "string",
            "maxLength": 524288
          },
          "body_too_large": {
            "type": "boolean"
          }
        }
      },
      "DomainReadiness": {
        "description": "Independent ownership, DNS routing, and TLS activation state.",
        "type": "object",
        "required": [
          "status",
          "ownership",
          "routing",
          "tls"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "awaiting_ownership",
              "expired",
              "checking_dns",
              "fix_routing",
              "preparing_https",
              "ready",
              "needs_attention"
            ]
          },
          "ownership": {
            "type": "string",
            "enum": [
              "pending",
              "verified",
              "expired"
            ]
          },
          "routing": {
            "type": "string",
            "enum": [
              "ok",
              "fail",
              "pending",
              "na"
            ]
          },
          "tls": {
            "type": "string",
            "description": "Certificate state, independently of ownership and routing."
          }
        }
      },
      "DomainManifest": {
        "description": "Versioned desired bindings. Only listed domains change; omission never removes a binding. At most 20 bindings in a 128 KiB request. Use a separate file from the application deployment manifest.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "domains"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "domains": {
            "type": "array",
            "minItems": 1,
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/DomainBindingSpec"
            }
          }
        }
      },
      "DomainBindingSpec": {
        "description": "A desired exact or wildcard hostname, app slug and optional project environment. An omitted environment selects ordinary default routing.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "domain",
          "app"
        ],
        "properties": {
          "domain": {
            "type": "string",
            "example": "api.example.com"
          },
          "app": {
            "type": "string",
            "example": "my-api"
          },
          "environment": {
            "type": "string"
          }
        }
      },
      "DomainBindingTarget": {
        "description": "Resolved app and environment identity captured in a reviewed plan.",
        "type": "object",
        "properties": {
          "app": {
            "type": "string"
          },
          "app_id": {
            "type": "string"
          },
          "environment": {
            "type": "string"
          },
          "environment_id": {
            "type": "string"
          }
        }
      },
      "DomainBindingChange": {
        "description": "A proposed create, move or noop. New claims need verification. A move retains proof and TLS state.",
        "type": "object",
        "properties": {
          "domain": {
            "type": "string"
          },
          "action": {
            "type": "string",
            "enum": [
              "create",
              "move",
              "noop"
            ]
          },
          "before": {
            "$ref": "#/components/schemas/DomainBindingTarget"
          },
          "after": {
            "$ref": "#/components/schemas/DomainBindingTarget"
          },
          "verified": {
            "type": "boolean"
          },
          "clears_default": {
            "type": "boolean",
            "description": "The source app's default domain pointer will be cleared."
          },
          "deployment_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Serving destination deployments captured for review; this is not an HTTP smoke-test result."
          }
        }
      },
      "DomainPlan": {
        "description": "Deterministic review artifact. The SHA-256 binds the diff to private claim identity, intervening moves, destination release and traffic allocations. It contains no ownership proof token.",
        "type": "object",
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "manifest": {
            "$ref": "#/components/schemas/DomainManifest"
          },
          "changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DomainBindingChange"
            }
          }
        }
      },
      "DomainApplyRequest": {
        "description": "Apply exactly the reviewed bindings. Confirmation and the fingerprint from planDomains are required.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "manifest",
          "expected_plan_sha256",
          "confirm"
        ],
        "properties": {
          "manifest": {
            "$ref": "#/components/schemas/DomainManifest"
          },
          "expected_plan_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "confirm": {
            "type": "boolean",
            "const": true
          }
        }
      },
      "DomainApplyResponse": {
        "description": "The committed snapshot and optional previous bindings for a separately reviewed rollback.",
        "type": "object",
        "properties": {
          "plan": {
            "$ref": "#/components/schemas/DomainPlan"
          },
          "domains": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomDomainResponse"
            }
          },
          "rollback": {
            "$ref": "#/components/schemas/DomainManifest"
          }
        }
      },
      "CustomDomainResponse": {
        "description": "A custom domain binding: domain string, target app, optional project environment, verification status, and TLS provisioning state. adds `default`, `cert_not_after`, and `cert_sans` for the `gregale domains set-default | verify | show` surface.",
        "type": "object",
        "required": [
          "domain",
          "app_id",
          "verified"
        ],
        "properties": {
          "readiness": {
            "$ref": "#/components/schemas/DomainReadiness"
          },
          "verification_next_check_at": {
            "type": "string",
            "format": "date-time",
            "description": "Next scheduled automatic ownership check; omitted after verification."
          },
          "verification_attempts": {
            "type": "integer",
            "minimum": 0
          },
          "cert_retry_at": {
            "type": "string",
            "format": "date-time",
            "description": "Next permitted legacy certificate attempt, when a durable cooldown is active. Caddy manages its own retry schedule."
          },
          "checks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DomainDoctorCheck"
            },
            "description": "Fresh checks for this claim, including observed values and remediation. Stale observations are omitted."
          },
          "domain": {
            "type": "string",
            "example": "app.example.com"
          },
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "environment": {
            "type": "string",
            "description": "Project environment that owns the route; omitted for legacy application-wide domains."
          },
          "challenge_token": {
            "type": [
              "string",
              "null"
            ]
          },
          "verified": {
            "type": "boolean"
          },
          "verified_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "verification_expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "Hard deadline for an unverified claim. An expired claim requires a fresh create request and a new TXT proof."
          },
          "verification_expired": {
            "type": "boolean",
            "description": "True when the unverified claim has expired. Obsolete challenge_token, txt_record, and verification DNS instructions are omitted; resume domain setup to recreate the claim."
          },
          "txt_record": {
            "type": [
              "string",
              "null"
            ]
          },
          "default": {
            "type": "boolean",
            "description": "True when this domain is the app's default. Set via `gregale domains set-default`."
          },
          "cert_not_after": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Issued cert NotAfter (RFC3339 UTC). Populated on verified domains; the `gregale domains show` line below the cert expiry renders against this field."
          },
          "cert_sans": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Cert subject alt names (DNSNames). Useful for the `gregale domains show` listing — if the customer's CNAME points at a CDN, the SANs reveal which CDN."
          },
          "cert_status": {
            "type": [
              "string",
              "null"
            ],
            "description": "Durable TLS lifecycle for the legacy custom domain (pending, issued, renewing, failed, or dns_drifted). The show endpoint may temporarily return a live `dial_failed:<reason>` value when the probe cannot reach the edge."
          },
          "cert_expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Durable certificate expiry timestamp recorded by the cert observer."
          },
          "cert_last_error": {
            "type": [
              "string",
              "null"
            ],
            "description": "Most recent certificate issuance/renewal error, when cert_status is failed."
          },
          "dns_last_checked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Timestamp of the most recent DNS verification/doctor probe."
          },
          "dns_records": {
            "type": "array",
            "description": "DNS records to publish: the TXT ownership proof and the routing CNAME, plus A/AAAA alternatives for a zone apex when the platform publishes edge addresses.",
            "items": {
              "$ref": "#/components/schemas/DNSRecordInstruction"
            }
          }
        }
      },
      "CustomDomainHostsResponse": {
        "description": "A wildcard custom domain's host allowlist. Names are the parts of hosts before the wildcard's suffix.",
        "type": "object",
        "required": [
          "domain",
          "names",
          "restricted"
        ],
        "properties": {
          "domain": {
            "type": "string",
            "example": "*.example.com"
          },
          "names": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "string"
            },
            "example": [
              "app",
              "api",
              "eu.shop"
            ]
          },
          "restricted": {
            "type": "boolean",
            "description": "False when no allowlist is set: every name below the wildcard may hold a certificate."
          }
        }
      },
      "SetCustomDomainHostsRequest": {
        "description": "Replaces a wildcard custom domain's host allowlist; DELETE the allowlist to allow every name again.",
        "type": "object",
        "required": [
          "names"
        ],
        "properties": {
          "names": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "type": "string"
            },
            "description": "Names below the wildcard (or full hosts) that may hold certificates."
          }
        }
      },
      "DNSRecordInstruction": {
        "description": "One DNS record a customer publishes for a custom domain. `alternative` marks an A/AAAA routing record that replaces the CNAME where a CNAME is not allowed, such as at a zone apex.",
        "type": "object",
        "required": [
          "type",
          "name",
          "value",
          "purpose"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "TXT",
              "CNAME",
              "A",
              "AAAA"
            ],
            "example": "CNAME"
          },
          "name": {
            "type": "string",
            "example": "app.example.com"
          },
          "value": {
            "type": "string",
            "example": "edge.gregale.dev"
          },
          "purpose": {
            "type": "string",
            "enum": [
              "verification",
              "routing"
            ],
            "example": "routing"
          },
          "alternative": {
            "type": "boolean",
            "default": false
          }
        }
      },
      "CreateCustomDomainRequest": {
        "description": "Bind a custom domain to an app, optionally routing it to one project environment.",
        "type": "object",
        "required": [
          "domain",
          "app_id"
        ],
        "properties": {
          "domain": {
            "type": "string",
            "example": "app.example.com"
          },
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "environment": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{0,31}[a-z0-9])?$",
            "description": "Optional project environment slug. When set, traffic follows only that environment's active release graph."
          }
        }
      },
      "DomainDoctorReport": {
        "description": "Per-domain doctor report. Carries 5 Render-style checks (dns_record, points_to_gregale, tls_certificate, caa_permits, ipv6_conflict) plus the durable row's app_id and observed_at. `stale:true` means the cached observation row was older than FAAS_DOMAIN_DOCTOR_TTL_SECONDS (default 300) when the handler ran a synchronous re-probe.",
        "type": "object",
        "required": [
          "domain",
          "app_id",
          "observed_at",
          "healthy",
          "checks"
        ],
        "properties": {
          "domain": {
            "type": "string",
            "example": "app.example.com"
          },
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "stale": {
            "type": "boolean",
            "default": false
          },
          "observed_at": {
            "type": "string",
            "format": "date-time",
            "example": "2026-08-18T14:23:11Z"
          },
          "healthy": {
            "type": "boolean",
            "example": false
          },
          "checks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DomainDoctorCheck"
            }
          }
        }
      },
      "DomainDoctorCheck": {
        "description": "One row of the doctor report. Stable name tokens (dns_record / points_to_gregale / tls_certificate / caa_permits / ipv6_conflict) so the CLI can filter by name without parsing the human Detail field. Remediation is the exact record to change when status is fail — the load-bearing field for the activation drop-off.",
        "type": "object",
        "required": [
          "name",
          "status",
          "detail"
        ],
        "properties": {
          "name": {
            "type": "string",
            "enum": [
              "dns_record",
              "points_to_gregale",
              "tls_certificate",
              "caa_permits",
              "ipv6_conflict"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ok",
              "fail",
              "pending",
              "na"
            ],
            "example": "fail"
          },
          "detail": {
            "type": "string",
            "example": "CNAME does not point at Gregale (observed: wrong.example.com.)"
          },
          "observed": {
            "type": "string",
            "example": "wrong.example.com."
          },
          "remediation": {
            "type": "string",
            "example": "Set CNAME app.example.com → edge.gregale.dev"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time",
            "example": "2026-08-18T14:23:11Z"
          }
        }
      },
      "TemplateView": {
        "description": "A starter template entry from GET /v1/templates.",
        "type": "object",
        "required": [
          "name",
          "category",
          "description"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "The template name — matches the CLI's template names verbatim.",
            "example": "hello-node"
          },
          "category": {
            "type": "string",
            "enum": [
              "hello",
              "function",
              "stateless-contract",
              "ai"
            ],
            "description": "Customer-facing group label (templates.CategoryFor)."
          },
          "description": {
            "type": "string",
            "description": "One-line customer-facing blurb.",
            "example": "minimal Node.js HTTP server — first-touch smoke test"
          }
        }
      },
      "TenantSurfaceResponse": {
        "description": "A tenant surface: a multi-hostname SAN bundle attached to one app. managed_by_platform_tenant is true only when created by a platform-tenant bundle apply.",
        "type": "object",
        "required": [
          "id",
          "account_id",
          "app_id",
          "name",
          "cert_kind",
          "status",
          "cert_state",
          "hostnames"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "account_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "name": {
            "type": "string",
            "example": "customer-zones"
          },
          "cert_kind": {
            "type": "string",
            "enum": [
              "per_host_san"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "active",
              "suspended",
              "deleted"
            ]
          },
          "cert_state": {
            "type": "string",
            "enum": [
              "none",
              "pending",
              "issued",
              "renewing",
              "failed"
            ]
          },
          "cert_not_after": {
            "type": "string",
            "format": "date-time"
          },
          "cert_last_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "managed_by_platform_tenant": {
            "type": "boolean",
            "description": "True only when a platform-tenant bundle created this surface; omitted otherwise."
          },
          "hostnames": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TenantHostnameResponse"
            }
          }
        }
      },
      "TenantHostnameResponse": {
        "description": "A hostname attached to a tenant surface (DNS-01 verified). managed_by_platform_tenant is true only when created by a platform-tenant bundle apply.",
        "type": "object",
        "required": [
          "hostname",
          "verified",
          "txt_record"
        ],
        "properties": {
          "hostname": {
            "type": "string",
            "example": "api.customer-a.com"
          },
          "challenge_token": {
            "type": [
              "string",
              "null"
            ]
          },
          "verified": {
            "type": "boolean"
          },
          "verified_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "txt_record": {
            "type": "string",
            "description": "TXT record the customer must publish (_faas-verify.<hostname>)."
          },
          "managed_by_platform_tenant": {
            "type": "boolean",
            "description": "True only when a platform-tenant bundle created this hostname; omitted otherwise."
          }
        }
      },
      "CreateTenantSurfaceRequest": {
        "description": "Create a tenant surface with a seed set of hostnames.",
        "type": "object",
        "required": [
          "app_id",
          "name"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "name": {
            "type": "string",
            "example": "customer-zones"
          },
          "cert_kind": {
            "type": "string",
            "enum": [
              "per_host_san"
            ]
          },
          "hostnames": {
            "type": "array",
            "items": {
              "type": "string",
              "example": "api.customer-a.com"
            }
          }
        }
      },
      "ListTenantSurfacesResponse": {
        "description": "Surfaces on the app (soft-deleted excluded server-side).",
        "type": "object",
        "required": [
          "surfaces"
        ],
        "properties": {
          "surfaces": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TenantSurfaceResponse"
            }
          }
        }
      },
      "AddTenantHostnameRequest": {
        "description": "Append a hostname to an existing surface.",
        "type": "object",
        "required": [
          "hostname"
        ],
        "properties": {
          "hostname": {
            "type": "string",
            "example": "api.customer-c.com"
          }
        }
      },
      "CronResponse": {
        "description": "An app schedule: either an HTTP-path cron or a deployment-attached command cron.",
        "type": "object",
        "required": [
          "id",
          "app_id",
          "kind",
          "schedule",
          "enabled",
          "timezone",
          "skip_if_running",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "kind": {
            "type": "string",
            "enum": [
              "http",
              "command"
            ],
            "description": "HTTP triggers the app path; command runs argv in a fresh VM using the live deployment selected at fire time."
          },
          "schedule": {
            "type": "string",
            "example": "*/5 * * * *"
          },
          "path": {
            "type": "string",
            "description": "HTTP target path; omitted for command crons."
          },
          "command": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Direct command argv; present only for command crons."
          },
          "command_shell": {
            "type": "boolean",
            "description": "Interpret a one-element command through the app shell; false executes argv directly."
          },
          "timeout_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3600,
            "description": "Per-fire command deadline."
          },
          "max_output_bytes": {
            "type": "integer",
            "minimum": 1024,
            "maximum": 16777216,
            "description": "Combined stdout/stderr tail cap for command runs."
          },
          "retry_max": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5,
            "description": "Additional attempts after an execution fails or times out; zero disables retries."
          },
          "retry_backoff_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3600,
            "description": "Base retry delay. Each subsequent retry doubles the delay, capped at 24 hours."
          },
          "enabled": {
            "type": "boolean"
          },
          "suspended_reason": {
            "type": "string",
            "enum": [
              "no_live_deployment"
            ],
            "description": "Why an enabled schedule is paused. Redeploy the app successfully to clear no_live_deployment."
          },
          "timezone": {
            "type": "string",
            "description": "IANA timezone used to evaluate the schedule; defaults to UTC.",
            "example": "America/New_York"
          },
          "skip_if_running": {
            "type": "boolean",
            "description": "When true, consume a scheduled occurrence while a prior HTTP invocation or app command task is active."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_fired_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "environment": {
            "type": "string",
            "description": "Project environment the cron runs in; omitted for production.",
            "example": "staging"
          },
          "clone_paused": {
            "type": "boolean",
            "description": "A full environment clone copied this cron disabled although the source ran it; resuming the environment's automation enables it."
          },
          "schedule_policy": {
            "$ref": "#/components/schemas/SchedulePolicy"
          },
          "failure_rules": {
            "$ref": "#/components/schemas/FailureRules"
          }
        }
      },
      "CronRun": {
        "description": "One execution of a cron: when it fired, how long it ran, and how it ended. HTTP fires project invocations; command fires project deployment-attached app tasks.",
        "type": "object",
        "required": [
          "id",
          "started_at",
          "outcome",
          "attempts"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^(?:[a-f0-9]{32}|[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})$",
            "description": "Invocation id for HTTP crons or task UUID for command crons.",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "started_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the cron fired (the invocation/task creation time), not when the app began executing."
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the run reached a terminal state; null while still in flight."
          },
          "duration_ms": {
            "type": [
              "integer",
              "null"
            ],
            "description": "completed_at - started_at in milliseconds, computed server-side. Null while the run is still in flight."
          },
          "outcome": {
            "type": "string",
            "enum": [
              "success",
              "failed",
              "timeout",
              "dead_letter",
              "running",
              "cancelled",
              "uncertain"
            ],
            "description": "Normalized result. `timeout` means the dispatch exceeded its deadline; `dead_letter` means the retry budget was exhausted; `running` means the run has not reached a terminal state yet; `uncertain` means delivery may have reached the app without a completion receipt. Branch on this, never on `error`."
          },
          "attempts": {
            "type": "integer",
            "description": "Dispatch attempts for this run; greater than 1 means it was retried."
          },
          "instance_id": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[a-f0-9]{32}$",
            "description": "The instance that served the run; null if the fire never reached one."
          },
          "task_id": {
            "type": "string",
            "format": "uuid",
            "description": "Deployment-attached app-task receipt for command crons."
          },
          "error": {
            "type": [
              "string",
              "null"
            ],
            "description": "Operator-facing failure text. Unstructured and unversioned — do not parse it."
          }
        }
      },
      "ListCronRunsResponse": {
        "description": "Page of cron runs; ordered newest-first. Pass the LAST id of the returned slice as the next `?before=` to load older runs.",
        "type": "object",
        "required": [
          "runs"
        ],
        "properties": {
          "runs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CronRun"
            }
          }
        }
      },
      "ScheduleOccurrenceResponse": {
        "description": "Durable decision and lifecycle snapshot for one nominal schedule time.",
        "type": "object",
        "required": [
          "id",
          "schedule_revision",
          "scheduled_for",
          "schedule_policy",
          "status",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "schedule_revision": {
            "type": "integer",
            "minimum": 1
          },
          "scheduled_for": {
            "type": "string",
            "format": "date-time"
          },
          "start_deadline_at": {
            "type": "string",
            "format": "date-time"
          },
          "schedule_policy": {
            "$ref": "#/components/schemas/SchedulePolicy"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "queued",
              "running",
              "succeeded",
              "failed",
              "cancelled",
              "skipped_overlap",
              "missed_deadline",
              "coalesced",
              "waiting_replacement",
              "uncertain"
            ]
          },
          "reason": {
            "type": "string"
          },
          "work_decision": {
            "$ref": "#/components/schemas/WorkDecision"
          },
          "outcome_code": {
            "type": "string",
            "maxLength": 64,
            "pattern": "^[a-z0-9_.-]*$"
          },
          "blocking_occurrence_id": {
            "type": "string",
            "format": "uuid"
          },
          "exclusive_operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "job_run_id": {
            "type": "string",
            "format": "uuid"
          },
          "invocation_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_task_id": {
            "type": "string",
            "format": "uuid"
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ListScheduleOccurrencesResponse": {
        "description": "Newest-first page of scheduled occurrence decisions.",
        "type": "object",
        "required": [
          "occurrences",
          "limit"
        ],
        "properties": {
          "occurrences": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ScheduleOccurrenceResponse"
            }
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 200
          },
          "before": {
            "type": "string",
            "format": "uuid"
          },
          "next_before": {
            "type": "string",
            "format": "uuid",
            "description": "Pass this id as before to read an older page; omitted when the page is complete."
          }
        }
      },
      "FireCronResponse": {
        "description": "The 202 body for `POST /v1/crons/{id}/run`.\n`request_id` is the durable handle on the fire-now row in\n`cron_fire_now_requests`; poll\n`GET /v1/crons/{id}/runs` for the matching `cron.fired.manually`\naudit row, or watch the future `GET /v1/cron-fire-now-requests/{id}`\nfor terminal status. `status` is `\"pending\"` at the moment of\nthe response; transitions to `\"succeeded\"` or `\"failed\"`\nasynchronously as the scheduler claims the row.\n",
        "type": "object",
        "required": [
          "request_id",
          "cron_id",
          "status"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "cron_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "fedcba9876543210fedcba9876543210"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "running",
              "succeeded",
              "failed"
            ],
            "example": "pending"
          }
        }
      },
      "FireCronRequestResponse": {
        "description": "Read shape for `GET /v1/cron-fire-now-requests/{request_id}`.\n",
        "type": "object",
        "required": [
          "request_id",
          "cron_id",
          "status",
          "requested_at",
          "account_id"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "cron_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "running",
              "succeeded",
              "failed",
              "cancelled"
            ]
          },
          "requested_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "invocation_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "operation_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Managed exclusive operation admitted by this fire-now request."
          },
          "task_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Command task created by this request; absent for HTTP crons or before queueing."
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "CreateCronRequest": {
        "description": "Create an HTTP-path cron or deployment-attached app command schedule. Schedule policies apply to both kinds. HTTP Crons accept outcome-code failure rules; command Crons also accept exit-code rules.",
        "type": "object",
        "required": [
          "app_id",
          "schedule"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "description": "App id or slug.",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "schedule": {
            "type": "string",
            "example": "*/5 * * * *"
          },
          "path": {
            "type": "string",
            "maxLength": 2048,
            "description": "HTTP target path on the cron's own app; defaults to /, starts with a single /, may carry a query string, and is mutually exclusive with command."
          },
          "command": {
            "type": "array",
            "minItems": 1,
            "maxItems": 64,
            "items": {
              "type": "string",
              "maxLength": 4096
            },
            "description": "Direct command argv; mutually exclusive with path."
          },
          "command_shell": {
            "type": "boolean",
            "default": false,
            "description": "Interpret one command string through the app shell when true."
          },
          "timeout_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 3600,
            "description": "Per-fire command deadline; zero uses the 600-second default."
          },
          "max_output_bytes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 16777216,
            "description": "Combined stdout/stderr tail cap; zero uses the 1 MiB default."
          },
          "enabled": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "timezone": {
            "type": "string",
            "description": "IANA timezone; defaults to UTC.",
            "example": "Europe/Istanbul"
          },
          "skip_if_running": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Skip a scheduled fire when an earlier cron invocation is still running."
          },
          "retry_max": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5,
            "description": "Additional command attempts after failure or timeout; command crons only."
          },
          "retry_backoff_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3600,
            "description": "Base retry delay in seconds; doubles per retry and is capped at 24 hours. Command crons only."
          },
          "environment": {
            "type": "string",
            "description": "Project environment the cron runs in; omitted or production is the app's production environment. Immutable once created.",
            "example": "staging"
          },
          "schedule_policy": {
            "$ref": "#/components/schemas/SchedulePolicy"
          },
          "failure_rules": {
            "$ref": "#/components/schemas/FailureRules"
          }
        }
      },
      "UpdateCronRequest": {
        "description": "Partial cron update. Schedule policies apply to HTTP and command Crons. HTTP Cron failure rules match outcome codes; command Cron rules may also match exit codes.",
        "type": "object",
        "properties": {
          "schedule": {
            "type": [
              "string",
              "null"
            ],
            "example": "*/5 * * * *"
          },
          "path": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 2048,
            "description": "HTTP target path on the cron's own app; starts with a single /."
          },
          "enabled": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "timezone": {
            "type": [
              "string",
              "null"
            ],
            "description": "IANA timezone; an empty value resets to UTC."
          },
          "skip_if_running": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Enable or disable overlap skipping for scheduled fires."
          },
          "retry_max": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 5,
            "description": "Replace the retry allowance for an existing deployment-command cron."
          },
          "retry_backoff_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 3600,
            "description": "Replace the base retry delay for an existing deployment-command cron; the delay doubles after each failed attempt."
          },
          "schedule_policy": {
            "$ref": "#/components/schemas/SchedulePolicy"
          },
          "failure_rules": {
            "$ref": "#/components/schemas/FailureRules"
          },
          "clear_schedule_policy": {
            "type": "boolean",
            "description": "Remove the cron's schedule policy. An omitted schedule_policy keeps it; cannot be sent with schedule_policy."
          },
          "clear_failure_rules": {
            "type": "boolean",
            "description": "Remove the cron's failure rules. An omitted failure_rules keeps them; cannot be sent with failure_rules."
          }
        }
      },
      "SchedulePolicy": {
        "description": "Versioned recurring-work scheduling policy for Jobs and both HTTP and command Crons. HTTP replace waits for a prior dispatched request to complete because the scheduler has no stop acknowledgement for a request already delivered to the app.",
        "type": "object",
        "required": [
          "version",
          "overlap",
          "missed_runs"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "overlap": {
            "type": "string",
            "enum": [
              "allow",
              "skip",
              "replace"
            ],
            "description": "Allow concurrent occurrences, record-and-skip while one is active, or replace when previous work can be stopped safely. HTTP Crons wait for a dispatched request to finish."
          },
          "start_deadline_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2592000,
            "description": "Maximum delay from the nominal schedule time to the first task start; zero or omitted disables the deadline."
          },
          "missed_runs": {
            "type": "string",
            "enum": [
              "coalesce_latest",
              "skip"
            ],
            "description": "On scheduler recovery, coalesce the due backlog into its latest occurrence or record stale occurrences as skipped."
          }
        }
      },
      "FailureRules": {
        "description": "Versioned explicit classification policy for failed Job partitions, command-Cron executions, and HTTP Cron outcome codes. HTTP status is not a business outcome matcher.",
        "type": "object",
        "required": [
          "version",
          "rules",
          "unmatched_failure",
          "uncertain_outcome"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "rules": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "$ref": "#/components/schemas/FailureRule"
            }
          },
          "unmatched_failure": {
            "type": "string",
            "enum": [
              "retry",
              "fail_partition"
            ]
          },
          "uncertain_outcome": {
            "type": "string",
            "enum": [
              "hold",
              "retry"
            ],
            "description": "Choose whether a missing completion receipt stays held for reconciliation or is retried with possible duplicate execution."
          }
        }
      },
      "FailureRule": {
        "description": "A guest exit-code or structured application-outcome matcher and the action for that confirmed result. HTTP Crons support outcome_codes; exit_codes apply to Jobs and command Crons.",
        "type": "object",
        "required": [
          "action"
        ],
        "additionalProperties": false,
        "properties": {
          "exit_codes": {
            "type": "array",
            "uniqueItems": true,
            "items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 255
            }
          },
          "outcome_codes": {
            "type": "array",
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z0-9_.-]+$"
            }
          },
          "action": {
            "type": "string",
            "enum": [
              "retry",
              "fail_partition"
            ]
          }
        }
      },
      "WorkDecision": {
        "description": "Persisted classifier decision for one execution result.",
        "type": "object",
        "required": [
          "classification",
          "action",
          "reason",
          "policy_version"
        ],
        "properties": {
          "classification": {
            "type": "string"
          },
          "action": {
            "type": "string",
            "enum": [
              "retry",
              "fail_partition",
              "complete",
              "hold"
            ]
          },
          "reason": {
            "type": "string"
          },
          "policy_version": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "PrewarmRequest": {
        "description": "Schedule temporary capacity restoration ahead of a demand window.",
        "type": "object",
        "required": [
          "count",
          "wake_at",
          "expires_at"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "minimum": 1,
            "description": "Desired number of live instances during the window; normal plan and ledger caps still apply."
          },
          "wake_at": {
            "type": "string",
            "format": "date-time",
            "description": "Start of the expected demand window."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "End of the temporary intent; must be after wake_at."
          }
        }
      },
      "PrewarmIntentResponse": {
        "description": "Durable scheduled/predicted prewarm intent and scheduler outcome.",
        "type": "object",
        "required": [
          "id",
          "app_id",
          "count",
          "wake_at",
          "expires_at",
          "trigger",
          "status",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "count": {
            "type": "integer"
          },
          "wake_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "trigger": {
            "type": "string",
            "enum": [
              "calendar",
              "cron",
              "pattern",
              "webhook"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "running",
              "succeeded",
              "failed",
              "cancelled"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "claimed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "fired_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "admitted_count": {
            "type": "integer",
            "description": "Instances actually admitted; may be lower than count when capacity gates apply."
          },
          "outcome": {
            "type": "string"
          },
          "last_error": {
            "type": "string"
          }
        }
      },
      "CreateJobRequest": {
        "description": "Job creation payload — name + image + command + caps; schedule enables recurring runs.",
        "type": "object",
        "required": [
          "name",
          "image_ref",
          "command"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 3,
            "maxLength": 40,
            "pattern": "^[a-z0-9][a-z0-9-]*[a-z0-9]$",
            "example": "nightly-export"
          },
          "kind": {
            "type": "string",
            "enum": [
              "batch",
              "recurring"
            ],
            "default": "batch"
          },
          "schedule": {
            "type": "string",
            "description": "Optional five-field cron expression. When present, the job becomes recurring and the scheduler creates one single-task run per occurrence.",
            "example": "0 3 * * *"
          },
          "timezone": {
            "type": "string",
            "description": "IANA timezone for schedule; defaults to UTC.",
            "example": "Europe/Istanbul"
          },
          "image_ref": {
            "type": "string",
            "example": "ghcr.io/acme/etl:v1.2.3"
          },
          "command": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "type": "string"
            },
            "example": [
              "/bin/sh",
              "-c",
              "python -m etl.run"
            ]
          },
          "env_overrides": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "example": {
              "AWS_REGION": "eu-central-1",
              "LOG_LEVEL": "info"
            }
          },
          "ram_mb": {
            "type": "integer",
            "minimum": 0,
            "example": 2048
          },
          "task_timeout_sec": {
            "type": "integer",
            "minimum": 0,
            "example": 1800
          },
          "max_parallelism": {
            "type": "integer",
            "minimum": 0,
            "example": 25
          },
          "retry_max": {
            "type": "integer",
            "minimum": 0,
            "example": 5
          },
          "schedule_policy": {
            "$ref": "#/components/schemas/SchedulePolicy"
          },
          "failure_rules": {
            "$ref": "#/components/schemas/FailureRules"
          }
        }
      },
      "UpdateJobRequest": {
        "description": "Partial job update. nil pointer fields leave the column untouched.",
        "type": "object",
        "properties": {
          "image_ref": {
            "type": "string"
          },
          "command": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "env_overrides": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "ram_mb": {
            "type": "integer",
            "minimum": 0
          },
          "task_timeout_sec": {
            "type": "integer",
            "minimum": 0
          },
          "max_parallelism": {
            "type": "integer",
            "minimum": 0
          },
          "retry_max": {
            "type": "integer",
            "minimum": 0
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "paused"
            ]
          },
          "schedule": {
            "type": "string",
            "description": "Replace the cron expression; an empty string removes the schedule."
          },
          "timezone": {
            "type": "string",
            "description": "Replace the schedule IANA timezone."
          },
          "schedule_policy": {
            "$ref": "#/components/schemas/SchedulePolicy"
          },
          "failure_rules": {
            "$ref": "#/components/schemas/FailureRules"
          }
        }
      },
      "CreateJobRunRequest": {
        "description": "Atomic fan-out into indexed task records; supply `tasks`, an ordered\n`inputs` array, or an external `input_manifest_uri` and checksum.\nEach manifest entry is assigned to one task index in array order.\nThe handler validates the count against `Plan.JobMaxTasksPerRun`\n(Hobby=100, Pro=1000, Scale=5000). Per-run overrides\n(parallelism / retry_max / task_timeout_sec) inherit from\nthe job when null.\n",
        "type": "object",
        "properties": {
          "tasks": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5000,
            "example": 100
          },
          "failure_rules": {
            "$ref": "#/components/schemas/FailureRules"
          },
          "inputs": {
            "type": "array",
            "minItems": 1,
            "maxItems": 5000,
            "description": "Ordered input set. Creates one task per entry; tasks may be omitted or must match the input count. References are opaque and fetched by the customer image.",
            "items": {
              "$ref": "#/components/schemas/JobRunInput"
            }
          },
          "input_manifest_uri": {
            "type": "string",
            "description": "obj://<app-id>/<bucket-id>/<key> for a JSON array of inputs, up to 16 MiB. Mutually exclusive with inputs."
          },
          "input_manifest_sha256": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$",
            "description": "SHA-256 of the external manifest's exact bytes; required with input_manifest_uri."
          },
          "execution_class": {
            "type": "string",
            "enum": [
              "standard",
              "flexible"
            ],
            "default": "standard"
          },
          "failure_policy": {
            "type": "string",
            "enum": [
              "continue",
              "fail_fast"
            ],
            "default": "continue"
          },
          "eligible_at": {
            "type": "string",
            "format": "date-time",
            "description": "Earliest admission time for flexible tasks; defaults to now."
          },
          "latest_start_at": {
            "type": "string",
            "format": "date-time",
            "description": "Required for flexible runs. Unstarted tasks expire at this time; completion is not guaranteed by this time."
          },
          "parallelism": {
            "type": "integer",
            "minimum": 1,
            "example": 10
          },
          "retry_max": {
            "type": "integer",
            "minimum": 0,
            "example": 3
          },
          "task_timeout_sec": {
            "type": "integer",
            "minimum": 1,
            "example": 600
          },
          "env_overrides": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "arguments": {
            "type": "array",
            "maxItems": 63,
            "description": "Replace the command arguments for this run, retaining its executable. Empty array removes trailing arguments.",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "JobRunInput": {
        "description": "Stable input identity and opaque reference assigned to one task.",
        "type": "object",
        "required": [
          "input_id",
          "input_ref"
        ],
        "properties": {
          "input_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "input_ref": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048
          }
        }
      },
      "CreateImageRunRequest": {
        "description": "Body of POST /v1/image-runs.",
        "type": "object",
        "required": [
          "image"
        ],
        "properties": {
          "image": {
            "type": "string",
            "maxLength": 2048,
            "description": "OCI image reference; normalized before use (alpine → docker.io/library/alpine:latest)."
          },
          "entrypoint": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "type": "string"
            },
            "description": "Replaces the image ENTRYPOINT; without args the image CMD is dropped."
          },
          "args": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "type": "string"
            },
            "description": "Replaces the image CMD."
          },
          "env": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Per-run environment, validated like Job run env_overrides."
          },
          "ram_mb": {
            "type": "integer",
            "minimum": 0,
            "description": "Task memory in MB; 0 means the Job default. Capped by the plan's Job RAM ceiling."
          },
          "timeout_sec": {
            "type": "integer",
            "minimum": 0,
            "description": "Task deadline in seconds; 0 means the plan's Job task timeout ceiling."
          },
          "pull": {
            "type": "string",
            "enum": [
              "missing",
              "always"
            ],
            "default": "missing",
            "description": "always re-pulls a cached image so a moved tag is resolved again."
          },
          "interactive": {
            "type": "boolean",
            "description": "Hold the command until one client attaches to the run's task. The run has no retries and timeout_sec is at most 3600. Needs the operator gate FAAS_INTERACTIVE_IMAGE_RUNS; otherwise 501."
          },
          "tty": {
            "type": "boolean",
            "description": "Give the interactive command a pseudo-terminal. Requires interactive."
          },
          "user": {
            "type": "string",
            "maxLength": 256,
            "description": "Run as name|uid[:group|gid], resolved in the image's passwd and group files, instead of the image USER (docker run -u)."
          },
          "workdir": {
            "type": "string",
            "maxLength": 4096,
            "description": "Absolute working directory instead of the image WORKDIR (docker run -w); created when missing."
          },
          "registry_auth": {
            "$ref": "#/components/schemas/ImageRunRegistryAuth"
          }
        }
      },
      "ImageRunRegistryAuth": {
        "description": "Credential for a private image's registry. The API stores it sealed on the image's runner job for that registry host, exactly as PUT /v1/jobs/{name}/registry-credentials does, and never returns it. Every run that supplies it refreshes it.",
        "type": "object",
        "required": [
          "username",
          "password"
        ],
        "properties": {
          "username": {
            "type": "string",
            "description": "Registry account or robot name for the image's registry."
          },
          "password": {
            "type": "string",
            "format": "password",
            "writeOnly": true,
            "description": "Registry password or access token; prefer a short-lived read-only token."
          }
        }
      },
      "ImageRunResponse": {
        "description": "Answer to POST /v1/image-runs. job names the runner job; run_id addresses /v1/jobs/{job}/runs/{run_id} once status is queued.",
        "type": "object",
        "required": [
          "status",
          "job",
          "image",
          "image_status"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "pulling",
              "queued"
            ]
          },
          "job": {
            "type": "string",
            "description": "Runner job name (ir-<hash>)."
          },
          "image": {
            "type": "string",
            "description": "Normalized image reference."
          },
          "image_status": {
            "type": "string",
            "enum": [
              "pending",
              "verifying_legacy",
              "ready",
              "failed"
            ]
          },
          "image_error": {
            "type": "string",
            "description": "Last pull or build error while the image is retried."
          },
          "image_digest": {
            "type": "string",
            "description": "Resolved manifest digest once ready."
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "command": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The resolved argv the task runs."
          },
          "attach": {
            "$ref": "#/components/schemas/AppTaskAttachInfo",
            "description": "One-time attach credential of an interactive run, returned only by the response that created the run."
          }
        }
      },
      "JobResponse": {
        "description": "Wire projection of state.Job.",
        "type": "object",
        "required": [
          "id",
          "account_id",
          "name",
          "kind",
          "image_ref",
          "image_materialization_status",
          "command",
          "ram_mb",
          "task_timeout_sec",
          "max_parallelism",
          "retry_max",
          "status",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "example": "nightly-export"
          },
          "kind": {
            "type": "string",
            "enum": [
              "batch",
              "recurring",
              "image_run"
            ]
          },
          "schedule": {
            "type": "string",
            "description": "Recurring five-field cron expression, when configured."
          },
          "timezone": {
            "type": "string",
            "description": "IANA timezone used to evaluate the recurring schedule."
          },
          "last_scheduled_at": {
            "type": "string",
            "format": "date-time",
            "description": "Most recent scheduled occurrence that created a run."
          },
          "schedule_policy": {
            "$ref": "#/components/schemas/SchedulePolicy"
          },
          "failure_rules": {
            "$ref": "#/components/schemas/FailureRules"
          },
          "image_ref": {
            "type": "string"
          },
          "image_resolved_digest": {
            "type": "string",
            "description": "Immutable OCI manifest digest selected from image_ref."
          },
          "image_storage_key": {
            "type": "string",
            "description": "Canonical ext4 artifact key consumed by the VM manager."
          },
          "image_materialization_status": {
            "type": "string",
            "enum": [
              "pending",
              "verifying_legacy",
              "ready",
              "failed"
            ]
          },
          "image_materialization_error": {
            "type": "string",
            "description": "Actionable pull/build failure when materialization_status is failed."
          },
          "image_materialized_at": {
            "type": "string",
            "format": "date-time"
          },
          "command": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "env_overrides": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "ram_mb": {
            "type": "integer",
            "example": 2048
          },
          "task_timeout_sec": {
            "type": "integer",
            "example": 1800
          },
          "max_parallelism": {
            "type": "integer",
            "example": 25
          },
          "retry_max": {
            "type": "integer",
            "example": 5
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "paused",
              "deleted"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "JobRunResponse": {
        "description": "Wire projection of state.JobRun. Aggregate counters are recomputed by the scheduler after every terminal task transition.",
        "type": "object",
        "required": [
          "id",
          "job_id",
          "account_id",
          "trigger_kind",
          "tasks",
          "parallelism",
          "execution_class",
          "failure_policy",
          "aggregate_status",
          "tasks_succeeded",
          "tasks_failed",
          "tasks_cancelled",
          "tasks_running",
          "dead_letter_count",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "trigger_kind": {
            "type": "string",
            "enum": [
              "manual",
              "scheduled",
              "triggered"
            ]
          },
          "occurrence_id": {
            "type": "string",
            "format": "uuid",
            "description": "Durable scheduled-occurrence decision linked to this run."
          },
          "start_deadline_at": {
            "type": "string",
            "format": "date-time",
            "description": "Latest permitted first task start for this scheduled occurrence."
          },
          "failure_rules": {
            "$ref": "#/components/schemas/FailureRules"
          },
          "env_overrides": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "tasks": {
            "type": "integer"
          },
          "input_manifest_version": {
            "type": "integer",
            "description": "0 for numeric fan-out, 1 for an ordered inline or external input manifest."
          },
          "input_digest": {
            "type": "string",
            "description": "SHA-256 of the canonical ordered input manifest."
          },
          "input_manifest_uri": {
            "type": "string",
            "description": "Source obj:// URI for an external input manifest."
          },
          "input_manifest_sha256": {
            "type": "string",
            "description": "SHA-256 of the external manifest's exact bytes."
          },
          "parallelism": {
            "type": "integer"
          },
          "execution_class": {
            "type": "string",
            "enum": [
              "standard",
              "flexible"
            ]
          },
          "failure_policy": {
            "type": "string",
            "enum": [
              "continue",
              "fail_fast"
            ]
          },
          "eligible_at": {
            "type": "string",
            "format": "date-time"
          },
          "latest_start_at": {
            "type": "string",
            "format": "date-time"
          },
          "retry_max": {
            "type": "integer"
          },
          "task_timeout_sec": {
            "type": "integer"
          },
          "command": {
            "type": "array",
            "description": "Command captured at run creation.",
            "items": {
              "type": "string"
            }
          },
          "image_ref_snapshot": {
            "type": "string"
          },
          "image_resolved_digest_snapshot": {
            "type": "string"
          },
          "ram_mb_snapshot": {
            "type": "integer"
          },
          "effective_env_snapshot": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "source_run_id": {
            "type": "string",
            "format": "uuid"
          },
          "aggregate_status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "succeeded",
              "failed",
              "cancelled",
              "dead_letter"
            ]
          },
          "tasks_succeeded": {
            "type": "integer"
          },
          "tasks_failed": {
            "type": "integer"
          },
          "tasks_cancelled": {
            "type": "integer"
          },
          "tasks_running": {
            "type": "integer"
          },
          "dead_letter_count": {
            "type": "integer"
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "JobTaskResponse": {
        "description": "Wire projection of state.JobTask. LeaseToken is intentionally omitted (internal dispatch primitive).",
        "type": "object",
        "required": [
          "run_id",
          "task_index",
          "status",
          "attempt",
          "created_at"
        ],
        "properties": {
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "task_index": {
            "type": "integer",
            "minimum": 0
          },
          "input_id": {
            "type": "string",
            "description": "Stable declared input identity for this task."
          },
          "input_ref": {
            "type": "string",
            "description": "Opaque input reference passed to the guest."
          },
          "source_task_index": {
            "type": "integer",
            "minimum": 0,
            "description": "Original task index when this task came from replay-failed."
          },
          "output_manifest": {
            "type": "object",
            "description": "Versioned artifact references published by a successful task. Gregale retains metadata, not artifact bytes.",
            "properties": {
              "version": {
                "type": "integer",
                "enum": [
                  1
                ]
              },
              "artifacts": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "name",
                    "uri",
                    "size_bytes",
                    "sha256"
                  ],
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "uri": {
                      "type": "string"
                    },
                    "size_bytes": {
                      "type": "integer",
                      "format": "int64"
                    },
                    "sha256": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "claimed",
              "succeeded",
              "failed",
              "timeout",
              "cancelled",
              "oom"
            ]
          },
          "work_decision": {
            "$ref": "#/components/schemas/WorkDecision"
          },
          "outcome_code": {
            "type": "string",
            "maxLength": 64
          },
          "attempt": {
            "type": "integer",
            "minimum": 1
          },
          "instance_id": {
            "type": "string",
            "format": "uuid"
          },
          "error_class": {
            "type": "string",
            "enum": [
              "succeeded",
              "failed",
              "timeout",
              "oom",
              "cancelled",
              "infra"
            ]
          },
          "error_message": {
            "type": "string"
          },
          "exit_code": {
            "type": "integer"
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "JobTaskAttemptResponse": {
        "description": "Immutable terminal outcome of one task attempt.",
        "type": "object",
        "required": [
          "run_id",
          "task_index",
          "attempt",
          "status",
          "finished_at",
          "log_content",
          "log_truncated"
        ],
        "properties": {
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "task_index": {
            "type": "integer",
            "minimum": 0
          },
          "attempt": {
            "type": "integer",
            "minimum": 1
          },
          "input_id": {
            "type": "string"
          },
          "input_ref": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "succeeded",
              "failed",
              "timeout",
              "cancelled",
              "oom"
            ]
          },
          "work_decision": {
            "$ref": "#/components/schemas/WorkDecision"
          },
          "outcome_code": {
            "type": "string",
            "maxLength": 64
          },
          "instance_id": {
            "type": "string",
            "format": "uuid"
          },
          "error_class": {
            "type": "string"
          },
          "error_message": {
            "type": "string"
          },
          "exit_code": {
            "type": "integer"
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": "string",
            "format": "date-time"
          },
          "log_content": {
            "type": "string"
          },
          "log_truncated": {
            "type": "boolean"
          },
          "output_manifest": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "ListJobTaskAttemptsResponse": {
        "description": "A page of task attempts in attempt order.",
        "type": "object",
        "required": [
          "attempts",
          "limit",
          "offset",
          "next_offset"
        ],
        "properties": {
          "attempts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobTaskAttemptResponse"
            }
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          },
          "next_offset": {
            "type": "integer"
          }
        }
      },
      "JobArtifactDownloadResponse": {
        "description": "Verified managed artifact and short-lived signed download request.",
        "type": "object",
        "required": [
          "name",
          "size_bytes",
          "sha256",
          "verified_at",
          "download"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "size_bytes": {
            "type": "integer",
            "format": "int64"
          },
          "sha256": {
            "type": "string"
          },
          "verified_at": {
            "type": "string",
            "format": "date-time"
          },
          "download": {
            "$ref": "#/components/schemas/ObjectSignedRequest"
          }
        }
      },
      "JobTaskLogResponse": {
        "description": "Durable per-task combined stdout/stderr tail. Truncated=true\nmeans the tail was capped at MaxBytes; clients re-fetch\nwith a larger limit to see more.\n",
        "type": "object",
        "required": [
          "task_status",
          "log_content",
          "truncated",
          "max_bytes"
        ],
        "properties": {
          "task_status": {
            "type": "string",
            "enum": [
              "queued",
              "claimed",
              "succeeded",
              "failed",
              "timeout",
              "cancelled",
              "oom"
            ]
          },
          "log_content": {
            "type": "string"
          },
          "truncated": {
            "type": "boolean"
          },
          "max_bytes": {
            "type": "integer"
          }
        }
      },
      "JobTaskRetryResponse": {
        "description": "POST .../tasks/{idx}/retry response. The task is re-queued with capped backoff.",
        "type": "object",
        "required": [
          "task",
          "run",
          "retried_at",
          "next_attempt_at"
        ],
        "properties": {
          "task": {
            "$ref": "#/components/schemas/JobTaskResponse"
          },
          "run": {
            "$ref": "#/components/schemas/JobRunResponse"
          },
          "retried_at": {
            "type": "string",
            "format": "date-time"
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ListJobsResponse": {
        "description": "Page of jobs on the account.",
        "type": "object",
        "required": [
          "jobs",
          "limit",
          "offset",
          "next_offset",
          "total"
        ],
        "properties": {
          "jobs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobResponse"
            }
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          },
          "next_offset": {
            "type": "integer",
            "description": "-1 = last page"
          },
          "total": {
            "type": "integer"
          }
        }
      },
      "ListJobRunsResponse": {
        "description": "Page of runs for a job.",
        "type": "object",
        "required": [
          "runs",
          "limit",
          "offset",
          "next_offset",
          "total"
        ],
        "properties": {
          "runs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobRunResponse"
            }
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          },
          "next_offset": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          }
        }
      },
      "ListJobTasksResponse": {
        "description": "Page of tasks for a job-run.",
        "type": "object",
        "required": [
          "tasks",
          "limit",
          "offset",
          "next_offset",
          "total"
        ],
        "properties": {
          "tasks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobTaskResponse"
            }
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          },
          "next_offset": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          }
        }
      },
      "JobRunCancelledResponse": {
        "description": "POST .../runs/{id}/cancel body. Returns the post-cancel run aggregate + cancelled_at timestamp.",
        "type": "object",
        "required": [
          "run",
          "cancelled_at"
        ],
        "properties": {
          "run": {
            "$ref": "#/components/schemas/JobRunResponse"
          },
          "cancelled_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "JobDeletedResponse": {
        "description": "DELETE /v1/jobs/{name} body.",
        "type": "object",
        "required": [
          "id",
          "name",
          "deleted_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "deleted_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PutJobRegistryCredentialRequest": {
        "description": "Job private-registry credential payload. Password is sealed at rest and never returned.",
        "type": "object",
        "required": [
          "registry",
          "username",
          "password"
        ],
        "properties": {
          "registry": {
            "type": "string",
            "description": "HTTPS registry host, optionally with port."
          },
          "username": {
            "type": "string",
            "maxLength": 256
          },
          "password": {
            "type": "string",
            "format": "password",
            "maxLength": 4096
          }
        }
      },
      "JobRegistryCredentialResponse": {
        "description": "Metadata-only job private-registry credential envelope.",
        "type": "object",
        "required": [
          "registry",
          "username",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "registry": {
            "type": "string"
          },
          "username": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_used_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "JobRegistryCredentialListResponse": {
        "description": "Job registry credential metadata plus the per-job quota.",
        "type": "object",
        "required": [
          "credentials",
          "quota_max",
          "count"
        ],
        "properties": {
          "credentials": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobRegistryCredentialResponse"
            }
          },
          "quota_max": {
            "type": "integer"
          },
          "count": {
            "type": "integer"
          }
        }
      },
      "RealtimeTriggerConfig": {
        "description": "Config of a `kind: realtime` trigger. Each message of the bound consumer group is delivered as one\ninvocation. The group must already exist in the caller's account with `lease_seconds` of at least 120, and binds\nto at most one trigger; while bound, direct claims and settlements return 409 `realtime_group_bound_to_trigger`.\nThe group's ordering, filters, retry policy and dead-letter queue govern delivery. The binding is immutable;\nonly `max_concurrency` can change.\n",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "endpoint_id",
          "channel",
          "group"
        ],
        "properties": {
          "endpoint_id": {
            "type": "string",
            "format": "uuid"
          },
          "channel": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "group": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "max_concurrency": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32,
            "description": "Parallel invocations; 0 means 1. Also capped by the plan's concurrency."
          }
        }
      },
      "TriggerKind": {
        "description": "Discriminator for the underlying event source.",
        "type": "string",
        "enum": [
          "cron",
          "kafka",
          "nats",
          "redis_streams",
          "sqs_compat",
          "queue",
          "realtime"
        ]
      },
      "Trigger": {
        "description": "Read shape returned by GET / POST / PATCH on /v1/triggers.\nThe `config` blob is opaque at the wire level — each kind\ndecodes its own per-shape struct lazily. The SDK round-trip\npreserves unknown fields across client versions. Kafka\ncredentials are never returned: `password_set` and\n`client_key_set` report their presence without exposing\nplaintext or the internal sealed envelope.\n",
        "type": "object",
        "required": [
          "id",
          "account_id",
          "app_id",
          "kind",
          "config",
          "batch_size_max",
          "batch_window_ms",
          "max_attempts",
          "payload_max_bytes",
          "broker_poison_strategy",
          "enabled",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "account_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "kind": {
            "$ref": "#/components/schemas/TriggerKind"
          },
          "slug": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$",
            "description": "Unique-per-app handle. Required for non-cron kinds; ignored on cron."
          },
          "enabled": {
            "type": "boolean"
          },
          "config": {
            "type": "object",
            "additionalProperties": true,
            "description": "Per-kind opaque configuration. Decode with the per-kind\nstruct (KafkaTriggerConfig, NATSTriggerConfig, etc).\nKafka responses replace write-only password/client-key\nleaves with boolean `password_set`/`client_key_set` markers.\n",
            "example": {
              "brokers": [
                "broker:9092"
              ],
              "topic": "orders.v1",
              "group": "faas-orders"
            }
          },
          "batch_size_max": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5000,
            "description": "Records per batch upper bound. Omitted create values use min(64, the account plan cap)."
          },
          "batch_window_ms": {
            "type": "integer",
            "minimum": 10,
            "maximum": 600000,
            "description": "Milliseconds a partial batch may wait before dispatch. Omitted create values use min(1000, the account plan cap)."
          },
          "max_attempts": {
            "type": "integer",
            "minimum": 1,
            "maximum": 25,
            "description": "Omitted create values use min(5, the account plan cap)."
          },
          "delivery": {
            "type": "string",
            "enum": [
              "record",
              "batch"
            ],
            "description": "record invokes the function once per record; batch invokes it once per dispatch batch with every record."
          },
          "retry_policy": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RetryPolicyDTO"
              }
            ],
            "description": "Optional per-trigger retry delay/jitter curve. max_attempts remains the trigger attempt cap."
          },
          "payload_max_bytes": {
            "type": "integer",
            "minimum": 1024,
            "maximum": 67108864,
            "description": "Per-record broker payload byte cap.\nRecords above this size are DLQ'd at insert time with\nreason='payload_too_large' rather than silently truncated.\nPlan-level ceiling in /v1/limits TriggerPayloadMaxBytes.\nOmitted create values use min(6291456, the account plan cap).\n"
          },
          "broker_poison_strategy": {
            "type": "string",
            "enum": [
              "commit",
              "seek-to-offset"
            ],
            "description": "Kafka-only poison-record handling strategy (audit #10). \"commit\" (default) advances the broker offset\nvia CommitMessages when the dispatcher dead-letters a\nrecord — the broker offset and the DB dead-letter state\nare permanently out of sync for that offset; operator\nretry works via the dashboard's \"re-drive from DLQ\"\naction which mints a fresh trigger_records row from the\nsame item_id. \"seek-to-offset\" calls SetOffset(msg.Offset)\ninstead so the next Poll re-fetches the same message —\noperator retry combines a trigger re-enable with a\ndashboard \"reset offset\" action that re-fetches the\ndead-lettered payload. No effect on non-kafka kinds.\n"
          },
          "filter_criteria": {
            "type": [
              "object",
              "null"
            ],
            "description": "Optional record-level filter. Records that fail the\nfilter are marked state='skipped' on insert and\ncontribute no audit row. Jsonpath evaluator:\ngithub.com/PaesslerAG/jsonpath (no eval semantics, no\ncustomer-supplied code execution). See the\nFilterCriteria schema for the full shape.\n",
            "$ref": "#/components/schemas/FilterCriteria"
          },
          "schedule": {
            "type": [
              "string",
              "null"
            ],
            "example": "*/5 * * * *"
          },
          "path": {
            "type": [
              "string",
              "null"
            ]
          },
          "cron_id": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[a-f0-9]{32}$"
          },
          "source": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "queue",
              "delayed_task",
              null
            ],
            "description": "Source discriminator for kind=queue rows."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "TriggerWorkBinding": {
        "description": "An external broker trigger's binding to a named app work policy.",
        "type": "object",
        "required": [
          "policy_name",
          "key"
        ],
        "properties": {
          "policy_name": {
            "type": "string",
            "description": "Named policy in the trigger's app."
          },
          "key": {
            "type": "string",
            "description": "Scalar dot path into the broker message JSON payload."
          },
          "fairness_key": {
            "type": "string",
            "description": "Optional scalar dot path for the fairness group."
          }
        }
      },
      "CreateTriggerRequest": {
        "description": "Trigger create payload. Kind is immutable after create. Per-kind\ngating matches the app manifest's trigger rules:\n  - cron: requires schedule + path (slug ignored)\n  - non-cron: requires slug + config\nOmitted delivery settings use the platform default capped to the\nselected account plan; explicit over-cap values are rejected.\n",
        "type": "object",
        "required": [
          "app_id",
          "kind"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "kind": {
            "$ref": "#/components/schemas/TriggerKind"
          },
          "slug": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          },
          "enabled": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "config": {
            "type": "object",
            "additionalProperties": true,
            "description": "Per-kind opaque config blob. Kafka password and client_key leaves are plaintext-on-write and sealed before persistence.\nFor `kind: realtime` the shape is `RealtimeTriggerConfig`; `batch_window_ms`, `max_attempts`,\n`retry_policy`, `broker_poison_strategy` and `filter_criteria` are rejected because the bound consumer group owns them,\nand `batch_size_max` may only be 1.\n"
          },
          "batch_size_max": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 5000
          },
          "batch_window_ms": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 10,
            "maximum": 600000
          },
          "max_attempts": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 25
          },
          "delivery": {
            "type": "string",
            "enum": [
              "record",
              "batch"
            ],
            "description": "Defaults to record. batch delivers every claimed record in one invocation; not available for cron or queue triggers."
          },
          "retry_policy": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RetryPolicyDTO"
              }
            ],
            "type": [
              "object",
              "null"
            ],
            "description": "Optional retry delay and jitter configuration; max_attempts remains the trigger attempt cap."
          },
          "payload_max_bytes": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1024,
            "maximum": 67108864
          },
          "broker_poison_strategy": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "commit",
              "seek-to-offset",
              null
            ],
            "description": "Kafka-only poison-record handling strategy. null/omitted\nfalls through to the DB default 'commit'. Same semantics\nas the Trigger read shape.\n"
          },
          "filter_criteria": {
            "type": [
              "object",
              "null"
            ],
            "description": "Optional record-level filter. nil on\ncreate falls through to the DB default NULL — every\nrecord passes the filter.\n",
            "$ref": "#/components/schemas/FilterCriteria"
          },
          "schedule": {
            "type": [
              "string",
              "null"
            ],
            "example": "*/5 * * * *"
          },
          "path": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "UpdateTriggerRequest": {
        "description": "Partial trigger update. nil means \"leave unchanged\" (same\nsemantics as UpdateCronRequest). Kind is NOT a member — it\nis immutable. To change kind, create a new trigger and\ndelete the old one. Inside a supplied Kafka sasl/tls block,\nomitting the write-only credential preserves its stored value;\nomitting the whole block removes that block and its credential.\n",
        "type": "object",
        "properties": {
          "enabled": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "config": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "batch_size_max": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 5000
          },
          "batch_window_ms": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 10,
            "maximum": 600000
          },
          "max_attempts": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 25
          },
          "delivery": {
            "type": "string",
            "enum": [
              "record",
              "batch"
            ],
            "description": "Switch between record and batch delivery; not available for cron or queue triggers."
          },
          "retry_policy": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RetryPolicyDTO"
              }
            ],
            "type": [
              "object",
              "null"
            ],
            "description": "Retry delay and jitter configuration; pass {} to clear the stored curve."
          },
          "payload_max_bytes": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1024,
            "maximum": 67108864
          },
          "broker_poison_strategy": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "commit",
              "seek-to-offset",
              null
            ],
            "description": "Kafka-only poison-record handling strategy. null/omitted\nmeans \"leave unchanged\" (the SQL coalesce keeps the existing\nvalue). Same semantics as the Trigger read shape.\n"
          },
          "filter_criteria": {
            "type": [
              "object",
              "null"
            ],
            "description": "Optional record-level filter. nil means \"leave\nunchanged\" — the SQL coalesce keeps the existing\nvalue. Pass {} to clear an existing filter.\n",
            "$ref": "#/components/schemas/FilterCriteria"
          },
          "schedule": {
            "type": [
              "string",
              "null"
            ],
            "example": "*/5 * * * *"
          },
          "path": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "KafkaSASLMechanism": {
        "description": "Kafka SASL mechanism. Closed-vocab.",
        "type": "string",
        "enum": [
          "PLAIN",
          "SCRAM-SHA-256",
          "SCRAM-SHA-512"
        ]
      },
      "KafkaSASLConfig": {
        "description": "Kafka SASL credentials. Required Username + Password for\nevery supported mechanism. xdg-go/scram library derives\nSCRAM client keypairs from Username + Password at dial\ntime.\n",
        "type": "object",
        "required": [
          "mechanism",
          "username"
        ],
        "properties": {
          "mechanism": {
            "$ref": "#/components/schemas/KafkaSASLMechanism"
          },
          "username": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "password": {
            "type": "string",
            "format": "password",
            "writeOnly": true,
            "minLength": 1,
            "maxLength": 4096,
            "description": "Plaintext-on-write only. Omit inside a supplied SASL block to preserve the stored password."
          },
          "password_set": {
            "type": "boolean",
            "readOnly": true,
            "description": "Response-only marker indicating that a password is configured; no credential material is returned."
          }
        }
      },
      "KafkaTLSConfig": {
        "description": "Kafka TLS material. MinVersion is forced to TLS 1.2 at\ndecoder time regardless of what the wire sends. When\nClientCert + ClientKey are both set the decoder performs\na half-wired guard — if only one is set, decode returns\nan error rather than the poller falling through silently\nto PLAINTEXT over an apparent mTLS endpoint.\n",
        "type": "object",
        "properties": {
          "ca_cert": {
            "type": "string",
            "description": "PEM-encoded CA bundle. Optional; if omitted the system trust store is used."
          },
          "client_cert": {
            "type": "string",
            "description": "PEM-encoded client cert for mTLS."
          },
          "client_key": {
            "type": "string",
            "format": "password",
            "writeOnly": true,
            "maxLength": 65536,
            "description": "PEM-encoded client key for mTLS, accepted only on writes. Omit inside a supplied TLS block to preserve the stored key."
          },
          "client_key_set": {
            "type": "boolean",
            "readOnly": true,
            "description": "Response-only marker indicating that a client key is configured; no credential material is returned."
          },
          "skip_verify": {
            "type": "boolean",
            "default": false,
            "description": "Skip TLS verification. Hobby plan rejects this\n(TLSSkipVerifyAllowed=false);\nPro and Scale accept it for self-signed brokers.\n"
          }
        }
      },
      "KafkaTriggerConfig": {
        "description": "Decoded `config` for kind=kafka triggers. The wire-level\nblob lives in Trigger.config; this is the SDK's\nserver-side shape.\n",
        "type": "object",
        "required": [
          "brokers",
          "topic",
          "group"
        ],
        "properties": {
          "brokers": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9.\\-]+:[0-9]+$"
            },
            "minItems": 1,
            "maxItems": 16,
            "description": "Bootstrap broker list (host:port per entry)."
          },
          "topic": {
            "type": "string",
            "minLength": 1,
            "maxLength": 249
          },
          "group": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "tls": {
            "type": [
              "object",
              "null"
            ],
            "$ref": "#/components/schemas/KafkaTLSConfig"
          },
          "sasl": {
            "type": [
              "object",
              "null"
            ],
            "$ref": "#/components/schemas/KafkaSASLConfig"
          }
        }
      },
      "FilterCriteriaOp": {
        "description": "Filter operation primitive.",
        "type": "string",
        "enum": [
          "eq",
          "neq",
          "exists",
          "jsonpath"
        ]
      },
      "FilterCriteriaClause": {
        "description": "One filter clause. The top-level FilterCriteria carries\n`$or`, `$and`, and `payload` arrays; each clause here\nis one primitive (eq / neq / exists / jsonpath) or a\nnested `$or` / `$and` for compound logic.\n",
        "type": "object",
        "required": [
          "op"
        ],
        "properties": {
          "op": {
            "$ref": "#/components/schemas/FilterCriteriaOp"
          },
          "field": {
            "type": "string",
            "description": "Header key for eq / neq / exists on the headers map."
          },
          "value": {
            "description": "Equality target for eq / neq; jsonpath expected type for jsonpath."
          },
          "path": {
            "type": "string",
            "description": "Jsonpath expression for op=jsonpath. Evaluated against the record payload."
          },
          "clauses": {
            "type": "array",
            "description": "Nested compound clauses for op=$or / $and.",
            "items": {
              "$ref": "#/components/schemas/FilterCriteriaClause"
            }
          }
        }
      },
      "FilterCriteria": {
        "description": "FilterCriteria on a trigger. nil / omitted matches every record.\nTop-level arrays combine via implicit OR for `$or` and\nAND for `$and`; nested clauses honour the same shape.\nJsonpath implementation: github.com/PaesslerAG/jsonpath —\nno eval semantics, no customer-supplied code execution.\n",
        "type": "object",
        "properties": {
          "$or": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FilterCriteriaClause"
            }
          },
          "$and": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FilterCriteriaClause"
            }
          },
          "payload": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FilterCriteriaClause"
            }
          }
        }
      },
      "TriggerRecordState": {
        "description": "Lifecycle of one trigger record.",
        "type": "string",
        "enum": [
          "pending",
          "claimed",
          "succeeded",
          "retry",
          "dead_letter"
        ]
      },
      "TriggerRecord": {
        "description": "Audit row for one record passing through a trigger.\nSurfaced via GET /v1/triggers/{id}/records so customers can\nanswer \"did my last N wake-ups succeed?\".\n",
        "type": "object",
        "required": [
          "id",
          "trigger_id",
          "item_identifier",
          "payload",
          "headers",
          "metadata",
          "state",
          "attempts",
          "next_fire_at",
          "received_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "trigger_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "item_identifier": {
            "type": "string",
            "description": "Broker-side identifier (Kafka offset, NATS seq, SQS receipt handle)."
          },
          "payload": {
            "type": "string",
            "description": "Raw JSON body, decoded lazily by the dashboard."
          },
          "headers": {
            "type": "string",
            "description": "Raw JSON of broker headers."
          },
          "metadata": {
            "type": "string",
            "description": "Raw JSON of broker metadata (delivery count, etc.)."
          },
          "state": {
            "$ref": "#/components/schemas/TriggerRecordState"
          },
          "attempts": {
            "type": "integer",
            "minimum": 0,
            "maximum": 25
          },
          "next_fire_at": {
            "type": "string",
            "format": "date-time"
          },
          "received_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_dispatched_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "ListTriggerRecordsResponse": {
        "description": "Page of trigger records, newest-first.",
        "type": "object",
        "required": [
          "records"
        ],
        "properties": {
          "records": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TriggerRecord"
            }
          }
        }
      },
      "TriggerDeadLetterReason": {
        "description": "Reason enum pinned by SQL CHECK on trigger_dead_letter.reason.\n",
        "type": "string",
        "enum": [
          "rate_limited",
          "poison_record",
          "max_attempts",
          "broker_error",
          "plan_quota",
          "payload_too_large",
          "customer_disabled",
          "exclusive_operation_rejected"
        ]
      },
      "TriggerRoutedTo": {
        "description": "Where a dead-lettered record was routed.",
        "type": "string",
        "enum": [
          "drop",
          "manual_retry",
          "customer_dlq"
        ]
      },
      "TriggerDeadLetter": {
        "description": "Read-only wire shape for one trigger_dead_letter row.",
        "type": "object",
        "required": [
          "record_id",
          "trigger_id",
          "reason",
          "routed_to",
          "detail",
          "created_at"
        ],
        "properties": {
          "record_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "trigger_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "reason": {
            "$ref": "#/components/schemas/TriggerDeadLetterReason"
          },
          "routed_to": {
            "$ref": "#/components/schemas/TriggerRoutedTo"
          },
          "detail": {
            "type": "object",
            "additionalProperties": true,
            "description": "Opaque per-reason JSON (broker-error vs poison-record shapes differ)."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ListTriggerDeadLetterResponse": {
        "description": "Dead-letter rows for a trigger, newest-first.",
        "type": "object",
        "required": [
          "records"
        ],
        "properties": {
          "records": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TriggerDeadLetter"
            }
          }
        }
      },
      "TriggerMetricsResponse": {
        "description": "Aggregated counters per state for one trigger, and the scheduler's\nlast observation of its broker consumer. NOT a Prometheus\nscrape — /v1/metrics is the Prometheus surface.\n",
        "type": "object",
        "required": [
          "trigger_id",
          "pending_count",
          "claimed_count",
          "succeeded_count",
          "retry_count",
          "dead_letter_count"
        ],
        "properties": {
          "trigger_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "pending_count": {
            "type": "integer"
          },
          "claimed_count": {
            "type": "integer"
          },
          "succeeded_count": {
            "type": "integer"
          },
          "retry_count": {
            "type": "integer"
          },
          "dead_letter_count": {
            "type": "integer"
          },
          "count_limit": {
            "type": "integer",
            "description": "Where each count stops; a count equal to it means at least that many."
          },
          "consumer": {
            "$ref": "#/components/schemas/TriggerConsumerStatus"
          }
        }
      },
      "TriggerConsumerStatus": {
        "description": "The scheduler's last observation of a trigger's broker consumer.\nAbsent until the trigger's first poll.\n",
        "type": "object",
        "required": [
          "liveness"
        ],
        "properties": {
          "liveness": {
            "type": "string",
            "enum": [
              "healthy",
              "degraded",
              "stale",
              "not_observed",
              "unknown"
            ],
            "description": "`degraded`: the last poll failed (see last_error). `stale`: no\npoll for 30 s (the trigger is disabled, its app cannot run, or\nno scheduler polls it).\n"
          },
          "last_poll_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_success_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_error_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_error": {
            "type": "string"
          },
          "lag_messages": {
            "type": "integer",
            "format": "int64",
            "description": "The broker's backlog for the consumer. Kafka: high watermark\nless the group's committed offset, summed over partitions.\nNATS JetStream: the consumer's pending messages. Redis Streams:\nthe group's lag.\n"
          },
          "lag_age_seconds": {
            "type": "number",
            "description": "Age of the oldest record the last poll returned."
          }
        }
      },
      "CreateTriggerBatchRequest": {
        "description": "Inline-manifest path (POST /v1/triggers:batch_create) — fire a\ngregale.yaml blob at the server without staging a tarball.\nThe handler re-uses validateManifestBytes from the manifest\napply path.\n",
        "type": "object",
        "required": [
          "app_id",
          "manifest_yaml"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "manifest_yaml": {
            "type": "string",
            "description": "Raw gregale.yaml triggers: list."
          }
        }
      },
      "CreateTriggerBatchResponse": {
        "description": "Bulk-create response — per-row trigger ids and any error codes.",
        "type": "object",
        "required": [
          "created"
        ],
        "properties": {
          "created": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "slug",
                "kind"
              ],
              "properties": {
                "slug": {
                  "type": "string"
                },
                "kind": {
                  "$ref": "#/components/schemas/TriggerKind"
                },
                "id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "pattern": "^[a-f0-9]{32}$"
                },
                "error": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "RFC 7807 code."
                }
              }
            }
          }
        }
      },
      "ProjectScanRequest": {
        "description": "Multipart body for POST /v1/projects/scan (dry-run).",
        "type": "object",
        "required": [
          "source"
        ],
        "properties": {
          "release_config": {
            "type": "string",
            "description": "JSON-encoded ProjectReleaseConfigRequest for atomic-config-verify; contains only non-secret workload variables."
          },
          "migration": {
            "type": "boolean",
            "default": false,
            "description": "Preserve repository service identities and suggest project-prefixed app names. Requires no_triggers and no repository push binding; apply repeats the reviewed setting."
          },
          "app_slugs": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Exact repository service names mapped to Gregale app names. Existing project members retain their names. Names are checked for format, reservation and availability; they are never allocated by scan. Multipart clients send this field as JSON."
          },
          "source": {
            "type": "string",
            "format": "binary",
            "description": "tar.gz of the repo root."
          },
          "project_slug": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$",
            "description": "kebab slug; default = repo dir basename"
          },
          "repo_full_name": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$",
            "description": "GitHub owner/name to persist for push reconciliation"
          },
          "production_branch": {
            "type": "string",
            "example": "main"
          },
          "install_id": {
            "type": "integer",
            "format": "int64",
            "description": "GitHub installation id (with --repository or --repo); 0 for unbound repos"
          },
          "only": {
            "type": "string",
            "description": "CSV of workload names to include (others skipped)"
          },
          "environment": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$",
            "description": "Environment slug used to scope all discovered workloads"
          },
          "no_triggers": {
            "type": "boolean",
            "default": false,
            "description": "Leave trigger and async-route declarations and existing project trigger/route state unchanged for this scan/apply pair."
          },
          "platform_tenant_required": {
            "type": "boolean",
            "description": "Override the customer identity policy for selected workloads in this scan/apply pair (Hobby and above). Omitted uses Compose declarations and preserves existing app policy. Apply must repeat the same override as scan."
          },
          "override_freeze": {
            "type": "string",
            "maxLength": 200,
            "description": "Apply only: release frozen apps to production anyway; the reason is audited."
          }
        }
      },
      "ProjectSummaryResponse": {
        "description": "Project list item with its persisted organization owner.",
        "type": "object",
        "required": [
          "id",
          "slug",
          "scan_source",
          "workload_count",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "slug": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          },
          "repo_full_name": {
            "type": "string"
          },
          "production_branch": {
            "type": "string"
          },
          "scan_source": {
            "type": "string"
          },
          "workload_count": {
            "type": "integer",
            "minimum": 0
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ProjectEnvironmentResponse": {
        "description": "Durable named environment target for a project.",
        "type": "object",
        "required": [
          "id",
          "project_id",
          "slug",
          "protected",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "project_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "slug": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$",
            "not": {
              "const": "default"
            },
            "description": "Project environment slug; the reserved app scope `default` cannot be used."
          },
          "protected": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "cloned_from": {
            "type": "string"
          },
          "clone": {
            "$ref": "#/components/schemas/ProjectEnvironmentCloneResponse"
          },
          "clone_operation": {
            "$ref": "#/components/schemas/ProjectEnvironmentCloneOperationResponse"
          },
          "branch": {
            "$ref": "#/components/schemas/ProjectEnvironmentBranchResponse"
          }
        }
      },
      "SeedDevSessionFromEnvironmentBranchRequest": {
        "description": "Deploys one workload of a simulated environment branch into a rehearsal member's developer session, reusing the branch's build.",
        "type": "object",
        "required": [
          "workspace_id",
          "project",
          "environment",
          "workload"
        ],
        "properties": {
          "workspace_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$",
            "description": "The rehearsal run's workspace ID."
          },
          "project": {
            "type": "string",
            "description": "Slug of the project that owns the branch."
          },
          "environment": {
            "type": "string",
            "description": "Slug of the simulated branch environment."
          },
          "workload": {
            "type": "string",
            "description": "Workload name in the project."
          }
        }
      },
      "SeedDevSessionFromEnvironmentBranchResponse": {
        "description": "The member's deployment, which goes live after one boot.",
        "type": "object",
        "required": [
          "app_slug",
          "deployment_id",
          "status"
        ],
        "properties": {
          "app_slug": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        }
      },
      "CreateProjectEnvironmentBranchRequest": {
        "description": "A new branch of the environment named in the path.",
        "type": "object",
        "required": [
          "slug"
        ],
        "properties": {
          "slug": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$",
            "description": "Slug of the new environment."
          },
          "ttl": {
            "type": "string",
            "description": "Time to live, a duration such as 24h between 1h and 720h. Defaults to 168h."
          },
          "egress": {
            "type": "string",
            "enum": [
              "live",
              "contained",
              "simulated"
            ],
            "description": "Outbound traffic from the branch. live (the default) behaves like a stage. contained reaches only the branch's own platform services (service calls inside the branch, the branch's managed PostgreSQL copies and the platform resolver) and takes no host-mediated action; it reaches the branch's own buckets through the platform's object relay, and a parent with object storage is refused where the operator has not enabled the relay. contained is available only where the operator enabled it. simulated is contained, and the branch can seed rehearsal members (POST /v1/dev/sessions/{project}/seed) whose side effects are simulated and recorded."
          },
          "private_networks": {
            "type": "string",
            "enum": [
              "off",
              "join"
            ],
            "description": "Whether the branch's instances join the private networks their workloads are attached to. off (the default) keeps them off, so a call to a private peer fails rather than reaching production. join attaches them with addresses of their own, never a workload's service address, so they can reach the parent's private peers; only a live branch may join."
          }
        }
      },
      "ProjectEnvironmentBranchResponse": {
        "description": "How an environment branches from its parent.",
        "type": "object",
        "required": [
          "parent",
          "branch_point",
          "expires_at",
          "egress",
          "private_networks",
          "depth",
          "data"
        ],
        "properties": {
          "parent": {
            "type": "string",
            "description": "Slug of the parent environment."
          },
          "branch_point": {
            "type": "string",
            "format": "date-time",
            "description": "The moment the branch copied its parent."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the branch is deleted."
          },
          "egress": {
            "type": "string"
          },
          "private_networks": {
            "type": "string",
            "enum": [
              "off",
              "join"
            ],
            "description": "Whether the branch's instances join their workloads' private networks."
          },
          "depth": {
            "type": "integer",
            "minimum": 1,
            "description": "1 for a branch of an ordinary environment",
            "2 for a branch of a branch.": null
          },
          "data": {
            "type": "string",
            "enum": [
              "ready",
              "pending",
              "failed"
            ],
            "description": "Whether the copies of the parent's managed PostgreSQL databases exist. The branch's workloads start only when this is ready."
          },
          "data_error": {
            "type": "string",
            "description": "Why copying the parent's data failed or is being retried."
          },
          "workloads": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentBranchWorkload"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the branch was created. Reported by the branch's own view."
          },
          "databases": {
            "type": "array",
            "description": "The managed PostgreSQL copies the branch owns. Reported by the branch's own view.",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentBranchDatabase"
            }
          }
        }
      },
      "ProjectEnvironmentBranchWorkload": {
        "description": "One workload the branch published from its parent's build. It starts on its first request.",
        "type": "object",
        "required": [
          "workload",
          "deployment_id",
          "source_deployment_id",
          "status"
        ],
        "properties": {
          "workload": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string"
          },
          "source_deployment_id": {
            "type": "string",
            "description": "The parent deployment whose build the branch reuses."
          },
          "status": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "description": "The workload's address in the branch. Its first request starts it."
          }
        }
      },
      "ProjectEnvironmentBranchDatabase": {
        "description": "One managed PostgreSQL copy a branch owns.",
        "type": "object",
        "required": [
          "source_database_id",
          "name"
        ],
        "properties": {
          "source_database_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "copy_database_id": {
            "type": "string",
            "description": "Empty until the copy is made."
          }
        }
      },
      "ExtendProjectEnvironmentBranchRequest": {
        "description": "Moves a branch's expiry.",
        "type": "object",
        "properties": {
          "ttl": {
            "type": "string",
            "description": "The time from now the branch lives, such as 48h. Empty takes the default (168h)."
          }
        }
      },
      "ProjectEnvironmentBranchListResponse": {
        "description": "The branches of one parent environment.",
        "type": "object",
        "required": [
          "branches"
        ],
        "properties": {
          "branches": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentBranchSummary"
            }
          }
        }
      },
      "ProjectEnvironmentBranchSummary": {
        "description": "One environment branch in a list.",
        "type": "object",
        "required": [
          "slug",
          "parent",
          "branch_point",
          "expires_at",
          "egress",
          "private_networks",
          "depth",
          "data",
          "created_at"
        ],
        "properties": {
          "slug": {
            "type": "string"
          },
          "parent": {
            "type": "string"
          },
          "branch_point": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "egress": {
            "type": "string"
          },
          "private_networks": {
            "type": "string",
            "enum": [
              "off",
              "join"
            ]
          },
          "depth": {
            "type": "integer",
            "minimum": 1
          },
          "data": {
            "type": "string",
            "enum": [
              "ready",
              "pending",
              "failed"
            ]
          },
          "data_error": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PutAppSecretReferenceRequest": {
        "description": "Named sealed source selected within the exact registered project environment; contains no secret value.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "reference"
        ],
        "properties": {
          "reference": {
            "type": "string",
            "pattern": "^secret:[A-Z][A-Z0-9_]*$",
            "example": "secret:DATABASE_PRIMARY"
          }
        }
      },
      "AppSecretReferenceListResponse": {
        "description": "Current environment identity, destination-to-source names, suppressed destination keys and shared variable/reference quota usage.",
        "type": "object",
        "required": [
          "environment_id",
          "environment",
          "references",
          "count",
          "quota"
        ],
        "properties": {
          "environment_id": {
            "type": "string",
            "format": "uuid"
          },
          "environment": {
            "type": "string"
          },
          "references": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "pattern": "^secret:[A-Z][A-Z0-9_]*$"
            }
          },
          "suppressed_keys": {
            "type": "array",
            "description": "Destinations excluded from primary workload secret delivery until an explicit PUT reference re-enables them. Omitted by older servers; consumes no variable slots.",
            "items": {
              "type": "string"
            }
          },
          "count": {
            "type": "integer",
            "minimum": 0,
            "description": "Shared variable/reference quota usage across all environments."
          },
          "quota": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "AppSecretReferenceResponse": {
        "description": "Stored destination and sealed source names under the catalog environment identity captured for the write.",
        "type": "object",
        "required": [
          "environment_id",
          "environment",
          "key",
          "reference"
        ],
        "properties": {
          "environment_id": {
            "type": "string",
            "format": "uuid"
          },
          "environment": {
            "type": "string"
          },
          "key": {
            "type": "string"
          },
          "reference": {
            "type": "string",
            "pattern": "^secret:[A-Z][A-Z0-9_]*$"
          }
        }
      },
      "ProjectEnvironmentCloneResponse": {
        "description": "Non-secret copy counts for an environment clone. Managed database or bucket data appears as shared only after explicit opt-in.",
        "type": "object",
        "required": [
          "configuration_copied",
          "variables_copied",
          "secrets_copied",
          "workloads_copied",
          "bindings_copied",
          "routes_copied",
          "policies_copied",
          "shared_resources"
        ],
        "properties": {
          "configuration_copied": {
            "type": "boolean"
          },
          "variables_copied": {
            "type": "integer",
            "minimum": 0
          },
          "secrets_copied": {
            "type": "integer",
            "minimum": 0
          },
          "secret_references_copied": {
            "type": "integer",
            "minimum": 0,
            "description": "Destination-to-source references copied under the new catalog environment identity. Git source bindings, ownership, overrides and runtime receipts are not copied."
          },
          "project_secrets_copied": {
            "type": "integer",
            "minimum": 0,
            "description": "Secrets the source environment shares with every service, copied to the new environment. Values are never returned."
          },
          "workloads_copied": {
            "type": "integer",
            "minimum": 0
          },
          "bindings_copied": {
            "type": "integer",
            "minimum": 0
          },
          "routes_copied": {
            "type": "integer",
            "minimum": 0
          },
          "policies_copied": {
            "type": "integer",
            "minimum": 0
          },
          "shared_resources": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "domains",
                "policies",
                "routes",
                "managed_postgres_data",
                "object_storage_bucket_data"
              ]
            }
          }
        }
      },
      "ProjectEnvironmentReleaseListResponse": {
        "description": "Current non-secret release inventory for a project environment.",
        "type": "object",
        "required": [
          "project_slug",
          "environment",
          "workloads"
        ],
        "properties": {
          "project_slug": {
            "type": "string"
          },
          "environment": {
            "type": "string"
          },
          "workloads": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentReleaseWorkloadResponse"
            }
          }
        }
      },
      "PublishProjectReleaseSetRequest": {
        "description": "A complete mapping of project workload slugs to live deployment UUIDs.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "ttl_seconds",
          "deployments"
        ],
        "properties": {
          "ttl_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 604800
          },
          "deployments": {
            "type": "object",
            "minProperties": 1,
            "maxProperties": 100,
            "additionalProperties": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      },
      "ProjectReleaseSetResponse": {
        "description": "Immutable project deployment graph. Active sets do not expire; when replaced, their TTL starts and expires_at is set.",
        "type": "object",
        "required": [
          "id",
          "account_id",
          "project_id",
          "environment",
          "active",
          "ttl_seconds",
          "created_at",
          "members"
        ],
        "properties": {
          "deactivation": {
            "$ref": "#/components/schemas/ProjectReleaseDeactivationReceipt"
          },
          "rollback_source_release_id": {
            "type": "string",
            "format": "uuid"
          },
          "rollback_previous_release_id": {
            "type": "string",
            "format": "uuid"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "environment": {
            "type": "string"
          },
          "active": {
            "type": "boolean"
          },
          "ttl_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 604800
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "members": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectReleaseSetMemberResponse"
            }
          }
        }
      },
      "ProjectReleaseSetListResponse": {
        "description": "Cursor-paginated release graphs, newest first, including expired sets.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectReleaseSetResponse"
            }
          },
          "next_before": {
            "type": "string"
          }
        }
      },
      "ProjectReleaseSetMemberResponse": {
        "description": "One app and exact deployment in an immutable project release set.",
        "type": "object",
        "required": [
          "app_id",
          "deployment_id"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "ProjectEnvironmentReleaseWorkloadResponse": {
        "description": "Current live deployment metadata for one project workload. The stable environment URL is present before the first deployment but returns 404 until a live release exists.",
        "type": "object",
        "required": [
          "workload_slug",
          "workload_name",
          "status"
        ],
        "properties": {
          "workload_config_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "workload_slug": {
            "type": "string"
          },
          "workload_name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "live",
              "not_deployed"
            ]
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "deployment_id": {
            "type": "string"
          },
          "build_id": {
            "type": "string"
          },
          "image_digest": {
            "type": "string"
          },
          "source_url": {
            "type": "string"
          },
          "commit_sha": {
            "type": "string"
          },
          "source_sha256": {
            "type": "string"
          },
          "traffic_percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ProjectEnvironmentVariableResponse": {
        "description": "Non-secret runtime variable attached to an environment workload.",
        "type": "object",
        "required": [
          "key",
          "value"
        ],
        "properties": {
          "key": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ProjectEnvironmentSecretResponse": {
        "description": "Safe secret metadata. Version is omitted for legacy secrets with unknown history; secret values and ciphertext are never included.",
        "type": "object",
        "required": [
          "key"
        ],
        "properties": {
          "key": {
            "type": "string"
          },
          "value_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{16}$"
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "managed_by": {
            "type": "string",
            "enum": [
              "managed_postgres",
              "object_storage"
            ]
          },
          "binding_id": {
            "type": "string"
          },
          "credential_generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ProjectEnvironmentBindingResponse": {
        "description": "Managed resource binding and its target-scoped credential metadata.",
        "type": "object",
        "required": [
          "kind",
          "binding_id",
          "secret_keys"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "managed_postgres",
              "object_storage"
            ]
          },
          "binding_id": {
            "type": "string"
          },
          "credential_generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "secret_keys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "ProjectEnvironmentDomainResponse": {
        "description": "Custom hostname routed to one workload in this project environment.",
        "type": "object",
        "required": [
          "domain",
          "verified"
        ],
        "properties": {
          "domain": {
            "type": "string"
          },
          "verified": {
            "type": "boolean"
          }
        }
      },
      "ProjectEnvironmentStateWorkloadResponse": {
        "description": "Effective configuration and live release state for one workload.",
        "type": "object",
        "required": [
          "workload_slug",
          "workload_name",
          "release",
          "variables",
          "secrets",
          "bindings",
          "domains",
          "routes",
          "policies"
        ],
        "properties": {
          "workload_config_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "workload_config_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "workload_slug": {
            "type": "string"
          },
          "workload_name": {
            "type": "string"
          },
          "release": {
            "$ref": "#/components/schemas/ProjectEnvironmentReleaseWorkloadResponse"
          },
          "variables": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentVariableResponse"
            }
          },
          "secrets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentSecretResponse"
            }
          },
          "bindings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentBindingResponse"
            }
          },
          "domains": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentDomainResponse"
            }
          },
          "routes": {
            "$ref": "#/components/schemas/ProjectEnvironmentRoutePolicyResponse"
          },
          "policies": {
            "$ref": "#/components/schemas/ProjectEnvironmentEdgePolicyResponse"
          }
        }
      },
      "ProjectEnvironmentEdgeRuleResponse": {
        "description": "One inline headers or CORS rule on a stable environment URL.",
        "type": "object",
        "required": [
          "kind",
          "match_path",
          "priority",
          "enabled",
          "action"
        ],
        "additionalProperties": false,
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "headers",
              "cors"
            ]
          },
          "match_path": {
            "type": "string"
          },
          "match_methods": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "match_headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "priority": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          },
          "enabled": {
            "type": "boolean"
          },
          "action": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "ProjectEnvironmentEdgePolicyResponse": {
        "description": "Headers/CORS policy ownership and rules. Other edge-rule kinds remain application-owned.",
        "type": "object",
        "required": [
          "ownership",
          "rules"
        ],
        "properties": {
          "ownership": {
            "type": "string",
            "enum": [
              "application",
              "environment"
            ]
          },
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentEdgeRuleResponse"
            }
          }
        }
      },
      "UpdateProjectEnvironmentEdgePolicyRequest": {
        "description": "Complete replacement for an environment's headers/CORS rules. Inline CORS settings are required; shared presets are not accepted.",
        "type": "object",
        "required": [
          "rules"
        ],
        "additionalProperties": false,
        "properties": {
          "rules": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentEdgeRuleResponse"
            }
          }
        }
      },
      "ProjectEnvironmentRoutePolicyResponse": {
        "description": "Effective declared-route contract and whether it is environment-owned.",
        "type": "object",
        "required": [
          "ownership",
          "only_allow_declared_routes",
          "declared_routes"
        ],
        "properties": {
          "ownership": {
            "type": "string",
            "enum": [
              "application",
              "environment"
            ]
          },
          "only_allow_declared_routes": {
            "type": "boolean"
          },
          "declared_routes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeclaredRoute"
            }
          }
        }
      },
      "UpdateProjectEnvironmentRoutePolicyRequest": {
        "description": "Complete replacement for a workload's environment route contract. Enabling enforcement requires a non-empty explicit route list; application-wide OpenAPI documents are not cloned.",
        "type": "object",
        "required": [
          "only_allow_declared_routes",
          "declared_routes"
        ],
        "additionalProperties": false,
        "properties": {
          "only_allow_declared_routes": {
            "type": "boolean"
          },
          "declared_routes": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/DeclaredRoute"
            }
          }
        }
      },
      "ProjectEnvironmentQueueBinding": {
        "description": "Desired logical queue binding without runtime consumer identity or messages. HTTP consumers require push mode and a function workload.",
        "type": "object",
        "required": [
          "name",
          "queue_name",
          "mode",
          "workload_class",
          "enabled",
          "max_concurrency"
        ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "queue_name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "mode": {
            "type": "string",
            "enum": [
              "pull",
              "push"
            ]
          },
          "workload_class": {
            "type": "string",
            "enum": [
              "worker",
              "job",
              "http"
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "max_concurrency": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000
          },
          "retry_policy": {
            "$ref": "#/components/schemas/RetryPolicyDTO"
          }
        }
      },
      "ReplaceProjectEnvironmentQueueBindingsRequest": {
        "description": "Complete stage queue replacement fenced by the workload revision, not the queue collection clock.",
        "type": "object",
        "required": [
          "expected_revision",
          "bindings"
        ],
        "additionalProperties": false,
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "bindings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentQueueBinding"
            }
          }
        }
      },
      "ProjectEnvironmentQueueBindingsResponse": {
        "description": "Desired stage queue definitions. Consumer activation is currently unavailable and these definitions do not enable delivery or qualify promotion.",
        "type": "object",
        "required": [
          "environment",
          "workload",
          "revision",
          "workload_revision",
          "config_hash",
          "activation_state",
          "bindings"
        ],
        "properties": {
          "environment": {
            "type": "string"
          },
          "workload": {
            "type": "string"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Queue collection clock."
          },
          "workload_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Complete workload revision to use as expected_revision on replacement."
          },
          "config_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "activation_state": {
            "type": "string",
            "enum": [
              "unavailable"
            ]
          },
          "bindings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentQueueBinding"
            }
          }
        }
      },
      "ProjectEnvironmentSharedResourceResponse": {
        "description": "Application-scoped resource that is shared by all environments.",
        "type": "object",
        "required": [
          "kind",
          "ownership",
          "note"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "domains",
              "policies",
              "routes"
            ]
          },
          "ownership": {
            "type": "string",
            "enum": [
              "application"
            ]
          },
          "note": {
            "type": "string"
          }
        }
      },
      "ProjectEnvironmentStateResponse": {
        "description": "Point-in-time effective state snapshot for a project environment.",
        "type": "object",
        "required": [
          "project_slug",
          "environment",
          "protected",
          "configuration",
          "workloads",
          "shared_resources",
          "generated_at"
        ],
        "properties": {
          "project_secrets_revision_hash": {
            "description": "Opaque shared-secret set identity observed before qualification probes. Submit it as the project:secrets entry in secret_revision_hashes; it changes on secret additions, rotations, and deletions, but not master-key reseals. Omitted by older servers.",
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "feature_flags_hash": {
            "description": "Fingerprint of the environment identity, current flag version, and configuration observed before qualification probes. Omitted only for the legacy identity with no published flags. Combine with each released workload settings hash when submitting workload_config_hashes.",
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "active_release_set": {
            "description": "Active graph, or null when no graph has been published. Its selected members may differ from the per-workload live deployments below.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ProjectReleaseSetResponse"
              },
              {
                "type": "null"
              }
            ]
          },
          "release_set_status": {
            "type": "string",
            "enum": [
              "active",
              "none"
            ]
          },
          "project_slug": {
            "type": "string"
          },
          "environment": {
            "type": "string"
          },
          "protected": {
            "type": "boolean"
          },
          "configuration": {
            "$ref": "#/components/schemas/ProjectEnvironmentConfigResponse"
          },
          "workloads": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentStateWorkloadResponse"
            }
          },
          "shared_resources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentSharedResourceResponse"
            }
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ProjectEnvironmentReleaseDiffResponse": {
        "description": "Before-and-after release state for a workload in an environment diff.",
        "type": "object",
        "required": [
          "kind",
          "before",
          "after"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "added",
              "removed",
              "changed",
              "unchanged"
            ]
          },
          "before": {
            "$ref": "#/components/schemas/ProjectEnvironmentReleaseWorkloadResponse"
          },
          "after": {
            "$ref": "#/components/schemas/ProjectEnvironmentReleaseWorkloadResponse"
          }
        }
      },
      "ProjectEnvironmentVariableChangeResponse": {
        "description": "Non-secret runtime variable change between two environments.",
        "type": "object",
        "required": [
          "key",
          "kind"
        ],
        "properties": {
          "key": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "added",
              "removed",
              "changed"
            ]
          },
          "before": {
            "type": "string"
          },
          "after": {
            "type": "string"
          }
        }
      },
      "ProjectEnvironmentSecretCellResponse": {
        "description": "One side of a secret comparison. Version is omitted when unknown; never contains secret material.",
        "type": "object",
        "required": [
          "present"
        ],
        "properties": {
          "present": {
            "type": "boolean"
          },
          "value_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{16}$"
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "managed_by": {
            "type": "string",
            "enum": [
              "managed_postgres",
              "object_storage"
            ]
          },
          "binding_id": {
            "type": "string"
          },
          "credential_generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        }
      },
      "ProjectEnvironmentSecretChangeResponse": {
        "description": "Secret metadata comparison that excludes secret values and ciphertext.",
        "type": "object",
        "required": [
          "key",
          "kind",
          "before",
          "after"
        ],
        "properties": {
          "key": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "added",
              "removed",
              "changed",
              "version_drift",
              "unknown"
            ]
          },
          "before": {
            "$ref": "#/components/schemas/ProjectEnvironmentSecretCellResponse"
          },
          "after": {
            "$ref": "#/components/schemas/ProjectEnvironmentSecretCellResponse"
          }
        }
      },
      "ProjectEnvironmentBindingChangeResponse": {
        "description": "Managed resource binding change between two environment states.",
        "type": "object",
        "required": [
          "kind",
          "binding_id",
          "change"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "managed_postgres",
              "object_storage"
            ]
          },
          "binding_id": {
            "type": "string"
          },
          "change": {
            "type": "string",
            "enum": [
              "added",
              "removed",
              "changed"
            ]
          },
          "before": {
            "$ref": "#/components/schemas/ProjectEnvironmentBindingResponse"
          },
          "after": {
            "$ref": "#/components/schemas/ProjectEnvironmentBindingResponse"
          }
        }
      },
      "ProjectEnvironmentDomainDiffResponse": {
        "description": "Environment-owned hostname changes for one workload.",
        "type": "object",
        "required": [
          "kind",
          "before",
          "after"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "unchanged",
              "changed"
            ]
          },
          "before": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentDomainResponse"
            }
          },
          "after": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentDomainResponse"
            }
          }
        }
      },
      "ProjectEnvironmentWorkloadDiffResponse": {
        "description": "Release, variable, secret, binding, and domain changes for one workload.",
        "type": "object",
        "required": [
          "workload_slug",
          "workload_name",
          "release",
          "variables",
          "secrets",
          "bindings",
          "domains",
          "routes",
          "policies"
        ],
        "properties": {
          "workload_slug": {
            "type": "string"
          },
          "workload_name": {
            "type": "string"
          },
          "release": {
            "$ref": "#/components/schemas/ProjectEnvironmentReleaseDiffResponse"
          },
          "variables": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentVariableChangeResponse"
            }
          },
          "secrets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentSecretChangeResponse"
            }
          },
          "bindings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentBindingChangeResponse"
            }
          },
          "domains": {
            "$ref": "#/components/schemas/ProjectEnvironmentDomainDiffResponse"
          },
          "routes": {
            "$ref": "#/components/schemas/ProjectEnvironmentRoutePolicyDiffResponse"
          },
          "policies": {
            "$ref": "#/components/schemas/ProjectEnvironmentEdgePolicyDiffResponse"
          }
        }
      },
      "ProjectEnvironmentEdgePolicyDiffResponse": {
        "description": "Difference in environment headers/CORS rules or ownership.",
        "type": "object",
        "required": [
          "kind",
          "before",
          "after"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "unchanged",
              "changed"
            ]
          },
          "before": {
            "$ref": "#/components/schemas/ProjectEnvironmentEdgePolicyResponse"
          },
          "after": {
            "$ref": "#/components/schemas/ProjectEnvironmentEdgePolicyResponse"
          }
        }
      },
      "ProjectEnvironmentRoutePolicyDiffResponse": {
        "description": "Difference in the effective declared-route contract or its ownership.",
        "type": "object",
        "required": [
          "kind",
          "before",
          "after"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "unchanged",
              "changed"
            ]
          },
          "before": {
            "$ref": "#/components/schemas/ProjectEnvironmentRoutePolicyResponse"
          },
          "after": {
            "$ref": "#/components/schemas/ProjectEnvironmentRoutePolicyResponse"
          }
        }
      },
      "ProjectEnvironmentDiffResponse": {
        "description": "Effective-state comparison from one project environment to another.",
        "type": "object",
        "required": [
          "project_slug",
          "from_environment",
          "to_environment",
          "configuration",
          "workloads",
          "shared_resources",
          "generated_at"
        ],
        "properties": {
          "project_slug": {
            "type": "string"
          },
          "from_environment": {
            "type": "string"
          },
          "to_environment": {
            "type": "string"
          },
          "configuration": {
            "$ref": "#/components/schemas/ProjectEnvironmentConfigDiffResponse"
          },
          "workloads": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentWorkloadDiffResponse"
            }
          },
          "shared_resources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentSharedResourceResponse"
            }
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "UpdateProjectEnvironmentConfigRequest": {
        "description": "Non-secret JSON configuration to append as a new environment version.",
        "type": "object",
        "required": [
          "values"
        ],
        "additionalProperties": false,
        "properties": {
          "values": {
            "type": "object",
            "additionalProperties": true,
            "maxProperties": 256
          }
        }
      },
      "ProjectEnvironmentConfigResponse": {
        "description": "Latest immutable non-secret configuration snapshot for a project environment.",
        "type": "object",
        "required": [
          "project_slug",
          "environment",
          "version",
          "config_hash",
          "values"
        ],
        "properties": {
          "project_slug": {
            "type": "string"
          },
          "environment": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "config_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "values": {
            "type": "object",
            "additionalProperties": true
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ProjectEnvironmentSharedSecret": {
        "description": "Metadata of one secret shared by every service of a project environment. The value is write-only.",
        "type": "object",
        "required": [
          "key",
          "version",
          "kid",
          "value_hash",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "key": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Increases on every value change."
          },
          "kid": {
            "type": "string",
            "description": "Recipient of the fleet key that sealed the value."
          },
          "value_hash": {
            "type": "string",
            "description": "HMAC fingerprint of the value, for comparing values without revealing them."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ProjectEnvironmentSharedSecretsResponse": {
        "description": "The secrets a project environment shares with its services.",
        "type": "object",
        "required": [
          "project_slug",
          "environment",
          "secrets",
          "limit"
        ],
        "properties": {
          "project_slug": {
            "type": "string"
          },
          "environment": {
            "type": "string"
          },
          "secrets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentSharedSecret"
            }
          },
          "limit": {
            "type": "integer",
            "description": "The plan's ProjectSecretCountMax for one environment."
          }
        }
      },
      "SetProjectEnvironmentSharedSecretRequest": {
        "description": "The plaintext value to seal. Never returned.",
        "type": "object",
        "required": [
          "value"
        ],
        "properties": {
          "value": {
            "type": "string",
            "minLength": 1
          }
        }
      },
      "ProjectEnvironmentSharedSecretResponse": {
        "description": "A shared secret's metadata after a write.",
        "type": "object",
        "required": [
          "project_slug",
          "environment",
          "secret"
        ],
        "properties": {
          "project_slug": {
            "type": "string"
          },
          "environment": {
            "type": "string"
          },
          "secret": {
            "$ref": "#/components/schemas/ProjectEnvironmentSharedSecret"
          }
        }
      },
      "ProjectEnvironmentConfigChange": {
        "description": "One key-level change between two environment configuration snapshots.",
        "type": "object",
        "required": [
          "key",
          "kind"
        ],
        "properties": {
          "key": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "added",
              "removed",
              "changed"
            ]
          },
          "before": {},
          "after": {}
        }
      },
      "ProjectEnvironmentConfigDiffResponse": {
        "description": "Stable key-level diff between two project environment configuration snapshots.",
        "type": "object",
        "required": [
          "project_slug",
          "from_environment",
          "to_environment",
          "from_version",
          "to_version",
          "from_hash",
          "to_hash",
          "changes"
        ],
        "properties": {
          "project_slug": {
            "type": "string"
          },
          "from_environment": {
            "type": "string"
          },
          "to_environment": {
            "type": "string"
          },
          "from_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "to_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "from_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "to_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentConfigChange"
            }
          }
        }
      },
      "ProjectEnvironmentPromotionChange": {
        "description": "One workload's live release identity in a source and target environment.",
        "type": "object",
        "required": [
          "workload_slug",
          "workload_name",
          "kind"
        ],
        "properties": {
          "secret_changes": {
            "type": "array",
            "description": "Production secret key names and change kinds, without values or fingerprints.",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentConfigChange"
            }
          },
          "release_configuration_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Identity of the approved immutable HTTP variable snapshot and environment versions; destination secrets and bindings remain owned by the target."
          },
          "environment_changes": {
            "type": "array",
            "description": "Variable key names and change kinds only; values and secret material are omitted.",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentConfigChange"
            }
          },
          "source_workload_config_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "target_workload_config_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "promoted_workload_config_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "workload_slug": {
            "type": "string"
          },
          "workload_name": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "source_missing",
              "create",
              "update",
              "unchanged"
            ]
          },
          "source_deployment_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "target_deployment_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "source_build_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "target_build_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "source_revision": {
            "type": "string"
          },
          "target_revision": {
            "type": "string"
          },
          "source_revision_kind": {
            "type": "string",
            "enum": [
              "source_sha256",
              "image_digest",
              "commit_sha",
              "deployment_id"
            ]
          },
          "target_revision_kind": {
            "type": "string",
            "enum": [
              "source_sha256",
              "image_digest",
              "commit_sha",
              "deployment_id"
            ]
          }
        }
      },
      "ProjectPromotionMigrationRecoveryRequest": {
        "description": "Operator inspection evidence and captured task identity for resuming or resolving a promotion migration incident.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "request_id",
          "expected_task_id",
          "expected_generation",
          "action",
          "database_state_checked",
          "schema_compatible",
          "evidence_hash"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "expected_task_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "action": {
            "type": "string",
            "enum": [
              "resume",
              "resolve"
            ]
          },
          "replacement_promotion_id": {
            "type": "string",
            "format": "uuid",
            "description": "Required for resolve; must identify a different succeeded verified active promotion in the same destination."
          },
          "database_state_checked": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Explicit operator attestation of destination database inspection."
          },
          "schema_compatible": {
            "type": "boolean",
            "description": "Required true for resume; attests that the expected expansion is present and backward-compatible."
          },
          "evidence_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "SHA256 reference to private inspection evidence. Contents are not uploaded."
          }
        }
      },
      "ProjectPromotionMigrationRecovery": {
        "description": "Durable acknowledgement and deadline for an operator's promotion migration recovery decision.",
        "type": "object",
        "required": [
          "request",
          "status",
          "operator_account_id",
          "requested_at",
          "deadline"
        ],
        "properties": {
          "request": {
            "$ref": "#/components/schemas/ProjectPromotionMigrationRecoveryRequest"
          },
          "status": {
            "type": "string",
            "enum": [
              "quiescing",
              "verifying",
              "resumed",
              "resolved",
              "blocked"
            ]
          },
          "reason": {
            "type": "string"
          },
          "operator_account_id": {
            "type": "string",
            "format": "uuid"
          },
          "requested_at": {
            "type": "string",
            "format": "date-time"
          },
          "deadline": {
            "type": "string",
            "format": "date-time"
          },
          "resolved_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ProjectPromotionMigrationPolicy": {
        "type": "object",
        "description": "One backward-compatible source release command authorized against destination runtime inputs. Contains a command fingerprint, never command bytes or credentials.",
        "required": [
          "app_id",
          "slug",
          "command_hash",
          "compatibility"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string"
          },
          "command_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "compatibility": {
            "type": "string",
            "enum": [
              "backward-compatible"
            ]
          }
        }
      },
      "ProjectDeploymentCheckRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Metadata-only project intent. Local source checks provide workloads; promotion checks provide from_environment instead. Proposed files never stage production changes.",
        "properties": {
          "environment": {
            "type": "string",
            "default": "production"
          },
          "from_environment": {
            "type": "string"
          },
          "expected_state_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "atomic": {
            "type": "boolean"
          },
          "add_services": {
            "type": "boolean"
          },
          "verify": {
            "type": "boolean"
          },
          "workers": {
            "type": "boolean"
          },
          "worker_health": {
            "type": "boolean"
          },
          "migrate": {
            "type": "boolean"
          },
          "progressive": {
            "type": "boolean"
          },
          "stabilize": {
            "type": "boolean"
          },
          "sync_config": {
            "type": "boolean"
          },
          "release_config": {
            "$ref": "#/components/schemas/ProjectReleaseConfigRequest"
          },
          "workloads": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/ProjectDeploymentCheckWorkload"
            }
          },
          "managed": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "string"
            }
          }
        }
      },
      "ProjectDeploymentCheckWorkload": {
        "description": "Planned workload and provided key names used by metadata-only deployment readiness checks.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "workload"
        ],
        "properties": {
          "workload": {
            "$ref": "#/components/schemas/PlanWorkload"
          },
          "command_shell": {
            "type": "boolean"
          },
          "release_command": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "release_command_shell": {
            "type": "boolean"
          },
          "provided_keys": {
            "description": "Key names proposed by a separate secrets input; values are never included.",
            "type": "array",
            "maxItems": 256,
            "items": {
              "type": "string"
            }
          }
        }
      },
      "ProjectDeploymentCheck": {
        "description": "Public deployment readiness finding with its status, observed limits and suggested remedy.",
        "type": "object",
        "required": [
          "code",
          "status",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "passed",
              "blocked",
              "unknown"
            ]
          },
          "workload": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "remedy": {
            "type": "string"
          },
          "observed": {
            "type": "integer"
          },
          "limit": {
            "type": "integer"
          }
        }
      },
      "ProjectDeploymentReadiness": {
        "description": "Metadata-only project deployment readiness report tied to the inspected environment and state hash.",
        "type": "object",
        "required": [
          "schema_version",
          "project_slug",
          "environment",
          "status",
          "checked_at",
          "runtime_checked",
          "checks"
        ],
        "properties": {
          "schema_version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "project_slug": {
            "type": "string"
          },
          "environment": {
            "type": "string"
          },
          "from_environment": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "ready",
              "blocked",
              "unknown"
            ]
          },
          "state_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "runtime_checked": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "checks": {
            "type": "array",
            "maxItems": 1024,
            "items": {
              "$ref": "#/components/schemas/ProjectDeploymentCheck"
            }
          }
        }
      },
      "ProjectPromotionHealthPolicy": {
        "type": "object",
        "description": "Destination probe and optional migration contract bound to the exact promotion preview and approval.",
        "required": [
          "probes"
        ],
        "properties": {
          "workers": {
            "description": "Complete immutable worker set for multiple-worker promotions; mutually exclusive with worker.",
            "type": "array",
            "minItems": 2,
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/ProjectReleaseWorker"
            }
          },
          "worker": {
            "$ref": "#/components/schemas/ProjectReleaseWorker"
          },
          "migration": {
            "$ref": "#/components/schemas/ProjectPromotionMigrationPolicy"
          },
          "probes": {
            "type": "array",
            "minItems": 1,
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/ProjectReleaseProbe"
            }
          }
        }
      },
      "ProjectPromotionControlRequest": {
        "description": "Stable operator request identity and expected promotion checkpoint generation.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "request_id",
          "expected_generation"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "expected_generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        }
      },
      "ProjectPromotionControl": {
        "description": "Durable promotion abort or restoration decision, including its operator, deadline and resolution.",
        "type": "object",
        "required": [
          "request",
          "action",
          "status",
          "operator_account_id",
          "requested_at",
          "deadline"
        ],
        "properties": {
          "request": {
            "$ref": "#/components/schemas/ProjectPromotionControlRequest"
          },
          "action": {
            "type": "string",
            "enum": [
              "abort",
              "recover"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "aborted",
              "restored",
              "blocked"
            ]
          },
          "operator_account_id": {
            "type": "string"
          },
          "requested_at": {
            "type": "string",
            "format": "date-time"
          },
          "deadline": {
            "type": "string",
            "format": "date-time"
          },
          "resolved_at": {
            "type": "string",
            "format": "date-time"
          },
          "reason": {
            "type": "string"
          }
        }
      },
      "ProjectPromotionAdmission": {
        "type": "object",
        "description": "Durable capacity wait receipt. Queue time does not consume the execution health window. An absent started_at means execution has never started.",
        "required": [
          "queued_at",
          "wait_deadline",
          "reason"
        ],
        "properties": {
          "queued_at": {
            "type": "string",
            "format": "date-time"
          },
          "wait_deadline": {
            "type": "string",
            "format": "date-time"
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "reason": {
            "type": "string"
          }
        }
      },
      "ProjectPromotionHealth": {
        "type": "object",
        "description": "Durable destination health checkpoint. Includes counts only, without challenge tokens, credentials or response bodies.",
        "required": [
          "policy",
          "phase",
          "generation",
          "started_at",
          "deadline",
          "verdict",
          "healthy_rounds",
          "regressed_rounds"
        ],
        "properties": {
          "workers": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/ProjectPromotionWorkerHealth"
            }
          },
          "admission": {
            "$ref": "#/components/schemas/ProjectPromotionAdmission"
          },
          "control": {
            "$ref": "#/components/schemas/ProjectPromotionControl"
          },
          "worker": {
            "$ref": "#/components/schemas/ProjectReleaseWorker"
          },
          "worker_health": {
            "$ref": "#/components/schemas/ProjectWorkerHealth"
          },
          "recovery": {
            "$ref": "#/components/schemas/ProjectPromotionMigrationRecovery"
          },
          "migration": {
            "$ref": "#/components/schemas/ProjectReleaseCommand"
          },
          "policy": {
            "$ref": "#/components/schemas/ProjectPromotionHealthPolicy"
          },
          "phase": {
            "type": "string",
            "enum": [
              "queued",
              "migrating",
              "preflight",
              "cutover",
              "verifying",
              "finalizing",
              "rolling_back",
              "restoring",
              "aborted",
              "succeeded",
              "failed",
              "conflicted",
              "rollback_failed"
            ]
          },
          "generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "started_at": {
            "type": "string",
            "format": "date-time",
            "description": "Queue entry time while waiting; reset once to execution start at validated dispatch."
          },
          "deadline": {
            "type": "string",
            "format": "date-time",
            "description": "Queue wait deadline while queued; a fresh execution deadline after dispatch."
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "verdict": {
            "type": "string",
            "enum": [
              "unknown",
              "healthy",
              "regressed"
            ]
          },
          "healthy_rounds": {
            "type": "integer",
            "minimum": 0
          },
          "regressed_rounds": {
            "type": "integer",
            "minimum": 0
          },
          "message": {
            "type": "string"
          },
          "evidence": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/ProjectReleaseProbeEvidence"
            }
          }
        }
      },
      "ProjectPromotionWorkerHealth": {
        "description": "Captured queue worker policy paired with observed delivery health for one promotion member.",
        "type": "object",
        "required": [
          "worker",
          "health"
        ],
        "properties": {
          "worker": {
            "$ref": "#/components/schemas/ProjectReleaseWorker"
          },
          "health": {
            "$ref": "#/components/schemas/ProjectWorkerHealth"
          }
        }
      },
      "ProjectEnvironmentPromotionSecretPreviewRequest": {
        "description": "Environment promotion preview inputs referencing staged immutable secrets without plaintext values.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "from_environment",
          "sync_config",
          "verify",
          "secrets"
        ],
        "properties": {
          "from_environment": {
            "type": "string"
          },
          "sync_config": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "verify": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "secrets": {
            "type": "object",
            "minProperties": 1,
            "description": "Complete destination secret key/version maps by workload. Values must be staged immutable UUIDs, never plaintext.",
            "additionalProperties": {
              "type": "object",
              "additionalProperties": {
                "type": "string",
                "format": "uuid"
              }
            }
          }
        }
      },
      "ProjectEnvironmentPromotionPreviewResponse": {
        "description": "Read-only promotion preview between two registered project environments.",
        "type": "object",
        "required": [
          "project_slug",
          "from_environment",
          "to_environment",
          "to_environment_protected",
          "approval_required",
          "can_promote",
          "config_diff",
          "changes",
          "release_graph_mode",
          "promotion_hash",
          "promotion_token"
        ],
        "properties": {
          "secrets": {
            "$ref": "#/components/schemas/ProjectReleaseSecretConfiguration"
          },
          "destination_config_hash": {
            "type": "string",
            "description": "Hash of the configuration resolved with destination service bindings; included in the promotion identity."
          },
          "health": {
            "$ref": "#/components/schemas/ProjectPromotionHealthPolicy"
          },
          "project_slug": {
            "type": "string"
          },
          "from_environment": {
            "type": "string"
          },
          "to_environment": {
            "type": "string"
          },
          "sync_config": {
            "type": "boolean",
            "description": "Whether this exact promotion will copy the source's non-secret configuration to the target."
          },
          "to_environment_protected": {
            "type": "boolean"
          },
          "approval_required": {
            "type": "boolean"
          },
          "can_promote": {
            "type": "boolean"
          },
          "blocking_reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "config_diff": {
            "$ref": "#/components/schemas/ProjectEnvironmentConfigDiffResponse"
          },
          "changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentPromotionChange"
            }
          },
          "from_release_set": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ProjectReleaseSetResponse"
              }
            ],
            "description": "Immutable active release graph snapshot for the source environment, when present."
          },
          "to_release_set": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ProjectReleaseSetResponse"
              }
            ],
            "description": "Immutable active release graph snapshot for the target environment, when present."
          },
          "release_graph_mode": {
            "type": "boolean",
            "description": "True when promotion stages deployments dark and atomically activates a project release graph."
          },
          "release_ttl_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 604800,
            "description": "Compatibility window used by the promoted release graph."
          },
          "qualification_required": {
            "type": "boolean",
            "description": "True when a protected-target promotion requires a fresh source qualification."
          },
          "qualification": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ProjectEnvironmentQualificationResponse"
              }
            ],
            "description": "Latest qualification for the active source release set, including failed or expired receipts."
          },
          "promotion_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "promotion_token": {
            "type": "string",
            "minLength": 1
          }
        }
      },
      "CreateProjectEnvironmentQualificationRequest": {
        "description": "Closed-schema health and smoke probe results for one exact active source release set, non-secret source configuration version, and workload and shared-secret revision fingerprints observed before probes.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "release_set_id",
          "configuration_version",
          "configuration_hash",
          "secret_revision_hashes",
          "checks"
        ],
        "properties": {
          "workload_config_hashes": {
            "description": "Configuration fingerprints observed before probes; environment-owned settings require an exact match to deployed revisions.",
            "type": "object",
            "propertyNames": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
            },
            "additionalProperties": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            }
          },
          "release_set_id": {
            "type": "string",
            "format": "uuid"
          },
          "configuration_version": {
            "type": "integer",
            "minimum": 0
          },
          "configuration_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "secret_revision_hashes": {
            "description": "Per-workload secret fingerprints plus the reserved project:secrets identity from the pre-probe environment state. The shared identity is required once the environment has held shared secrets, including after the final key is deleted.",
            "type": "object",
            "minProperties": 1,
            "propertyNames": {
              "type": "string",
              "pattern": "^([a-z0-9][a-z0-9-]{0,62}|project:secrets)$"
            },
            "additionalProperties": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            }
          },
          "checks": {
            "type": "array",
            "minItems": 2,
            "maxItems": 2,
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentQualificationCheck"
            }
          }
        }
      },
      "ProjectEnvironmentQualificationCheck": {
        "description": "Aggregate result plus one exact-deployment probe outcome per workload.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "status",
          "results"
        ],
        "properties": {
          "name": {
            "type": "string",
            "enum": [
              "health",
              "smoke"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "passed",
              "failed"
            ]
          },
          "results": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentQualificationResult"
            }
          }
        }
      },
      "ProjectEnvironmentQualificationResult": {
        "description": "Non-secret GET probe result tied to one workload deployment in the active release set.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "workload_slug",
          "deployment_id",
          "status"
        ],
        "properties": {
          "workload_slug": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "passed",
              "failed"
            ]
          },
          "http_status": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599
          },
          "error_code": {
            "type": "string",
            "enum": [
              "preview_unavailable",
              "request_failed",
              "unexpected_status"
            ]
          }
        }
      },
      "ProjectEnvironmentQualificationResponse": {
        "description": "Non-secret, 24-hour qualification receipt for an immutable release set and the exact source configuration and per-workload secret revision snapshots probed.",
        "type": "object",
        "required": [
          "id",
          "environment",
          "release_set_id",
          "configuration_version",
          "configuration_hash",
          "secret_revision_hashes",
          "status",
          "checks",
          "created_at",
          "expires_at"
        ],
        "properties": {
          "workload_config_hashes": {
            "description": "Immutable per-workload fingerprints bound to this qualification receipt.",
            "type": "object",
            "propertyNames": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
            },
            "additionalProperties": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            }
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "environment": {
            "type": "string"
          },
          "release_set_id": {
            "type": "string",
            "format": "uuid"
          },
          "configuration_version": {
            "type": "integer",
            "minimum": -1,
            "description": "Version tested; -1 marks a legacy receipt that predates configuration binding and cannot qualify for promotion."
          },
          "configuration_hash": {
            "type": "string",
            "description": "SHA-256 of canonical non-secret environment configuration; empty only for a legacy receipt that cannot qualify for promotion."
          },
          "secret_revision_hashes": {
            "type": "object",
            "description": "Opaque per-workload secret fingerprints and, for tracked shared-secret sets, the reserved project:secrets identity. No secret values or value hashes are included. Empty only for a legacy receipt that cannot qualify for promotion.",
            "additionalProperties": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "passed",
              "failed"
            ]
          },
          "checks": {
            "type": "array",
            "minItems": 2,
            "maxItems": 2,
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentQualificationCheck"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ResumeEnvironmentAutomationResponse": {
        "type": "object",
        "description": "Crons enabled by resuming a stage's automation after a full environment clone.",
        "required": [
          "environment",
          "crons_resumed",
          "cron_ids"
        ],
        "properties": {
          "environment": {
            "type": "string",
            "description": "Stage whose paused automation was enabled.",
            "example": "staging"
          },
          "crons_resumed": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of crons enabled."
          },
          "cron_ids": {
            "type": "array",
            "description": "Crons enabled by this call.",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "ProjectEnvironmentCloneOperationResponse": {
        "description": "Durable clone progress within one account and project, excluding private source configuration and worker credentials.",
        "type": "object",
        "required": [
          "operation_id",
          "project_slug",
          "source_environment",
          "target_environment",
          "source_revision_hash",
          "status",
          "revision",
          "resources",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "operation_id": {
            "type": "string"
          },
          "project_slug": {
            "type": "string"
          },
          "source_environment": {
            "type": "string"
          },
          "target_environment": {
            "type": "string"
          },
          "source_revision_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "source_release_set_id": {
            "type": "string"
          },
          "target_release_set_id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "capturing",
              "copying",
              "publishing",
              "ready",
              "failed",
              "compensating",
              "compensated"
            ]
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "resources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentCloneResourceResponse"
            }
          },
          "error_code": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ProjectEnvironmentCloneResourceResponse": {
        "description": "Progress and named blockers for an individual resource in a complete environment clone.",
        "type": "object",
        "required": [
          "kind",
          "name",
          "status"
        ],
        "properties": {
          "kind": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "source_id": {
            "type": "string"
          },
          "source_version": {
            "type": "string"
          },
          "target_id": {
            "type": "string"
          },
          "capture_point": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "planned",
              "capturing",
              "captured",
              "copying",
              "verifying",
              "ready",
              "failed",
              "unsupported",
              "compensating",
              "compensated"
            ]
          }
        }
      },
      "CreateProjectEnvironmentRequest": {
        "description": "Request to register or clone a named project environment.",
        "type": "object",
        "required": [
          "slug"
        ],
        "properties": {
          "slug": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$",
            "not": {
              "const": "default"
            },
            "description": "Canonical slug to assign to the new environment; `default` is reserved for application scope."
          },
          "protected": {
            "type": "boolean",
            "default": false
          },
          "from_environment": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$",
            "not": {
              "const": "default"
            },
            "description": "Source environment whose scoped configuration and values are copied."
          },
          "full": {
            "type": "boolean",
            "default": false,
            "description": "Require a complete isolated copy; use the dedicated environment-clones route. Admission remains closed while complete coverage is unavailable."
          },
          "share_resources": {
            "type": "boolean",
            "default": false,
            "description": "Explicitly attach fresh target-scoped credentials to the source environment's managed database and object-storage resources; data remains shared."
          }
        }
      },
      "BrowserPromotionApprovalRequest": {
        "description": "Exact reviewed environment promotion submitted for human browser authorization.",
        "type": "object",
        "required": [
          "promotion_token",
          "reason"
        ],
        "properties": {
          "promotion_token": {
            "type": "string",
            "minLength": 1,
            "maxLength": 16384
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 280
          }
        }
      },
      "BrowserPromotionApprovalResponse": {
        "description": "Five-minute human review link with separate private polling material. Only review_url and expires_at may be exposed to agents.",
        "type": "object",
        "required": [
          "review_url",
          "ticket",
          "exchange_code",
          "expires_at"
        ],
        "properties": {
          "review_url": {
            "type": "string",
            "format": "uri"
          },
          "ticket": {
            "type": "string"
          },
          "exchange_code": {
            "type": "string",
            "minLength": 43,
            "maxLength": 43
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "BrowserPromotionApprovalExchange": {
        "description": "One-use exchange of a browser-authorized promotion ticket.",
        "type": "object",
        "required": [
          "ticket",
          "exchange_code"
        ],
        "properties": {
          "ticket": {
            "type": "string",
            "maxLength": 32768
          },
          "exchange_code": {
            "type": "string",
            "minLength": 43,
            "maxLength": 43
          }
        }
      },
      "SecretEntryRequest": {
        "description": "A secret the account owner is asked to enter on a one-time page.",
        "type": "object",
        "required": [
          "key",
          "reason"
        ],
        "properties": {
          "key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "scope": {
            "type": "string",
            "description": "Env scope; empty selects default."
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 280,
            "description": "Shown to the owner on the entry page."
          }
        }
      },
      "SecretEntryResponse": {
        "description": "Fifteen-minute entry link with separate private status material. Only entry_url and expires_at may be exposed to agents; the link works only in the owner's signed-in session.",
        "type": "object",
        "required": [
          "entry_url",
          "ticket",
          "exchange_code",
          "expires_at"
        ],
        "properties": {
          "entry_url": {
            "type": "string",
            "format": "uri"
          },
          "ticket": {
            "type": "string"
          },
          "exchange_code": {
            "type": "string",
            "minLength": 43,
            "maxLength": 43
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SecretEntryStatusRequest": {
        "description": "Private status check of a secret entry request.",
        "type": "object",
        "required": [
          "ticket",
          "exchange_code"
        ],
        "properties": {
          "ticket": {
            "type": "string",
            "maxLength": 32768
          },
          "exchange_code": {
            "type": "string",
            "minLength": 43,
            "maxLength": 43
          }
        }
      },
      "SecretEntryStatus": {
        "description": "Whether the owner has set the requested secret. Never carries the value.",
        "type": "object",
        "required": [
          "status",
          "app",
          "key",
          "scope",
          "expires_at"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "set"
            ]
          },
          "app": {
            "type": "string"
          },
          "key": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreateProjectEnvironmentApprovalRequest": {
        "description": "Request to approve one exact plan for a protected environment. Provide exactly one of plan_token or promotion_token.",
        "type": "object",
        "properties": {
          "plan_token": {
            "type": "string",
            "minLength": 1,
            "description": "Exact plan token returned by the scan endpoint."
          },
          "promotion_token": {
            "type": "string",
            "minLength": 1,
            "description": "Exact promotion token returned by the environment promotion preview."
          }
        }
      },
      "ProjectEnvironmentApprovalResponse": {
        "description": "Short-lived, single-use credential for applying the approved plan. The approval token is returned only to the approving caller or the private browser-review exchange.",
        "type": "object",
        "required": [
          "approval_id",
          "approval_token",
          "environment",
          "token_kind",
          "status",
          "expires_at"
        ],
        "properties": {
          "approval_id": {
            "type": "string",
            "format": "uuid"
          },
          "approval_token": {
            "type": "string",
            "minLength": 1
          },
          "environment": {
            "type": "string"
          },
          "token_kind": {
            "type": "string",
            "enum": [
              "plan",
              "promotion"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "expired",
              "consumed"
            ]
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ProjectEnvironmentApprovalStatusResponse": {
        "description": "Durable, non-secret lifecycle status for one environment approval.",
        "type": "object",
        "required": [
          "approval_id",
          "environment",
          "token_kind",
          "status",
          "created_at",
          "expires_at"
        ],
        "properties": {
          "approval_id": {
            "type": "string",
            "format": "uuid"
          },
          "environment": {
            "type": "string"
          },
          "token_kind": {
            "type": "string",
            "enum": [
              "plan",
              "promotion"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "expired",
              "consumed"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "consumed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PromoteProjectEnvironmentRequest": {
        "description": "Request to execute one exact environment promotion.",
        "type": "object",
        "required": [
          "from_environment",
          "promotion_token"
        ],
        "properties": {
          "from_environment": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$"
          },
          "promotion_token": {
            "type": "string",
            "minLength": 1,
            "description": "Exact promotion token returned by the preview endpoint."
          },
          "approval_token": {
            "type": "string",
            "minLength": 1,
            "description": "Short-lived approval for a protected target environment."
          },
          "override_freeze": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Promote into production while a deploy freeze covers one of the apps; the reason is audited."
          }
        }
      },
      "ProjectEnvironmentPromotionWorkloadResponse": {
        "description": "Result for one workload in an environment promotion.",
        "type": "object",
        "required": [
          "workload_slug",
          "workload_name",
          "status"
        ],
        "properties": {
          "workload_slug": {
            "type": "string"
          },
          "workload_name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "promoted",
              "unchanged"
            ]
          },
          "source_deployment_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "target_deployment_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          }
        }
      },
      "ProjectEnvironmentPromotionResponse": {
        "description": "Result of a guarded project environment promotion.",
        "type": "object",
        "required": [
          "promotion_id",
          "project_slug",
          "from_environment",
          "to_environment",
          "promotion_hash",
          "workloads"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "running",
              "succeeded",
              "failed"
            ],
            "description": "A running health-gated promotion has been accepted and has not completed cutover and verification."
          },
          "promotion_id": {
            "type": "string",
            "minLength": 1
          },
          "project_slug": {
            "type": "string"
          },
          "from_environment": {
            "type": "string"
          },
          "to_environment": {
            "type": "string"
          },
          "sync_config": {
            "type": "boolean",
            "description": "Whether this promotion copied the source's non-secret configuration."
          },
          "promotion_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "release_graph": {
            "$ref": "#/components/schemas/ProjectEnvironmentPromotionReleaseGraphResponse"
          },
          "workloads": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentPromotionWorkloadResponse"
            }
          }
        }
      },
      "ProjectEnvironmentPromotionReleaseGraphResponse": {
        "description": "Immutable graph identities involved in a graph-aware promotion and rollback.",
        "type": "object",
        "required": [
          "ttl_seconds"
        ],
        "properties": {
          "source_release_set_id": {
            "type": "string",
            "format": "uuid"
          },
          "previous_target_release_set_id": {
            "type": "string",
            "format": "uuid"
          },
          "target_release_set_id": {
            "type": "string",
            "format": "uuid"
          },
          "restored_target_release_set_id": {
            "type": "string",
            "format": "uuid"
          },
          "ttl_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 604800
          }
        }
      },
      "ProjectEnvironmentPromotionStatusWorkloadResponse": {
        "description": "Durable checkpoint for one workload in an environment promotion.",
        "type": "object",
        "required": [
          "workload_slug",
          "workload_name",
          "status"
        ],
        "properties": {
          "workload_slug": {
            "type": "string"
          },
          "workload_name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "promoted",
              "unchanged",
              "failed"
            ]
          },
          "source_deployment_id": {
            "type": "string"
          },
          "previous_target_deployment_id": {
            "type": "string"
          },
          "target_deployment_id": {
            "type": "string"
          },
          "error": {
            "type": "string"
          },
          "rollback_status": {
            "type": "string",
            "enum": [
              "pending",
              "restored",
              "cleared",
              "unchanged",
              "skipped",
              "failed"
            ]
          },
          "restored_target_deployment_id": {
            "type": "string"
          },
          "rollback_error": {
            "type": "string"
          },
          "verification_status": {
            "type": "string",
            "enum": [
              "pending",
              "verified",
              "failed"
            ]
          },
          "verification_error": {
            "type": "string"
          }
        }
      },
      "ProjectEnvironmentPromotionStatusResponse": {
        "description": "Durable status for a project environment promotion operation.",
        "type": "object",
        "required": [
          "promotion_id",
          "project_slug",
          "from_environment",
          "to_environment",
          "promotion_hash",
          "status",
          "created_at",
          "updated_at",
          "workloads"
        ],
        "properties": {
          "health": {
            "$ref": "#/components/schemas/ProjectPromotionHealth"
          },
          "promotion_id": {
            "type": "string",
            "minLength": 1
          },
          "project_slug": {
            "type": "string"
          },
          "from_environment": {
            "type": "string"
          },
          "to_environment": {
            "type": "string"
          },
          "sync_config": {
            "type": "boolean",
            "description": "Config sync was enabled for this promotion."
          },
          "promotion_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "running",
              "succeeded",
              "failed"
            ]
          },
          "error": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          },
          "rollback_status": {
            "type": "string",
            "enum": [
              "rolling_back",
              "rolled_back",
              "rollback_failed"
            ]
          },
          "rollback_error": {
            "type": "string"
          },
          "rollback_started_at": {
            "type": "string",
            "format": "date-time"
          },
          "rollback_completed_at": {
            "type": "string",
            "format": "date-time"
          },
          "verification_status": {
            "type": "string",
            "enum": [
              "pending",
              "verifying",
              "verified",
              "failed"
            ]
          },
          "verification_error": {
            "type": "string"
          },
          "verification_started_at": {
            "type": "string",
            "format": "date-time"
          },
          "verification_completed_at": {
            "type": "string",
            "format": "date-time"
          },
          "release_graph": {
            "$ref": "#/components/schemas/ProjectEnvironmentPromotionReleaseGraphResponse"
          },
          "workloads": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentPromotionStatusWorkloadResponse"
            }
          }
        }
      },
      "ProjectEnvironmentPromotionSummaryResponse": {
        "description": "Compact non-secret summary of one project environment promotion.",
        "type": "object",
        "required": [
          "promotion_id",
          "project_slug",
          "from_environment",
          "to_environment",
          "promotion_hash",
          "status",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "promotion_id": {
            "type": "string"
          },
          "project_slug": {
            "type": "string"
          },
          "from_environment": {
            "type": "string"
          },
          "to_environment": {
            "type": "string"
          },
          "sync_config": {
            "type": "boolean",
            "description": "Whether the operation copied non-secret source config to its target."
          },
          "promotion_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "running",
              "succeeded",
              "failed"
            ]
          },
          "error": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          },
          "rollback_status": {
            "type": "string",
            "enum": [
              "rolling_back",
              "rolled_back",
              "rollback_failed"
            ]
          },
          "rollback_error": {
            "type": "string"
          },
          "verification_status": {
            "type": "string",
            "enum": [
              "pending",
              "verifying",
              "verified",
              "failed"
            ]
          },
          "verification_error": {
            "type": "string"
          },
          "verification_completed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ProjectEnvironmentPromotionListResponse": {
        "description": "Cursor-paginated project environment promotion history.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectEnvironmentPromotionSummaryResponse"
            }
          },
          "next_before": {
            "type": "string",
            "description": "Opaque cursor for the next older page."
          }
        }
      },
      "UpdateProjectEnvironmentRequest": {
        "description": "Protection policy update for a project environment.",
        "type": "object",
        "required": [
          "protected"
        ],
        "properties": {
          "protected": {
            "type": "boolean"
          }
        }
      },
      "ProjectWorkloadResponse": {
        "description": "Live app attached to a durable project and its latest release state.",
        "type": "object",
        "required": [
          "slug",
          "workload_name",
          "status"
        ],
        "properties": {
          "slug": {
            "type": "string"
          },
          "workload_name": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "deployment_status": {
            "type": "string"
          },
          "rollout_state": {
            "type": "string"
          },
          "build_status": {
            "type": "string"
          },
          "depends_on": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The project services this one declares it calls (Compose depends_on), sorted. Omitted when none."
          }
        }
      },
      "ProjectResponse": {
        "description": "Project metadata with its workloads, exclusions, and latest reconciliation state.",
        "allOf": [
          {
            "$ref": "#/components/schemas/ProjectSummaryResponse"
          },
          {
            "type": "object",
            "required": [
              "workloads",
              "exclusions"
            ],
            "properties": {
              "workloads": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ProjectWorkloadResponse"
                }
              },
              "exclusions": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "last_reconciliation_status": {
                "type": "string"
              },
              "last_build_status": {
                "type": "string"
              }
            }
          }
        ]
      },
      "UpdateProjectRequest": {
        "description": "Patch for the customer-managed repository binding and production branch.",
        "type": "object",
        "minProperties": 1,
        "properties": {
          "repo_full_name": {
            "type": "string",
            "description": "GitHub owner/name. An empty string removes the repository binding."
          },
          "production_branch": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          }
        }
      },
      "ProjectDeletePreviewResponse": {
        "description": "Workloads and related resources that remain live when a project is deleted.",
        "type": "object",
        "required": [
          "project",
          "workloads",
          "domain_count",
          "env_count",
          "cron_count"
        ],
        "properties": {
          "project": {
            "$ref": "#/components/schemas/ProjectSummaryResponse"
          },
          "workloads": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectWorkloadResponse"
            }
          },
          "domain_count": {
            "type": "integer",
            "minimum": 0
          },
          "env_count": {
            "type": "integer",
            "minimum": 0
          },
          "cron_count": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "ProjectSourceRefScanRequest": {
        "description": "Connected GitHub repository input for POST /v1/projects/scan/source-ref.",
        "type": "object",
        "required": [
          "repo",
          "ref",
          "project_slug"
        ],
        "properties": {
          "app_slugs": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "App allocations for this connected repository review. Keys are exact service names. Existing project apps keep their names; new names are checked for format, reservation and availability without being allocated."
          },
          "repo": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$",
            "description": "GitHub owner/name to fetch through the connected installation."
          },
          "ref": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Branch, tag, or commit ref to scan."
          },
          "project_slug": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          },
          "repo_full_name": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$",
            "description": "Repository binding stored if the plan is later applied; defaults to repo."
          },
          "production_branch": {
            "type": "string",
            "default": "main"
          },
          "install_id": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Optional connected installation id. Omit to resolve the single installation that can access repo."
          },
          "only": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "exclude": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "environment": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$",
            "description": "Environment slug applied to deployments created by this scan"
          },
          "no_triggers": {
            "type": "boolean",
            "default": false
          },
          "migration": {
            "type": "boolean",
            "default": false,
            "description": "Prepare a manual migration: preserve repository service names, suggest project-prefixed app names, leave the project unbound from GitHub push deployments and suppress schedules and async routes. Credentials remain inside the GitHub integration."
          }
        }
      },
      "SourceReviewRequest": {
        "description": "Git repository and revision selectors to resolve without creating a deployment.",
        "type": "object",
        "required": [
          "repo",
          "ref"
        ],
        "properties": {
          "repo": {
            "type": "string",
            "maxLength": 200
          },
          "ref": {
            "type": "string",
            "maxLength": 200,
            "description": "GitHub branch or full lowercase commit SHA; use the commit SHA for tags."
          },
          "environment": {
            "type": "string",
            "description": "Registered target environment; omitted selects default."
          }
        }
      },
      "SourceReviewResponse": {
        "description": "Resolved repository identity and immutable commit bound to a release review.",
        "type": "object",
        "required": [
          "app_id",
          "repo",
          "commit_sha",
          "installation_id",
          "repository_id",
          "source_root",
          "release_review"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "repo": {
            "type": "string"
          },
          "commit_sha": {
            "type": "string",
            "pattern": "^[a-f0-9]{40}$"
          },
          "installation_id": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "repository_id": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "source_root": {
            "type": "string"
          },
          "release_review": {
            "$ref": "#/components/schemas/AppReleaseReview"
          }
        }
      },
      "SourceRefDeployRequest": {
        "description": "JSON body for POST /v1/apps/{slug}/deployments/source-ref. The headless CI deploy\npath: `repo` resolves to an install-token-bound fetch, `ref` is\nthe customer's chosen input (branch / tag / SHA — server\nresolves to a 40-char SHA before stamping the deployment row).\n",
        "type": "object",
        "required": [
          "repo",
          "ref"
        ],
        "properties": {
          "native_rollout": {
            "type": "string",
            "enum": [
              "service",
              "worker"
            ],
            "description": "Reviewed native service handoff or worker generation activation. Requires expected_source, omitted traffic, an unprotected target and matching workload mode."
          },
          "expected_source": {
            "$ref": "#/components/schemas/SourceReviewResponse",
            "description": "Commit-pinned staging or native rollout guard. Requires no_triggers, an exact commit, and no rollout overrides. Repository declarations are not imported. Named targets freeze reviewed settings; the response includes staged_review."
          },
          "healthcheck": {
            "$ref": "#/components/schemas/DeploymentHealthcheck",
            "description": "Startup readiness for this source-ref deployment. Select exactly one HTTP path or standard gRPC health probe; omitted preserves source inference."
          },
          "repo": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9._-]+/[a-zA-Z0-9._-]+$",
            "description": "GitHub owner/name slug, e.g. `onebox-faas/hello`.",
            "example": "onebox-faas/hello"
          },
          "ref": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Commit ref — 40-char SHA, branch, or tag. api.github.com\n/repos/<repo>/commits/<ref> resolves branch / tag inputs\nto a pinned SHA before the tarball fetch starts. The wire\nshape pins to the resolved 40-char SHA (server override;\ncaller's `ref` is preserved on the `deploy.source_ref`\naudit row for traceability).\n",
            "example": "main"
          },
          "source_branch": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Optional branch provenance for a request whose `ref` is a full\ncommit SHA. The server verifies this branch still points at the\nfetched commit, then rechecks it immediately before promotion.\nGitHub Actions push deployments use this to keep their immutable\nevent SHA from becoming stale during a long build. Omit for an\nexplicit pinned deployment or a tag.\n",
            "example": "release/2026-q3"
          },
          "format": {
            "type": "string",
            "enum": [
              "tarball"
            ],
            "default": "tarball",
            "description": "Forward-compat field. only supports `tarball`."
          },
          "environment": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$",
            "description": "Registered project environment to target for this source-ref deployment."
          },
          "no_triggers": {
            "type": "boolean",
            "default": false,
            "description": "Skip applying trigger declarations from the fetched gregale.yaml; workflow definitions are still deployed."
          },
          "reason": {
            "type": "string",
            "maxLength": 280,
            "description": "Free-form operator note (≤280 chars). Example: 'Emergency rollback after payment provider incident'."
          },
          "tag": {
            "type": "string",
            "enum": [
              "incident_recovery",
              "hotfix",
              "scheduled_maintenance",
              "compliance_hold",
              "partner_request"
            ],
            "description": "Closed-set annotation tag for grouping/filtering."
          },
          "deployed_by": {
            "type": "string",
            "description": "Human-readable actor label. CLI auto-captures from `git config user.name`; the GitHub integration stamps pusher.name; the GitHub Action defaults to ${{ github.actor }}."
          },
          "pr_number": {
            "type": "integer",
            "minimum": 1,
            "description": "Pull-request number when the wire offers it (the GitHub integration pull_request.number; Action ${{ github.event.pull_request.number }}). NULL for push-to-main with no inferred PR."
          },
          "traffic_percent": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 100,
            "description": "Explicit initial traffic weight for this source-ref deployment. Omitted uses the normal stable rollout; zero stages a dark live revision."
          },
          "canary": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CanaryPresetSpec"
              },
              {
                "type": "null"
              }
            ],
            "description": "Canary rollout policy for this source-ref deployment. Mutually exclusive with traffic_percent."
          },
          "rollback_on_5xx": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Source-ref deployment opt-in for first-wake 5xx auto-rollback; Pro/Scale only, with omitted or null defaulting to false."
          },
          "mcp_task_migration_override": {
            "type": "boolean",
            "description": "Source-ref deployment grant consumed once to permit cutover despite outstanding tasks requiring omitted handler versions."
          },
          "override_freeze": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Release this source ref to production while a deploy freeze is active; the reason is audited."
          },
          "release_at": {
            "type": "string",
            "format": "date-time",
            "description": "Build this source ref now, keep it live without traffic, and start its production rollout at this time; deploy freezes are checked at that time."
          },
          "release_notify": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "description": "Slack or email notification channels told when this source ref, scheduled with release_at, starts or cannot start."
          },
          "disable_startup_cpu_boost": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Opt this source-ref deployment out of temporary startup CPU headroom. Omitted or null preserves the default boost."
          }
        }
      },
      "DiffRequest": {
        "description": "JSON body for POST /v1/apps/{slug}/diff. Slim\npurpose-built DTO — every field maps 1:1 to a\n[deploydiff.Pending] entry via the API handler's adapter.\nEmpty / absent fields mean \"no change proposed\" (matches\nthe engine's pointer semantics: every nested field is\noptional; null = \"don't touch\").\n",
        "type": "object",
        "properties": {
          "app_config": {
            "$ref": "#/components/schemas/DiffAppConfigPatch"
          },
          "image": {
            "type": "string",
            "description": "Would-write image reference. Empty = no image deploy\nproposed. Compared against the baseline's\nDeploymentResponse.ImageDigest for the immutable-diff\ncheck.\n",
            "example": "ghcr.io/me/api@sha256:abc"
          },
          "manifest": {
            "$ref": "#/components/schemas/AppManifest"
          },
          "env_by_scope": {
            "type": "object",
            "description": "Per-scope env write. Full-replacement semantics per\nscope. Keys are scope names (\"default\",\n\"staging\", ...); values are DiffEnvRow arrays.\n",
            "additionalProperties": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/DiffEnvRow"
              }
            }
          },
          "crons": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateCronRequest"
            }
          },
          "edge_rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateEdgeRuleRequest"
            }
          },
          "scope": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$",
            "description": "Pending per-deployment env scope (production-leveling Stream E). Compared against Baseline.LatestScope; mismatch emits a scope_mismatch break. Empty = default.",
            "example": "prod"
          },
          "build_plan": {
            "$ref": "#/components/schemas/BuildPlan",
            "description": "Resolved source/workload intent for a deploy preview. Supplying this makes fresh app creation explicit even when resource values use server defaults."
          },
          "traffic_percent": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 100,
            "description": "Proposed initial deployment traffic weight. Mutually exclusive with canary."
          },
          "canary": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CanaryPresetSpec"
              },
              {
                "type": "null"
              }
            ],
            "description": "Proposed canary rollout policy. Mutually exclusive with traffic_percent."
          },
          "workflows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowSpec"
            },
            "description": "Workflow declarations that the deployment would persist."
          }
        }
      },
      "DiffAppConfigPatch": {
        "description": "Per-app scalar patch. Pointer-aware: nil = \"don't touch\";\nexplicit zero / explicit value = \"set to this\". Matches\n[UpdateAppRequest] semantics but exposes only the fields\nthe engine computes against (no PublicAuth /\nOverflowNode).\n",
        "type": "object",
        "properties": {
          "ram_mb": {
            "type": "integer",
            "minimum": 128,
            "maximum": 10240
          },
          "vcpu": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4
          },
          "cpu_millicores": {
            "type": "integer",
            "enum": [
              250,
              500,
              1000
            ]
          },
          "idle_timeout_s": {
            "type": "integer",
            "minimum": 30,
            "maximum": 600
          },
          "max_concurrency": {
            "type": "integer",
            "minimum": 1,
            "maximum": 200
          },
          "min_instances": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10
          },
          "egress_allowlist": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "autoscale_target_rps": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000
          },
          "autoscale_target_cpu_pct": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "streaming_enabled": {
            "type": "boolean"
          },
          "websocket_enabled": {
            "type": "boolean"
          },
          "require_signed": {
            "type": "boolean"
          },
          "warm_snapshot_enabled": {
            "type": "boolean"
          },
          "require_authn": {
            "type": "boolean"
          },
          "eviction_priority": {
            "type": "string",
            "enum": [
              "normal",
              "batch",
              "latency"
            ]
          },
          "app_protocol": {
            "description": "Per-app wire-protocol selector. Same closed set + plan gate as UpdateAppRequest.app_protocol. Pointer-aware: omitted → no change; non-null → set to this value.",
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "http1",
              "http2",
              "grpc"
            ],
            "example": "http1"
          },
          "execution_mode": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "request",
              "service",
              "worker",
              "job"
            ],
            "description": "Lifecycle mode. Omitted → no change; worker runs as a long-lived non-HTTP workload."
          },
          "restart_policy": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "no",
              "on-failure",
              "always",
              "unless-stopped"
            ],
            "description": "Supervisor restart policy. Omitted → no change."
          },
          "startup_deadline_s": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "description": "Maximum startup deadline in seconds; zero inherits the plan default."
          },
          "max_retries": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "description": "Maximum lifecycle restart attempts; zero inherits the plan default."
          },
          "request_timeout_s": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 30,
            "description": "Per-app request wall-clock timeout in seconds; zero inherits the plan/type default."
          },
          "service_replicas": {
            "type": [
              "object",
              "null"
            ],
            "description": "Replica policy for service mode.",
            "properties": {
              "min": {
                "type": "integer",
                "minimum": 0
              },
              "max": {
                "type": "integer",
                "minimum": 0
              },
              "desired": {
                "type": "integer",
                "minimum": 0
              }
            }
          },
          "scaling_policy": {
            "description": "Per-app scaling policy. Omitted → no change. Non-null → atomic full-overwrite of the app scaling policy.",
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ScalingPolicy"
              }
            ]
          }
        }
      },
      "DiffEnvRow": {
        "description": "One would-write env var. Value carries plaintext so the\nquota gate's per-value byte cap can fire (the wire's list\npath never echoes values 4).\n",
        "type": "object",
        "required": [
          "key",
          "value"
        ],
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[A-Z][A-Z0-9_]*$",
            "maxLength": 64
          },
          "value": {
            "type": "string",
            "maxLength": 8192
          }
        }
      },
      "DiffChange": {
        "description": "One diff row. Polymorphic values (Before / After) re-emitted\nas JSON objects — the engine emits primitives, slices, or\nstructs depending on the field.\n",
        "type": "object",
        "required": [
          "field",
          "kind"
        ],
        "properties": {
          "field": {
            "type": "string",
            "description": "Human path: 'memory', 'concurrency', 'environment.<scope>.<key>', 'cron[<schedule> <path>]', 'edge_rule[<kind> <host><path>]'"
          },
          "kind": {
            "type": "string",
            "enum": [
              "add",
              "remove",
              "modify"
            ]
          },
          "before": {
            "description": "Primitive value (int / string / bool / []string) — JSON-encoded. Omitted on Add."
          },
          "after": {
            "description": "Primitive value — JSON-encoded. Omitted on Remove."
          }
        }
      },
      "DiffBreak": {
        "description": "One would-ship-a-problem row. Stable RFC 7807 code\n(matches [api.Code*] constants) so the CLI error renders\nidentically to what a real deploy would say.\n",
        "type": "object",
        "required": [
          "code",
          "severity",
          "reason"
        ],
        "properties": {
          "code": {
            "type": "string",
            "description": "Stable RFC 7807 code; matches api.Code* constants"
          },
          "severity": {
            "type": "string",
            "enum": [
              "error",
              "warn"
            ]
          },
          "reason": {
            "type": "string"
          },
          "field": {
            "type": "string",
            "description": "Optional scope-wide ('memory') or per-row ('environment.<scope>.<key>')."
          },
          "observed": {
            "description": "JSON-encoded observed value (int / string / []string / …)."
          },
          "limit": {
            "description": "JSON-encoded limit value."
          }
        }
      },
      "DiffPayload": {
        "description": "Inner diff object the engine produces. Slug + Plan +\nChanges + Breaks. Wrapped by [DiffResponse] so a CI\nconsumer reading `.diff.changes` and a CLI consumer\nreading the top-level keys agree.\n",
        "type": "object",
        "required": [
          "slug",
          "changes",
          "breaks"
        ],
        "properties": {
          "slug": {
            "type": "string"
          },
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "hobby",
              "pro",
              "scale"
            ],
            "description": "Customer's subscription tier (echoed from acct.Plan)."
          },
          "changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DiffChange"
            }
          },
          "breaks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DiffBreak"
            }
          }
        }
      },
      "DiffResponse": {
        "description": "Wire envelope for POST /v1/apps/{slug}/diff and\n`gregale deploy --diff --json`. Wraps the [DiffPayload]\nplus the Blocking bit so a CI consumer doesn't have to\nre-scan Breaks and pick the max severity.\n",
        "type": "object",
        "required": [
          "diff",
          "blocking",
          "slug"
        ],
        "properties": {
          "diff": {
            "$ref": "#/components/schemas/DiffPayload"
          },
          "blocking": {
            "type": "boolean",
            "description": "True if any break has severity \"error\". The exit-1\ninput for CI gates.\n"
          },
          "slug": {
            "type": "string"
          },
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "hobby",
              "pro",
              "scale"
            ],
            "description": "Echoed at top level too — kept in sync with diff.plan."
          }
        }
      },
      "ProjectInitialSecrets": {
        "type": "object",
        "description": "Request-only mapping of exact selected workload names to initial sealed environment values. Values stay in memory until sealing and never enter responses or source caches.",
        "additionalProperties": {
          "type": "object",
          "additionalProperties": {
            "type": "string",
            "writeOnly": true
          }
        }
      },
      "MigrationDNSRecord": {
        "type": "object",
        "description": "Previous routing record at the production hostname. No URLs, credentials or TXT records.",
        "required": [
          "type",
          "value",
          "ttl"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "A",
              "AAAA",
              "CNAME"
            ]
          },
          "value": {
            "type": "string",
            "maxLength": 253
          },
          "ttl": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          }
        }
      },
      "CreateMigrationCutoverRequest": {
        "type": "object",
        "description": "Immutable production cutover plan. The stable ID reconciles lost responses. Preparation changes no traffic or domain bindings.",
        "required": [
          "id",
          "verification_id",
          "hostname",
          "previous_records",
          "previous_proxy_enabled",
          "max_5xx_rate_bps",
          "max_p95_ms"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "verification_id": {
            "type": "string",
            "format": "uuid"
          },
          "hostname": {
            "type": "string",
            "maxLength": 253
          },
          "previous_records": {
            "type": "array",
            "minItems": 1,
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/MigrationDNSRecord"
            }
          },
          "previous_proxy_enabled": {
            "type": "boolean"
          },
          "max_5xx_rate_bps": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 10000
          },
          "max_p95_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 86400000
          }
        }
      },
      "MigrationCutoverActionRequest": {
        "type": "object",
        "description": "Explicit user action. Restored records the customer attestation that provider DNS was restored; Gregale never edits external DNS.",
        "required": [
          "action",
          "acknowledge_limited_traffic"
        ],
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "start_checks",
              "complete",
              "cancel",
              "confirm_restored"
            ]
          },
          "acknowledge_limited_traffic": {
            "type": "boolean"
          }
        }
      },
      "MigrationCutoverTraffic": {
        "type": "object",
        "description": "Existing deployment and exact GET route observations after hostname proof. Aggregates are not hostname-specific and never prove every customer moved.",
        "required": [
          "status",
          "coverage",
          "reason",
          "requests",
          "server_errors"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "unknown",
              "healthy",
              "violated"
            ]
          },
          "coverage": {
            "type": "string",
            "enum": [
              "deployment_route_observed_only"
            ]
          },
          "reason": {
            "type": "string"
          },
          "requests": {
            "type": "integer",
            "format": "int64"
          },
          "server_errors": {
            "type": "integer",
            "format": "int64"
          },
          "worst_window_p95_ms": {
            "type": "number",
            "format": "double"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "MigrationCutover": {
        "type": "object",
        "description": "Saved plan, immutable recovery routing and bounded background cutover evidence. Ready means current DNS, trusted TLS and an exact-deployment gateway response passed; completion remains explicit.",
        "required": [
          "id",
          "app",
          "deployment_id",
          "configuration_revision",
          "smoke_path",
          "status",
          "request",
          "domain_connected",
          "dns_records",
          "checks",
          "traffic",
          "created_at",
          "limited_traffic_acknowledged"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "configuration_revision": {
            "type": "string"
          },
          "smoke_path": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "prepared",
              "checking",
              "ready",
              "attention",
              "completed",
              "cancelled",
              "restored",
              "blocked"
            ]
          },
          "reason": {
            "type": "string"
          },
          "request": {
            "$ref": "#/components/schemas/CreateMigrationCutoverRequest"
          },
          "domain_connected": {
            "type": "boolean"
          },
          "dns_records": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DNSRecordInstruction"
            }
          },
          "checks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MigrationVerificationCheck"
            }
          },
          "traffic": {
            "$ref": "#/components/schemas/MigrationCutoverTraffic"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "check_deadline": {
            "type": "string",
            "format": "date-time"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "hostname_verified_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          },
          "limited_traffic_acknowledged": {
            "type": "boolean"
          }
        }
      },
      "MigrationCutoverList": {
        "type": "object",
        "description": "Latest app-owned cutover plans, newest first. Up to twenty are retained; terminal plans may be pruned after ninety days.",
        "required": [
          "plans"
        ],
        "properties": {
          "plans": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/MigrationCutover"
            }
          }
        }
      },
      "ProjectServiceConnections": {
        "type": "object",
        "maxProperties": 10,
        "description": "Selected caller names mapped to variable-to-service choices. Targets must be selected declared HTTP or GraphQL dependencies. service_connections uses private runtime URLs; public_service_connections uses reviewed public build URLs.",
        "additionalProperties": {
          "type": "object",
          "maxProperties": 10,
          "additionalProperties": {
            "type": "string"
          }
        }
      },
      "ProjectPublicBuildURLs": {
        "type": "object",
        "maxProperties": 10,
        "description": "Explicit public HTTPS build URLs for selected services, persisted and exposed in frontend bundles. Keys use VITE_, NEXT_PUBLIC_, REACT_APP_, PUBLIC_, NUXT_PUBLIC_ or GATSBY_ and end in _URL. URLs may include a base path but no credentials, query, fragment, IP, localhost or private service name. Up to ten URLs per service. Omitted keys keep their existing runtime configuration.",
        "additionalProperties": {
          "type": "object",
          "maxProperties": 10,
          "additionalProperties": {
            "type": "string",
            "maxLength": 2048
          }
        }
      },
      "MigrationServiceConnectionCheck": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "env_key",
          "service",
          "deployment_id"
        ],
        "description": "Runtime variable and logical service pinned to an exact target deployment. The guest checks its private HTTPS value and authorized routing; no URLs or credentials are saved.",
        "properties": {
          "env_key": {
            "type": "string"
          },
          "service": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "MigrationDependencyChecks": {
        "type": "object",
        "description": "Existing scoped environment names; values are resolved only in the task guest.",
        "properties": {
          "postgres_env_key": {
            "type": "string",
            "description": "PostgreSQL connection string environment key for authenticated SELECT 1."
          },
          "object_storage_prefix": {
            "type": "string",
            "description": "Prefix for the existing six S3 binding variables; read-only listing."
          },
          "http_env_key": {
            "type": "string",
            "description": "Environment key containing an HTTPS external API URL for a bounded GET; redirects are rejected."
          },
          "service_connections": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/MigrationServiceConnectionCheck"
            }
          }
        }
      },
      "CreateMigrationVerificationRequest": {
        "type": "object",
        "description": "Immutable migration checks and explicit consent to park and wake the selected Gregale app.",
        "required": [
          "id",
          "deployment_id",
          "checks",
          "smoke_path",
          "cold_wake"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Stable caller-generated identity for creation recovery."
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "checks": {
            "$ref": "#/components/schemas/MigrationDependencyChecks"
          },
          "smoke_path": {
            "type": "string",
            "maxLength": 512,
            "description": "Read-only GET path on this app; no query, fragment or absolute URL. A successful 2xx response is required."
          },
          "cold_wake": {
            "type": "boolean",
            "description": "Explicitly park this Gregale app and verify a correlated wake followed by repeated checks."
          }
        }
      },
      "MigrationVerificationCheck": {
        "type": "object",
        "description": "Sanitized verification verdict; excludes credentials, URLs, response headers and bodies.",
        "required": [
          "name",
          "status",
          "detail"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "passed",
              "failed",
              "pending"
            ]
          },
          "detail": {
            "type": "string"
          }
        }
      },
      "MigrationVerification": {
        "type": "object",
        "description": "Durable migration report tied to a deployment, configuration revision and optional cold-wake evidence.",
        "required": [
          "id",
          "app",
          "deployment_id",
          "scope",
          "configuration_revision",
          "status",
          "phase",
          "request",
          "checks",
          "created_at",
          "expires_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "configuration_revision": {
            "type": "string",
            "description": "Opaque fingerprint of deployment and scoped runtime configuration."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "passed",
              "failed",
              "blocked",
              "expired",
              "cancelled"
            ]
          },
          "phase": {
            "type": "string",
            "enum": [
              "dependencies",
              "startup",
              "park",
              "drain",
              "wake",
              "waking",
              "cold_smoke",
              "cold_dependencies",
              "restoring",
              "complete"
            ]
          },
          "reason": {
            "type": "string"
          },
          "request": {
            "$ref": "#/components/schemas/CreateMigrationVerificationRequest"
          },
          "checks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MigrationVerificationCheck"
            }
          },
          "dependency_task_id": {
            "type": "string",
            "format": "uuid"
          },
          "cold_dependency_task_id": {
            "type": "string",
            "format": "uuid"
          },
          "wake_id": {
            "type": "string",
            "format": "uuid"
          },
          "instance_id": {
            "type": "string",
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "drained_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          },
          "cancel_requested_at": {
            "type": "string",
            "format": "date-time",
            "description": "Durable cancellation intent; pending status includes task shutdown and service recovery."
          },
          "recovery_status": {
            "type": "string",
            "enum": [
              "pending",
              "restored",
              "superseded",
              "blocked"
            ],
            "description": "Restoration outcome after interrupted verification. Restored requires a running instance; superseded leaves the new deployment alone; blocked requires resolving an account or security restriction."
          }
        }
      },
      "MigrationVerificationList": {
        "type": "object",
        "description": "Latest saved migration reports for the authorized app.",
        "required": [
          "runs"
        ],
        "properties": {
          "runs": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/MigrationVerification"
            }
          }
        }
      },
      "ApplyCachedProjectPlanRequest": {
        "type": "object",
        "description": "Applies an account-owned reviewed project archive with selected workloads and optional initial sealed configuration.",
        "required": [
          "plan_token"
        ],
        "properties": {
          "plan_token": {
            "type": "string",
            "minLength": 1
          },
          "only": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Selected workload names; unselected existing workloads remain unchanged."
          },
          "exclude": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "approval_token": {
            "type": "string"
          },
          "initial_secrets": {
            "$ref": "#/components/schemas/ProjectInitialSecrets"
          }
        }
      },
      "ProjectApplyRequest": {
        "description": "Multipart body for POST /v1/projects (apply). Same shape as\nProjectScanRequest; the apply handler resolves AppIDs and\ninserts crons in a follow-up pass.\n",
        "type": "object",
        "required": [
          "source"
        ],
        "properties": {
          "release_config": {
            "type": "string",
            "description": "Planned non-secret workload variables encoded as ProjectReleaseConfigRequest JSON for atomic-config-verify admission."
          },
          "migration": {
            "type": "boolean",
            "default": false,
            "description": "Apply the reviewed migration naming mode, preserving repository service identities and project-prefixed app allocations. Automatic triggers and repository push bindings must be disabled."
          },
          "app_slugs": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Reviewed repository service-to-app allocations for this apply. Preserve existing project app names and repeat the exact selected names from review; multipart clients encode this object as JSON."
          },
          "source": {
            "type": "string",
            "format": "binary"
          },
          "project_slug": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          },
          "repo_full_name": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$"
          },
          "production_branch": {
            "type": "string"
          },
          "install_id": {
            "type": "integer",
            "format": "int64"
          },
          "only": {
            "type": "string"
          },
          "environment": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,31}[a-z0-9])?$",
            "description": "Environment slug applied to deployments created by this apply"
          },
          "secrets": {
            "type": "string",
            "writeOnly": true,
            "description": "JSON object of secret names to plaintext values, sealed for every selected workload in the deployment environment before any build is queued. Requires secrets:write or admin in addition to deploy permission. Uses the existing plan secret count/value quotas; never included in source or responses. Failed configuration queues no builds; already applied configuration remains available for retry."
          },
          "approval_token": {
            "type": "string",
            "description": "Short-lived approval credential for the exact protected-environment plan"
          },
          "no_triggers": {
            "type": "boolean",
            "default": false,
            "description": "Leave trigger and async-route declarations and existing project trigger/route state unchanged for this apply."
          },
          "platform_tenant_required": {
            "type": "boolean",
            "description": "Override the customer identity policy for selected workloads (Hobby and above). Must match the scan override. Omitted uses Compose declarations and preserves existing app policy."
          },
          "initial_secrets": {
            "$ref": "#/components/schemas/ProjectInitialSecrets"
          }
        }
      },
      "ComposeHealthcheck": {
        "type": "object",
        "description": "Partial Compose override for a prebuilt image HEALTHCHECK. Empty test and zero timing/retry values inherit image settings. NONE disables the check. Durations retain nanosecond precision; positive durations must be at least 1ms.",
        "properties": {
          "test": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "CMD followed by argv, CMD-SHELL followed by one command, or NONE."
          },
          "interval_ns": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "timeout_ns": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "start_period_ns": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "start_interval_ns": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "retries": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "ComposeProcess": {
        "type": "object",
        "description": "Compose process overrides for a prebuilt image. Omitted fields inherit the image's ENTRYPOINT, USER, WORKDIR and stop settings.",
        "properties": {
          "entrypoint": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Replaces the image ENTRYPOINT and drops its CMD; the Compose command supplies the arguments. An empty array clears the ENTRYPOINT."
          },
          "user": {
            "type": "string",
            "description": "User name or id, optionally with :group, resolved against the image's /etc/passwd and /etc/group."
          },
          "working_dir": {
            "type": "string",
            "description": "Clean absolute working directory."
          },
          "stop_signal": {
            "type": "string",
            "enum": [
              "SIGTERM",
              "SIGINT",
              "SIGQUIT",
              "SIGHUP",
              "SIGUSR1",
              "SIGUSR2"
            ]
          },
          "stop_grace_period_s": {
            "type": "integer",
            "minimum": 1,
            "description": "Seconds between the stop signal and SIGKILL, capped by the plan."
          }
        }
      },
      "SecretFile": {
        "type": "object",
        "description": "An app secret guest-init writes to /run/secrets/<name> in the main workload, from a Compose service's secrets. Names the secret; its value is never returned.",
        "required": [
          "secret",
          "name"
        ],
        "properties": {
          "secret": {
            "type": "string",
            "description": "App secret whose value the file holds."
          },
          "name": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$",
            "description": "File name in /run/secrets."
          },
          "mode": {
            "type": "integer",
            "minimum": 0,
            "maximum": 511,
            "description": "Permission bits; omitted means 0444."
          }
        }
      },
      "ComposeResources": {
        "type": "object",
        "description": "A Compose service's deploy.replicas and deploy.resources.limits, converted to app settings. Omitted fields are undeclared and keep the app's own settings.",
        "properties": {
          "replicas": {
            "type": "integer",
            "minimum": 1,
            "description": "Caps a request-mode app's instances (max_concurrency) and fixes a worker's or service's replica count."
          },
          "memory_mb": {
            "type": "integer",
            "minimum": 1,
            "description": "App RAM in MB, rounded up from the declared size."
          },
          "cpu_millicores": {
            "type": "integer",
            "enum": [
              250,
              500,
              1000
            ],
            "description": "App CPU share."
          }
        }
      },
      "PlanWorkload": {
        "description": "One discovered unit of work. Mirrors reposcan.Workload.",
        "type": "object",
        "required": [
          "name",
          "root_dir",
          "command",
          "ports"
        ],
        "properties": {
          "public_url": {
            "type": "string",
            "description": "Reviewed public HTTPS base URL derived from this app allocation and installation domain. Absent when wildcard app URLs are disabled."
          },
          "public_auth_mode": {
            "type": "string",
            "description": "Public URL auth the app will have after apply (bearer, basic, ...), from the existing app or the plan default for a new app. Omitted when the URL accepts anonymous requests."
          },
          "app_slug": {
            "type": "string",
            "description": "Reviewed Gregale app name. Repository name, dependencies and configuration keys retain their original identity. Present for migration scans, existing allocations, and new workloads whose name cannot be a slug, which get the project-prefixed name."
          },
          "name": {
            "type": "string",
            "example": "api"
          },
          "platform_tenant_required": {
            "type": "boolean",
            "description": "Requested customer identity policy from Compose x-gregale-platform-tenant-required or the request override. Omitted preserves existing app policy; new apps default to false."
          },
          "visibility": {
            "type": "string",
            "enum": [
              "internal"
            ],
            "description": "Present when the app is or will be internal (no public route): an existing internal app, or a new Compose service without `ports:`. Omitted means public."
          },
          "root_dir": {
            "type": "string",
            "example": "",
            "description": "Effective build context inside the uploaded repository archive. Workspace manifests and sibling packages remain available outside this directory."
          },
          "dockerfile": {
            "type": "string",
            "example": "Dockerfile"
          },
          "image": {
            "type": "string",
            "description": "Normalized prebuilt OCI image for a workload without build. Tags are resolved and pinned by the image worker before materialization; stateful images remain managed requirements. Image deployments return a deployment_id without a build_id.",
            "example": "docker.io/library/nginx:1.27"
          },
          "image_healthcheck": {
            "$ref": "#/components/schemas/ComposeHealthcheck",
            "description": "Compose healthcheck override for prebuilt image workloads, captured per deployment."
          },
          "image_process": {
            "$ref": "#/components/schemas/ComposeProcess",
            "description": "Compose entrypoint, user, working_dir and stop overrides for prebuilt image workloads, captured per deployment."
          },
          "build_target": {
            "type": "string",
            "description": "Dockerfile stage a source-built Compose service builds (build.target). Omitted builds the final stage."
          },
          "build_args": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Names of the Compose build.args passed to the Dockerfile build, sorted. Values are not returned."
          },
          "go_command": {
            "type": "string",
            "example": "api",
            "description": "The cmd/<name> main package this service builds from the root of a Go module with several commands."
          },
          "secret_files": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SecretFile"
            },
            "description": "Compose secrets written to /run/secrets."
          },
          "resources": {
            "$ref": "#/components/schemas/ComposeResources"
          },
          "command": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "depends_on": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Compose service dependencies. The apply path validates the graph, deploys in dependency order, and injects GREGALE_SERVICE_<NAME>_URL plus GREGALE_SERVICE_<NAME>_HTTPS_URL for workload dependencies."
          },
          "depends_on_conditions": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "enum": [
                "service_started",
                "service_healthy"
              ]
            },
            "description": "Explicit Compose dependency conditions. service_started retains admission ordering; service_healthy gates release on the captured same-project, same-environment dependency deployment."
          },
          "service_binding_policy": {
            "$ref": "#/components/schemas/ServiceBindingPolicy",
            "description": "Effective policy selected by Compose `x-gregale-service-policy` (`project`, `declared` or `account`). New project workloads default to `project`; existing workloads retain their persisted policy when the extension is omitted."
          },
          "service_reliability": {
            "$ref": "#/components/schemas/ServiceReliabilityPolicies",
            "description": "Dependency-specific policy selected by Compose `x-gregale-service-reliability`."
          },
          "service_binding_transport": {
            "$ref": "#/components/schemas/ServiceBindingTransport",
            "description": "Canonical URL transport selected by Compose `x-gregale-service-transport`. Omitted preserves the established transport; new workloads default to `http`."
          },
          "preview_service_calls_policy": {
            "$ref": "#/components/schemas/PreviewServiceCallsPolicy",
            "description": "Effective policy selected by the Compose `x-gregale-preview-calls` extension. Defaults to `allow`."
          },
          "allowed_service_callers": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Target-side service allowlist from Compose `x-gregale-allow-callers`. Omitted permits same-account callers; an empty array denies all."
          },
          "allowed_service_call_scopes": {
            "$ref": "#/components/schemas/ServiceCallerScopes",
            "description": "Target-side method/path grants from Compose `x-gregale-allow-call-scopes`. When present, callers missing from the map are denied."
          },
          "class": {
            "type": "string",
            "enum": [
              "http",
              "graphql",
              "grpc",
              "job",
              "worker",
              "server",
              "unknown"
            ]
          },
          "schedule": {
            "type": "string",
            "description": "cron expression when declared (CronJob, render, serverless)"
          },
          "ports": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "env_keys": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "KEYS only — never values; forbids logging secrets"
          },
          "required_env_keys": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Explicit names from .gregale/required-secrets.json. Detected env_keys alone do not establish requirements."
          },
          "unset_env_keys": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Names from env_keys and required_env_keys that will have no value in the selected environment: not configured on the app and not provided by the platform. Names only, never values."
          },
          "unset_env_key_reasons": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "enum": [
                "not_opted_in",
                "secret",
                "service_address",
                "local_address",
                "interpolated",
                "host_value",
                "empty",
                "invalid"
              ]
            },
            "description": "For an unset_env_keys name with a Compose value, why that value is not imported. Never values."
          },
          "imported_env_keys": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Compose environment names whose plain values apply will write, because the project sets x-gregale-env-import: true and they are unset. Names only."
          },
          "source": {
            "type": "string",
            "description": "detector provenance, e.g. compose.yaml: api"
          },
          "tier": {
            "type": "string",
            "enum": [
              "single",
              "convention",
              "workspace",
              "compose",
              "unknown"
            ]
          },
          "action": {
            "type": "string",
            "description": "Blast-radius projection. create = workload is new to the account; update = existing app matches (root_dir, name).",
            "enum": [
              "create",
              "update"
            ]
          },
          "existing_app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "description": "App row ID the update targets. Empty iff action == create."
          },
          "detected_by": {
            "$ref": "#/components/schemas/PlanDetectedBy"
          }
        }
      },
      "PlanDetectedBy": {
        "description": "Structured detection trace for one workload.\n`source` on PlanWorkload carries the same provenance as free\ntext (\"compose.yaml: api\"); this is the machine-readable form\nso a client can branch on the detector without parsing it.\n\nAdditive and optional: absent on any response the server did\nnot populate, so existing consumers are unaffected.\n",
        "type": "object",
        "required": [
          "detector",
          "marker",
          "priority"
        ],
        "properties": {
          "detector": {
            "type": "string",
            "description": "closed vocabulary — the detector that won identity for this workload",
            "enum": [
              "compose",
              "procfile",
              "k8s",
              "render",
              "fly",
              "serverless",
              "app_yaml",
              "functions",
              "other"
            ],
            "example": "compose"
          },
          "marker": {
            "type": "string",
            "description": "Concrete source marker for the winning detector, such as compose.yaml or Procfile; excludes the workload name.",
            "example": "compose.yaml"
          },
          "priority": {
            "type": "integer",
            "description": "The detector's tiebreak weight; higher wins identity\nwithin a tier. Surfaced so the precedence order is visible\non the wire rather than implied by server source.\n",
            "example": 80
          },
          "merged_from": {
            "type": "array",
            "description": "Other detectors whose seeds collapsed into this workload\nunder the (root_dir, name) merge key, deduplicated and\ndeterministically ordered. Absent when the workload came\nfrom a single seed. Answers \"why didn't my Procfile `web`\nget its own workload?\" — it merged into the compose `web`.\n",
            "items": {
              "type": "string",
              "enum": [
                "compose",
                "procfile",
                "k8s",
                "render",
                "fly",
                "serverless",
                "app_yaml",
                "functions",
                "other"
              ]
            },
            "example": [
              "procfile"
            ]
          }
        }
      },
      "PlanDetectionWarning": {
        "description": "One detector decision that did not become a standalone workload. Outcome is merged when the candidate collapsed into\nthe winning workload, or skipped when the detector rejected it.\nThe legacy warnings string list remains available for compatibility.\n",
        "type": "object",
        "required": [
          "detector",
          "marker",
          "priority",
          "outcome",
          "reason"
        ],
        "properties": {
          "workload": {
            "type": "string",
            "description": "Workload affected by the decision; omitted for source-wide warnings."
          },
          "detector": {
            "type": "string",
            "enum": [
              "compose",
              "procfile",
              "k8s",
              "render",
              "fly",
              "serverless",
              "app_yaml",
              "functions",
              "other"
            ]
          },
          "marker": {
            "type": "string",
            "description": "Concrete source marker associated with the detector decision."
          },
          "priority": {
            "type": "integer",
            "description": "Detector priority used by the merge tiebreak."
          },
          "outcome": {
            "type": "string",
            "enum": [
              "merged",
              "skipped"
            ]
          },
          "reason": {
            "type": "string",
            "description": "Stable human-readable reason for the detector decision."
          }
        }
      },
      "PlanManaged": {
        "description": "A service the repo declared (compose image:, render.yaml, etc.)\nbut the platform will NOT provision. Surfaced so the customer\nsees them in the plan and reads a learnable env hint instead of\na runtime 422 (two-drive FROM-base contract).\n",
        "type": "object",
        "required": [
          "name",
          "kind",
          "env_hint",
          "source",
          "image"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "example": "postgres"
          },
          "env_hint": {
            "type": "string",
            "example": "DATABASE_URL"
          },
          "source": {
            "type": "string"
          },
          "image": {
            "type": "string"
          },
          "provision": {
            "$ref": "#/components/schemas/PlanManagedProvision"
          },
          "not_provisioned_reason": {
            "type": "string",
            "enum": [
              "unavailable",
              "plan",
              "quota",
              "unsupported",
              "configured",
              "not_referenced",
              "permission"
            ],
            "description": "Why apply does not provide a Compose postgres service. Omitted for other datastores and when provision is set."
          },
          "unbound": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "api.REDIS_URL"
            ],
            "description": "Selected services' keys that point at this datastore and will have no value, as service.KEY. Omitted when none."
          }
        }
      },
      "PlanManagedProvision": {
        "description": "The managed PostgreSQL database a project apply creates or reuses for a Compose postgres service, and the service keys it binds.",
        "type": "object",
        "required": [
          "database",
          "bindings"
        ],
        "properties": {
          "database": {
            "type": "string",
            "example": "shop-db"
          },
          "existing": {
            "type": "boolean",
            "description": "True when a database with this name already exists and is reused."
          },
          "postgres_major": {
            "type": "integer",
            "example": 17,
            "description": "The database's PostgreSQL major: the Compose image's, or the nearest newer one the platform offers."
          },
          "bindings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlanManagedBinding"
            }
          }
        }
      },
      "PlanManagedBinding": {
        "description": "One service key bound to the database a project apply provides.",
        "type": "object",
        "required": [
          "workload",
          "env_key"
        ],
        "properties": {
          "workload": {
            "type": "string"
          },
          "env_key": {
            "type": "string",
            "example": "DATABASE_URL"
          }
        }
      },
      "PlanAffectedApp": {
        "description": "One row of the blast-radius partition. action is closed-\nvocabulary:\n  create — scan workload, no existing app row matches (root_dir, name).\n  update — scan workload, existing app matches.\n  remove — existing app, no scan workload, not protected by --exclude.\n  noop — operator excluded via --exclude, or no scan change.\nid is empty for action == create. existing_root_dir is populated\nonly when the existing app's root_dir differs from the scan root_dir\n(monorepo collision surface).\n",
        "type": "object",
        "required": [
          "slug",
          "action"
        ],
        "properties": {
          "slug": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "action": {
            "type": "string",
            "enum": [
              "create",
              "update",
              "remove",
              "noop"
            ]
          },
          "existing_root_dir": {
            "type": "string",
            "description": "RootDir of the existing app row. Empty for create. Populated only when it differs from the scan-time RootDir."
          }
        }
      },
      "PlanCron": {
        "description": "A cron expression lifted from a workload (k8s CronJob, render.yaml, serverless.yml).",
        "type": "object",
        "required": [
          "workload_name",
          "schedule",
          "path",
          "enabled"
        ],
        "properties": {
          "workload_name": {
            "type": "string",
            "example": "nightly"
          },
          "schedule": {
            "type": "string",
            "example": "0 3 * * *"
          },
          "path": {
            "type": "string",
            "example": "/"
          },
          "enabled": {
            "type": "boolean"
          }
        }
      },
      "PlanAsyncRoute": {
        "description": "One manifest-owned async-route reconciliation row in a project deployment plan. Route fields describe the planned route, or the existing route for a removal.",
        "type": "object",
        "required": [
          "app",
          "name",
          "action",
          "match_host",
          "match_path",
          "match_methods",
          "priority",
          "enabled"
        ],
        "properties": {
          "app": {
            "type": "string",
            "description": "Workload or app slug that owns the route"
          },
          "name": {
            "type": "string",
            "description": "Stable async-route identity within the app"
          },
          "action": {
            "type": "string",
            "enum": [
              "create",
              "update",
              "remove",
              "unchanged",
              "skipped"
            ],
            "description": "Reconciliation result; skipped means selection flags or --no-triggers leave this route untouched."
          },
          "match_host": {
            "type": "string"
          },
          "match_path": {
            "type": "string"
          },
          "match_methods": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "priority": {
            "type": "integer"
          },
          "enabled": {
            "type": "boolean"
          },
          "on_success": {
            "type": "string",
            "description": "App webhook destination for successful executions"
          },
          "on_failure": {
            "type": "string",
            "description": "App webhook destination for failed executions"
          },
          "retry_policy": {
            "$ref": "#/components/schemas/RetryPolicyDTO"
          },
          "max_age_seconds": {
            "type": "integer",
            "minimum": 0
          },
          "reason": {
            "type": "string",
            "description": "Why this route is skipped, or what reconciliation does"
          }
        }
      },
      "QuotaBlock": {
        "description": "Limit + observed extension on a plan-quota problem. Mirrors\napi.Problem.WithLimit; emitted alongside any 402/403 quota\nresponse so the CLI can render \"X/Y apps\" without a second\nrequest.\n",
        "type": "object",
        "properties": {
          "limit": {
            "type": "integer",
            "format": "int64"
          },
          "observed": {
            "type": "integer",
            "format": "int64"
          },
          "docs_url": {
            "type": "string"
          }
        }
      },
      "PlanResponse": {
        "description": "Dry-run scan response.",
        "type": "object",
        "required": [
          "project_slug",
          "scan_source",
          "tier",
          "workloads",
          "managed",
          "crons",
          "observed_apps",
          "observed_crons",
          "limit_apps",
          "limit_crons",
          "can_apply",
          "plan_token"
        ],
        "properties": {
          "safe_release": {
            "$ref": "#/components/schemas/ProjectSafeRelease"
          },
          "project_slug": {
            "type": "string"
          },
          "repo_full_name": {
            "type": "string"
          },
          "environment": {
            "type": "string",
            "description": "Registered project environment targeted by this plan"
          },
          "environment_protected": {
            "type": "boolean",
            "description": "Whether applying this plan requires protected-environment approval"
          },
          "environment_config_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Hash of the non-secret environment configuration bound into this plan"
          },
          "scan_source": {
            "type": "string",
            "enum": [
              "compose",
              "procfile",
              "k8s",
              "render",
              "fly",
              "serverless",
              "workspace",
              "convention",
              "single",
              "unknown",
              "functions"
            ]
          },
          "tier": {
            "type": "string"
          },
          "workloads": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlanWorkload"
            }
          },
          "managed": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlanManaged"
            }
          },
          "crons": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlanCron"
            }
          },
          "async_routes": {
            "type": "array",
            "description": "Structured diff for manifest-owned async routes; omitted when the manifest does not declare async_routes or no route actions need to be shown.",
            "items": {
              "$ref": "#/components/schemas/PlanAsyncRoute"
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "detection_warnings": {
            "type": "array",
            "description": "Structured skipped/merged detector decisions available to explain-mode clients.",
            "items": {
              "$ref": "#/components/schemas/PlanDetectionWarning"
            }
          },
          "observed_apps": {
            "type": "integer"
          },
          "observed_crons": {
            "type": "integer"
          },
          "limit_apps": {
            "type": "integer"
          },
          "limit_crons": {
            "type": "integer"
          },
          "can_apply": {
            "type": "boolean"
          },
          "crons_not_allowed": {
            "type": "boolean"
          },
          "plan_token": {
            "type": "string",
            "description": "base64-JSON plan token; pass back as ?plan_token= on /v1/projects to skip the second extract."
          },
          "can_apply_pre_exclude": {
            "type": "boolean"
          },
          "gate_rescued_by_exclude": {
            "type": "boolean"
          },
          "can_apply_reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "will_deploy": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlanAffectedApp"
            }
          },
          "unaffected": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlanAffectedApp"
            }
          },
          "skipped": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlanAffectedApp"
            }
          },
          "removed": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "Slugs the apply path will SoftDeleteAppCascade."
            }
          },
          "persisted_exclusions": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "Lowercase slug carried forward from a previous --persist-exclude deploy."
            }
          },
          "stale_persisted_exclusions": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "Persisted slug no longer in the repo; ignored this deploy. Run `gregale deployments exclude clear --slug=...` to drop."
            }
          }
        }
      },
      "ProjectSafeRelease": {
        "type": "object",
        "description": "Server-owned safe project release checkpoint. Activation occurs only after all zero-traffic candidates complete readiness.",
        "required": [
          "status",
          "previous_release_id",
          "ttl_seconds",
          "deadline"
        ],
        "properties": {
          "add_services": {
            "type": "boolean",
            "description": "Explicit opt-in to reserve new HTTP source services."
          },
          "additions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectReleaseAddition"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "building",
              "activated",
              "failed",
              "conflicted",
              "verifying",
              "succeeded",
              "rolling_back",
              "rolled_back",
              "rollback_failed"
            ]
          },
          "previous_release_id": {
            "type": "string"
          },
          "release_id": {
            "type": "string"
          },
          "ttl_seconds": {
            "type": "integer"
          },
          "deadline": {
            "type": "string",
            "format": "date-time"
          },
          "message": {
            "type": "string"
          },
          "verification": {
            "$ref": "#/components/schemas/ProjectReleaseVerification"
          },
          "configuration": {
            "$ref": "#/components/schemas/ProjectReleaseConfiguration"
          },
          "release_command": {
            "$ref": "#/components/schemas/ProjectReleaseCommand"
          },
          "worker": {
            "$ref": "#/components/schemas/ProjectReleaseWorker"
          },
          "restored_release_id": {
            "type": "string"
          }
        }
      },
      "ProjectReleaseAddition": {
        "type": "object",
        "description": "Source-owned settings bound by the plan. app_id is assigned during durable reservation.",
        "required": [
          "slug",
          "root_dir",
          "fingerprint"
        ],
        "properties": {
          "app_id": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "root_dir": {
            "type": "string"
          },
          "fingerprint": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        }
      },
      "ProjectReleaseWorker": {
        "type": "object",
        "description": "One graph-owned production push worker, its immutable binding intent and runtime admission evidence.",
        "required": [
          "app_id",
          "slug",
          "binding_id",
          "binding_hash",
          "previous_deployment_id",
          "drain_seconds",
          "status"
        ],
        "properties": {
          "app_id": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "binding_id": {
            "type": "string"
          },
          "binding_hash": {
            "type": "string"
          },
          "previous_deployment_id": {
            "type": "string"
          },
          "drain_seconds": {
            "type": "integer"
          },
          "status": {
            "type": "string",
            "enum": [
              "building",
              "ready",
              "active",
              "restored",
              "failed",
              "conflicted"
            ]
          },
          "deployment_id": {
            "type": "string"
          },
          "instance_id": {
            "type": "string"
          }
        }
      },
      "ProjectReleaseCommand": {
        "type": "object",
        "description": "Planned backward-compatible migration identity and durable task outcome. Task logs remain on the app-task resource.",
        "required": [
          "app_id",
          "slug",
          "command_hash",
          "compatibility",
          "status"
        ],
        "properties": {
          "app_id": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "command_hash": {
            "type": "string"
          },
          "compatibility": {
            "type": "string",
            "enum": [
              "backward-compatible"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "waiting",
              "queued",
              "restoring",
              "running",
              "succeeded",
              "failed",
              "timed_out",
              "cancelled",
              "uncertain"
            ]
          },
          "task_id": {
            "type": "string"
          },
          "exit_code": {
            "type": "integer"
          },
          "failure_code": {
            "type": "string"
          },
          "verify_baseline": {
            "type": "boolean",
            "description": "Require attributed production baseline probes after migration and before publication."
          },
          "baseline_verification": {
            "$ref": "#/components/schemas/ProjectMigrationBaselineVerification"
          },
          "contract_command_hash": {
            "type": "string",
            "description": "Immutable hash of the source-declared cleanup command."
          },
          "contract": {
            "$ref": "#/components/schemas/ProjectMigrationContract"
          }
        }
      },
      "ProjectMigrationContract": {
        "type": "object",
        "description": "Guarded schema cleanup admission and durable task result. Cleanup command and task logs remain private to their existing resources.",
        "required": [
          "status",
          "retired_deployments"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ready",
              "blocked",
              "queued",
              "restoring",
              "running",
              "succeeded",
              "failed",
              "timed_out",
              "cancelled",
              "uncertain",
              "unknown"
            ]
          },
          "reason": {
            "type": "string"
          },
          "request_id": {
            "type": "string"
          },
          "expected_generation": {
            "type": "integer",
            "format": "int64"
          },
          "task_id": {
            "type": "string"
          },
          "retired_deployments": {
            "type": "integer",
            "minimum": 0
          },
          "exit_code": {
            "type": "integer"
          },
          "failure_code": {
            "type": "string"
          },
          "recovery": {
            "$ref": "#/components/schemas/ProjectMigrationRecovery"
          }
        }
      },
      "ProjectMigrationRecoveryRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Operator attestation after database inspection and cleanup execution quiescence, bound to a different verified active replacement. This request records recovery and retires drained old code; it does not execute SQL or replay cleanup.",
        "required": [
          "request_id",
          "expected_task_id",
          "expected_generation",
          "replacement_attempt_id",
          "database_state_checked",
          "execution_quiescent",
          "evidence_hash"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "expected_task_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "replacement_attempt_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "database_state_checked": {
            "type": "boolean",
            "description": "Operator must attest that database state was inspected and repaired."
          },
          "execution_quiescent": {
            "type": "boolean",
            "description": "Operator must confirm the original cleanup execution has stopped."
          },
          "evidence_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        }
      },
      "ProjectMigrationRecovery": {
        "type": "object",
        "description": "Durable operator resolution and verified roll-forward identity. The cleanup outcome remains unchanged; database and execution checks are operator attestations.",
        "required": [
          "status"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "blocked",
              "needs_operator",
              "not_required",
              "resolved"
            ]
          },
          "reason": {
            "type": "string"
          },
          "request_id": {
            "type": "string"
          },
          "task_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_generation": {
            "type": "integer",
            "format": "int64"
          },
          "replacement_attempt_id": {
            "type": "string"
          },
          "replacement_release_id": {
            "type": "string",
            "format": "uuid"
          },
          "evidence_hash": {
            "type": "string"
          },
          "operator_account_id": {
            "type": "string",
            "format": "uuid"
          },
          "resolved_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ProjectMigrationBaselineVerification": {
        "type": "object",
        "description": "Durable post-expansion production probe checkpoint. Commands and database contents remain private.",
        "required": [
          "task_id",
          "release_id",
          "started_at",
          "checked_at",
          "status",
          "evidence"
        ],
        "properties": {
          "task_id": {
            "type": "string"
          },
          "release_id": {
            "type": "string"
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": [
              "healthy",
              "failed",
              "unknown"
            ]
          },
          "evidence": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectReleaseProbeEvidence"
            }
          }
        }
      },
      "ProjectReleaseSecretVersionMap": {
        "type": "object",
        "description": "Workload names mapped to complete secret name and immutable version ID snapshots; empty maps remove secrets from that candidate.",
        "additionalProperties": {
          "type": "object",
          "additionalProperties": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "ProjectReleaseSecretConfiguration": {
        "type": "object",
        "description": "Candidate and baseline immutable secret version references bound to an atomic release.",
        "additionalProperties": false,
        "required": [
          "versions",
          "previous_versions"
        ],
        "properties": {
          "versions": {
            "$ref": "#/components/schemas/ProjectReleaseSecretVersionMap"
          },
          "previous_versions": {
            "$ref": "#/components/schemas/ProjectReleaseSecretVersionMap"
          }
        }
      },
      "ProjectReleaseSecretStageRequest": {
        "type": "object",
        "description": "A bounded secret staging identity and complete private workload value sets.",
        "additionalProperties": false,
        "required": [
          "request_id",
          "workloads"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "workloads": {
            "type": "object",
            "description": "Complete proposed workload secret snapshots within shared document and per-plan value limits. Values are accepted over TLS and sealed before storage.",
            "additionalProperties": {
              "type": "object",
              "additionalProperties": {
                "type": "string",
                "minLength": 1,
                "writeOnly": true
              }
            }
          }
        }
      },
      "ProjectReleaseSecretStageResponse": {
        "type": "object",
        "description": "Stable staging identity and version references returned after encryption.",
        "additionalProperties": false,
        "required": [
          "request_id",
          "versions"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "versions": {
            "$ref": "#/components/schemas/ProjectReleaseSecretVersionMap"
          }
        }
      },
      "ProjectReleaseConfiguration": {
        "type": "object",
        "description": "Paired release configuration fingerprints and committed version identities; values remain private to server storage.",
        "required": [
          "previous_version",
          "previous_hash",
          "target_hash",
          "environment_hash"
        ],
        "properties": {
          "secrets": {
            "$ref": "#/components/schemas/ProjectReleaseSecretConfiguration"
          },
          "previous_version": {
            "type": "integer",
            "format": "int64"
          },
          "previous_hash": {
            "type": "string"
          },
          "target_hash": {
            "type": "string"
          },
          "environment_hash": {
            "type": "string"
          },
          "request_hash": {
            "type": "string"
          },
          "target_version": {
            "type": "integer",
            "format": "int64"
          },
          "restored_version": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "ProjectReleaseConfigRequest": {
        "type": "object",
        "description": "Complete variable sets and optional staged secret version references for selected workloads; omitted snapshots inherit prior release values.",
        "anyOf": [
          {
            "required": [
              "env"
            ]
          },
          {
            "required": [
              "secrets"
            ]
          }
        ],
        "additionalProperties": false,
        "properties": {
          "secrets": {
            "$ref": "#/components/schemas/ProjectReleaseSecretVersionMap"
          },
          "env": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          }
        }
      },
      "ProjectWorkerJobSample": {
        "type": "object",
        "description": "Attributed delivery attempts in a bounded window, including unknown unfinished deliveries.",
        "required": [
          "attempts",
          "failures",
          "incomplete",
          "duration_ms",
          "retries",
          "queue_delay_ms"
        ],
        "properties": {
          "attempts": {
            "type": "integer",
            "format": "int64"
          },
          "failures": {
            "type": "integer",
            "format": "int64"
          },
          "incomplete": {
            "type": "integer",
            "format": "int64"
          },
          "duration_ms": {
            "type": "integer",
            "format": "int64"
          },
          "retries": {
            "type": "integer",
            "format": "int64"
          },
          "queue_delay_ms": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "ProjectWorkerHealth": {
        "type": "object",
        "description": "Opt-in real production queue delivery verification; absence of traffic never proves health.",
        "required": [
          "status",
          "candidate",
          "baseline",
          "pending_jobs",
          "oldest_pending_age_ms",
          "baseline_pending_jobs",
          "baseline_oldest_pending_age_ms"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "insufficient_evidence",
              "healthy",
              "regressed"
            ]
          },
          "candidate": {
            "$ref": "#/components/schemas/ProjectWorkerJobSample"
          },
          "baseline": {
            "$ref": "#/components/schemas/ProjectWorkerJobSample"
          },
          "pending_jobs": {
            "type": "integer",
            "format": "int64"
          },
          "oldest_pending_age_ms": {
            "type": "integer",
            "format": "int64"
          },
          "baseline_pending_jobs": {
            "type": "integer",
            "format": "int64"
          },
          "baseline_oldest_pending_age_ms": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "ProjectReleaseControlRequest": {
        "description": "An operator decision fenced against the inspected progressive checkpoint.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "request_id",
          "expected_generation"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "description": "Reuse this identity after an ambiguous response."
          },
          "expected_generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Inspected checkpoint generation."
          }
        }
      },
      "ProjectReleaseControl": {
        "description": "Most recent durable operator decision and its restoration outcome.",
        "type": "object",
        "required": [
          "action",
          "request_id",
          "expected_generation",
          "requested_at",
          "status"
        ],
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "abort",
              "recover"
            ]
          },
          "request_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "expected_generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "requested_at": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "restored",
              "blocked"
            ]
          }
        }
      },
      "ProjectReleaseStabilization": {
        "type": "object",
        "description": "Opt-in bounded health monitoring after progressive rollout success.",
        "required": [
          "enabled",
          "status"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "enum": [
              "waiting",
              "monitoring",
              "completed",
              "rolled_back",
              "needs_operator",
              "conflicted"
            ]
          },
          "health": {
            "type": "string",
            "enum": [
              "healthy",
              "regressed",
              "unknown"
            ]
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "deadline": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ProjectReleaseVerification": {
        "type": "object",
        "description": "Snapshotted critical probes and durable post-cutover verification evidence.",
        "required": [
          "probes",
          "healthy_rounds",
          "regressed_rounds"
        ],
        "properties": {
          "stabilization": {
            "$ref": "#/components/schemas/ProjectReleaseStabilization"
          },
          "control": {
            "$ref": "#/components/schemas/ProjectReleaseControl"
          },
          "actions": {
            "type": "array",
            "description": "Currently available guarded controls; an empty list permits inspection only.",
            "items": {
              "type": "string",
              "enum": [
                "abort",
                "recover"
              ]
            }
          },
          "progressive": {
            "type": "boolean",
            "description": "Require staged 5 percent, 25 percent and full project promotion."
          },
          "percent": {
            "type": "integer",
            "enum": [
              5,
              25,
              100
            ],
            "description": "Current progressive stage traffic percentage."
          },
          "generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Durable progressive observation generation."
          },
          "worker_health": {
            "$ref": "#/components/schemas/ProjectWorkerHealth"
          },
          "probes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectReleaseProbe"
            }
          },
          "deadline": {
            "type": "string",
            "format": "date-time"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "healthy_rounds": {
            "type": "integer"
          },
          "regressed_rounds": {
            "type": "integer"
          },
          "evidence": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectReleaseProbeEvidence"
            }
          }
        }
      },
      "ProjectReleaseProbe": {
        "type": "object",
        "description": "Concrete read-only critical endpoint bound to one project workload.",
        "required": [
          "app_id",
          "slug",
          "method",
          "path"
        ],
        "properties": {
          "app_id": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "path": {
            "type": "string"
          }
        }
      },
      "ProjectReleaseProbeEvidence": {
        "type": "object",
        "description": "Attributed candidate and retained baseline samples for a critical probe round.",
        "required": [
          "probe",
          "candidate_requests",
          "candidate_errors",
          "stable_requests",
          "stable_errors",
          "unauthenticated",
          "unexpected_responses"
        ],
        "properties": {
          "probe": {
            "$ref": "#/components/schemas/ProjectReleaseProbe"
          },
          "candidate_requests": {
            "type": "integer"
          },
          "candidate_errors": {
            "type": "integer"
          },
          "stable_requests": {
            "type": "integer"
          },
          "stable_errors": {
            "type": "integer"
          },
          "unauthenticated": {
            "type": "integer"
          },
          "unexpected_responses": {
            "type": "integer"
          }
        }
      },
      "ProjectSubmissionReceipt": {
        "type": "object",
        "description": "Durable, account-scoped recovery for one project apply attempt.",
        "required": [
          "attempt_id",
          "project_slug",
          "status",
          "selection_complete",
          "apply"
        ],
        "properties": {
          "selection_complete": {
            "type": "boolean",
            "description": "Whether the selected workload set was durably recorded before enqueue."
          },
          "attempt_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "project_slug": {
            "type": "string"
          },
          "environment": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "processing",
              "complete",
              "rejected",
              "interrupted"
            ]
          },
          "apply": {
            "$ref": "#/components/schemas/ApplyResponse"
          }
        }
      },
      "ApplyResponse": {
        "description": "Apply response. Carries the inserted project_id and per-app IDs.",
        "type": "object",
        "required": [
          "project_slug",
          "scan_source",
          "can_apply",
          "plan_token"
        ],
        "properties": {
          "safe_release": {
            "$ref": "#/components/schemas/ProjectSafeRelease"
          },
          "submission_attempt_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "project_slug": {
            "type": "string"
          },
          "repo_full_name": {
            "type": "string"
          },
          "scan_source": {
            "type": "string"
          },
          "tier": {
            "type": "string"
          },
          "workloads": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlanWorkload"
            }
          },
          "managed": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlanManaged"
            }
          },
          "crons": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlanCron"
            }
          },
          "async_routes": {
            "type": "array",
            "description": "Structured async-route reconciliation returned with the applied plan.",
            "items": {
              "$ref": "#/components/schemas/PlanAsyncRoute"
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "detection_warnings": {
            "type": "array",
            "description": "Structured skipped/merged detector decisions returned with the applied plan.",
            "items": {
              "$ref": "#/components/schemas/PlanDetectionWarning"
            }
          },
          "observed_apps": {
            "type": "integer"
          },
          "observed_crons": {
            "type": "integer"
          },
          "limit_apps": {
            "type": "integer"
          },
          "limit_crons": {
            "type": "integer"
          },
          "can_apply": {
            "type": "boolean"
          },
          "crons_not_allowed": {
            "type": "boolean"
          },
          "plan_token": {
            "type": "string"
          },
          "can_apply_pre_exclude": {
            "type": "boolean"
          },
          "gate_rescued_by_exclude": {
            "type": "boolean"
          },
          "can_apply_reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "will_deploy": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlanAffectedApp"
            }
          },
          "unaffected": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlanAffectedApp"
            }
          },
          "skipped": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlanAffectedApp"
            }
          },
          "removed": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "persisted_exclusions": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "Slugs folded into this apply from deployment_scope_exclusions (a prior --persist-exclude deploy). Empty when the apply path took the per-deploy req.Exclude list verbatim."
            }
          },
          "stale_persisted_exclusions": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "Persisted slug no longer in the repo; ignored this deploy."
            }
          },
          "project_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "apps": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "slug",
                "id"
              ],
              "properties": {
                "slug": {
                  "type": "string"
                },
                "id": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{32}$"
                }
              }
            }
          },
          "builds": {
            "description": "Per-workload build enqueue results. Populated when the apply\npath actually enqueued one (deployment, build) per added or\nchanged workload (repo decomposition close-\nthe-loop). On staging or enqueue failure the per-app Error\nfield is populated and the IDs are empty.\n",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppliedBuild"
            }
          },
          "unchanged": {
            "description": "Slugs in apps that this apply did not rebuild: nothing in them\nchanged, or --only left them out. apps is the whole project\nmembership, so a client compares it with builds plus unchanged.\n",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "AppliedBuild": {
        "description": "Per-workload build result from the apply-time build-enqueue loop.\nOn success: slug + app_id + deployment_id + build_id. On failure:\nslug + app_id + error, no IDs.\n",
        "type": "object",
        "required": [
          "slug",
          "app_id"
        ],
        "properties": {
          "slug": {
            "type": "string"
          },
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "deployment_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "build_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "deployment_status": {
            "type": "string",
            "description": "Terminal deployment status added by wait-aware CLI responses."
          },
          "build_status": {
            "type": "string",
            "description": "Terminal build status added by wait-aware CLI responses."
          },
          "configuration": {
            "$ref": "#/components/schemas/DeploymentConfigurationStatus"
          },
          "error": {
            "type": "string",
            "description": "Staging or enqueue error message; partial-failure rows carry this in lieu of IDs."
          }
        }
      },
      "AlertRuleResponse": {
        "description": "A customer-configurable alert rule. Carries the masked webhook\nsecret; the sealed ciphertext is server-side only.\n",
        "type": "object",
        "required": [
          "id",
          "app_id",
          "name",
          "enabled",
          "metric",
          "comparison",
          "threshold",
          "window_spec",
          "webhook_url",
          "webhook_secret_sealed_masked",
          "cooldown_minutes",
          "action",
          "state",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "mcp_readiness_scope": {
            "type": "string",
            "maxLength": 40,
            "pattern": "^$|^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$",
            "description": "Immutable readiness environment selector. Omitted or empty means every environment; default selects only default. Valid only for mcp_readiness_unhealthy."
          },
          "mcp_min_calls": {
            "type": "integer",
            "minimum": 20,
            "maximum": 1000000,
            "description": "MCP protocol alerts only. Minimum observations in every rolling window; defaults to 20 on create. Latency uses measured executions. Omit for other metrics."
          },
          "mcp_for_minutes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 60,
            "description": "MCP protocol alerts only. Continuous breach duration sampled every 30 seconds; defaults to 10 on create. Missing observations interrupt eligibility. Webhook action, app scope, gt/gte and windows 5m/15m/1h are required. Error thresholds are percent (0..100), execution p95 thresholds are milliseconds (0..300000)."
          },
          "event_subscription_id": {
            "type": "string",
            "format": "uuid",
            "description": "Immutable subscription selector. Required only for event consumer metrics; webhook action and windows up to 24h are required."
          },
          "edge_rule_id": {
            "type": "string",
            "format": "uuid",
            "description": "Immutable edge rule selector for edge_rule_hits, edge_rule_log_hits and edge_rule_activity; absent means every rule of the app."
          },
          "post_deploy_rollback_window_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 3600,
            "description": "Configured completed-release rollback eligibility window in seconds; 0 is disabled. Acceptance requires deployment-specific error_rate_pct evidence, a gt or gte comparison, and recorded predecessor lineage."
          },
          "notify_resolved": {
            "type": "boolean",
            "description": "The webhook also receives a signed alert.resolved event when the rule recovers. Omitted when false."
          },
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "description": "Pinned app id. Empty string = account-wide rule.",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "name": {
            "type": "string",
            "example": "p99 > 500ms"
          },
          "enabled": {
            "type": "boolean",
            "example": true
          },
          "metric": {
            "type": "string",
            "description": "MCP task age reads a fresh app gauge in seconds and degrades when unavailable; mcp_tasks_metrics_stale is 1 when either task gauge is missing, stale, or invalid. Min=0 worker apps also require a fresh observer heartbeat with value 1. mcp_task_promotion_hold_age_seconds reads the oldest active hold directly from state (seconds, zero with no holds); its alerts support webhook action only.",
            "enum": [
              "error_rate_pct",
              "latency_p50_ms",
              "latency_p95_ms",
              "latency_p99_ms",
              "cold_start_pct",
              "request_count",
              "failed_invocations",
              "api_up",
              "account_spend_eur",
              "deployment_failed",
              "cert_expiry_seconds",
              "cert_issuance_failed",
              "queue_depth",
              "new_error_fingerprint",
              "cold_wake_rate_pct",
              "daily_cost_cents",
              "slo_burn_rate",
              "pre_auth_target_threshold",
              "pre_auth_target_signal_gap_pct",
              "mcp_tasks_oldest_age_seconds",
              "mcp_tasks_metrics_stale",
              "mcp_task_promotion_hold_age_seconds",
              "mcp_policy_unconverged_gateways",
              "mcp_policy_unverified",
              "mcp_protocol_error_rate_pct",
              "mcp_protocol_execution_p95_ms",
              "mcp_readiness_unhealthy",
              "mcp_catalog_drift",
              "mcp_catalog_monitor_unavailable",
              "mcp_oauth_reauthorization_required",
              "mcp_oauth_renewal_failed",
              "mcp_oauth_retirement_expiring",
              "mcp_oauth_issuance_unknown",
              "pre_auth_pressure",
              "edge_validation_failures",
              "edge_rejections",
              "edge_waf_detections",
              "event_pending_recipients",
              "event_oldest_pending_seconds",
              "event_retry_rate_per_second",
              "event_terminal_failure_pct",
              "event_routing_latency_p95_seconds",
              "event_paused_seconds",
              "event_drain_rate_per_second",
              "event_execution_dead_letters",
              "event_execution_dead_letter_rate_per_second",
              "event_handler_failure_pct",
              "event_completion_latency_p95_seconds",
              "event_recovery_stalled_jobs",
              "event_recovery_expiring_jobs",
              "event_recovery_capacity_wait_jobs",
              "event_recovery_execution_waiting_jobs",
              "event_recovery_execution_prolonged_wait_jobs",
              "event_recovery_execution_unknown_jobs",
              "event_recovery_execution_retention_risk_jobs",
              "event_recovery_notification_admission_overdue_jobs",
              "event_recovery_notification_admission_dead_jobs",
              "event_recovery_notification_admission_unknown_jobs",
              "event_recovery_notification_admission_no_receivers_jobs",
              "event_recovery_notification_execution_overdue_jobs",
              "event_recovery_notification_execution_dead_jobs",
              "event_recovery_notification_execution_unknown_jobs",
              "event_recovery_notification_execution_no_receivers_jobs",
              "event_retention_expiring_receipts",
              "event_storage_utilization_pct",
              "workflow_failures",
              "workflow_schedule_quota_skips",
              "workflow_pending_age_seconds",
              "workflow_waiting_age_seconds",
              "workflow_due_age_seconds",
              "custom_metric",
              "log_search_matches",
              "queue_backlog",
              "queue_oldest_age_seconds",
              "log_error_lines",
              "log_warn_lines",
              "slo_budget_burn",
              "slo_budget_remaining_pct",
              "synthetic_check_consecutive_failures",
              "synthetic_check_latency_p95_ms",
              "edge_rule_hits",
              "edge_rule_log_hits",
              "edge_rule_activity",
              "route_insights_detected",
              "route_monitor_incidents",
              "route_health_holds",
              "ai_budget_alerts"
            ]
          },
          "comparison": {
            "type": "string",
            "enum": [
              "gt",
              "gte",
              "lt",
              "lte",
              "above_baseline",
              "below_baseline"
            ]
          },
          "threshold": {
            "type": "number",
            "format": "double",
            "example": 500
          },
          "window_spec": {
            "type": "string",
            "enum": [
              "5m",
              "15m",
              "1h",
              "6h",
              "24h",
              "7d",
              "15d"
            ]
          },
          "failure_source": {
            "type": "string",
            "description": "Source dimension for failed_invocations; omit when metric is not failed_invocations (xor_chk).",
            "enum": [
              "any",
              "cron",
              "queue",
              "delayed_task",
              "async_invoke",
              "inbound_webhook"
            ]
          },
          "custom_metric_name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,62}$",
            "description": "The pushed custom metric a custom_metric rule watches. Present only when metric is custom_metric.",
            "example": "orders_pending"
          },
          "custom_metric_labels": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "maxLength": 128
            },
            "maxProperties": 3,
            "description": "The labelled series a custom_metric rule watches: the series with exactly these labels. Absent when the rule watches the aggregate."
          },
          "log_query": {
            "type": "string",
            "description": "The canonical log search filters a log_search_matches rule counts. Present only when metric is log_search_matches.",
            "example": "level=error&q=timeout&source=runtime"
          },
          "slo_id": {
            "type": "string",
            "format": "uuid",
            "description": "The customer SLO an slo_budget_burn or slo_budget_remaining_pct rule watches; absent for other metrics."
          },
          "synthetic_check_id": {
            "type": "string",
            "format": "uuid",
            "description": "The synthetic check a synthetic_check_* rule watches; absent for other metrics."
          },
          "webhook_url": {
            "type": "string",
            "example": "https://example.com/hook",
            "description": "Signed webhook destination; empty for a rule that delivers only to notification channels."
          },
          "channel_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Notification channels the rule delivers fires and resolves to."
          },
          "webhook_secret_sealed_masked": {
            "type": "string",
            "description": "Literal \"***\" — the plaintext is never returned.",
            "example": "***"
          },
          "cooldown_minutes": {
            "type": "integer",
            "minimum": 5,
            "maximum": 1440,
            "example": 15
          },
          "action": {
            "type": "string",
            "enum": [
              "webhook",
              "rollback",
              "demote",
              "promote"
            ],
            "description": "What to do when the rule fires. webhook = fire the configured webhook only (legacy default). rollback = roll the rule's app back to its last live deployment. demote = pin the current canary step (no traffic advance). promote = short-circuit the canary ladder to 100%. Pre-auth target and MCP task, event consumer, and workflow metrics support webhook only.",
            "default": "webhook",
            "example": "webhook"
          },
          "state": {
            "type": "string",
            "enum": [
              "ok",
              "firing",
              "degraded",
              "unknown"
            ],
            "description": "Evaluation state. degraded means the rule's own metric source is unavailable; unknown means insufficient samples, compacted event history, or a paused event consumer."
          },
          "last_fired_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_evaluated_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreateAlertRuleRequest": {
        "description": "Create an alert rule on an app.",
        "type": "object",
        "required": [
          "name",
          "metric",
          "comparison",
          "threshold",
          "window_spec"
        ],
        "properties": {
          "mcp_readiness_scope": {
            "type": "string",
            "maxLength": 40,
            "pattern": "^$|^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$",
            "description": "Readiness environment requested when creating this alert. Immutable readiness environment selector. Omitted or empty means every environment; default selects only default. Valid only for mcp_readiness_unhealthy."
          },
          "mcp_min_calls": {
            "type": "integer",
            "minimum": 20,
            "maximum": 1000000,
            "description": "Observation minimum requested for the new protocol alert. MCP protocol alerts only. Minimum observations in every rolling window; defaults to 20 on create. Latency uses measured executions. Omit for other metrics."
          },
          "mcp_for_minutes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 60,
            "description": "Sustained duration requested for the new protocol alert. MCP protocol alerts only. Continuous breach duration sampled every 30 seconds; defaults to 10 on create. Missing observations interrupt eligibility. Webhook action, app scope, gt/gte and windows 5m/15m/1h are required. Error thresholds are percent (0..100), execution p95 thresholds are milliseconds (0..300000)."
          },
          "event_subscription_id": {
            "type": "string",
            "format": "uuid",
            "description": "Event subscription id in the create alert rule request: immutable subscription selector. Required only for event consumer metrics; webhook action and windows up to 24h are required."
          },
          "edge_rule_id": {
            "type": "string",
            "format": "uuid",
            "description": "Edge rule to count for edge_rule_hits (enforced matches), edge_rule_log_hits (log-mode matches) or edge_rule_activity (matches in either mode, so the alert survives a switch from log mode to enforce); omit to count every rule of the app. Immutable. Edge-rule metrics are webhook-only and take window_spec 1h, 6h, 24h or 7d (hourly hit buckets, kept 14 days)."
          },
          "post_deploy_rollback_window_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 3600,
            "description": "Enable completed-release rollback for this many seconds after cutover; 0 disables it. Requires action=rollback. Only deployment-specific error_rate_pct breaches with gt or gte comparisons can qualify."
          },
          "notify_resolved": {
            "type": "boolean",
            "description": "Also send the webhook a signed alert.resolved event when the rule recovers. Requires webhook_url; notification channels always receive resolves. Defaults to false, because receivers that predate it count every delivery as a fire."
          },
          "name": {
            "type": "string",
            "example": "p99 > 500ms"
          },
          "enabled": {
            "type": "boolean",
            "example": true
          },
          "metric": {
            "type": "string",
            "description": "Selected metric for the existing alert rule. MCP task age reads a fresh app gauge in seconds and degrades when unavailable; mcp_tasks_metrics_stale is 1 when either task gauge is missing, stale, or invalid. Min=0 worker apps also require a fresh observer heartbeat with value 1. mcp_task_promotion_hold_age_seconds reads the oldest active hold directly from state (seconds, zero with no holds); its alerts support webhook action only.",
            "enum": [
              "error_rate_pct",
              "latency_p50_ms",
              "latency_p95_ms",
              "latency_p99_ms",
              "cold_start_pct",
              "request_count",
              "failed_invocations",
              "api_up",
              "account_spend_eur",
              "deployment_failed",
              "cert_expiry_seconds",
              "cert_issuance_failed",
              "queue_depth",
              "new_error_fingerprint",
              "cold_wake_rate_pct",
              "daily_cost_cents",
              "slo_burn_rate",
              "pre_auth_target_threshold",
              "pre_auth_target_signal_gap_pct",
              "pre_auth_pressure",
              "edge_validation_failures",
              "edge_rejections",
              "edge_waf_detections",
              "event_pending_recipients",
              "event_oldest_pending_seconds",
              "event_retry_rate_per_second",
              "event_terminal_failure_pct",
              "event_routing_latency_p95_seconds",
              "event_paused_seconds",
              "event_drain_rate_per_second",
              "event_execution_dead_letters",
              "event_execution_dead_letter_rate_per_second",
              "event_handler_failure_pct",
              "event_completion_latency_p95_seconds",
              "event_recovery_stalled_jobs",
              "event_recovery_expiring_jobs",
              "event_recovery_capacity_wait_jobs",
              "event_recovery_execution_waiting_jobs",
              "event_recovery_execution_prolonged_wait_jobs",
              "event_recovery_execution_unknown_jobs",
              "event_recovery_execution_retention_risk_jobs",
              "event_recovery_notification_admission_overdue_jobs",
              "event_recovery_notification_admission_dead_jobs",
              "event_recovery_notification_admission_unknown_jobs",
              "event_recovery_notification_admission_no_receivers_jobs",
              "event_recovery_notification_execution_overdue_jobs",
              "event_recovery_notification_execution_dead_jobs",
              "event_recovery_notification_execution_unknown_jobs",
              "event_recovery_notification_execution_no_receivers_jobs",
              "event_retention_expiring_receipts",
              "event_storage_utilization_pct",
              "mcp_tasks_oldest_age_seconds",
              "mcp_tasks_metrics_stale",
              "mcp_task_promotion_hold_age_seconds",
              "mcp_policy_unconverged_gateways",
              "mcp_policy_unverified",
              "mcp_readiness_unhealthy",
              "mcp_catalog_drift",
              "mcp_catalog_monitor_unavailable",
              "mcp_oauth_reauthorization_required",
              "mcp_oauth_renewal_failed",
              "mcp_oauth_retirement_expiring",
              "mcp_oauth_issuance_unknown",
              "mcp_protocol_error_rate_pct",
              "mcp_protocol_execution_p95_ms",
              "edge_rule_hits",
              "edge_rule_log_hits",
              "custom_metric",
              "log_error_lines",
              "log_warn_lines",
              "slo_budget_burn",
              "slo_budget_remaining_pct",
              "synthetic_check_consecutive_failures",
              "synthetic_check_latency_p95_ms",
              "edge_rule_activity",
              "route_insights_detected",
              "log_search_matches",
              "queue_backlog",
              "queue_oldest_age_seconds",
              "route_monitor_incidents",
              "route_health_holds",
              "ai_budget_alerts"
            ]
          },
          "comparison": {
            "type": "string",
            "enum": [
              "gt",
              "gte",
              "lt",
              "lte",
              "above_baseline",
              "below_baseline"
            ],
            "description": "above_baseline and below_baseline (preview behind FAAS_ANOMALY_ALERTS_ENABLED) compare against the median of the same metric at the same time of day over the previous 7 days; threshold is then a multiplier (1.5-20 above, 0.05-0.67 below). Supported for error_rate_pct, latency_p95_ms, latency_p99_ms, cold_start_pct and request_count (below_baseline: request_count only)."
          },
          "threshold": {
            "type": "number",
            "format": "double",
            "example": 500
          },
          "window_spec": {
            "type": "string",
            "enum": [
              "5m",
              "15m",
              "1h",
              "6h",
              "24h",
              "7d",
              "15d"
            ]
          },
          "failure_source": {
            "type": "string",
            "description": "Required when metric == failed_invocations; omit otherwise (xor_chk).",
            "enum": [
              "any",
              "cron",
              "queue",
              "delayed_task",
              "async_invoke",
              "inbound_webhook"
            ]
          },
          "custom_metric_name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,62}$",
            "description": "Required when metric is custom_metric; omit otherwise. A gauge is compared on its average over the window and a counter on its per-second rate. custom_metric rules support webhook action only and windows up to 24h.",
            "example": "orders_pending"
          },
          "custom_metric_labels": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "maxLength": 128
            },
            "maxProperties": 3,
            "description": "custom_metric rules only: watch the one labelled series with exactly these labels instead of the aggregate (counters summed, gauges max across series). Keys match ^[a-z_][a-z0-9_]{0,62}$."
          },
          "log_query": {
            "type": "string",
            "maxLength": 2048,
            "description": "Required when metric is log_search_matches; omit otherwise. URL query string of log search filters (source, level, status, route, deployment_id, request_id, trace_id, q); the rule counts matching log events in its window. Webhook action only, windows up to 24h.",
            "example": "level=error&q=timeout&source=runtime"
          },
          "slo_id": {
            "type": "string",
            "format": "uuid",
            "description": "Required for slo_budget_burn (multi-window burn rate; 14.4 is the paging threshold) and slo_budget_remaining_pct (percent of the error budget left); names one of this app's SLOs. The rule window_spec is ignored for these metrics."
          },
          "synthetic_check_id": {
            "type": "string",
            "format": "uuid",
            "description": "Required for synthetic_check_consecutive_failures (failed runs since the last success; window_spec ignored) and synthetic_check_latency_p95_ms (p95 of successful runs in the window); names one of this app's checks."
          },
          "webhook_url": {
            "type": "string",
            "format": "uri",
            "example": "https://example.com/hook",
            "description": "Signed webhook destination. Required with webhook_secret unless channel_ids is set."
          },
          "channel_ids": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Notification channels to deliver fires and resolves to. With at least one, webhook_url and webhook_secret may be omitted."
          },
          "webhook_secret": {
            "type": "string",
            "description": "Plaintext HMAC secret (max 256 bytes). Sealed at rest; never echoed.",
            "maxLength": 256,
            "example": "shh"
          },
          "cooldown_minutes": {
            "type": "integer",
            "minimum": 5,
            "maximum": 1440,
            "example": 15
          },
          "action": {
            "type": "string",
            "enum": [
              "webhook",
              "rollback",
              "demote",
              "promote"
            ],
            "description": "What to do when the rule fires. Omit to default to webhook. Pre-auth target and MCP task, event consumer, and workflow metrics support webhook only.",
            "default": "webhook",
            "example": "webhook"
          }
        }
      },
      "UpdateAlertRuleRequest": {
        "description": "Partial update — every field is optional. Omitted means leave alone.",
        "type": "object",
        "properties": {
          "mcp_readiness_scope": {
            "type": "string",
            "maxLength": 40,
            "pattern": "^$|^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$",
            "description": "Immutable environment selector. If supplied it must equal the current value; create a new rule to select another environment."
          },
          "mcp_min_calls": {
            "type": "integer",
            "minimum": 20,
            "maximum": 1000000,
            "description": "Replacement observation minimum for the existing protocol alert. MCP protocol alerts only. Minimum observations in every rolling window; defaults to 20 on create. Latency uses measured executions. Omit for other metrics."
          },
          "mcp_for_minutes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 60,
            "description": "Replacement sustained duration for the existing protocol alert. MCP protocol alerts only. Continuous breach duration sampled every 30 seconds; defaults to 10 on create. Missing observations interrupt eligibility. Webhook action, app scope, gt/gte and windows 5m/15m/1h are required. Error thresholds are percent (0..100), execution p95 thresholds are milliseconds (0..300000)."
          },
          "post_deploy_rollback_window_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 3600,
            "description": "Change the completed-release recovery window. Omission preserves it and explicit 0 disables it. Positive values require action=rollback; only error_rate_pct with gt or gte and sufficient exact deployment telemetry qualifies."
          },
          "notify_resolved": {
            "type": "boolean",
            "description": "Turn the webhook's alert.resolved events on or off. Turning them on requires the rule to have a webhook_url."
          },
          "name": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "metric": {
            "type": "string",
            "description": "Cannot cross metric families (e.g. error_rate_pct → failed_invocations) — returns 400. MCP task metrics are notification-only.",
            "enum": [
              "error_rate_pct",
              "latency_p50_ms",
              "latency_p95_ms",
              "latency_p99_ms",
              "cold_start_pct",
              "request_count",
              "failed_invocations",
              "api_up",
              "account_spend_eur",
              "deployment_failed",
              "cert_expiry_seconds",
              "cert_issuance_failed",
              "queue_depth",
              "new_error_fingerprint",
              "cold_wake_rate_pct",
              "daily_cost_cents",
              "slo_burn_rate",
              "pre_auth_target_threshold",
              "pre_auth_target_signal_gap_pct",
              "pre_auth_pressure",
              "edge_validation_failures",
              "edge_rejections",
              "edge_waf_detections",
              "event_pending_recipients",
              "event_oldest_pending_seconds",
              "event_retry_rate_per_second",
              "event_terminal_failure_pct",
              "event_routing_latency_p95_seconds",
              "event_paused_seconds",
              "event_drain_rate_per_second",
              "event_execution_dead_letters",
              "event_execution_dead_letter_rate_per_second",
              "event_handler_failure_pct",
              "event_completion_latency_p95_seconds",
              "event_recovery_stalled_jobs",
              "event_recovery_expiring_jobs",
              "event_recovery_capacity_wait_jobs",
              "event_recovery_execution_waiting_jobs",
              "event_recovery_execution_prolonged_wait_jobs",
              "event_recovery_execution_unknown_jobs",
              "event_recovery_execution_retention_risk_jobs",
              "event_recovery_notification_admission_overdue_jobs",
              "event_recovery_notification_admission_dead_jobs",
              "event_recovery_notification_admission_unknown_jobs",
              "event_recovery_notification_admission_no_receivers_jobs",
              "event_recovery_notification_execution_overdue_jobs",
              "event_recovery_notification_execution_dead_jobs",
              "event_recovery_notification_execution_unknown_jobs",
              "event_recovery_notification_execution_no_receivers_jobs",
              "event_retention_expiring_receipts",
              "event_storage_utilization_pct",
              "mcp_tasks_oldest_age_seconds",
              "mcp_tasks_metrics_stale",
              "mcp_task_promotion_hold_age_seconds",
              "mcp_policy_unconverged_gateways",
              "mcp_policy_unverified",
              "mcp_readiness_unhealthy",
              "mcp_catalog_drift",
              "mcp_catalog_monitor_unavailable",
              "mcp_oauth_reauthorization_required",
              "mcp_oauth_renewal_failed",
              "mcp_oauth_retirement_expiring",
              "mcp_oauth_issuance_unknown",
              "mcp_protocol_error_rate_pct",
              "mcp_protocol_execution_p95_ms",
              "edge_rule_hits",
              "edge_rule_log_hits",
              "custom_metric",
              "log_error_lines",
              "log_warn_lines",
              "slo_budget_burn",
              "slo_budget_remaining_pct",
              "synthetic_check_consecutive_failures",
              "synthetic_check_latency_p95_ms",
              "edge_rule_activity",
              "route_insights_detected",
              "log_search_matches",
              "queue_backlog",
              "queue_oldest_age_seconds",
              "route_monitor_incidents",
              "route_health_holds",
              "ai_budget_alerts"
            ]
          },
          "comparison": {
            "type": "string",
            "enum": [
              "gt",
              "gte",
              "lt",
              "lte",
              "above_baseline",
              "below_baseline"
            ]
          },
          "threshold": {
            "type": "number",
            "format": "double"
          },
          "window_spec": {
            "type": "string",
            "enum": [
              "5m",
              "15m",
              "1h",
              "6h",
              "24h",
              "7d",
              "15d"
            ]
          },
          "webhook_url": {
            "type": "string",
            "format": "uri"
          },
          "channel_ids": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Replaces the rule's notification channels; an empty list clears them, which a rule without a webhook cannot do."
          },
          "webhook_secret": {
            "type": "string",
            "description": "New plaintext HMAC secret. Omit to keep the existing secret.",
            "maxLength": 256
          },
          "cooldown_minutes": {
            "type": "integer",
            "minimum": 5,
            "maximum": 1440
          },
          "action": {
            "type": "string",
            "enum": [
              "webhook",
              "rollback",
              "demote",
              "promote"
            ],
            "description": "Replace the action. Omit to leave the existing action in place. Pre-auth target and MCP task, event consumer, and workflow metrics support webhook only."
          }
        }
      },
      "RotateAlertRuleSecretResponse": {
        "description": "rotate-secret response — returns the rotated_at timestamp + the masked constant.",
        "type": "object",
        "required": [
          "rotated_at",
          "webhook_secret_sealed_masked"
        ],
        "properties": {
          "rotated_at": {
            "type": "string",
            "format": "date-time",
            "example": "2026-07-28T12:00:00Z"
          },
          "webhook_secret_sealed_masked": {
            "type": "string",
            "example": "***"
          }
        }
      },
      "RotateAlertRuleSecretRequest": {
        "description": "Caller-supplied replacement. Provision the receiver first; cutover is immediate with no old-key overlap.",
        "type": "object",
        "required": [
          "webhook_secret"
        ],
        "properties": {
          "webhook_secret": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "writeOnly": true
          }
        }
      },
      "AlertDeliveryResponse": {
        "description": "One alert_deliveries row as surfaced by\nGET /v1/apps/{slug}/alerts/{id}/deliveries.\nTest rows (IsTest=true) are written by Dispatcher.DispatchTest\n(the customer-facing \"send test alert\" path); the production\nread (include_test=false) hides them, the operator read\n(?include_test=true) surfaces them.\n",
        "type": "object",
        "required": [
          "id",
          "rule_id",
          "account_id",
          "idempotency_key",
          "status",
          "attempt_count",
          "observed_value",
          "fired_at",
          "is_test"
        ],
        "properties": {
          "readiness_event_id": {
            "type": "string",
            "format": "uuid",
            "description": "Stable readiness logical event associated with this physical delivery."
          },
          "readiness_destination": {
            "type": "string",
            "enum": [
              "primary",
              "fallback"
            ],
            "description": "Selected receiver role for this physical readiness dispatch."
          },
          "readiness_failover_reason": {
            "type": "string",
            "enum": [
              "primary_failure_threshold",
              "incident_sticky_fallback",
              "recovery_to_primary",
              "primary_queue_blocked"
            ],
            "description": "Destination selection reason recorded on this physical readiness delivery."
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "rule_id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid",
            "description": "omitted on account-wide rules"
          },
          "idempotency_key": {
            "type": "string",
            "description": "rule_id + ':' + cooldown bucket (production) or delivery_id + ':test' (test path)"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "delivered",
              "failed"
            ]
          },
          "attempt_count": {
            "type": "integer",
            "minimum": 0
          },
          "last_status_code": {
            "type": "integer",
            "description": "0 when the attempt never reached the wire"
          },
          "last_error": {
            "type": "string",
            "description": "truncated server-side via dashboard.FormatAlertError (log-injection-safe)"
          },
          "observed_value": {
            "type": "number",
            "format": "double"
          },
          "fired_at": {
            "type": "string",
            "format": "date-time"
          },
          "delivered_at": {
            "type": "string",
            "format": "date-time",
            "description": "omitted until status=delivered"
          },
          "is_test": {
            "type": "boolean",
            "description": "true iff the row was written by Dispatcher.DispatchTest"
          }
        }
      },
      "AlertPresetResponse": {
        "description": "One row of the alert-preset catalog.\nThe catalog is system-seeded and R/O for customers — the\nenable endpoint clones the row into a real alert_rules row\nthe customer owns from then on. No persistent preset_id FK\nlands on alert_rules.\n",
        "type": "object",
        "required": [
          "id",
          "name",
          "display_name",
          "description",
          "category",
          "metric",
          "comparison",
          "threshold",
          "window_spec",
          "default_cooldown_minutes",
          "minimum_plan",
          "enabled_in_catalog"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "example": "error_rate_2pct"
          },
          "display_name": {
            "type": "string",
            "example": "Error rate exceeds 2%"
          },
          "description": {
            "type": "string",
            "example": "Fires when the rolling 15-minute error rate exceeds 2%."
          },
          "category": {
            "type": "string",
            "enum": [
              "availability",
              "reliability",
              "cost",
              "deployment",
              "infrastructure",
              "security"
            ],
            "example": "reliability"
          },
          "metric": {
            "type": "string",
            "example": "error_rate_pct"
          },
          "comparison": {
            "type": "string",
            "enum": [
              "gt",
              "gte",
              "lt",
              "lte"
            ],
            "example": "gt"
          },
          "threshold": {
            "type": "number",
            "example": 2
          },
          "window_spec": {
            "type": "string",
            "enum": [
              "5m",
              "15m",
              "1h",
              "6h",
              "24h",
              "7d",
              "15d"
            ],
            "example": "15m"
          },
          "default_cooldown_minutes": {
            "type": "integer",
            "minimum": 5,
            "maximum": 1440,
            "example": 15
          },
          "minimum_plan": {
            "type": "string",
            "enum": [
              "free",
              "hobby",
              "pro",
              "scale"
            ],
            "example": "hobby"
          },
          "enabled_in_catalog": {
            "type": "boolean",
            "example": true
          }
        }
      },
      "EnableAlertPresetRequest": {
        "description": "Body for POST /v1/apps/{slug}/alert-presets/{name}/enable.\nThe (name, metric, comparison, threshold, window_spec,\ndefault_cooldown_minutes) sextuple is pre-filled from the\ncatalog; the caller supplies the delivery-side fields and an\noptional safe-release action.\n",
        "type": "object",
        "properties": {
          "webhook_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048,
            "example": "https://hooks.example.com/alerts",
            "description": "Signed webhook destination; required with webhook_secret unless channel_ids is set."
          },
          "webhook_secret": {
            "type": "string",
            "maxLength": 256,
            "example": "shh",
            "description": "HMAC secret for the webhook; required with webhook_url unless channel_ids is set."
          },
          "channel_ids": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Notification channels the instantiated rule delivers to; with at least one, the webhook fields may be omitted."
          },
          "action": {
            "type": "string",
            "enum": [
              "webhook",
              "rollback",
              "demote",
              "promote"
            ],
            "default": "webhook",
            "description": "Action to run when the instantiated alert fires. Omit to\nuse the default webhook-only behavior. The login_target_pressure,\nlogin_target_signal_health, pre_auth_pressure,\nedge_validation_failures, and edge_rejection_pressure presets\nsupport webhook only.\n"
          },
          "cooldown_minutes": {
            "type": "integer",
            "minimum": 5,
            "maximum": 1440,
            "description": "Override for the preset's default_cooldown_minutes.\nOmit to use the catalog default.\n"
          },
          "enabled": {
            "type": "boolean",
            "default": true,
            "description": "Whether the instantiated rule is enabled. Defaults to\ntrue; pass false to stage the rule in disabled state.\n"
          }
        }
      },
      "TestAlertPresetResponse": {
        "description": "Response body for POST /v1/apps/{slug}/alert-presets/{name}/test\n(and the sibling dashboard form-POST handler). The handler\ndispatches a synthetic event to the customer's configured\nwebhook URL with `payload.test == true`; this shape confirms\nthe dispatch completed and surfaces the delivery_id the\ncustomer's webhook receiver should echo back.\n(commit 2)\n",
        "type": "object",
        "required": [
          "status",
          "test",
          "delivery_id",
          "attempts"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "sent"
            ],
            "description": "Always \"sent\" on 200. A dispatch failure returns 502\nwith an RFC 7807 problem document (NOT this shape).\n"
          },
          "test": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Always true on 200. Discriminator customers can key off\nin their webhook receiver to skip production alerting\npaths (e.g. PagerDuty incidents) for test dispatches.\n"
          },
          "delivery_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "description": "32-char lowercase hex identifier for this dispatch\n(16 random bytes from crypto/rand encoded as hex). The\naudit log row (`alert_preset.test_sent`) carries the\nsame delivery_id so the customer can correlate by\ntimestamp + delivery_id without leaking via UUID dashes.\n"
          },
          "attempts": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5,
            "description": "Number of dispatch attempts the webhookout.Dispatcher\nmade before reaching the final state (1..MaxAttempts).\nCustomers can use this to tune their receiver's SLA\n(e.g. a successful first attempt vs. a successful\nretry after a transient 502 from the receiver).\n"
          }
        }
      },
      "EdgeRuleResponse": {
        "description": "A customer-configurable edge rule. The `action` blob is a\nkind-tagged union — the shape varies by `kind`. See\nCreateEdgeRuleRequest.action for the per-kind shape.\n",
        "type": "object",
        "required": [
          "id",
          "account_id",
          "app_id",
          "match_host",
          "match_path",
          "match_methods",
          "match_headers",
          "priority",
          "enabled",
          "kind",
          "action",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "account_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "match_host": {
            "type": "string",
            "maxLength": 253,
            "description": "Host glob. `*` matches any; `*.example.com` matches any subdomain; `@app` covers every hostname the rule's app serves, including custom domains added later.",
            "example": "api.example.com"
          },
          "match_path": {
            "type": "string",
            "maxLength": 2048,
            "description": "Path glob. Trailing `*` matches anything beneath.",
            "example": "/api/*"
          },
          "match_methods": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Empty array = match any method.",
            "example": [
              "GET",
              "POST"
            ]
          },
          "match_headers": {
            "type": "object",
            "maxProperties": 10,
            "additionalProperties": {
              "type": "string",
              "maxLength": 1024
            },
            "description": "Request headers required to match this rule. Names are case-insensitive; every configured name must have an exact value present, and any repeated request-header value may satisfy it."
          },
          "priority": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000,
            "default": 100
          },
          "enabled": {
            "type": "boolean",
            "default": true
          },
          "kind": {
            "type": "string",
            "enum": [
              "route",
              "rewrite",
              "redirect",
              "headers",
              "cors",
              "jwt",
              "ip",
              "validate",
              "limit",
              "maintenance",
              "geo",
              "throttle",
              "budget",
              "cache",
              "respond",
              "retry",
              "circuit_breaker",
              "async",
              "waf",
              "challenge"
            ]
          },
          "validate_mode": {
            "type": "string",
            "enum": [
              "block",
              "observe",
              "warn"
            ],
            "default": "block",
            "description": "Top-level source of truth for kind=validate.\nResolved mode; always present on read. Empty on read\nwould be a database invariant violation.\n"
          },
          "action": {
            "description": "Kind-tagged union — shape varies by `kind`.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/EdgeRuleRouteAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleRewriteAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleRedirectAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleHeadersAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleCORSAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleJWTAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleIPAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleValidateAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleLimitAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleMaintenanceAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleGeoAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleThrottleAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleBudgetAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleCacheAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleRespondAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleRetryAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleCircuitBreakerAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleAsyncAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleWAFAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleChallengeAction"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "name": {
            "type": "string",
            "description": "Operator-facing rule name."
          },
          "description": {
            "type": "string",
            "description": "Operator-facing description."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the gateway stops applying the rule."
          },
          "expired": {
            "type": "boolean",
            "description": "True once expires_at has passed and the rule no longer applies."
          },
          "match": {
            "$ref": "#/components/schemas/EdgeRuleMatchExpr"
          },
          "mode": {
            "type": "string",
            "enum": [
              "enforce",
              "log"
            ],
            "description": "enforce (default) or log; a log-mode rule is matched and counted but never acts."
          },
          "managed_by": {
            "type": "string",
            "enum": [
              "attack_mode"
            ],
            "description": "Set on the app's attack-mode rule, which changes only through /v1/apps/{slug}/edge-protection/attack-mode; PATCH refuses it. Absent on every other rule."
          },
          "penalty": {
            "$ref": "#/components/schemas/EdgeRulePenalty"
          },
          "unreleased_features": {
            "type": "array",
            "description": "Gated features this rule uses that are not yet released to the\naccount. The gateway does not enforce them:\na challenge rule is inert, a warn or block WAF rule only\nobserves, a penalty boxes nobody, an AI crawler condition never\nmatches, and attack mode challenges nobody. Absent when every\nfeature the rule uses is released.\n",
            "items": {
              "type": "string",
              "enum": [
                "challenge",
                "waf_blocking",
                "penalty_box",
                "ai_crawlers",
                "attack_mode"
              ]
            }
          }
        }
      },
      "DeploymentRoutePolicySnapshotResponse": {
        "description": "Immutable gateway edge-rule state recorded on the deployment's first live transition.",
        "type": "object",
        "required": [
          "deployment_id",
          "app_id",
          "scope",
          "sha256",
          "schema_version",
          "captured_at",
          "rules"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "schema_version": {
            "type": "integer",
            "minimum": 1
          },
          "captured_at": {
            "type": "string",
            "format": "date-time"
          },
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EdgeRuleResponse"
            }
          }
        }
      },
      "CreateEdgeRuleRequest": {
        "description": "Body shape for POST /v1/apps/{slug}/edge-rules.",
        "type": "object",
        "required": [
          "match_host",
          "kind",
          "action"
        ],
        "properties": {
          "match_host": {
            "type": "string",
            "maxLength": 253,
            "description": "Exact host, glob (`*`, `*.example.com`), or `@app` for every hostname the app serves. Other values starting with `@` are reserved."
          },
          "match_path": {
            "type": "string",
            "maxLength": 2048,
            "default": "/"
          },
          "match_methods": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "match_headers": {
            "type": "object",
            "maxProperties": 10,
            "additionalProperties": {
              "type": "string",
              "maxLength": 1024
            },
            "description": "Optional exact-value request-header selectors. Header names compare case-insensitively; every configured name must match, with any repeated request-header value eligible to satisfy it."
          },
          "priority": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000,
            "default": 100
          },
          "enabled": {
            "type": "boolean",
            "default": true
          },
          "kind": {
            "type": "string",
            "enum": [
              "route",
              "rewrite",
              "redirect",
              "headers",
              "cors",
              "jwt",
              "ip",
              "validate",
              "limit",
              "maintenance",
              "geo",
              "throttle",
              "budget",
              "cache",
              "respond",
              "retry",
              "circuit_breaker",
              "async",
              "waf",
              "challenge"
            ]
          },
          "validate_mode": {
            "type": "string",
            "enum": [
              "block",
              "observe",
              "warn"
            ],
            "default": "block",
            "description": "Top-level source of truth for kind=validate.\nOmitted == 'block' (the SQL-side default).\n"
          },
          "action": {
            "description": "Kind-tagged action body — shape depends on `kind`.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/EdgeRuleRouteAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleRewriteAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleRedirectAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleHeadersAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleCORSAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleJWTAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleIPAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleValidateAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleLimitAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleMaintenanceAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleGeoAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleThrottleAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleBudgetAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleCacheAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleRespondAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleRetryAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleCircuitBreakerAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleAsyncAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleWAFAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleChallengeAction"
              }
            ]
          },
          "name": {
            "type": "string",
            "maxLength": 100,
            "description": "Optional operator-facing name for the new rule."
          },
          "description": {
            "type": "string",
            "maxLength": 1000,
            "description": "Optional operator-facing notes for the new rule."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "Optional time after which the gateway stops applying the new rule."
          },
          "match": {
            "$ref": "#/components/schemas/EdgeRuleMatchExpr"
          },
          "mode": {
            "type": "string",
            "enum": [
              "enforce",
              "log"
            ],
            "description": "Start the rule enforced (default) or in log mode, where it is only matched and counted."
          },
          "penalty": {
            "$ref": "#/components/schemas/EdgeRulePenalty"
          }
        }
      },
      "UpdateEdgeRuleRequest": {
        "description": "Partial update — every field optional. Kind is not patchable.",
        "type": "object",
        "properties": {
          "match_host": {
            "type": "string",
            "maxLength": 253
          },
          "match_path": {
            "type": "string",
            "maxLength": 2048
          },
          "match_methods": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "match_headers": {
            "type": "object",
            "maxProperties": 10,
            "additionalProperties": {
              "type": "string",
              "maxLength": 1024
            },
            "description": "Replacing this map changes the request-header selectors. Header names compare case-insensitively and values compare exactly; use an empty object to remove all header conditions."
          },
          "priority": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          },
          "enabled": {
            "type": "boolean"
          },
          "validate_mode": {
            "type": "string",
            "enum": [
              "block",
              "observe",
              "warn"
            ],
            "description": "Top-level source of truth for kind=validate.\nOmit (do not send) to leave the column untouched.\n"
          },
          "action": {
            "description": "Replaces the jsonb column whole.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/EdgeRuleRouteAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleRewriteAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleRedirectAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleHeadersAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleCORSAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleJWTAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleIPAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleValidateAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleLimitAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleMaintenanceAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleGeoAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleThrottleAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleBudgetAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleCacheAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleRespondAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleRetryAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleCircuitBreakerAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleAsyncAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleWAFAction"
              },
              {
                "$ref": "#/components/schemas/EdgeRuleChallengeAction"
              }
            ]
          },
          "name": {
            "type": "string",
            "maxLength": 100,
            "description": "Replacement rule name."
          },
          "description": {
            "type": "string",
            "maxLength": 1000,
            "description": "Replacement rule notes."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "New expiry; the gateway stops applying the rule after it."
          },
          "clear_expires_at": {
            "type": "boolean",
            "description": "Remove the expiry so the rule applies indefinitely."
          },
          "match": {
            "$ref": "#/components/schemas/EdgeRuleMatchExpr"
          },
          "clear_match": {
            "type": "boolean",
            "description": "Remove the match condition."
          },
          "mode": {
            "type": "string",
            "enum": [
              "enforce",
              "log"
            ],
            "description": "Switch the rule to enforce, or to log so it is matched and counted but never acts."
          },
          "penalty": {
            "$ref": "#/components/schemas/EdgeRulePenalty"
          },
          "clear_penalty": {
            "type": "boolean",
            "description": "Remove the rule's penalty box, releasing the clients it holds."
          }
        }
      },
      "EdgeRuleMatchExpr": {
        "description": "Match condition, ANDed with the rule's fixed selectors. A node\nis exactly one of all, any, not, or a field/op leaf. Fields: method,\npath, host, client_ip, country, asn (the client IP's\nautonomous system, e.g. 13335 or AS13335), ua_family (the\nUser-Agent's family, one of browser, mobile, bot, tool, other),\nverified_bot (a known crawler confirmed by its operator's\npublished IP ranges or forward-confirmed reverse DNS of the client\nIP, one of googlebot, bingbot, applebot, yandexbot, baiduspider,\nyahoo, petalbot; absent otherwise), ai_crawler (the AI crawler the User-Agent claims, such as gptbot, claudebot,\nccbot, perplexitybot, bytespider), ai_crawler_purpose (that\ncrawler's purpose: training, search or assistant),\nverified_ai_crawler (the claimed AI crawler when the client IP is\nin its operator's published ranges; only crawlers that publish\nranges can verify), header:<name>, cookie:<name>, query:<name>.\nua_family, verified_bot and the AI crawler fields take eq, ne, in,\nnot_in, exists, missing. Ops: eq, ne, in, not_in, prefix, suffix, contains,\nexists, missing, regex (RE2), cidr (client_ip only), in_list (list names an account list whose kind fits the field). Depth at most 4,\nat most 32 nodes, 64 values per leaf, values and regexes at most 256\nbytes. An untrusted client IP, or its unknown country or ASN, is absent.\n",
        "type": "object",
        "properties": {
          "all": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EdgeRuleMatchExpr"
            }
          },
          "any": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EdgeRuleMatchExpr"
            }
          },
          "not": {
            "$ref": "#/components/schemas/EdgeRuleMatchExpr"
          },
          "field": {
            "type": "string",
            "example": "cookie:beta"
          },
          "op": {
            "type": "string",
            "enum": [
              "eq",
              "ne",
              "in",
              "not_in",
              "prefix",
              "suffix",
              "contains",
              "exists",
              "missing",
              "regex",
              "cidr",
              "in_list"
            ]
          },
          "value": {
            "type": "string",
            "maxLength": 256
          },
          "values": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "type": "string",
              "maxLength": 256
            }
          },
          "list": {
            "type": "string",
            "description": "Account list name for op in_list."
          }
        }
      },
      "EdgeRuleListResponse": {
        "description": "A reusable account-level list.",
        "type": "object",
        "required": [
          "id",
          "name",
          "kind",
          "item_count",
          "referenced_by",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "ip",
              "country",
              "host",
              "string",
              "asn"
            ]
          },
          "description": {
            "type": "string"
          },
          "item_count": {
            "type": "integer",
            "minimum": 0
          },
          "items": {
            "type": "array",
            "description": "Present when one list is fetched.",
            "items": {
              "type": "string"
            }
          },
          "referenced_by": {
            "type": "array",
            "description": "IDs of rules whose match conditions use the list.",
            "items": {
              "type": "string"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ListEdgeRuleListsResponse": {
        "description": "The account's edge-rule lists, without items.",
        "type": "object",
        "required": [
          "lists"
        ],
        "properties": {
          "lists": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EdgeRuleListResponse"
            }
          }
        }
      },
      "CreateEdgeRuleListRequest": {
        "description": "Create an edge-rule list.",
        "type": "object",
        "required": [
          "name",
          "kind"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
          },
          "kind": {
            "type": "string",
            "enum": [
              "ip",
              "country",
              "host",
              "string",
              "asn"
            ],
            "description": "ip (addresses and CIDRs, for client_ip), country (ISO 3166-1 alpha-2), host (exact hosts and *.suffix patterns), string (exact values, for path, header, cookie and query fields), asn (autonomous system numbers such as 13335 or AS13335, for asn)."
          },
          "description": {
            "type": "string",
            "maxLength": 500
          },
          "items": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 256
            }
          }
        }
      },
      "UpdateEdgeRuleListRequest": {
        "description": "Edit an edge-rule list: replace items, or add and remove some.",
        "type": "object",
        "properties": {
          "description": {
            "type": "string",
            "maxLength": 500
          },
          "items": {
            "type": "array",
            "description": "Replace every item. Cannot be combined with add or remove.",
            "items": {
              "type": "string",
              "maxLength": 256
            }
          },
          "add": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 256
            }
          },
          "remove": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 256
            }
          }
        }
      },
      "EdgeRuleEventsResponse": {
        "description": "A page of sampled edge-rule matches.",
        "type": "object",
        "required": [
          "since",
          "events"
        ],
        "properties": {
          "since": {
            "type": "string",
            "format": "date-time",
            "description": "Effective window start after the plan clamp."
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EdgeRuleEventResponse"
            }
          },
          "next_cursor": {
            "type": "string"
          }
        }
      },
      "EdgeRuleEventResponse": {
        "description": "One sampled request an edge rule matched, or a request a\nkind=waf rule detected as a likely attack.\nDetections carry the CRS rule IDs that scored, their attack\ncategories and the anomaly score, never the matched payload.\n",
        "type": "object",
        "required": [
          "id",
          "rule_id",
          "outcome",
          "occurred_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "rule_id": {
            "type": "string"
          },
          "rule_name": {
            "type": "string",
            "description": "Empty once the rule is deleted."
          },
          "rule_kind": {
            "type": "string"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "matched",
              "logged",
              "detected",
              "warned",
              "blocked",
              "challenged",
              "rejected",
              "solved",
              "failed",
              "boxed"
            ],
            "description": "matched (enforced rule) and logged (log-mode rule) are rule matches. detected is a kind=waf detection in a sampled request; warned and blocked are kind=waf detections in-path by a warn or block rule (blocked requests were answered with 403). challenged, rejected, solved and failed are kind=challenge outcomes: the challenge page served to a browser, a request that is not a browser navigation answered with 403, a solution that earned a pass, and a solution answered with 403. An enforced challenge rule records these instead of matched. boxed is a client put in a penalty box by the rule, recorded from the request whose refusal tipped it in."
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "request_id": {
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "host": {
            "type": "string"
          },
          "path": {
            "type": "string",
            "description": "Request path without the query string."
          },
          "client_ip": {
            "type": "string",
            "description": "Trusted client IP, when known."
          },
          "country": {
            "type": "string"
          },
          "user_agent": {
            "type": "string"
          },
          "waf_rule_ids": {
            "type": "array",
            "maxItems": 32,
            "description": "CRS rule IDs that scored in a kind=waf detection.",
            "items": {
              "type": "integer"
            }
          },
          "waf_categories": {
            "type": "array",
            "maxItems": 16,
            "description": "CRS attack categories of a kind=waf detection (sqli, xss, lfi, ...).",
            "items": {
              "type": "string"
            }
          },
          "waf_score": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000,
            "description": "CRS inbound anomaly score of a kind=waf detection."
          }
        }
      },
      "EdgeWAFReviewResponse": {
        "description": "An app's sampled kind=waf detections grouped for a false-positive review.",
        "type": "object",
        "required": [
          "since",
          "scanned",
          "truncated",
          "groups"
        ],
        "properties": {
          "since": {
            "type": "string",
            "format": "date-time",
            "description": "Start of the reviewed window",
            "after the plan clamp.": null
          },
          "scanned": {
            "type": "integer",
            "minimum": 0,
            "description": "Detection events read."
          },
          "truncated": {
            "type": "boolean",
            "description": "The window held more detections than a review reads (5,000 per outcome, newest first), so the oldest were left out."
          },
          "groups": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/EdgeWAFReviewGroup"
            }
          }
        }
      },
      "EdgeWAFReviewGroup": {
        "description": "One edge rule's detections by one CRS rule on one path.",
        "type": "object",
        "required": [
          "rule_id",
          "crs_rule_id",
          "category",
          "path",
          "events",
          "detected",
          "warned",
          "blocked",
          "clients",
          "top_client_percent",
          "scanner_percent",
          "first_seen",
          "last_seen",
          "request_ids",
          "excluded",
          "assessment",
          "reason"
        ],
        "properties": {
          "rule_id": {
            "type": "string"
          },
          "rule_name": {
            "type": "string"
          },
          "rule_mode": {
            "type": "string",
            "enum": [
              "observe",
              "warn",
              "block"
            ]
          },
          "crs_rule_id": {
            "type": "integer"
          },
          "category": {
            "type": "string",
            "description": "CRS attack category of the rule (sqli, xss, rce, lfi, rfi, php, java, generic, protocol, multipart, scanner, session_fixation, other)."
          },
          "path": {
            "type": "string",
            "description": "Request path with id-like segments (numbers, UUIDs, long hex or tokens) read as {id}."
          },
          "events": {
            "type": "integer",
            "minimum": 0
          },
          "detected": {
            "type": "integer",
            "minimum": 0,
            "description": "Detections in sampled requests."
          },
          "warned": {
            "type": "integer",
            "minimum": 0
          },
          "blocked": {
            "type": "integer",
            "minimum": 0
          },
          "clients": {
            "type": "integer",
            "minimum": 0,
            "description": "Distinct client IPs."
          },
          "top_client_percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Share of the group's detections from its busiest client."
          },
          "scanner_percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Share of the group's detections from clients flagged on 5 or more paths in the window."
          },
          "first_seen": {
            "type": "string",
            "format": "date-time"
          },
          "last_seen": {
            "type": "string",
            "format": "date-time"
          },
          "request_ids": {
            "type": "array",
            "maxItems": 3,
            "description": "The newest example request IDs; look them up with the events listing.",
            "items": {
              "type": "string"
            }
          },
          "known_false_positive": {
            "type": "string",
            "description": "The documented legitimate traffic this CRS rule flags."
          },
          "excluded": {
            "type": "boolean",
            "description": "The rule excludes this CRS rule now."
          },
          "assessment": {
            "type": "string",
            "enum": [
              "likely_false_positive",
              "likely_attack",
              "review",
              "excluded"
            ]
          },
          "reason": {
            "type": "string",
            "description": "Why the group got its assessment."
          }
        }
      },
      "EdgeWAFExclusionsRequest": {
        "description": "CRS rule IDs to add to and remove from a kind=waf rule's exclude_rule_ids.",
        "type": "object",
        "properties": {
          "add": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "type": "integer",
              "minimum": 900000,
              "maximum": 999999
            }
          },
          "remove": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "type": "integer",
              "minimum": 900000,
              "maximum": 999999
            }
          }
        }
      },
      "EdgeRuleStatsResponse": {
        "description": "Per-rule match counts over a window.",
        "type": "object",
        "required": [
          "window",
          "since",
          "rules"
        ],
        "properties": {
          "window": {
            "type": "string",
            "enum": [
              "1h",
              "24h",
              "7d"
            ]
          },
          "since": {
            "type": "string",
            "format": "date-time"
          },
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EdgeRuleHitStatsResponse"
            }
          },
          "cache_activity": {
            "$ref": "#/components/schemas/EdgeRuleCacheActivity"
          }
        }
      },
      "EdgeRuleCacheActivity": {
        "type": "object",
        "required": [
          "from",
          "until",
          "available",
          "rules"
        ],
        "properties": {
          "from": {
            "type": "string",
            "format": "date-time"
          },
          "until": {
            "type": "string",
            "format": "date-time"
          },
          "available": {
            "type": "boolean"
          },
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EdgeRuleCacheActivityRow"
            }
          }
        }
      },
      "EdgeRuleCacheActivityRow": {
        "type": "object",
        "required": [
          "rule_id",
          "edge_responses",
          "origin_requests",
          "refresh_wakes",
          "bypass_credentials",
          "bypass_request"
        ],
        "properties": {
          "eligible_gets": {
            "type": "integer",
            "minimum": 0,
            "description": "Public GET requests eligible for this cache rule."
          },
          "route_wakes": {
            "type": "integer",
            "minimum": 0,
            "description": "App wakes admitted by eligible GET requests."
          },
          "wake_refilled": {
            "type": "integer",
            "minimum": 0,
            "description": "Responses stored after a normal app wake."
          },
          "wake_refill_skipped": {
            "type": "integer",
            "minimum": 0,
            "description": "Refill opportunities that left the existing cache entry as it was."
          },
          "wake_refill_origin_requests": {
            "type": "integer",
            "minimum": 0,
            "description": "Origin GETs attempted by refill after a wake."
          },
          "wake_refill_used": {
            "type": "integer",
            "minimum": 0,
            "description": "Distinct refilled responses observed serving a visitor while fresh."
          },
          "rule_id": {
            "type": "string"
          },
          "edge_responses": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "origin_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Requests dispatched to the app, including retries and background refreshes."
          },
          "refresh_wakes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Background refresh admissions with a scheduler wake ID."
          },
          "bypass_credentials": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "bypass_request": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "EdgeRuleHitStatsResponse": {
        "description": "One rule's match counts over the window.",
        "type": "object",
        "required": [
          "rule_id",
          "matched",
          "logged"
        ],
        "properties": {
          "rule_id": {
            "type": "string"
          },
          "matched": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Requests an enforced rule matched."
          },
          "logged": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Requests a log-mode rule matched."
          },
          "series": {
            "type": "array",
            "description": "With series=true, matched plus logged per hour; the first value is the hour starting at since, the last the current hour.",
            "items": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          }
        }
      },
      "EdgeRuleRecipeSuggestionsResponse": {
        "description": "Protection recipes suggested from the app's traffic.",
        "type": "object",
        "required": [
          "window",
          "since",
          "suggestions"
        ],
        "properties": {
          "window": {
            "type": "string",
            "example": "7d",
            "description": "Telemetry window the suggestions read, in days: 7d, or the plan's telemetry retention when shorter."
          },
          "since": {
            "type": "string",
            "format": "date-time",
            "description": "Start of the telemetry window."
          },
          "suggestions": {
            "type": "array",
            "description": "Ranked suggestions, at most five.",
            "items": {
              "$ref": "#/components/schemas/EdgeRuleRecipeSuggestion"
            }
          }
        }
      },
      "EdgeRuleRecipeSuggestion": {
        "description": "One suggested protection recipe and why.",
        "type": "object",
        "required": [
          "recipe",
          "title",
          "reason"
        ],
        "properties": {
          "recipe": {
            "type": "string",
            "description": "Recipe id to add."
          },
          "title": {
            "type": "string",
            "description": "The recipe's title."
          },
          "reason": {
            "type": "string",
            "description": "What in the app's traffic led to the suggestion."
          },
          "params": {
            "type": "object",
            "description": "Recipe parameters to add it with; required parameters not listed must be supplied.",
            "additionalProperties": {
              "type": "string"
            }
          },
          "alternative": {
            "$ref": "#/components/schemas/EdgeRuleRecipeSuggestionAlternative"
          }
        }
      },
      "EdgeRuleRecipeSuggestionAlternative": {
        "description": "A softer recipe for the same observation, such as challenging browsers instead of rate-limiting.",
        "type": "object",
        "required": [
          "recipe",
          "title"
        ],
        "properties": {
          "recipe": {
            "type": "string",
            "description": "Recipe id of the alternative."
          },
          "title": {
            "type": "string",
            "description": "The alternative recipe's title."
          },
          "params": {
            "type": "object",
            "description": "Parameters to add the alternative with.",
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      },
      "EdgeRuleSetVersionResponse": {
        "description": "One recorded state of an app's whole edge-rule set.",
        "type": "object",
        "required": [
          "version",
          "rule_count",
          "rules_sha256",
          "created_at",
          "current"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "minimum": 1
          },
          "rule_count": {
            "type": "integer",
            "minimum": 0
          },
          "rules_sha256": {
            "type": "string",
            "description": "Digest of the recorded rule set."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "current": {
            "type": "boolean",
            "description": "True for the app's latest version."
          },
          "rules": {
            "type": "array",
            "description": "The recorded rules; present only when a single version is fetched.",
            "items": {
              "$ref": "#/components/schemas/EdgeRuleResponse"
            }
          }
        }
      },
      "RollbackEdgeRulesRequest": {
        "description": "Restore an app's edge rules to a recorded rule-set version.",
        "type": "object",
        "required": [
          "version"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "minimum": 1,
            "description": "The version to restore."
          }
        }
      },
      "EdgeRuleRouteAction": {
        "description": "Re-targets the matched request to another app owned by the same account.",
        "type": "object",
        "required": [
          "target_app_slug"
        ],
        "properties": {
          "target_app_slug": {
            "type": "string",
            "maxLength": 40,
            "example": "legacy-api"
          }
        }
      },
      "EdgeRuleRewriteAction": {
        "description": "Mutates the request path before forwarding.",
        "type": "object",
        "required": [
          "from",
          "to"
        ],
        "properties": {
          "from": {
            "type": "string",
            "maxLength": 2048,
            "example": "/api"
          },
          "to": {
            "type": "string",
            "maxLength": 2048,
            "example": "/v1"
          }
        }
      },
      "EdgeRuleRedirectAction": {
        "description": "3xx short-circuit.",
        "type": "object",
        "required": [
          "status_code",
          "to"
        ],
        "properties": {
          "status_code": {
            "type": "integer",
            "enum": [
              301,
              302,
              307,
              308
            ]
          },
          "to": {
            "type": "string",
            "maxLength": 2048
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Headers stamped on the redirect response."
          },
          "template": {
            "type": "boolean",
            "description": "Expand ${name} request values in `to` and in the\nheader values (host, path, method, query, client_ip, country, asn, request_id, header:<name>, query:<name>, cookie:<name>; $$ is a\nliteral $). The target must start with a literal \"/\" or\n\"http(s)://\", and only ${host} may appear before the path.\n"
          }
        }
      },
      "EdgeRuleHeaderOp": {
        "description": "One header mutation. `action` ∈ {add,set,remove}.",
        "type": "object",
        "required": [
          "name",
          "action"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 64
          },
          "value": {
            "type": "string",
            "maxLength": 4096
          },
          "action": {
            "type": "string",
            "enum": [
              "add",
              "set",
              "remove"
            ]
          },
          "template": {
            "type": "boolean",
            "description": "Expand ${name} request values in `value` (host, path, method, query, client_ip, country, asn, request_id, header:<name>, query:<name>, cookie:<name>;\n$$ is a literal $). Control characters are dropped and each\nvalue is capped at 1 KiB. Not allowed with action=remove.\n"
          },
          "secret": {
            "type": "boolean",
            "description": "Seal `value` (request headers only): it is\nstored encrypted to the edge seal domain and never returned.\nAuthorization, Proxy-Authorization, Cookie and names containing\ntoken, secret, password, api-key, apikey, signature or credential\nare sealed without it. Not allowed with template or action=remove.\n"
          },
          "secret_id": {
            "type": "string",
            "description": "The sealed value of a secret op, returned in place of `value`.\nSend it back with no `value` to keep that value.\n"
          },
          "redacted": {
            "type": "boolean",
            "description": "Set in responses on a credential-named value stored before\nsealing, which is left out. Send the op back with no `value` to\nseal the stored value.\n"
          }
        }
      },
      "EdgeRuleHeadersAction": {
        "description": "Mutates request + response headers. The gateway enforces a hard-coded blacklist (Host, Content-Length, Transfer-Encoding, Connection, x-faas-*).",
        "type": "object",
        "properties": {
          "request_headers": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/EdgeRuleHeaderOp"
            }
          },
          "response_headers": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/EdgeRuleHeaderOp"
            }
          }
        }
      },
      "CorsPresetResponse": {
        "description": "One cors_presets row. The\nid is a server-generated UUID; app_id is null on the\nwire for account-wide presets and a UUID for app-scoped\npresets (the SQL NULL marker is the canonical \"account-\nwide\" encoding; the empty string is not used). The\nallow_origins array accepts the same CorsOriginPattern\ngrammar as the inline EdgeRuleCORSAction field. The\ncreate-time gate enforces AllowCredentials: true +\nAllowOrigins: [\"*\"] ⇒ 422. Updated_at is\nbumped on every successful PATCH; the gateway's\nper-account overlay cache invalidates on pg_notify\n(cors_preset_changed).\n",
        "type": "object",
        "required": [
          "id",
          "account_id",
          "name",
          "allow_origins",
          "allow_methods",
          "allow_credentials",
          "max_age_seconds",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Optional app scoping. Null on the\nwire = account-wide preset (visible to every app on\nthe account). A UUID = app-scoped preset (visible\nonly to that one app; cross-tenant IDOR collapses to\n404).\n"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "example": "public-https"
          },
          "description": {
            "type": "string",
            "maxLength": 256,
            "example": "Origins allowed on every public-facing endpoint."
          },
          "allow_origins": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "pattern": "^(\\\\*|https?://(?:\\\\*\\\\.[a-zA-Z0-9.\\\\-]+|localhost)(?::\\\\*|\\\\:[0-9]+)?|https?://[a-zA-Z0-9.\\\\-]+(?::\\\\*|\\\\:[0-9]+)?)$"
            }
          },
          "allow_methods": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string"
            }
          },
          "allow_headers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "expose_headers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "allow_credentials": {
            "type": "boolean",
            "default": false
          },
          "max_age_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreateCorsPresetRequest": {
        "description": "Body for POST /v1/cors-presets. The customer must supply\nat least one allow_origin and one allow_method. AppID is\noptional on the wire (null pointer = \"account-wide\",\nnon-nil = \"app-scoped\"); the handler maps the\npointer-nil case to a SQL NULL on insert. Name length\nis 1..64 characters (cors_presets_name_check). The\n*+credentials footgun is enforced at\nvalidate-time.\n",
        "type": "object",
        "required": [
          "name",
          "allow_origins",
          "allow_methods",
          "allow_credentials",
          "max_age_seconds"
        ],
        "properties": {
          "app_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Optional app scoping. Null = account-wide. Set to a\nUUID = app-scoped.\n"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "description": {
            "type": "string",
            "maxLength": 256
          },
          "allow_origins": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "pattern": "^(\\\\*|https?://(?:\\\\*\\\\.[a-zA-Z0-9.\\\\-]+|localhost)(?::\\\\*|\\\\:[0-9]+)?|https?://[a-zA-Z0-9.\\\\-]+(?::\\\\*|\\\\:[0-9]+)?)$"
            }
          },
          "allow_methods": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string"
            }
          },
          "allow_headers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "expose_headers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "allow_credentials": {
            "type": "boolean",
            "default": false
          },
          "max_age_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400
          }
        }
      },
      "UpdateCorsPresetRequest": {
        "description": "Body for PATCH /v1/cors-presets/{id}. Every field is\noptional (PATCH nil-skip convention). At least one field\nmust be present (an empty PATCH is rejected with 422\ncors_preset_update_requires_field). The same partial\ngrammar check that fires on CreateCorsPresetRequest\n(CorsOriginPattern, *+credentials footgun) fires here\non the partial payload; the API handler additionally\nre-validates against the merged post-update shape so a\nPATCH that flips AllowCredentials to true while leaving\nAllowOrigins=[\"*\"] is rejected.\n\napp_id uses the **string tri-state: outer null = \"do\nnot touch\", inner null = \"set to NULL (account-wide)\",\ninner non-null = \"set to UUID (app-scoped)\".\n",
        "type": "object",
        "properties": {
          "app_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Optional app scoping. Outer null = do not touch.\nInner null = set to NULL (account-wide). Inner\nnon-null = set to UUID (app-scoped).\n"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "description": {
            "type": "string",
            "maxLength": 256
          },
          "allow_origins": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "pattern": "^(\\\\*|https?://(?:\\\\*\\\\.[a-zA-Z0-9.\\\\-]+|localhost)(?::\\\\*|\\\\:[0-9]+)?|https?://[a-zA-Z0-9.\\\\-]+(?::\\\\*|\\\\:[0-9]+)?)$"
            }
          },
          "allow_methods": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string"
            }
          },
          "allow_headers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "expose_headers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "allow_credentials": {
            "type": "boolean"
          },
          "max_age_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400
          }
        }
      },
      "CorsPresetListResponse": {
        "description": "GET /v1/cors-presets list shape. The (account-wide,\napp-scoped) order mirrors ListCorsPresetsForAccount:\naccount-wide rows first (app_id IS NULL), then\napp-scoped rows, both ordered by name.\n",
        "type": "object",
        "required": [
          "presets"
        ],
        "properties": {
          "presets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CorsPresetResponse"
            }
          }
        }
      },
      "EdgeRuleCORSAction": {
        "description": "Stamps CORS headers + handles preflight in-process.",
        "type": "object",
        "required": [
          "allow_origins",
          "allow_methods"
        ],
        "properties": {
          "cors_preset_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Optional CORS preset reference. When set, the rule's resolved CORS action is\nthe merged union of the preset's fields and the rule's\ninline fields — with the rule taking precedence for any\nnon-empty inline field. Mutually exclusive with inline\nfields: if cors_preset_id is set, allow_origins,\nallow_methods, allow_headers, expose_headers,\nallow_credentials, and max_age_seconds must all be empty\n/ unset. The preset is referenced by id (UUID); an\ninvalid id (cross-tenant, deleted) causes the rule to\nbe silently dropped from the gateway's compiled slice\n(the request matches no rule, returning 404 from the\nroute layer).\n"
          },
          "allow_origins": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "pattern": "^(\\\\*|https?://(?:\\\\*\\\\.[a-zA-Z0-9.\\\\-]+|localhost)(?::\\\\*|\\\\:[0-9]+)?|https?://[a-zA-Z0-9.\\\\-]+(?::\\\\*|\\\\:[0-9]+)?)$"
            }
          },
          "allow_methods": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string"
            }
          },
          "allow_headers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "expose_headers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "allow_credentials": {
            "type": "boolean",
            "default": false
          },
          "max_age_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400
          }
        }
      },
      "MCPResourcePolicy": {
        "description": "Opt-in MCP resource-server policy on a JWT edge rule. Requires a\ncanonical HTTPS resource, matching JWT audience, match_path=/**,\nand no method or header selectors. The gateway serves OAuth resource\nmetadata, rejects expired credentials, and enforces JSON-RPC execution\nscopes. Catalog filtering and task ownership remain application duties.\n",
        "type": "object",
        "required": [
          "resource"
        ],
        "properties": {
          "resource": {
            "type": "string",
            "format": "uri"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 256
          },
          "allowed_origins": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            }
          },
          "tool_scopes": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "resource_scopes": {
            "description": "Absolute URIs or simple variable templates; every matching entry must authorize access.",
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "prompt_scopes": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "EdgeRuleJWTAction": {
        "description": "Validates an inbound Bearer JWT against a JWKS endpoint. The\nalgorithm allowlist is asymmetric-only and the selected JWK's\n`alg` metadata must match the JWT header; a JWK with `use=enc`\nis rejected (RFC 8725 §3.1, RFC 7517).\n",
        "type": "object",
        "required": [
          "issuer",
          "jwks_url",
          "algorithms"
        ],
        "properties": {
          "issuer": {
            "type": "string",
            "example": "https://idp.example.com/"
          },
          "audience": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "jwks_url": {
            "type": "string",
            "maxLength": 2048,
            "pattern": "^https://",
            "example": "https://idp.example.com/.well-known/jwks.json"
          },
          "algorithms": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "enum": [
                "RS256",
                "RS384",
                "RS512",
                "ES256",
                "ES384",
                "ES512"
              ]
            }
          },
          "required_claims": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "mcp": {
            "$ref": "#/components/schemas/MCPResourcePolicy"
          },
          "platform_tenant_external_ref_claim": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[^\\s]{1,128}$",
            "description": "Optional verified custom JWT claim name whose exact value resolves to a platform tenant external_ref in the app owner's account. Supports namespaced claims. When set, unknown, suspended, or unavailable tenants are rejected before the request reaches the guest."
          },
          "require_exp": {
            "type": "boolean",
            "description": "Reject tokens that carry no `exp` claim. Defaults to true when omitted, because a token minted without `exp` never expires; set false to accept such tokens (`exp` is then validated only when present). Rules saved before this default keep their saved value, and responses show the field only when it is true."
          }
        }
      },
      "EdgeRuleIPAction": {
        "description": "CIDR allow/deny evaluator. Deny is checked AFTER allow so a single-IP deny wins.",
        "type": "object",
        "properties": {
          "allow": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "cidr"
            }
          },
          "deny": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "cidr"
            }
          }
        }
      },
      "EdgeRuleValidateParameters": {
        "description": "Path, query, and header validation for a kind=validate rule\n(request parameters). Each schema is a JSON\nSchema object whose properties are parameter names; property types\nmust be string, integer, number, boolean, or an array of those.\nRequest values are converted to the declared type before\nvalidation, and a value that does not convert stays a string so\nthe schema reports it. All three are checked before the body is\nread, in the rule's validate_mode; errors name the location\n(`path/id`, `query/limit`, `headers/x-tenant`).\n",
        "type": "object",
        "properties": {
          "path_template": {
            "type": "string",
            "description": "OpenAPI path template, such as `/users/{id}`. Required with\n`path`. The rule's `match_path` must equal the template with\neach placeholder replaced by `?*` (`/users/?*`), and each\nsegment may hold at most one placeholder.\n"
          },
          "path": {
            "type": "object",
            "additionalProperties": true,
            "description": "Object schema whose properties are exactly the template's placeholders."
          },
          "query": {
            "type": "object",
            "additionalProperties": true,
            "description": "Object schema over every query parameter; a repeated name\nbecomes an array, and `additionalProperties: false` rejects\nunknown parameters.\n"
          },
          "headers": {
            "type": "object",
            "additionalProperties": true,
            "description": "Object schema over the headers it declares, named in lowercase.\nComma-separated values become an array for array properties.\n"
          }
        }
      },
      "EdgeRuleValidateAction": {
        "description": "Customer-supplied JSON Schema (Draft 2020-12) evaluated against\nthe inbound request body BEFORE the wake gate fires. The\nkind=validate rule is the platform's API-native request-\nvalidation surface: rejections return 422\n`request_validation_failed` with `Problem.errors` carrying\nper-field detail, never pay a cold-boot cost, never consume\nthe rate-limit / wake-quota budget on malformed traffic.\n\nFree-and-above (no plan gate). Schema lives inline in the\n`action` jsonb blob (single-table flow), capped at the\nplatform's `MaxEdgeRuleValidateSchemaBytes` (64 KiB). The\ngateway re-validates at compile time as defence-in-depth so\nthe SQL hotfix path that bypasses API-Validate still cannot\nship an external `$ref`.\n\nField-by-field:\n  * `schema` — JSON Schema document (Draft 2020-12) for the\n    request body. Capped at 64 KiB. External `$ref` / `$id` URLs\n    are rejected at create-time; internal pointers\n    (`#/definitions/Foo`) pass through. Optional when\n    `parameters` is set, so a body-less request can be validated.\n  * `parameters` — optional path, query, and header schemas,\n    checked before the body is read.\n  * `content_types` — optional media-type allowlist.\n    Closed set `application/*`. Empty = match any.\n  * `apply_while_streaming` — per-rule opt-in for the\n    streaming response path. Default false mirrors\n    the `Accept: application/json` opt-out.\n  * `reject_on_unknown_fields` — toggles\n    `additionalProperties: false` on the compiled schema.\n    Default false preserves byte-stable schemas.\n  * `max_body_bytes` — per-rule inbound body cap. 0 =\n    inherit `MaxRequestBodyBytes` (per-plan 25 MB buffered /\n    100 MB streaming). Must be > 0 and <= `MaxRequestBodyBytes`.\nAt least one of `schema` and `parameters` is required.\n",
        "type": "object",
        "properties": {
          "schema": {
            "type": "object",
            "description": "Inline JSON Schema document (Draft 2020-12). The schema\nis preserved byte-exact across the API↔the gateway round-trips\nso the SHA-256 cache key is stable.\n",
            "additionalProperties": true
          },
          "parameters": {
            "$ref": "#/components/schemas/EdgeRuleValidateParameters"
          },
          "content_types": {
            "type": "array",
            "description": "Optional media-type allowlist. Every entry must start\nwith `application/`. Empty array = match any Content-Type.\n",
            "items": {
              "type": "string"
            }
          },
          "apply_while_streaming": {
            "type": "boolean",
            "description": "Whether validation fires on the streaming response path. Default false; set true per-rule to opt the\nSSE / chunked response path into body validation.\n"
          },
          "reject_on_unknown_fields": {
            "type": "boolean",
            "description": "Toggles `additionalProperties: false` on the compiled\nschema. Default false so a body with stray fields does\nnot silently fail; opt in per-rule for strict schemas.\n"
          },
          "max_body_bytes": {
            "type": "integer",
            "minimum": 0,
            "description": "Per-rule inbound body cap. 0 (default) inherits the\nplatform cap (`api.MaxRequestBodyBytes`). When set, must\nbe > 0 and <= the platform cap.\n"
          },
          "validate_mode": {
            "type": "string",
            "enum": [
              "block",
              "observe",
              "warn"
            ],
            "default": "block",
            "deprecated": true,
            "description": "DEPRECATED. Moved to top-level\n`EdgeRuleResponse.validate_mode` /\n`CreateEdgeRuleRequest.validate_mode` /\n`UpdateEdgeRuleRequest.validate_mode`. Retained on\nthe action body for the back-compat read window.\nHow the gateway handles a schema mismatch. `block`\nrejects with 422 (the strictest mode; preserves the\npre-2026 behaviour). `observe` counts via the metric\nand proxies normally. `warn` does the same and stamps\n`X-Validation-Warning: <rule_id>` on the response.\nAn empty / omitted value is coerced to `block` at the\ngateway-side handler.\n"
          }
        }
      },
      "EdgeRuleRetryAction": {
        "description": "Request replay against a different healthy instance\n(kind=retry).\n\nThere is deliberately NO \"retry on status\" field. Only a\nTRANSPORT failure may arm a replay — a guest that answered 5xx\nhas served the request, and replaying it would run the\ncustomer's side effects a second time — so the set of\nretryable conditions is not configurable.\n\nA replay additionally requires that the response has not\ncommitted, a healthy sibling exists, the aggregate per-app\nretry budget has capacity, and the remaining `kind=budget`\nallowance is at least `min_remaining_ms`. A retry can never\nextend a request's deadline.\n",
        "type": "object",
        "properties": {
          "max_attempts": {
            "type": "integer",
            "minimum": 2,
            "maximum": 3,
            "default": 2,
            "description": "Total attempts, NOT retries: 2 means the original plus one\nreplay. 0 applies the default (2). 1 is rejected — it is a\nsilent no-op that reads like protection.\n\nThe ceiling is deliberately tight: every replay holds\nanother instance's concurrency slot for the duration of the\nrequest, so a high attempt count multiplies load against\nyour own capacity at exactly the moment instances are\nalready failing.\n"
          },
          "allow_non_idempotent": {
            "type": "boolean",
            "default": false,
            "description": "Opt POST and PATCH into replay. Off by default. Even when\nenabled, these methods are replayed only when the request\ncarries a non-empty `Idempotency-Key` header.\n\nThis is the only field here that can cost correctness\nrather than latency: your handler must honor the key and\nreturn the stored result instead of repeating the side\neffect. GET, HEAD, OPTIONS, TRACE, PUT and DELETE are\nreplayed without this flag.\n"
          },
          "min_remaining_ms": {
            "type": "integer",
            "minimum": 0,
            "maximum": 30000,
            "default": 250,
            "description": "Request-budget floor below which a replay is skipped. 0\napplies the default (250ms). Below this floor a retry\nmostly converts a 502 into a 504 without improving the\noutcome.\n"
          },
          "backoff_ms": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000,
            "default": 0,
            "description": "Delay before a replay. Defaults to 0 because the failure\nbeing retried is a dead peer, not a loaded one, and the\nnext instance is a different process — so waiting buys\nnothing. Raise it only when the sibling may still be\nwaking.\n"
          },
          "budget_percent": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 10,
            "description": "Aggregate replay allowance as a percentage of original\nrequests in the gateway's short per-app window. For\nexample, 10 permits at most one replay per ten originals,\npreventing a broad outage from doubling all traffic.\n"
          },
          "budget_min_retries": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32,
            "default": 1,
            "description": "Minimum replay allowance per app and accounting window.\nThe default preserves one recovery opportunity for a\nlow-traffic app even when budget_percent rounds down.\n"
          }
        }
      },
      "EdgeRuleCircuitBreakerAction": {
        "description": "Instance health thresholds (kind=circuit_breaker).\n\nThis rule TUNES a breaker that already runs for every app on\nevery plan; it does not enable protection. With no rule your\napp is still protected from a flapping instance by the\nplatform defaults below.\n\nStates are closed → open → half_open. In half_open exactly one\nrequest is admitted as a probe: success closes the circuit and\nresets the backoff, failure returns it to open with the\ninterval doubled, up to `max_open_seconds`.\n",
        "type": "object",
        "properties": {
          "failure_threshold": {
            "type": "number",
            "format": "double",
            "exclusiveMinimum": 0,
            "maximum": 1,
            "default": 0.5,
            "description": "Failure RATIO (not a count) at or above which a closed\nbreaker opens. Consulted only once `min_requests`\nobservations exist inside the window. 0 applies the\ndefault (0.5).\n"
          },
          "min_requests": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000,
            "default": 5,
            "description": "Minimum observations inside `window_seconds` before the\nratio is consulted at all. 0 applies the default (5).\n\nThis is the field most likely to be set badly. At 1 a\nsingle transport blip opens the circuit, which on a route\nserving one request a minute reads as a 100% failure rate.\n"
          },
          "window_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 300,
            "default": 10,
            "description": "Rolling failure window. 0 applies the default (10s).\n"
          },
          "open_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3600,
            "default": 5,
            "description": "First open interval before a half-open probe is offered. 0\napplies the default (5s). Each failed probe doubles the\ninterval up to `max_open_seconds`.\n"
          },
          "max_open_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3600,
            "default": 60,
            "description": "Ceiling the exponential backoff grows toward. 0 applies the\ndefault (60s). Must be at least `open_seconds`. The cap is\n1 hour: a longer bench outlives most instances, so the\nbreaker would be holding state about a target that no\nlonger exists.\n"
          }
        }
      },
      "CacheRefreshRequest": {
        "type": "object",
        "properties": {
          "undo_receipt_id": {
            "type": "string",
            "format": "uuid",
            "description": "Undo this confirmed publish. Omit all other fields."
          },
          "retain_previous": {
            "type": "boolean",
            "default": false,
            "description": "Keep one eligible previous verified snapshot for undo. Requires expected_release_id."
          },
          "host": {
            "type": "string",
            "description": "Exact verified hostname attached to this app. Defaults to its Gregale hostname."
          },
          "allow_wake": {
            "type": "boolean",
            "default": false,
            "description": "Allow this publish to wake a parked app."
          },
          "expected_release_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "description": "Optional case-sensitive release ID. Every response must return this ID in one X-Content-Version header. Use visible ASCII without commas or spaces."
          },
          "additional_rule_ids": {
            "type": "array",
            "maxItems": 4,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^[0-9a-fA-F]{32}$"
            },
            "description": "Additional rules for distinct exact GET paths on the same app and hostname."
          }
        }
      },
      "StartDeploymentCacheCandidateRequest": {
        "type": "object",
        "required": [
          "plan_version"
        ],
        "properties": {
          "plan_version": {
            "type": "string",
            "description": "Saved plan version returned by a cache check waiting for a ready candidate."
          }
        }
      },
      "CacheStagingProgress": {
        "type": "object",
        "required": [
          "prepared",
          "ready_gateways",
          "serving_gateways"
        ],
        "properties": {
          "prepared": {
            "type": "boolean",
            "description": "Whether this attempt has a valid snapshot awaiting promotion."
          },
          "ready_gateways": {
            "type": "integer",
            "minimum": 0
          },
          "serving_gateways": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "DeploymentCachePreflight": {
        "type": "object",
        "required": [
          "deployment_id",
          "plan_version",
          "host",
          "checked_at",
          "routes"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "plan_version": {
            "type": "string"
          },
          "host": {
            "type": "string"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "prepared_until": {
            "type": "string",
            "format": "date-time",
            "description": "When the privately prepared responses expire."
          },
          "routes": {
            "type": "array",
            "minItems": 1,
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/DeploymentCachePreflightRoute"
            }
          }
        }
      },
      "DeploymentCachePreflightRoute": {
        "type": "object",
        "required": [
          "path",
          "result"
        ],
        "properties": {
          "path": {
            "type": "string"
          },
          "result": {
            "type": "string",
            "enum": [
              "eligible",
              "needs_attention",
              "waiting"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "candidate_not_running",
              "rule_changed",
              "response_unavailable",
              "unexpected_status",
              "response_too_large",
              "incomplete_response",
              "sets_cookie",
              "cache_control",
              "unsupported_vary",
              "invalid_cache_tags"
            ]
          },
          "http_status": {
            "type": "integer",
            "description": "Status returned by the candidate, when available."
          }
        }
      },
      "CacheDeployPlan": {
        "type": "object",
        "required": [
          "enabled"
        ],
        "properties": {
          "refill_after_wake": {
            "type": "boolean",
            "description": "Refill missing or near-expiry routes during an existing production wake window."
          },
          "version": {
            "type": "string",
            "readOnly": true,
            "description": "Saved plan version used to identify stale candidate checks."
          },
          "enabled": {
            "type": "boolean",
            "description": "Enable the group for future full production cutovers. False removes the saved selection."
          },
          "host": {
            "type": "string",
            "maxLength": 253,
            "description": "Exact verified production hostname. Defaults to the app's Gregale hostname."
          },
          "rule_ids": {
            "type": "array",
            "minItems": 1,
            "maxItems": 5,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^(?:[0-9a-fA-F]{32}|[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"
            },
            "description": "Required when enabled. Distinct rules for exact public GET paths on the same hostname."
          },
          "allow_wake": {
            "type": "boolean",
            "default": false
          },
          "retain_previous": {
            "type": "boolean",
            "default": false,
            "description": "Keep an eligible previously verified snapshot for undo."
          },
          "notification_channel_ids": {
            "type": "array",
            "maxItems": 5,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Optional Slack or email channels in this account for terminal production refresh failures and actionable canary cache holds."
          },
          "canary_preparation_policy": {
            "type": "string",
            "enum": [
              "hold",
              "regular_refresh"
            ],
            "description": "Prepare the saved group at the final production canary step. Omit to refresh after cutover. On preparation failure hold the split or continue with regular refresh."
          },
          "wake_refill_controls": {
            "type": "object",
            "readOnly": true,
            "description": "Per-rule after-wake settings keyed by cache rule ID.",
            "additionalProperties": {
              "$ref": "#/components/schemas/CacheWakeRefillControl"
            }
          },
          "wake_refill_evidence": {
            "type": "object",
            "readOnly": true,
            "description": "Completed freshness windows and observed use over the last seven days of the current plan.",
            "additionalProperties": {
              "$ref": "#/components/schemas/CacheWakeRefillEvidence"
            }
          },
          "wake_refill_impact": {
            "readOnly": true,
            "$ref": "#/components/schemas/CacheWakeRefillImpact"
          }
        }
      },
      "CacheWakeRefillPause": {
        "type": "object",
        "required": [
          "rule_id",
          "paused"
        ],
        "properties": {
          "rule_id": {
            "type": "string"
          },
          "paused": {
            "type": "boolean"
          }
        }
      },
      "CacheWakeRefillControl": {
        "type": "object",
        "required": [
          "paused",
          "changed_at"
        ],
        "properties": {
          "paused": {
            "type": "boolean"
          },
          "changed_at": {
            "type": "string",
            "format": "date-time"
          },
          "enabled_since": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CacheWakeRefillEvidence": {
        "type": "object",
        "required": [
          "completed",
          "used",
          "suggest_pause"
        ],
        "properties": {
          "completed": {
            "type": "integer",
            "minimum": 0
          },
          "used": {
            "type": "integer",
            "minimum": 0
          },
          "suggest_pause": {
            "type": "boolean"
          }
        }
      },
      "CacheWakeRefillWindow": {
        "type": "object",
        "required": [
          "from",
          "until",
          "eligible_gets",
          "wakes",
          "extra_origin_gets"
        ],
        "properties": {
          "from": {
            "type": "string",
            "format": "date-time"
          },
          "until": {
            "type": "string",
            "format": "date-time"
          },
          "eligible_gets": {
            "type": "integer",
            "minimum": 0
          },
          "wakes": {
            "type": "integer",
            "minimum": 0
          },
          "extra_origin_gets": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "CacheWakeRefillImpact": {
        "type": "object",
        "required": [
          "state"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "ready",
              "collecting",
              "baseline_unavailable",
              "unavailable",
              "low_traffic"
            ]
          },
          "before": {
            "$ref": "#/components/schemas/CacheWakeRefillWindow"
          },
          "after": {
            "$ref": "#/components/schemas/CacheWakeRefillWindow"
          }
        }
      },
      "CanaryCacheRecovery": {
        "description": "One recovery choice for a failed preparation on this release.",
        "type": "object",
        "required": [
          "hold_id",
          "action"
        ],
        "properties": {
          "hold_id": {
            "type": "string",
            "format": "uuid"
          },
          "action": {
            "type": "string",
            "enum": [
              "retry",
              "regular_refresh"
            ]
          }
        }
      },
      "CanaryCachePreparation": {
        "description": "Preparation and outcome for the final canary promotion.",
        "type": "object",
        "required": [
          "state",
          "policy",
          "requested_at"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "queued",
              "preparing",
              "ready",
              "failed",
              "prepared",
              "regular_refresh",
              "cancelled"
            ]
          },
          "policy": {
            "type": "string",
            "enum": [
              "hold",
              "regular_refresh"
            ]
          },
          "detail": {
            "type": "string"
          },
          "requested_at": {
            "type": "string",
            "format": "date-time"
          },
          "checks_passed_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the final rollout checks first passed for this cache plan."
          },
          "prestaged": {
            "type": "boolean",
            "description": "Preparation started during the final canary stage."
          },
          "ready_at": {
            "type": "string",
            "format": "date-time"
          },
          "cutover_at": {
            "type": "string",
            "format": "date-time"
          },
          "fresh_until": {
            "type": "string",
            "format": "date-time"
          },
          "hold_id": {
            "type": "string",
            "format": "uuid",
            "description": "The exact failed preparation that can accept a recovery choice."
          },
          "held_at": {
            "type": "string",
            "format": "date-time"
          },
          "recovery_action": {
            "type": "string",
            "enum": [
              "retry",
              "regular_refresh"
            ]
          },
          "recovery_at": {
            "type": "string",
            "format": "date-time"
          },
          "recovery_actor": {
            "type": "string"
          }
        }
      },
      "RetryDeploymentCacheRefreshRequest": {
        "type": "object",
        "required": [
          "receipt_id"
        ],
        "properties": {
          "receipt_id": {
            "type": "string",
            "format": "uuid",
            "description": "The failed automatic refresh receipt to retry."
          }
        }
      },
      "CacheCutoverActivity": {
        "type": "object",
        "required": [
          "state"
        ],
        "description": "Sampled gateway estimates for eligible GET responses in the first minute after a production cache cutover.",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "collecting",
              "estimated",
              "unavailable"
            ]
          },
          "eligible_gets": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "fresh_hits": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "app_wakes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "CacheRefreshReceipt": {
        "type": "object",
        "required": [
          "id",
          "host",
          "path",
          "state",
          "allow_wake",
          "woke_app",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "rule_id": {
            "type": "string",
            "description": "Primary cache rule used to read the receipt or request undo."
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Deployment verified by an automatic refresh."
          },
          "host": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "paths": {
            "type": "array",
            "minItems": 2,
            "maxItems": 5,
            "items": {
              "type": "string"
            },
            "description": "All selected paths, including the primary path, for a grouped refresh."
          },
          "expected_release_id": {
            "type": "string",
            "maxLength": 128,
            "description": "The release ID the caller asked Gregale to verify."
          },
          "observed_release_id": {
            "type": "string",
            "maxLength": 128,
            "description": "The valid release ID returned by the failed route when it differs from the expected ID."
          },
          "failed_path": {
            "type": "string",
            "description": "Path that prevented the group from publishing, when known."
          },
          "state": {
            "type": "string",
            "enum": [
              "queued",
              "waiting_for_app",
              "refreshing",
              "publishing",
              "active",
              "failed"
            ]
          },
          "reason": {
            "type": "string",
            "description": "Reason for a failed or no-longer-current replacement."
          },
          "allow_wake": {
            "type": "boolean"
          },
          "woke_app": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "published_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the replacement entered the gateway publication ledger."
          },
          "prepared_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the responses used by this receipt were prepared."
          },
          "cutover_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the deployment took all production traffic."
          },
          "first_minute": {
            "$ref": "#/components/schemas/CacheCutoverActivity"
          },
          "confirmed_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the serving gateways had all acknowledged the replacement."
          },
          "fresh_until": {
            "type": "string",
            "format": "date-time"
          },
          "revision": {
            "type": "integer",
            "format": "int64"
          },
          "gateway_progress": {
            "$ref": "#/components/schemas/RuntimePolicyComponentStatus"
          },
          "undo": {
            "$ref": "#/components/schemas/CacheRefreshUndo"
          },
          "restored_from_receipt_id": {
            "type": "string",
            "format": "uuid",
            "description": "Receipt whose cached responses were restored."
          },
          "retry_of_receipt_id": {
            "type": "string",
            "format": "uuid",
            "description": "The failed production refresh attempt that this receipt retries."
          },
          "retry_available": {
            "type": "boolean",
            "description": "Whether the failed attempt is eligible to be retried on its production deployment."
          }
        }
      },
      "CacheRefreshUndo": {
        "type": "object",
        "required": [
          "release_id",
          "published_at",
          "expires_at"
        ],
        "properties": {
          "release_id": {
            "type": "string"
          },
          "published_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CacheCheckRequest": {
        "type": "object",
        "required": [
          "path"
        ],
        "properties": {
          "host": {
            "type": "string",
            "maxLength": 253,
            "description": "The app's Gregale hostname or a verified custom domain attached to the app. Defaults to the Gregale hostname."
          },
          "path": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4096,
            "description": "The concrete path and optional query string on the selected hostname."
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "HEAD"
            ],
            "default": "GET"
          }
        }
      },
      "CacheCheckResult": {
        "type": "object",
        "required": [
          "status",
          "outcome"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599,
            "description": "The HTTP status returned by the live request."
          },
          "outcome": {
            "type": "string",
            "enum": [
              "hit",
              "miss",
              "stale",
              "bypassed",
              "unconfirmed"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "credentials",
              "request_ineligible",
              "response_cache_control",
              "different_rule",
              "no_cache_decision"
            ]
          },
          "age_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "The age of a confirmed cached response when available."
          }
        }
      },
      "EdgeRuleCacheAction": {
        "description": "Edge-cache control primitive (kind=cache). Wraps the\nresponse body in a per-route freshness window so a wake-elision\ncache absorbs repeat traffic without paying a cold-boot cost.\n\nField-by-field:\n  * `max_age_seconds` — required. Fresh window in seconds. The\n    API-side default is 60; the absolute platform cap is 3600\n    (`api.ResponseCacheMaxAgeMaxSeconds`). The runtime cache\n    layer re-checks this\n    cap as defence-in-depth.\n  * `stale_while_revalidate_seconds` — optional. After the fresh\n    window, return the cached response immediately while one\n    gateway request refreshes the key in the background. Default\n    0 (disabled); absolute cap 300.\n  * `refresh_only_when_awake` — optional. A background refresh\n    uses an already-running instance of the selected deployment.\n    Requires a positive stale-while-revalidate window and\n    stale-if-error set to 0. The sum of the fresh and revalidate\n    windows is the maximum response age.\n  * `stale_if_error_seconds` — required. Stale-on-error window\n    in seconds; 0 disables it (the API does not replace 0 with a\n    default, so send 300 explicitly for the recommended\n    window). Absolute cap 300\n    (`api.ResponseCacheStaleIfErrorMaxSeconds`). During an\n    upstream error the gateway returns the cached body within\n    this window instead of 502/504.\n  * `vary_on` — optional closed vocabulary of non-credential\n    request headers that participate in the cache key.\n    Allowed values: `Accept-Language`, `Accept-Encoding`.\n    Credential-bearing headers (Authorization, Cookie) are\n    deliberately excluded — authed requests bypass the cache\n    entirely.\n  * `methods` — optional closed vocabulary of HTTP methods\n    eligible for caching. Allowed values: `GET`, `HEAD`.\n    POST/PUT/PATCH/DELETE are deliberately excluded —\n    caching their responses is either incorrect (idempotency\n    breaks under retry) or unsafe (cross-user state).\n",
        "type": "object",
        "required": [
          "max_age_seconds",
          "stale_if_error_seconds"
        ],
        "properties": {
          "max_age_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 3600,
            "default": 60,
            "description": "Fresh window in seconds. 0 = inherit the API-side default\n(60s). Values above the platform cap\n(3600s = 1 hour) are rejected with 422.\n"
          },
          "stale_while_revalidate_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 300,
            "default": 0,
            "description": "After the fresh window, serve stale for this many seconds\nwhile a single coalesced background request refreshes the\ncache key. 0 disables stale-while-revalidate.\n"
          },
          "refresh_only_when_awake": {
            "type": "boolean",
            "default": false,
            "description": "Refresh in the background only when the selected deployment\nis already running. On a miss or after the freshness and\nrevalidation windows expire, the request can wake the app.\nRequires stale_while_revalidate_seconds above 0 and\nstale_if_error_seconds set to 0.\n"
          },
          "stale_if_error_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 300,
            "default": 300,
            "description": "Stale-on-error window in seconds. 0 = no stale-on-error\n(errors return 502/504 directly). Values above the\nplatform cap (300s = 5 minutes) are rejected with 422.\n"
          },
          "vary_on": {
            "type": "array",
            "description": "Non-credential request headers that participate in the\ncache key. Closed vocabulary:\n  - `Accept-Language`\n  - `Accept-Encoding`\nEmpty array (default) collapses to no extra key\ndimensions; the URL path + query alone drives cache\nidentity.\n",
            "items": {
              "type": "string",
              "enum": [
                "Accept-Language",
                "Accept-Encoding"
              ]
            }
          },
          "methods": {
            "type": "array",
            "description": "HTTP methods eligible for caching. Closed vocabulary:\n  - `GET`\n  - `HEAD`\nEmpty array (default) collapses to the runtime's\ncacheability predicate (GET + HEAD). POST/PUT/PATCH/DELETE\nare deliberately absent.\n",
            "items": {
              "type": "string",
              "enum": [
                "GET",
                "HEAD"
              ]
            }
          }
        }
      },
      "EdgeRuleLimitAction": {
        "description": "Standalone per-route body-size cap.\nThe primitive for \"POST /upload ≤ 5 MB, POST /users ≤ 1 MB,\nPOST /webhooks ≤ 2 MB\" without shipping a JSON Schema. The\nhot-path applier installs a body-size limit\non the inbound body and short-circuits oversize requests\nwith 413 `request_too_large` — and, more importantly,\nperforms a Content-Length fast-path deny so a 30 MB body on\na 5 MB cap costs zero bytes of buffering (a `MaxBytesReader`\nalone only trips when something reads the body, and on this\nhot path nothing reads it until the proxy leg).\n\nRejections never reach the wake gate, the auth chain, or the\nrate limiter — same posture as kind=validate. Free-and-above\n(no plan gate).\n\nField-by-field:\n  * `max_body_bytes` — required buffered-path cap. Must be\n    > 0 and ≤ `MaxRequestBodyBytes` (25 MiB). A standalone\n    limit rule with no cap is a silent no-op and is\n    rejected at create-time with 422 — use `kind=validate`\n    if you need a body cap alongside a JSON Schema.\n  * `max_body_bytes_streaming` — optional streaming opt-in\n    cap (≤ `MaxEdgeRuleLimitBodyBytesStreaming` = 100 MiB).\n    0 (default) = no streaming carve-out; the buffered\n    `max_body_bytes` is the cap on both paths. When set,\n    must be ≥ `max_body_bytes` — a streaming cap tighter\n    than the buffered cap would 413 every streaming request\n    for a body already accepted as buffered. Runtime\n    enforcement of this field is declared + clamped at\n    create-time; it is not enforced yet.\n",
        "type": "object",
        "required": [
          "max_body_bytes"
        ],
        "properties": {
          "max_body_bytes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 26214400,
            "description": "Required per-rule buffered-path body cap. Must be > 0\nand ≤ `api.MaxRequestBodyBytes` (25 MiB). A standalone\nlimit rule with no cap is rejected at create-time with\n422 — use `kind=validate` if you need a body cap\nalongside a JSON Schema.\n"
          },
          "max_body_bytes_streaming": {
            "type": "integer",
            "minimum": 1,
            "maximum": 104857600,
            "description": "Optional streaming opt-in cap. 0 (default) = no\nstreaming carve-out; the buffered `max_body_bytes` is\nthe cap on both paths. Must be ≥ `max_body_bytes` when\nset. Runtime enforcement deferred to follow-up PR.\n"
          }
        }
      },
      "EdgeRuleMaintenanceAction": {
        "description": "Per-route maintenance toggle.\nThe fine-grained primitive for \"this endpoint is in\nmaintenance mode\" — the gateway's hot-path applier short-\ncircuits a matched (host, path, http_method) request with\n503 + Retry-After BEFORE auth, BEFORE wake. The coarse\nsibling (`apps.maintenance_mode`, PATCH /v1/apps/{slug})\ncovers the \"whole app in maintenance\" case; use this kind\nwhen only specific routes need to be pinned.\n\nField-by-field:\n  * `retry_after_seconds` — optional per-rule override for\n    the `Retry-After` header. 0 (default) = use the\n    platform default\n    `api.EdgeRuleMaintenanceRetryAfterSeconds` (60 s).\n    Must be in `[0, 86400]` (24 h, enforced by\n    `api.MaxEdgeRuleMaintenanceRetryAfterSeconds`); a\n    customer cannot ship a rule that asks a client to\n    back off for a week.\n  * `message` — optional operator-friendly string that\n    goes into `Problem.detail`. ≤ 512 B (same payload-\n    size budget as `EdgeRuleValidateAction.schema`).\n    Surface this on the customer's status page or in a\n    dashboard alert so operators see why the endpoint is\n    dark without scraping the rule row.\n\nFree-and-above (no plan gate). Mirror the validate /\nlimit posture: rejection never reaches the wake gate, the\nauth chain, or the rate limiter.\n",
        "type": "object",
        "properties": {
          "retry_after_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400,
            "description": "Optional per-rule Retry-After override in seconds.\n0 (default) = use the platform default\n`api.EdgeRuleMaintenanceRetryAfterSeconds` (60 s).\nMust be in `[0, 86400]` (24 h); values above 86400 are\nrejected at create-time with 422.\n",
            "example": 0
          },
          "message": {
            "type": "string",
            "maxLength": 512,
            "description": "Optional operator-friendly detail string that goes into\n`Problem.detail`. ≤ 512 B. Surface this on the\ncustomer's status page so monitoring / curl users see\nwhy the endpoint is dark.\n",
            "example": "Rolling out v2; back at 14:00 UTC."
          }
        }
      },
      "EdgeRuleRespondAction": {
        "description": "Preview-only fixed JSON response. The gateway serves this body\ndirectly for the matched route, so the preview frontend can be\ndeveloped before the backend endpoint exists. Status codes are\nlimited to 200..599 and the JSON body is capped at 64 KiB.\n",
        "type": "object",
        "required": [
          "status_code"
        ],
        "properties": {
          "status_code": {
            "type": "integer",
            "minimum": 200,
            "maximum": 599,
            "example": 200
          },
          "body": {
            "description": "Arbitrary JSON response body. Omit for an empty response."
          }
        }
      },
      "EdgeRuleWAFAction": {
        "description": "Inspects matched requests with the OWASP Core Rule Set.\nEvery mode samples requests (bodies included) off the request path\nand reports detections without blocking them. warn and block also\ncheck headers and URL in-path with a smaller rule set at paranoia\nlevel 1: warn tags a detected request's response with X-WAF-Warning,\nblock answers it with 403. Request bodies are never blocked. When the\napp's in-path budget is exhausted a request passes unchecked (counted\nas inline_skipped). Detections appear in the edge-protection summary\nand the edge_waf_detections alert preset. Pro and above. Omitted\nvalues are stored as their defaults.\n",
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "observe",
              "warn",
              "block"
            ],
            "default": "observe",
            "description": "warn and block require paranoia_level 1."
          },
          "paranoia_level": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2,
            "default": 1,
            "description": "CRS paranoia level. Level 2 detects more and produces more false positives."
          },
          "anomaly_threshold": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 5,
            "description": "Inbound anomaly score at which a request counts as a detection (one critical match scores 5)."
          },
          "exclude_rule_ids": {
            "type": "array",
            "maxItems": 50,
            "description": "CRS rule IDs left out of scoring on this route, for known false positives.",
            "items": {
              "type": "integer",
              "minimum": 900000,
              "maximum": 999999
            }
          },
          "inspect_body_bytes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 65536,
            "default": 8192,
            "description": "Request body prefix inspected. Larger and streaming bodies are inspected up to this size only; larger values use more of the app's inspection budget."
          }
        }
      },
      "EdgeRuleChallengeAction": {
        "description": "Asks browsers on matched routes to prove they run a real browser\nbefore the request reaches the app. A request\nwithout a valid pass is answered at the edge: a page load gets a page\nthat solves a short proof of work in the browser and sets a signed\npass cookie, and any other request gets 403 challenge_required.\nRequests with a verified API key, consumer key or JWT subject are\nnever challenged. Use log mode to see what a rule would challenge,\nand add a verified_bot missing condition so search crawlers pass.\nHobby and above. Omitted values are stored as their defaults.\n",
        "type": "object",
        "properties": {
          "difficulty": {
            "type": "integer",
            "minimum": 10,
            "maximum": 22,
            "default": 16,
            "description": "Leading zero bits the browser must find in a SHA-256 hash. Each extra bit doubles the work; the default takes tens to a few hundred milliseconds."
          },
          "pass_ttl_seconds": {
            "type": "integer",
            "minimum": 300,
            "maximum": 86400,
            "default": 3600,
            "description": "How long a solved challenge lets the browser through."
          },
          "max_difficulty": {
            "type": "integer",
            "minimum": 10,
            "maximum": 22,
            "description": "When above difficulty, the gateway raises the difficulty up to this while the rule serves far more challenge pages than usual, two bits (4x the work) per minute, and lowers it again as the load eases. Must be at least difficulty. Omitted or equal to difficulty keeps the difficulty fixed."
          }
        }
      },
      "EdgeRuleAsyncAction": {
        "description": "Marks the matched route for durable asynchronous execution.\non_success and on_failure optionally select app webhook subscription\nIDs that receive the terminal job.finished invocation outcome. An\noptional retry_policy overrides the app retry curve for invocations\naccepted by this route. max_age_seconds starts when Gregale accepts a\nrequest; values above the plan's invocation deadline are clamped.\nOmitted values preserve existing app and plan defaults.\n",
        "type": "object",
        "properties": {
          "on_success": {
            "type": "string",
            "format": "uuid",
            "description": "Optional app webhook subscription ID for successful invocations."
          },
          "on_failure": {
            "type": "string",
            "format": "uuid",
            "description": "Optional app webhook subscription ID for failed or dead-lettered invocations."
          },
          "retry_policy": {
            "type": "object",
            "description": "Optional per-route retry override; attempts are capped by the account plan.",
            "properties": {
              "max_attempts": {
                "type": "integer",
                "minimum": 0,
                "maximum": 25,
                "description": "Total attempts including the first; 0 inherits the plan default."
              },
              "base_seconds": {
                "type": "number",
                "minimum": 0,
                "description": "Base delay for exponential retry backoff."
              },
              "max_seconds": {
                "type": "number",
                "minimum": 0,
                "description": "Maximum exponential backoff delay; must be at least base_seconds when both are positive."
              },
              "jitter_seconds": {
                "type": "number",
                "minimum": 0,
                "maximum": 1,
                "description": "Symmetric retry jitter fraction."
              }
            },
            "additionalProperties": false
          },
          "max_age_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400,
            "description": "Maximum lifetime from acceptance; 0 or omission inherits the account-plan default, and lower plan ceilings clamp this value."
          }
        },
        "additionalProperties": false
      },
      "EdgeRuleGeoAction": {
        "description": "ISO 3166-1 alpha-2 country allow/deny evaluator. Mirrors `EdgeRuleIPAction` exactly: `allow`\nand `deny` are parallel ISO 3166-1 alpha-2 country-code\nlists; the matcher walks deny AFTER allow so a single-country\ndeny wins even when the allow list is broad.\n\nThe gateway consults a\nDB-IP Lite `.mmdb` file at request time to translate the\ntrusted XFF client IP into a country code. Plan-tier quota\nis enforced at the API-create time via `Limits.EdgeRulesGeoPerApp`\n(Free=1, Hobby=5, Pro=25, Scale=100) inside the same apps-row\nFOR UPDATE lock as the general edge-rule cap. Geo is NOT in\nIsPaidOnly — Free customers get one rule before they upgrade.\n\nFailure posture is fail-open: missing `.mmdb`, IP not in\nany country, RFC1918/bogon, or corrupt file → the rule does\nnot fire → the request flows through. The\n`gateway_edge_rule_match_total{kind=\"geo\",result=\"failed\"}`\ncounter increments and an `edge_rule.geo_failed` audit event\nemits.\n",
        "type": "object",
        "properties": {
          "allow": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[A-Z]{2}$",
              "description": "ISO 3166-1 alpha-2 country code for the allowlist."
            },
            "description": "ISO 3166-1 alpha-2 country allowlist. Empty + deny non-empty = deny-only. Empty + deny empty = no-op (create-time 422)."
          },
          "deny": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[A-Z]{2}$",
              "description": "ISO 3166-1 alpha-2 country code for the denylist."
            },
            "description": "ISO 3166-1 alpha-2 country denylist. Evaluated AFTER allow; single-country deny wins."
          }
        }
      },
      "EdgeRuleThrottleAction": {
        "description": "Per-route token-bucket cap. Customers tighten the per-route rps/burst\nbelow their plan's `plan.RateLimitRPS` — the API\nvalidator enforces the sub-plan ceiling; the gateway\ncompiler enforces it again at load time.\n\nSub-plan ceiling — the load-bearing constraint. A\nthrottle rule is STRICTLY a tightening primitive. A\nrule that exceeds the ceiling is rejected with 422\nBEFORE any DB write — a customer cannot raise their\nplan limit by registering a throttle rule.\n\nPer-IP sub-keying is deliberately absent: a memory-bounded limiter\nwith attacker-controlled IP cardinality would grow without bound. Country keying uses\nthe existing trusted GeoIP lookup and therefore has bounded\ncardinality.\n\nThe wire shape has optional per-consumer\nkeying. Default values (`\"\"` for key_by, omitted\njwt_claim_name, 0 for max_keys_per_rule) preserve the behaviour bit-for-bit.\n",
        "type": "object",
        "required": [
          "requests_per_second",
          "burst"
        ],
        "properties": {
          "requests_per_second": {
            "type": "number",
            "format": "double",
            "minimum": 0.01,
            "description": "Token-bucket refill rate per route. The API\nvalidator rejects rps > plan.RateLimitRPS with a\n422. The gateway compiler clamps + warns on the\nsame bound at load time.\n",
            "example": 50
          },
          "burst": {
            "type": "integer",
            "minimum": 1,
            "description": "Token-bucket burst per route. Mirrors rps: rejected\nabove `plan.RateLimitBurst` at create time and\nclamped at compile time.\n",
            "example": 200
          },
          "key_by": {
            "type": "string",
            "enum": [
              "",
              "none",
              "api_key",
              "consumer_id",
              "jwt_subject",
              "jwt_claim",
              "country",
              "ip",
              "composite"
            ],
            "default": "",
            "description": "Per-consumer keying dimension. When `\"\"` or `\"none\"`, the bucket is shared\nacross every caller of the route (shape).\nWhen `\"api_key\"`, one bucket per authenticated API\nkey. When `\"consumer_id\"`, one bucket per stable API consumer\nidentity (all rotated keys for that consumer share a bucket).\nWhen `\"jwt_subject\"`, one bucket per JWT `sub`.\nWhen `\"jwt_claim\"`, one bucket per value of the\nclaim named by `jwt_claim_name`. When `\"country\"`, one\nbucket per ISO 3166-1 alpha-2 country resolved from the\ngateway's trusted client IP. When `\"ip\"`, one bucket per\ntrusted client IP (IPv6 clients keyed by their /64).\nWhen `\"composite\"`, one bucket per combination of\n`key_fields`.\nEach non-empty\nvalue activates the bounded design: when the\nper-rule consumer set exceeds\n`max_keys_per_rule`, all over-cap callers collapse\ninto a single non-evicting `__other__` bucket that\nstill consumes tokens (the load-bearing safety\nproperty — §\"Consequences\").\n",
            "example": "api_key"
          },
          "jwt_claim_name": {
            "type": "string",
            "pattern": "^[a-zA-Z_][a-zA-Z0-9_]{0,63}$",
            "description": "Required iff `key_by=\"jwt_claim\"`. Names the JWT\ncustom claim to extract (e.g., `\"tier\"`,\n`\"org_id\"`). Format is a CodeQL safe-identifier:\nleading letter or underscore, then `[A-Za-z0-9_]`,\nmax 64 chars. Top-level string, number, and boolean\nvalues are supported and normalized to their JSON scalar\nrepresentation. Arrays, objects, empty strings, and values\nlonger than 256 bytes are treated as missing. The configured\nclaim is retained first within the verifier's 64-claim\nrequest-context bound.\n",
            "example": "tier"
          },
          "max_keys_per_rule": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000,
            "default": 0,
            "description": "Caps the cardinality of the per-consumer bucket map\nfor this rule. 0 means \"use plan default\"\n(`Limits.ThrottleMaxKeysPerRule` per plan: Free 100\n/ Hobby 1000 / Pro 5000 / Scale 10000). The\nvalidator rejects values above\n`plan.ThrottleMaxKeysPerRule`. Must be 0 when\n`key_by` is `\"\"` or `\"none\"` — the cap is moot for\nnon-per-consumer rules.\n"
          },
          "key_fields": {
            "type": "array",
            "maxItems": 4,
            "description": "Required iff `key_by=\"composite\"`: the request\nfields combined into one bucket identity. Each is one of\nip, country, api_key, consumer_id, jwt_subject, jwt_claim\n(with `jwt_claim_name`), method, path or `header:<name>`.\nA field the request lacks makes the identity missing, so\n`missing_key_policy` applies.\n",
            "items": {
              "type": "string"
            },
            "example": [
              "ip",
              "path"
            ]
          },
          "count_statuses": {
            "type": "array",
            "maxItems": 16,
            "description": "When set, requests are admitted while the bucket\nhas a token but only responses with one of these statuses\ncharge it, e.g. [401, 403] to limit failed logins without\nlimiting successful ones. Across gateways the admission\ncheck uses each gateway's last-known shared balance.\n",
            "items": {
              "type": "integer",
              "minimum": 100,
              "maximum": 599
            },
            "example": [
              401
            ]
          },
          "missing_key_policy": {
            "type": "string",
            "enum": [
              "shared",
              "reject"
            ],
            "default": "shared",
            "description": "Behavior when an authentication-backed dimension is not\navailable on the request. `\"shared\"` places all such\nrequests in one bounded `__anonymous__` bucket (the\nbackward-compatible default). `\"reject\"` returns 401\nbefore consuming a route token. This field requires a\ndimensional `key_by` value. Country lookup dependency\nfailures remain fail-closed with 503 rather than being\ntreated as an anonymous identity.\n"
          }
        }
      },
      "EdgeRuleBudgetAction": {
        "description": "Per-route execution budget plus an optional total deadline.\nbudget_ms starts after upload, wake and capacity admission. Its\nconfigured override header (default x-faas-budget-ms) may alter the\nexecution allowance within the plan ceiling.\n\ntotal_deadline_ms starts when the public proxy receives the request\nand includes upload, routing, auth, queueing, wake, retries and the\nordinary response exchange. It cannot be increased by an execution\noverride. Zero or omission leaves existing execution semantics.\nBoth values are at most 15 min (`RequestBudgetPlanMax`); the plan\nceiling (`Plan.RequestBudgetMaxMs`: Free 30 s, Hobby 60 s, Pro 5 min,\nScale 15 min) caps them at request time. Expiry returns a 503 problem with code\nrequest_budget_exceeded before response commitment; a committed\nordinary response is terminated on expiry. Streaming and upgrades\nuse their idle/session contract after successful response headers.\nDetached work and unmediated guest sockets are excluded. Nested\nmanaged-service deadline transport remains pending acceptance.\n",
        "type": "object",
        "required": [
          "budget_ms"
        ],
        "properties": {
          "budget_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 900000,
            "description": "Execution allowance in milliseconds, after upload/wake/admission (1 ms – 15 min; the plan's ceiling applies at request time)."
          },
          "total_deadline_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 900000,
            "default": 0,
            "description": "Optional total deadline from trusted public ingress; zero leaves it unset."
          },
          "allow_override_header": {
            "type": "string",
            "maxLength": 128,
            "pattern": "^[A-Za-z][A-Za-z0-9-]*$",
            "description": "Header for the execution override; default x-faas-budget-ms. It never increases total_deadline_ms."
          }
        }
      },
      "CreateMirrorRuleRequest": {
        "description": "Body for POST /v1/apps/{slug}/mirrors. Both deployments must\nbe `live` and belong to the same app. `percent` defaults to\na 5% sample. `include_body` defaults to `false`; when enabled,\nonly response SHA-256 hashes are retained. Raw bodies are never\nstored. POST, PUT, PATCH, and DELETE are skipped unless\n`allow_unsafe_methods` is explicitly enabled.\n`redact_headers` is the\ncustomer's additive list on top of the always-stripped list\n(Authorization, Cookie, Set-Cookie, X-API-Key, Proxy-Authorization,\nWWW-Authenticate — applied by the redaction layer, NOT by\nA2's storage layer). Requests whose bodies exceed the 64 KiB mirror\nsnapshot cap are safely skipped rather than sending a partial request\nto the mirror deployment.\n",
        "type": "object",
        "required": [
          "source_deployment_id",
          "mirror_deployment_id"
        ],
        "properties": {
          "source_deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Source deployment id (live; must belong to the slug's app).",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "mirror_deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Mirror deployment id (live; must belong to the slug's app; must differ from source).",
            "example": "0123456789abcdef0123456789abcdf0"
          },
          "percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "default": 5,
            "description": "Fan-out percent. Defaults to a 5% sample; 100 mirrors every eligible request.",
            "example": 5
          },
          "include_body": {
            "type": "boolean",
            "default": false,
            "description": "If true, compare response values using hashes. Raw response bodies are never stored. Off by default."
          },
          "allow_unsafe_methods": {
            "type": "boolean",
            "default": false,
            "description": "If true, also mirror POST, PUT, PATCH, and DELETE. These methods may cause side effects in the mirror deployment."
          },
          "redact_headers": {
            "type": "array",
            "description": "Customer-supplied additional header names to redact on top of the always-stripped list (Authorization, Cookie, Set-Cookie, X-API-Key, Proxy-Authorization, WWW-Authenticate).",
            "items": {
              "type": "string"
            },
            "default": []
          }
        }
      },
      "UpdateMirrorRuleRequest": {
        "description": "Body for PATCH /v1/apps/{slug}/mirrors/{id}. All fields are\noptional; pointer-style patches mean an absent key keeps the\nexisting value, while an explicit zero/empty overrides. Setting\n`redact_headers` to `[]` clears the customer's list (leaving\nonly the always-stripped list).\n",
        "type": "object",
        "properties": {
          "percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "New fan-out percent in [0, 100]. 0 = rule stays but doesn't fire."
          },
          "enabled": {
            "type": "boolean",
            "description": "Set false to pause the rule without removing it."
          },
          "include_body": {
            "type": "boolean",
            "description": "Toggle response-value comparison using hashes. Raw bodies are never stored."
          },
          "allow_unsafe_methods": {
            "type": "boolean",
            "description": "Also mirror POST, PUT, PATCH, and DELETE; these can cause side effects in the mirror deployment."
          },
          "redact_headers": {
            "type": "array",
            "description": "Replace the customer's redact list. Empty array clears it.",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "MirrorRuleResponse": {
        "description": "A persisted mirror rule.\n`always_stripped_headers` is rendered so the customer can audit\nwhat the gateway guarantees regardless of their\n`redact_headers` setting.\n",
        "type": "object",
        "required": [
          "id",
          "account_id",
          "app_id",
          "source_deployment_id",
          "mirror_deployment_id",
          "percent",
          "enabled",
          "include_body",
          "allow_unsafe_methods",
          "redact_headers",
          "always_stripped_headers",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "account_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "source_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "mirror_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "enabled": {
            "type": "boolean"
          },
          "include_body": {
            "type": "boolean"
          },
          "allow_unsafe_methods": {
            "type": "boolean"
          },
          "redact_headers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "always_stripped_headers": {
            "type": "array",
            "description": "Headers the gateway ALWAYS strips regardless of the customer's redact_headers setting.",
            "items": {
              "type": "string"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "MirrorRuleListResponse": {
        "description": "Wrapper for GET /v1/apps/{slug}/mirrors. Bounded by\n`Limits.MirrorTargetsPerApp` (1-3) — no cursor in A2.\n",
        "type": "object",
        "required": [
          "rules",
          "count"
        ],
        "properties": {
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MirrorRuleResponse"
            }
          },
          "count": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "MirrorSummaryResponse": {
        "description": "Aggregated mirror drift counts over a trailing window. The changed\nresponse percentage uses only complete comparisons; `incomplete_comparison_count`\nseparately reports missing or truncated response snapshots and scheduler\nadmission failures. Admission counters explain scheduler failures without\nincluding them in `crash_count`.\n",
        "type": "object",
        "required": [
          "total_invocations",
          "changed_response_count",
          "changed_response_percent",
          "status_diff_count",
          "schema_diff_count",
          "body_diff_count",
          "mean_latency_diff_ms",
          "p99_latency_diff_ms",
          "crash_count",
          "incomplete_comparison_count",
          "scheduler_admission_timeout_count",
          "scheduler_admission_rejected_count",
          "scheduler_admission_error_count",
          "window_seconds"
        ],
        "properties": {
          "total_invocations": {
            "type": "integer",
            "format": "int64"
          },
          "changed_response_count": {
            "type": "integer",
            "format": "int64",
            "description": "Complete comparisons with any status, schema, or body difference; each request is counted once."
          },
          "changed_response_percent": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 100,
            "description": "100 × changed_response_count / complete comparisons; zero when none are complete."
          },
          "status_diff_count": {
            "type": "integer",
            "format": "int64"
          },
          "schema_diff_count": {
            "type": "integer",
            "format": "int64"
          },
          "body_diff_count": {
            "type": "integer",
            "format": "int64"
          },
          "mean_latency_diff_ms": {
            "type": "integer",
            "format": "int64",
            "description": "Signed: mirror - source. Positive = mirror slower."
          },
          "p99_latency_diff_ms": {
            "type": "integer",
            "format": "int64"
          },
          "crash_count": {
            "type": "integer",
            "format": "int64",
            "description": "Mirror invocations that returned 5xx or no response after admission; scheduler admission failures are counted separately."
          },
          "incomplete_comparison_count": {
            "type": "integer",
            "format": "int64",
            "description": "Comparisons without a complete source and mirror response, including scheduler admission failures."
          },
          "scheduler_admission_timeout_count": {
            "type": "integer",
            "format": "int64",
            "description": "Mirror admissions that timed out before the gateway received an admitted target. A late scheduler admission is cleaned up by the scheduler."
          },
          "scheduler_admission_rejected_count": {
            "type": "integer",
            "format": "int64",
            "description": "Mirror admissions refused by a capacity or concurrency limit. These are incomplete comparisons, not guest crashes."
          },
          "scheduler_admission_error_count": {
            "type": "integer",
            "format": "int64",
            "description": "Mirror admissions that failed for another scheduler error before returning a target."
          },
          "window_seconds": {
            "type": "integer",
            "minimum": 1,
            "description": "The window's length in seconds. Matches the requested `?window=` value."
          }
        }
      },
      "MirrorReplayBatchRequest": {
        "description": "A bounded batch of sanitized historical requests to replay against the mirror deployment.",
        "type": "object",
        "required": [
          "requests"
        ],
        "properties": {
          "requests": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/MirrorReplayRequestItem"
            }
          },
          "allow_unsafe_methods": {
            "type": "boolean",
            "default": false,
            "description": "Explicit acknowledgement required when any item uses POST, PUT, PATCH, or DELETE."
          }
        }
      },
      "MirrorReplayRequestItem": {
        "description": "One sanitized historical request and its optional expected source-response metadata.",
        "type": "object",
        "required": [
          "method",
          "path"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "maxLength": 128,
            "description": "Optional correlation id; generated when omitted."
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "HEAD",
              "OPTIONS",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ]
          },
          "path": {
            "type": "string",
            "maxLength": 4096,
            "pattern": "^/",
            "description": "Absolute request path with optional query; absolute URLs are rejected."
          },
          "headers": {
            "type": "object",
            "maxProperties": 32,
            "additionalProperties": {
              "type": "string"
            }
          },
          "body": {
            "description": "Sanitized JSON request body, bounded to 64 KiB."
          },
          "expected_status": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599
          },
          "expected_latency_ms": {
            "type": "integer",
            "minimum": 0
          },
          "expected_body_sha256": {
            "type": "string",
            "pattern": "^[a-fA-F0-9]{64}$",
            "description": "Optional SHA-256 of the historical source response body. The body itself is not uploaded."
          }
        }
      },
      "MirrorReplayBatchResponse": {
        "description": "The replay invocations accepted and queued for asynchronous mirror execution.",
        "type": "object",
        "required": [
          "queued",
          "invocations"
        ],
        "properties": {
          "queued": {
            "type": "integer",
            "minimum": 0
          },
          "invocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MirrorReplayInvocation"
            }
          }
        }
      },
      "MirrorReplayInvocation": {
        "description": "Correlation metadata for one queued mirror replay invocation.",
        "type": "object",
        "required": [
          "request_id",
          "mirror_invocation_id",
          "status"
        ],
        "properties": {
          "request_id": {
            "type": "string"
          },
          "mirror_invocation_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued"
            ]
          }
        }
      },
      "AgentConnectionResponse": {
        "description": "One agent connected to the account. `id` is the API key the agent uses; revoking the connection revokes that key.",
        "type": "object",
        "required": [
          "id",
          "kind",
          "prefix",
          "scopes",
          "created_at"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "description": "Immutable app boundary of an app_agent connection."
          },
          "id": {
            "type": "string",
            "description": "The agent's API key id."
          },
          "kind": {
            "type": "string",
            "enum": [
              "hosted_mcp",
              "agent_key",
              "app_agent"
            ],
            "description": "`hosted_mcp` for a browser sign-in through the hosted MCP server; `agent_key` for an API key with the `agent` scope."
          },
          "client_name": {
            "type": "string",
            "description": "The client name a hosted sign-in's consent page showed."
          },
          "client_site": {
            "type": "string",
            "description": "The host the client was verified at: the site serving its metadata document, or its HTTPS redirect host. Empty for a local client."
          },
          "label": {
            "type": "string",
            "description": "The key label."
          },
          "prefix": {
            "type": "string",
            "description": "The key's display prefix."
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_used_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "org_id": {
            "type": "string",
            "format": "uuid",
            "description": "The organization the agent acts in."
          },
          "member": {
            "type": "string",
            "description": "Email of the member who connected the agent, in an organization's list."
          },
          "projects": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Slugs of the projects the agent is limited to; absent when it reaches every project."
          },
          "approvals": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "delete",
                "production",
                "credentials",
                "billing"
              ]
            },
            "description": "Kinds of action the agent must have a person approve, including its organization's floor."
          }
        },
        "example": {
          "id": "3f2c9a7e-1b4d-4c8e-9f0a-6d5e4c3b2a19",
          "kind": "hosted_mcp",
          "client_name": "Claude",
          "client_site": "claude.ai",
          "label": "mcp-login",
          "prefix": "fp_live_ab12cd34",
          "scopes": [
            "apps:read"
          ],
          "created_at": "2026-10-30T11:25:00Z",
          "last_used_at": "2026-10-30T12:05:00Z",
          "expires_at": "2026-11-06T12:05:00Z"
        }
      },
      "AgentConnectionsResponse": {
        "description": "The agents connected to the account, newest first.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentConnectionResponse"
            }
          }
        }
      },
      "AgentConnectionsRevokeAllResponse": {
        "description": "The result of revoking every connected agent.",
        "type": "object",
        "required": [
          "revoked"
        ],
        "properties": {
          "revoked": {
            "type": "integer",
            "minimum": 0,
            "description": "The number of agent keys revoked."
          }
        }
      },
      "AgentClientRequest": {
        "description": "The client a hosted MCP connection's key belongs to, named once by the hosted MCP server.",
        "type": "object",
        "required": [
          "client_name"
        ],
        "additionalProperties": false,
        "properties": {
          "client_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "description": "Printable client name, without control characters or surrounding spaces."
          },
          "client_site": {
            "type": "string",
            "maxLength": 253,
            "description": "Lower-case host name the client was verified at."
          }
        }
      },
      "AgentBudgetResponse": {
        "description": "An agent connection's monthly budget for always-on capacity, and what it committed this month.",
        "type": "object",
        "required": [
          "source",
          "spent_cents",
          "month"
        ],
        "properties": {
          "monthly_cents": {
            "type": "integer",
            "format": "int64",
            "description": "The budget that applies, in cents a month; absent when unlimited."
          },
          "source": {
            "type": "string",
            "enum": [
              "key",
              "plan_default",
              "org_ceiling",
              "unlimited"
            ],
            "description": "Where the budget comes from."
          },
          "key_monthly_cents": {
            "type": "integer",
            "format": "int64",
            "description": "The budget set for this agent, when one was."
          },
          "key_unlimited": {
            "type": "boolean",
            "description": "The agent was set to have no budget of its own."
          },
          "org_max_cents": {
            "type": "integer",
            "format": "int64",
            "description": "The organization's ceiling on agents' budgets, when it set one."
          },
          "spent_cents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Always-on capacity the agent added this UTC month, priced at the overage rate and rounded up to the cent."
          },
          "month": {
            "type": "string",
            "pattern": "^[0-9]{4}-[0-9]{2}$",
            "description": "The UTC month spend counts in."
          }
        }
      },
      "AgentUndoRequest": {
        "description": "Chooses an agent's changes to undo: those since a time (default the last 24 hours), or the activity entries named.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "since": {
            "type": "string",
            "format": "date-time",
            "description": "Undo changes made at or after this time; at most 7 days ago."
          },
          "entries": {
            "type": "array",
            "maxItems": 500,
            "description": "Activity entry ids to undo; when given, only they are undone.",
            "items": {
              "type": "string"
            }
          },
          "force": {
            "type": "boolean",
            "description": "Also undo changes someone changed again since the agent did."
          },
          "plan_digest": {
            "type": "string",
            "description": "On apply, the plan_digest of the reviewed plan."
          }
        }
      },
      "AgentUndoItem": {
        "description": "One agent change in an undo plan or result.",
        "type": "object",
        "required": [
          "activity_id",
          "method",
          "path",
          "kind",
          "summary",
          "created_at",
          "status"
        ],
        "properties": {
          "activity_id": {
            "type": "string",
            "description": "The activity entry of the change."
          },
          "method": {
            "type": "string",
            "description": "The HTTP method of the agent's request."
          },
          "path": {
            "type": "string",
            "description": "The path of the agent's request."
          },
          "kind": {
            "type": "string",
            "enum": [
              "settings",
              "deploy",
              "create",
              "delete",
              "other"
            ],
            "description": "What kind of change it was."
          },
          "summary": {
            "type": "string",
            "description": "What the agent changed."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the agent made the change."
          },
          "status": {
            "type": "string",
            "enum": [
              "undoable",
              "not_undoable",
              "changed_since",
              "undone"
            ],
            "description": "What undoing it will do, or did."
          },
          "reason": {
            "type": "string",
            "description": "Why it cannot be undone, or why it was left."
          },
          "result": {
            "type": "string",
            "enum": [
              "undone",
              "changed_since",
              "failed",
              "skipped"
            ],
            "description": "On apply, what happened to it."
          },
          "error_code": {
            "type": "string",
            "description": "On a failed apply, the code of the refusal."
          },
          "error": {
            "type": "string",
            "description": "On a failed apply, why it was refused."
          }
        }
      },
      "AgentUndoPlan": {
        "description": "An agent's changes, newest first, and what undoing them will do.",
        "type": "object",
        "required": [
          "since",
          "items",
          "undoable",
          "plan_digest"
        ],
        "properties": {
          "since": {
            "type": "string",
            "format": "date-time",
            "description": "The oldest change time the plan covers."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentUndoItem"
            }
          },
          "undoable": {
            "type": "integer",
            "minimum": 0,
            "description": "How many changes applying the plan will undo."
          },
          "plan_digest": {
            "type": "string",
            "description": "Binds an apply to this plan."
          }
        }
      },
      "AgentUndoResult": {
        "description": "What an applied undo did to each change, newest first.",
        "type": "object",
        "required": [
          "items",
          "undone",
          "failed"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentUndoItem"
            }
          },
          "undone": {
            "type": "integer",
            "minimum": 0,
            "description": "Changes undone."
          },
          "failed": {
            "type": "integer",
            "minimum": 0,
            "description": "Changes whose undo was refused."
          }
        }
      },
      "AgentBudgetRequest": {
        "description": "Sets an agent connection's budget: exactly one of monthly_cents, unlimited or default.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "monthly_cents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 100000000,
            "description": "A monthly budget in cents."
          },
          "unlimited": {
            "type": "boolean",
            "description": "No budget of its own; the organization's ceiling still applies."
          },
          "default": {
            "type": "boolean",
            "description": "Return to the plan's default budget."
          }
        }
      },
      "OrgAgentPolicyRequest": {
        "description": "Whether agents may act in the organization, and the capabilities they may get.",
        "type": "object",
        "required": [
          "agents_allowed",
          "allowed_scopes"
        ],
        "additionalProperties": false,
        "properties": {
          "agents_allowed": {
            "type": "boolean",
            "description": "Whether hosted MCP connections and agent keys may act in the organization."
          },
          "allowed_scopes": {
            "type": "array",
            "description": "Capabilities agents may get beyond inspection; empty for read-only.",
            "items": {
              "type": "string",
              "enum": [
                "deploy:write",
                "secrets:request",
                "storage:manage",
                "postgres:manage"
              ]
            }
          },
          "approval_categories": {
            "type": "array",
            "description": "Kinds of action every agent acting in the organization must have a person approve; omit to keep the current ones.",
            "items": {
              "type": "string",
              "enum": [
                "delete",
                "production",
                "credentials",
                "billing"
              ]
            }
          },
          "approval_channels": {
            "type": "array",
            "maxItems": 5,
            "description": "Names of your own notification channels that get approval requests of agents acting in the organization; omit to keep them, send an empty list to remove them.",
            "items": {
              "type": "string"
            }
          },
          "max_agent_budget_cents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 100000000,
            "description": "Ceiling, in cents a month, on the budget of every agent acting in the organization; omit to keep the current ceiling."
          },
          "clear_max_agent_budget": {
            "type": "boolean",
            "description": "Remove the ceiling on agents' budgets."
          }
        }
      },
      "OrgAgentPolicyResponse": {
        "description": "An organization's agent policy.",
        "type": "object",
        "required": [
          "agents_allowed",
          "allowed_scopes"
        ],
        "properties": {
          "agents_allowed": {
            "type": "boolean",
            "description": "Whether agents may act in the organization."
          },
          "allowed_scopes": {
            "type": "array",
            "description": "The capabilities agents may carry beyond inspection.",
            "items": {
              "type": "string"
            }
          },
          "approval_categories": {
            "type": "array",
            "description": "Kinds of action every agent acting in the organization must have a person approve.",
            "items": {
              "type": "string"
            }
          },
          "approval_channels": {
            "type": "array",
            "description": "Your notification channels that get this organization's agents' approval requests.",
            "items": {
              "type": "string"
            }
          },
          "max_agent_budget_cents": {
            "type": "integer",
            "format": "int64",
            "description": "The ceiling on every agent's monthly budget in cents, when the organization set one."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the policy last changed; absent for an organization that never set one."
          },
          "revoked": {
            "type": "integer",
            "minimum": 0,
            "description": "Agent connections a change revoked because the new policy no longer allows them."
          }
        }
      },
      "AgentApprovalPendingInfo": {
        "description": "The approval request behind an approval_required, approval_denied or approval_expired problem. On approval_required a person opens review_url to decide, then the agent repeats the same request once; on the other two the agent should stop repeating it.",
        "type": "object",
        "required": [
          "id",
          "category",
          "review_url",
          "expires_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "The id of the approval request."
          },
          "category": {
            "type": "string",
            "enum": [
              "delete",
              "production",
              "credentials",
              "billing",
              "budget",
              "undo"
            ],
            "description": "The kind of action that needs approval; budget when the change would take the agent past its monthly budget, undo when the agent applies an undo of its own changes."
          },
          "review_url": {
            "type": "string",
            "format": "uri",
            "description": "The page where a signed-in member who may decide approves or denies the request."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the request and any approval of it expire."
          },
          "status": {
            "type": "string",
            "enum": [
              "denied",
              "expired"
            ],
            "description": "Set on approval_denied and approval_expired: what became of the request."
          },
          "note": {
            "type": "string",
            "maxLength": 280,
            "description": "The person's reason for denying the request, when they gave one."
          }
        }
      },
      "AgentApprovalChannelsRequest": {
        "description": "The notification channels to send the account's agents' approval requests to.",
        "type": "object",
        "required": [
          "channels"
        ],
        "properties": {
          "channels": {
            "type": "array",
            "maxItems": 5,
            "description": "Names of your notification channels; an empty list leaves email only.",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "AgentApprovalChannelsResponse": {
        "description": "The notification channels that get the account's agents' approval requests.",
        "type": "object",
        "required": [
          "channels"
        ],
        "properties": {
          "channels": {
            "type": "array",
            "description": "Channel names, in alphabetical order.",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "AgentActivityResponse": {
        "type": "object",
        "description": "One page of an agent's write requests, newest first.",
        "required": [
          "activity"
        ],
        "properties": {
          "activity": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentActivityEntry"
            }
          },
          "next_before": {
            "type": "string",
            "description": "Pass as `before` to read the next older page; absent on the last page."
          }
        }
      },
      "AgentActivityEntry": {
        "type": "object",
        "description": "One write request an agent key made.",
        "required": [
          "id",
          "method",
          "path",
          "status",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "method": {
            "type": "string",
            "enum": [
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ]
          },
          "path": {
            "type": "string",
            "description": "The request path, without its query string."
          },
          "status": {
            "type": "integer",
            "description": "The HTTP status the request was answered with."
          },
          "approval_id": {
            "type": "string",
            "description": "The approval request the write went through on, when it needed one."
          },
          "reason": {
            "type": "string",
            "maxLength": 280,
            "description": "What the agent said this write was for (its Gregale-Agent-Reason header), if it said. Untrusted agent text."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AgentApprovalResponse": {
        "description": "One request of an agent connection that needed a person's approval.",
        "type": "object",
        "required": [
          "id",
          "category",
          "method",
          "path",
          "body_bound",
          "status",
          "created_at",
          "expires_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "The request's id."
          },
          "category": {
            "type": "string",
            "enum": [
              "delete",
              "production",
              "credentials",
              "billing",
              "budget",
              "undo"
            ],
            "description": "The kind of action; budget for a change past the agent's monthly budget, undo for an agent undoing its own changes."
          },
          "method": {
            "type": "string",
            "description": "The HTTP method of the request the approval allows."
          },
          "path": {
            "type": "string",
            "description": "The path and query of the request the approval allows."
          },
          "body_bound": {
            "type": "boolean",
            "description": "Whether the approval is tied to the request body; large and multipart bodies are not."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "approved",
              "denied",
              "consumed",
              "expired"
            ],
            "description": "`consumed` once the approved request was made."
          },
          "review_url": {
            "type": "string",
            "format": "uri",
            "description": "The review page",
            "while the request is pending.": null
          },
          "agent": {
            "type": "string",
            "description": "The connection's client name or key label."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the agent first made the request."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "After this time the request can no longer be approved or used."
          },
          "decided_at": {
            "type": "string",
            "format": "date-time",
            "description": "When a person approved or denied it."
          },
          "note": {
            "type": "string",
            "maxLength": 280,
            "description": "Why the person denied this request, if they said; absent otherwise."
          },
          "reason": {
            "type": "string",
            "maxLength": 280,
            "description": "What the agent said the request is for (Gregale-Agent-Reason on the request that opened it), if it said. Untrusted agent text: it never changes what is approved."
          }
        }
      },
      "AgentApprovalsResponse": {
        "description": "Approval requests, newest first: an agent's own, or those pending that the caller may decide.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentApprovalResponse"
            }
          }
        }
      },
      "KeyOrg": {
        "description": "The shared organization an API key acts in.",
        "type": "object",
        "required": [
          "id",
          "slug",
          "name"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        }
      },
      "APIKeyResponse": {
        "description": "API key metadata: id, prefix (first 8 chars), label, scopes, created/last-used timestamps, request count. **Plaintext is returned only on POST**. `org_id` is the org the key was minted against; legacy account-scoped responses stamp `org_id = caller's personal org`. See `org.create_api_key` / `org.revoke_api_key` for the new org-scoped verbs.",
        "type": "object",
        "required": [
          "id",
          "prefix",
          "scopes",
          "created_at",
          "org_id"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "org_id": {
            "type": "string",
            "format": "uuid",
            "description": "Org the key was minted against. Always set — every `api_keys` row carries an org_id post-migration 00127. Personal-org scoped keys stamp the caller's personal org id here."
          },
          "prefix": {
            "type": "string",
            "description": "First 16 chars of the key (e.g. `fp_live_abc12345…`)."
          },
          "label": {
            "type": [
              "string",
              "null"
            ],
            "example": "ci-deploy"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "admin",
                "apps:read",
                "deploy:write",
                "secrets:read",
                "secrets:write",
                "usage:read",
                "runs:read",
                "runs:write",
                "env:read",
                "env:write",
                "registry_credentials:read",
                "registry_credentials:write",
                "upstreams:write",
                "metrics:write",
                "delayed_tasks:read",
                "delayed_tasks:write",
                "events:publish",
                "queues:send",
                "queues:consume",
                "storage:manage",
                "storage:read",
                "storage:write",
                "postgres:manage",
                "postgres:read",
                "project_environments:read",
                "project_environments:qualify",
                "github:manage"
              ]
            },
            "description": "Closed permission set attached to the key. github:manage controls customer GitHub connection stored workflow; storage:manage controls bucket lifecycle/grants; storage:read and storage:write also require a matching per-bucket grant; admin remains full access.",
            "example": [
              "admin"
            ]
          },
          "last_used_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "example": "2026-07-25T13:25:00Z"
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the key expires (RFC 3339). Absent on never-expiring admin keys."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "grace",
              "revoked"
            ],
            "description": "Status state machine. `active` = ready; `grace` = in the post-rotation window; `revoked` = terminal."
          },
          "revoked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the key was revoked (RFC 3339). Absent on active/grace keys."
          },
          "rotated_from_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Predecessor key id when this row was minted by rotateKey. Absent on a fresh mint."
          },
          "plaintext": {
            "type": [
              "string",
              "null"
            ],
            "description": "PRESENT ONLY on POST /v1/keys and POST /v1/keys/{id}/rotate responses. Never returned again."
          },
          "projects": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Project slugs the key was limited to, on the create response of a limited agent key."
          },
          "approval_categories": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "delete",
                "production",
                "credentials",
                "billing"
              ]
            },
            "description": "Kinds of action the agent key must have a person approve, on the create response when the request chose them."
          }
        },
        "example": {
          "id": "0123456789abcdef0123456789abcdef",
          "org_id": "8b1f5e5d-273e-5a18-ae00-58fceba4fe6c",
          "prefix": "fp_live_ab12cd34",
          "label": "ci-deploy",
          "scopes": [
            "apps:read",
            "deploy:write"
          ],
          "created_at": "2026-08-02T11:25:00Z",
          "expires_at": "2027-08-02T11:25:00Z",
          "status": "active",
          "last_used_at": "2026-07-25T13:25:00Z"
        }
      },
      "DeployTokenResponse": {
        "description": "Metadata for a per-app deploy token. The fp_deploy_ plaintext is returned only on create and rotate responses.",
        "type": "object",
        "required": [
          "id",
          "app_id",
          "prefix",
          "scopes",
          "status",
          "created_at",
          "expires_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "prefix": {
            "type": "string",
            "example": "fp_deploy_"
          },
          "label": {
            "type": "string",
            "maxLength": 100
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "deploy:write"
              ]
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "grace",
              "revoked"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_used_at": {
            "type": "string",
            "format": "date-time"
          },
          "revoked_at": {
            "type": "string",
            "format": "date-time"
          },
          "rotated_from_id": {
            "type": "string",
            "format": "uuid"
          },
          "plaintext": {
            "type": "string",
            "description": "Present only on create/rotate. Store it in CI immediately; it cannot be retrieved later."
          }
        }
      },
      "ListDeployTokensResponse": {
        "description": "GET /v1/apps/{slug}/deploy-tokens response. Plaintexts are never returned by list.",
        "type": "object",
        "required": [
          "tokens"
        ],
        "properties": {
          "tokens": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeployTokenResponse"
            }
          }
        }
      },
      "CreateDeployTokenRequest": {
        "description": "Create an app-bound credential. Standard tokens receive deploy:write; agent=true permits a narrow MCP permission set while preserving the native app boundary.",
        "type": "object",
        "properties": {
          "agent": {
            "type": "boolean",
            "description": "Mint an app-bound headless MCP credential. Omit for a standard deploy token."
          },
          "scopes": {
            "type": "array",
            "description": "Requires agent=true. Agent and apps:read are included; omitted scopes also include deploy:write.",
            "items": {
              "type": "string",
              "enum": [
                "agent",
                "apps:read",
                "deploy:write",
                "env:write",
                "secrets:request",
                "storage:manage",
                "usage:read"
              ]
            }
          },
          "label": {
            "type": "string",
            "maxLength": 100
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "Optional future expiry; defaults to 90 days and is capped at 365 days."
          }
        }
      },
      "RotateDeployTokenRequest": {
        "description": "Rotate a deploy token. Empty label inherits the predecessor; empty expiry defaults to 90 days.",
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "maxLength": 100
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "RotateDeployTokenResponse": {
        "description": "Replacement deploy-token metadata and one-time plaintext, plus the revoked predecessor id.",
        "type": "object",
        "required": [
          "token",
          "token_plaintext",
          "old_token_id"
        ],
        "properties": {
          "token": {
            "$ref": "#/components/schemas/DeployTokenResponse"
          },
          "token_plaintext": {
            "type": "string"
          },
          "old_token_id": {
            "type": "string",
            "format": "uuid"
          },
          "old_token_expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreateKeyRequest": {
        "description": "API key creation payload — label and optional scopes. Plaintext is returned exactly once in the 201 response. Scopes defaults to `[\"admin\"]` when omitted so existing callers preserve the legacy full-access behavior. rev2.",
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "maxLength": 100,
            "example": "ci-deploy"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "admin",
                "apps:read",
                "deploy:write",
                "secrets:read",
                "secrets:write",
                "usage:read",
                "runs:read",
                "runs:write",
                "env:read",
                "env:write",
                "registry_credentials:read",
                "registry_credentials:write",
                "upstreams:write",
                "metrics:write",
                "delayed_tasks:read",
                "delayed_tasks:write",
                "events:publish",
                "queues:send",
                "queues:consume",
                "storage:manage",
                "storage:read",
                "storage:write",
                "postgres:manage",
                "postgres:read",
                "project_environments:read",
                "project_environments:qualify",
                "github:manage"
              ]
            },
            "description": "Requested permission set. The server rejects unknown scopes. github:manage controls customer GitHub connection stored workflow. Object-storage read/write scopes do not expose data until a storage manager grants the key access to a logical bucket.",
            "example": [
              "apps:read",
              "deploy:write"
            ]
          },
          "projects": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "string"
            },
            "description": "Project slugs the key is limited to. Only an agent key (scope agent) can be limited; it then reaches only apps in these projects and cannot carry Postgres scopes. Omit for every project."
          },
          "approval_categories": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "delete",
                "production",
                "credentials",
                "billing"
              ]
            },
            "description": "Kinds of action an agent key must have a person approve before Gregale carries out the request. Omit for every kind; send an empty list for none. Only agent keys take this field."
          }
        }
      },
      "RotateKeyResponse": {
        "description": "Response body of POST /v1/keys/{id}/rotate. The new `key_plaintext` is returned exactly once; the old plaintext is NEVER returned (only the hash is stored). `old_key_expires_at` is the grace deadline applied to the predecessor — the customer's CI rotates over by then.",
        "type": "object",
        "required": [
          "key",
          "key_plaintext",
          "old_key_id",
          "old_key_expires_at"
        ],
        "properties": {
          "key": {
            "$ref": "#/components/schemas/APIKeyResponse"
          },
          "key_plaintext": {
            "type": "string",
            "description": "New plaintext (PRESENT ONLY on this response). Capture immediately; the API never returns it again."
          },
          "old_key_id": {
            "type": "string",
            "description": "Predecessor key id (matches Key.rotated_from_id)."
          },
          "old_key_expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "Grace deadline applied to the old key (RFC 3339, UTC). When grace_window_days=0 the deadline is 'now' (atomic rotation)."
          }
        }
      },
      "CreateOrgAPIKeyRequest": {
        "description": "POST /v1/orgs/{slug}/keys body. Mirrors `CreateKeyRequest` (keeps them in lockstep) — label + optional scopes. Empty `scopes` defaults to `[\"admin\"]` so existing callers preserve the legacy full-access behavior. rev2.",
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "maxLength": 100,
            "example": "ci-deploy"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "admin",
                "apps:read",
                "deploy:write",
                "secrets:read",
                "secrets:write",
                "usage:read",
                "runs:read",
                "runs:write",
                "env:read",
                "env:write",
                "registry_credentials:read",
                "registry_credentials:write",
                "upstreams:write",
                "metrics:write",
                "delayed_tasks:read",
                "delayed_tasks:write",
                "events:publish",
                "queues:send",
                "queues:consume",
                "storage:manage",
                "storage:read",
                "storage:write",
                "postgres:manage",
                "postgres:read",
                "project_environments:read",
                "project_environments:qualify",
                "github:manage"
              ]
            },
            "description": "Requested permission set for the org-scoped key. Unknown scopes are rejected; github:manage controls customer GitHub connection stored workflow; object-storage data scopes also require an explicit logical-bucket grant. The legacy and org-scoped key vocabularies remain identical.",
            "example": [
              "apps:read",
              "deploy:write"
            ]
          },
          "projects": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "string"
            },
            "description": "Slugs of the organization's projects the key is limited to. Only an agent key can be limited; it then reaches only those projects' apps and cannot carry Postgres scopes. Omit for every project."
          },
          "approval_categories": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "delete",
                "production",
                "credentials",
                "billing"
              ]
            },
            "description": "Kinds of action the organization's agent key must have a person approve; the organization's floor applies on top. Omit for every kind, empty for none."
          }
        }
      },
      "ListOrgAPIKeysResponse": {
        "description": "GET /v1/orgs/{slug}/keys body. Returns every key minted against the org (active + grace + revoked). Newest first; matches the legacy `GET /v1/keys` ordering.",
        "type": "object",
        "required": [
          "keys"
        ],
        "properties": {
          "keys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/APIKeyResponse"
            }
          }
        }
      },
      "RotateOrgAPIKeyRequest": {
        "description": "POST /v1/orgs/{slug}/keys/{id}/rotate body. `label` overrides the new key's label (inherits from the predecessor when omitted); `grace_window_days` is the same per-account override as `PATCH /v1/account/keys/grace_window_days` — defaulting to the plan default when omitted (`api.DefaultAPIKeyGraceWindowDays = 7`).",
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "maxLength": 100,
            "example": "ci-deploy-rotated"
          },
          "grace_window_days": {
            "type": "integer",
            "minimum": 0,
            "maximum": 30,
            "description": "Days the predecessor stays valid after rotation. `0` is atomic; omitted/null falls back to the plan default."
          }
        }
      },
      "RotateOrgAPIKeyResponse": {
        "description": "Response body of POST /v1/orgs/{slug}/keys/{id}/rotate. Mirrors `RotateKeyResponse`; org-scoped because the request was — both keys carry the same `org_id` in `APIKeyResponse.org_id`. The new `key_plaintext` is returned exactly once; the old plaintext is NEVER returned.",
        "type": "object",
        "required": [
          "key",
          "key_plaintext",
          "old_key_id",
          "old_key_expires_at"
        ],
        "properties": {
          "key": {
            "$ref": "#/components/schemas/APIKeyResponse"
          },
          "key_plaintext": {
            "type": "string",
            "description": "New plaintext (PRESENT ONLY on this response). Capture immediately; the API never returns it again. Org-scoped mint; the plaintext belongs to the active org's id."
          },
          "old_key_id": {
            "type": "string",
            "description": "Predecessor key id (matches Key.rotated_from_id). Same org as the new key (rotation is org-local, never re-bound)."
          },
          "old_key_expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "Grace deadline applied to the old key (RFC 3339, UTC). When grace_window_days=0 the deadline is 'now' (atomic rotation). Mirrors the legacy `RotateKeyResponse.old_key_expires_at` contract; the org binding carries through in `APIKeyResponse.org_id`."
          }
        }
      },
      "SetGraceWindowRequest": {
        "description": "Body of PATCH /v1/account/keys/grace_window_days. `days` is the per-account override for the rotation grace window. `days=0` is atomic rotation; `days=null` (or omitted) clears the override and falls back to the plan default (api.DefaultAPIKeyGraceWindowDays = 7).",
        "type": "object",
        "properties": {
          "days": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 30,
            "description": "Per-account override in days, at most 30 (`api.APIKeyGraceWindowMaxDays`). 0 = atomic, null = use plan default. Changing it needs a recent step-up when the account uses two-factor authentication."
          }
        }
      },
      "GraceWindowResponse": {
        "description": "Body of GET /v1/account/keys/grace_window_days. `days` is the customer's override (null = no override); `plan_default` is the platform default the rotation handler uses when the row is null.",
        "type": "object",
        "required": [
          "days",
          "plan_default"
        ],
        "properties": {
          "days": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "plan_default": {
            "type": "integer",
            "minimum": 0,
            "description": "Platform default grace window in days (api.DefaultAPIKeyGraceWindowDays = 7)."
          }
        }
      },
      "SetAccountEgressAllowlistExtraRequest": {
        "description": "Body of PATCH /v1/account/egress_allowlist_extra. `extra` is the per-account additive budget on top of the plan's `apps.egress_allowlist` cap. `extra=0` clears the override (the plan cap is authoritative again); negative values or values above `max_extra` (1024) are rejected with `account_egress_allowlist_extra_out_of_range`.",
        "type": "object",
        "required": [
          "extra"
        ],
        "properties": {
          "extra": {
            "type": "integer",
            "minimum": 0,
            "description": "Requested additive budget, in CIDR count. 0 = clear the override; values above max_extra are rejected."
          }
        }
      },
      "AccountEgressAllowlistExtraResponse": {
        "description": "Body of GET /v1/account/egress_allowlist_extra and PATCH /v1/account/egress_allowlist_extra. The trio (extra, plan_cap, max_extra) lets the dashboard render the override + plan cap + global ceiling in a single round-trip.",
        "type": "object",
        "required": [
          "extra",
          "plan_cap",
          "max_extra"
        ],
        "properties": {
          "extra": {
            "type": "integer",
            "minimum": 0,
            "description": "Effective additive budget currently in force. 0 = no override; the plan cap is authoritative."
          },
          "plan_cap": {
            "type": "integer",
            "minimum": 0,
            "description": "Plan cap on apps.egress_allowlist CIDR count (Hobby 8, Pro 16, Scale 64; Free 0)."
          },
          "max_extra": {
            "type": "integer",
            "minimum": 0,
            "description": "Global ceiling on the per-account override (api.MaxAccountEgressAllowlistExtra = 1024). Flat across plans; the validator rejects out-of-range values with `account_egress_allowlist_extra_out_of_range`."
          }
        }
      },
      "AuditEventResponse": {
        "description": "One row of the customer's security event timeline. The `kind` taxonomy and per-kind `data` schema are documented in `docs/adr/035-auth-audit-events.md`.",
        "type": "object",
        "required": [
          "id",
          "at",
          "actor",
          "kind",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Audit event row id (bigint as string).",
            "example": "42"
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event was recorded (RFC 3339, UTC).",
            "example": "2026-07-25T13:25:00Z"
          },
          "actor": {
            "type": "string",
            "description": "Which daemon wrote the row. `apid` for surface; `schedd` for state-transition events (instance wakes / parks / watchdog timeouts).",
            "example": "apid"
          },
          "kind": {
            "type": "string",
            "description": "Namespaced event kind. Common values: `auth.login`, `auth.logout`, `auth.session.created`, `auth.session.revoke`, `auth.sessions.revoke_all`, `auth.session.stolen`, `key.created`, `key.deleted`, `secret.set`, `secret.deleted`, `env.set`, `env.deleted`, `account.plan_changed`, `account.deletion_scheduled`, `account.deletion_restored`.",
            "example": "auth.login"
          },
          "subject": {
            "type": "string",
            "description": "Account id (uuid string form) the event was recorded against. Omitted when the event has no subject (e.g. system-level).",
            "example": "0190f8e1-2a3b-7c4d-9e5f-6a7b8c9d0e1f"
          },
          "severity": {
            "type": "string",
            "description": "Highest-severity classification for stateless.advisory rows (`high` for /data, /db, /var/lib/postgresql, /var/lib/mysql; `warn` for other closed paths; `info` for an empty batch). Omitted for non-stateless kinds and for older stateless.advisory rows without a severity.",
            "enum": [
              "high",
              "warn",
              "info"
            ],
            "example": "high"
          },
          "data": {
            "type": "object",
            "description": "Kind-specific payload. Always a JSON object; the inner shape depends on `kind`. Plaintext values (e.g. secret VALUE) are NEVER carried in `data`.",
            "additionalProperties": true,
            "example": {
              "method": "password"
            }
          }
        }
      },
      "ListAuditEventsResponse": {
        "description": "Envelope for `GET /v1/audit-events`. `limit` echoes the effective limit applied by the handler so the SDK can render `showing N of M` without re-issuing the request.",
        "type": "object",
        "required": [
          "events",
          "limit"
        ],
        "properties": {
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AuditEventResponse"
            }
          },
          "limit": {
            "type": "integer",
            "description": "Effective limit applied (always 1..100).",
            "example": 50
          }
        }
      },
      "AuditLogEntry": {
        "description": "One row of the FK-free `audit_log` table. The row outlives the account it relates to so a\nregulator / DPO can re-derive the post-deletion state\nwithout joining back to a deleted `accounts` row. The\ntable is append-only by spec (ISO 27001 SoA A.5.33 —\nretention forever); there is no UPDATE / DELETE\npermission in production and no Go-side path that would\nemit one.\n",
        "type": "object",
        "required": [
          "id",
          "kind",
          "received_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Audit-log row id (uuid canonical form).",
            "example": "0190f8e1-2a3b-7c4d-9e5f-6a7b8c9d0e1f"
          },
          "kind": {
            "type": "string",
            "description": "Namespaced audit-log kind. The surface currently\nemits only `account.deleted` from inside\n`(*PgStore).DeleteAccount` / `(*MemStore).DeleteAccount`\nso the regulator can replay post-deletion state. The\nclosed vocabulary will widen in a follow-up PR if a\nfuture audit emitter reuses the table for a new\nevidence surface.\n",
            "example": "account.deleted"
          },
          "account_id": {
            "type": "string",
            "format": "uuid",
            "description": "Account id (uuid canonical form) the row was recorded\nagainst. Nullable in the schema (anonymous /\nbackground activity can emit rows); omitted on the\nwire when the column is NULL.\n",
            "example": "0190f8e1-2a3b-7c4d-9e5f-6a7b8c9d0e1f"
          },
          "account_email": {
            "type": "string",
            "description": "Email captured at copy-time inside\n`DeleteAccount`. The audit row is self-contained: a\nregulator reading a row for a UUID that no longer\nexists in `accounts` still sees the human identifier\nwithout joining back to a deleted accounts row.\nOmitted when the row was emitted by anonymous\nactivity.\n",
            "example": "alice@example.com"
          },
          "actor": {
            "type": "string",
            "description": "Which daemon wrote the row. It emits `grace-sweep`\nfrom inside the DeleteAccount store method. Future\nemitters (follow-up PRs) will widen the vocabulary.\n",
            "example": "grace-sweep"
          },
          "received_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the audit-log row was recorded (RFC 3339, UTC).",
            "example": "2026-08-08T12:00:00Z"
          },
          "data": {
            "type": "object",
            "description": "Kind-specific payload. Always a JSON object; the\ninner shape depends on `kind`. For\n`account.deleted`, the payload carries `source`\n(`grace-sweep` today), `email` (the verbatim\ncaptured email), and `actor` (`grace-sweep` today)\nso the dashboard can render the row without joining\nback to a deleted `accounts` row.\n",
            "additionalProperties": true,
            "example": {
              "source": "grace-sweep",
              "email": "alice@example.com",
              "actor": "grace-sweep"
            }
          }
        }
      },
      "ListAuditLogResponse": {
        "description": "Envelope for `GET /v1/audit-log` and `GET /v1/audit-log/all`\n`entries` is newest-first\n(`received_at DESC, id DESC`) so the dashboard can render\ntop-of-list without re-sorting. `limit` echoes the\neffective limit applied by the handler so the SDK can\nrender `showing N of M` without re-issuing the request.\n",
        "type": "object",
        "required": [
          "entries",
          "limit"
        ],
        "properties": {
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AuditLogEntry"
            }
          },
          "limit": {
            "type": "integer",
            "description": "Effective page size applied (always 1..100; mirrors the customer and operator /v1/audit-log routes).",
            "example": 50
          },
          "next_before": {
            "type": "string",
            "description": "Opaque cursor for the next older page; omitted when this page reaches the end."
          }
        }
      },
      "WakeTimelineEvent": {
        "description": "One frame of the wake timeline. The shape mirrors the typed event payloads\nthe producers write — The\ncanonical `wake.*` vocabulary is documented in\n`docs/adr/064-wake-timeline-canonical-vocabulary.md`\n(including `wake.restore_breakdown`, which exposes the\nVM manager snapshot-restore phases in integer milliseconds;\n`wake.cold_boot_breakdown`, which attributes pre-guest artifact\nresolution and Firecracker startup phases, including artifact source,\nduration, and byte size;\n`wake.cold_boot_cpu`, which records the temporary startup CPU\nallowance and configured quota restored before routing; and\nbuild/deploy/boot failure kinds).\n",
        "type": "object",
        "required": [
          "at",
          "kind",
          "actor",
          "data"
        ],
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "RFC 3339 UTC. Oldest-first (forward narrative)."
          },
          "kind": {
            "type": "string",
            "description": "Canonical `wake.*` kind.",
            "example": "wake.boot_started"
          },
          "actor": {
            "type": "string",
            "description": "Daemon that wrote the row (`schedd` / `vmmd` / `gatewayd` / `egress` / `builderd` / `apid`).",
            "example": "schedd"
          },
          "data": {
            "type": "object",
            "additionalProperties": true,
            "description": "Producer-supplied payload (json object)."
          }
        }
      },
      "WakeTimelineResponse": {
        "description": "Envelope for `GET /v1/apps/{slug}/wakes/{wake_id}/timeline`.",
        "type": "object",
        "required": [
          "wake_id",
          "app_id",
          "events",
          "limit"
        ],
        "properties": {
          "wake_id": {
            "type": "string",
            "description": "Echo of the path-segment wake_id."
          },
          "app_id": {
            "type": "string",
            "format": "uuid",
            "description": "Resolved app id (the slug's owning app)."
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WakeTimelineEvent"
            }
          },
          "next_cursor": {
            "type": "string",
            "description": "Legacy timestamp hint, sent back as since. Can skip equal-time events. keyset_v1 uses page.next_cursor instead."
          },
          "limit": {
            "type": "integer",
            "description": "Effective limit applied (always 1..1000).",
            "example": 200
          },
          "page": {
            "$ref": "#/components/schemas/WakeTimelinePage"
          }
        }
      },
      "WakeTimelinePage": {
        "description": "Opt-in keyset_v1 metadata. App scoping and canonical boot selection precede the exclusive timestamp/event-ID seek and page limit. Complete means no further retained row in this live read, not complete capture or a frozen snapshot. Native event IDs stay inside the opaque cursor.",
        "type": "object",
        "required": [
          "mode",
          "complete"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "keyset_v1"
            ]
          },
          "since": {
            "type": "string",
            "format": "date-time",
            "description": "Normalized original exclusive lower bound; omitted when no lower bound was supplied."
          },
          "cursor": {
            "type": "string",
            "maxLength": 2048,
            "description": "Echo of the supplied opaque page cursor."
          },
          "next_cursor": {
            "type": "string",
            "maxLength": 2048,
            "description": "Opaque continuation for the same account/app/wake/since/limit. Omitted on terminal retained pages."
          },
          "complete": {
            "type": "boolean"
          }
        }
      },
      "SidecarTimelineStatus": {
        "description": "Most recent health transition for a sidecar, if one has been recorded.",
        "type": "object",
        "required": [
          "at",
          "status"
        ],
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "RFC 3339 UTC timestamp of the health transition."
          },
          "status": {
            "type": "string",
            "enum": [
              "starting",
              "healthy",
              "unhealthy",
              "restarting",
              "failed",
              "ready",
              "unready"
            ],
            "description": "Closed sidecar health state emitted by guest-init."
          },
          "reason": {
            "type": "string",
            "description": "Optional producer-supplied transition reason."
          }
        }
      },
      "SidecarTimelineResponse": {
        "description": "Envelope for GET /v1/apps/{slug}/sidecars/{sidecar_name}/timeline.",
        "type": "object",
        "required": [
          "sidecar_name",
          "app_id",
          "events",
          "limit"
        ],
        "properties": {
          "sidecar_name": {
            "type": "string",
            "description": "Echo of the sidecar_name path segment."
          },
          "app_id": {
            "type": "string",
            "format": "uuid",
            "description": "Identifier of the app that owns this sidecar timeline (resolved from the slug)."
          },
          "latest": {
            "$ref": "#/components/schemas/SidecarTimelineStatus"
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WakeTimelineEvent"
            }
          },
          "next_cursor": {
            "type": "string",
            "description": "RFC 3339 timestamp cursor for the next sidecar page; empty when no more frames remain."
          },
          "limit": {
            "type": "integer",
            "description": "Number of sidecar frames returned, from 1 through 1000.",
            "example": 200
          }
        }
      },
      "PutAppSecretRequest": {
        "description": "Set a secret: key name and plaintext (sealed at rest immediately, plaintext discarded after seal). secret_class is optional; omission preserves an existing class and defaults new rows to persistent. Ephemeral values prevent future init/warm captures for the app scope; older artifacts age out under normal snapshot garbage collection.",
        "type": "object",
        "required": [
          "value"
        ],
        "properties": {
          "value": {
            "type": "string",
            "description": "Plaintext. Sealed server-side; never persisted in plaintext.",
            "example": "sk_test_secret_value"
          },
          "secret_class": {
            "type": "string",
            "enum": [
              "persistent",
              "ephemeral"
            ],
            "description": "Optional snapshot-retention policy. Ephemeral secrets cause their runtime VM to be destroyed instead of creating warm or init snapshots when parked; new requests cold-boot."
          }
        }
      },
      "RotateAppSecretRequest": {
        "description": "Rotate a secret: new plaintext value. Same wire\nshape as `PutAppSecretRequest`; the rotate verb is distinct so\nthe server can emit the `secret.rotated` audit kind (vs\n`secret.set` on PUT). Byte cap is the per-plan\n`SecretValueMaxBytes`.\n",
        "type": "object",
        "required": [
          "value"
        ],
        "properties": {
          "value": {
            "type": "string",
            "description": "New plaintext. Sealed server-side; never persisted in plaintext.",
            "example": "sk_test_new_value"
          }
        }
      },
      "RotateAppSecretResponse": {
        "description": "Response from `POST /v1/apps/{slug}/secrets/{key}/rotate`. The\n`kid` is the age-1.. recipient string of the host identity that\nsealed the new envelope; `rotated_at` is\nRFC3339Nano so two rotates in the same second produce distinct\ntimestamps. Empty `kid` means the row was rotated but the kid\nwas not stampable (rare — happens only if the API started without\nhost.age.pub, which the handler 503s for instead).\n",
        "type": "object",
        "required": [
          "key",
          "rotated_at"
        ],
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[A-Z][A-Z0-9_]*$",
            "maxLength": 128,
            "example": "DATABASE_URL"
          },
          "rotated_at": {
            "type": "string",
            "format": "date-time",
            "example": "2026-08-10T11:37:52.123Z"
          },
          "kid": {
            "type": "string",
            "description": "age-1... recipient string of the host identity that sealed this row. Empty if kid was not stampable.",
            "example": "age1q..."
          }
        }
      },
      "AppSecretResponse": {
        "description": "A sealed secret envelope: key name, sealed ciphertext (server can't read it), version, and timestamps. Scope is the env-scope the row belongs to. Older clients see scope='default' echoed on every row.",
        "type": "object",
        "required": [
          "key",
          "scope",
          "secret_class",
          "created_at",
          "updated_at",
          "delivery_version",
          "delivery_status"
        ],
        "properties": {
          "config_change": {
            "$ref": "#/components/schemas/ConfigChangeReceipt",
            "description": "Present on writes: the config revision recorded and the config guard watching it."
          },
          "key": {
            "type": "string",
            "pattern": "^[A-Z][A-Z0-9_]*$",
            "maxLength": 128,
            "example": "DATABASE_URL"
          },
          "scope": {
            "type": "string",
            "pattern": "^([a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?|__all__)$",
            "maxLength": 40,
            "example": "prod"
          },
          "secret_class": {
            "type": "string",
            "enum": [
              "persistent",
              "ephemeral"
            ],
            "description": "Storage policy for this row: ephemeral values prevent future VM snapshots in the row's scope."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "kid": {
            "type": "string",
            "description": "age-1.. recipient string of the host identity that sealed this row. Empty for rows sealed before migration 00166.",
            "example": "age1q..."
          },
          "value_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{16}$",
            "maxLength": 16,
            "description": "16-hex HMAC-SHA256(plaintext) keyed by the per-host host.hmac.key. Empty for older rows. Same value across scopes = byte-identical plaintext.",
            "example": "abcdef0123456789"
          },
          "delivery_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Opaque monotonic version of the runtime value. Advances on value mutation, not host-key reseal."
          },
          "delivered_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Newest version confirmed in a successfully started runtime. Omitted until the first successful delivery."
          },
          "delivery_status": {
            "type": "string",
            "enum": [
              "pending",
              "delivered",
              "failed"
            ],
            "description": "Delivery state for the current delivery_version. A concurrent rotation remains pending until that exact version starts successfully."
          },
          "last_delivery_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_delivered_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_delivery_error_code": {
            "type": "string",
            "enum": [
              "runtime_start_failed"
            ],
            "description": "Non-sensitive closed failure reason for the current version; omitted unless delivery_status is failed."
          },
          "last_delivered_wake_id": {
            "type": "string",
            "description": "Wake correlation id of the most recent successful delivery."
          },
          "last_delivered_instance_id": {
            "type": "string",
            "description": "Runtime instance that most recently received a secret version."
          },
          "last_runtime_reload_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Secret version associated with the latest guest-init projection/signal observation. Compare with delivery_version; a mismatch means the observation is stale. This is not application acknowledgement."
          },
          "last_runtime_reload_projection": {
            "type": "string",
            "enum": [
              "updated",
              "unchanged",
              "failed"
            ],
            "description": "Whether guest-init updated the local projection, found it already current, or failed to write it."
          },
          "last_runtime_reload_signal": {
            "type": "string",
            "enum": [
              "sent",
              "queued",
              "failed",
              "not_attempted"
            ],
            "description": "Whether guest-init sent or queued its configured signal. This does not mean the application applied the new credentials."
          },
          "last_runtime_reload_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_runtime_reload_error_code": {
            "type": "string",
            "enum": [
              "projection_failed",
              "signal_failed"
            ],
            "description": "Closed, non-sensitive guest-init outcome code."
          },
          "last_runtime_reload_instance_id": {
            "type": "string",
            "description": "Runtime instance that reported this projection/signal outcome."
          },
          "runtime_reload_observations": {
            "type": "array",
            "description": "Complete current roster of active runtimes authorized for this secret by the deployment scope and env_secrets allowlist. Missing guest reports are represented explicitly.",
            "items": {
              "$ref": "#/components/schemas/SecretRuntimeReloadObservation"
            }
          },
          "runtime_reload_targets_complete": {
            "type": "boolean",
            "description": "True when this response includes the complete active, secret-authorized runtime roster. The field is absent from older control-plane responses; callers must fail closed when waiting for acknowledgements."
          }
        }
      },
      "SecretRuntimeReloadObservation": {
        "description": "Non-sensitive active main or explicitly authorized sidecar workload target and optional guest-init projection/signal outcome plus application-owned reload acknowledgement. An application acknowledgement is a self-attestation, not independent verification.",
        "type": "object",
        "required": [
          "instance_id",
          "runtime_state",
          "reload_support",
          "reported"
        ],
        "properties": {
          "instance_id": {
            "type": "string",
            "description": "Authorized active runtime instance ID."
          },
          "workload_name": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$",
            "description": "Sidecar workload name. Omitted for the main workload."
          },
          "runtime_state": {
            "type": "string",
            "enum": [
              "waking",
              "cold_booting",
              "running",
              "draining",
              "snapshotting",
              "migrating",
              "warm",
              "frozen"
            ],
            "description": "Current active instance state."
          },
          "reload_support": {
            "type": "string",
            "enum": [
              "enabled",
              "disabled",
              "unknown"
            ],
            "description": "Whether this deployment can participate in live reload; unknown means its image opt-in predates persisted metadata."
          },
          "reported": {
            "type": "boolean",
            "description": "Whether this runtime has reported a guest-init outcome. False is unknown, never success."
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Secret version observed by guest-init; compare with delivery_version to detect stale status. Present only when reported is true."
          },
          "projection": {
            "type": "string",
            "enum": [
              "updated",
              "unchanged",
              "failed"
            ]
          },
          "signal": {
            "type": "string",
            "enum": [
              "sent",
              "queued",
              "failed",
              "not_attempted"
            ]
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "error_code": {
            "type": "string",
            "enum": [
              "projection_failed",
              "signal_failed"
            ]
          },
          "application_ack_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Secret version the application claims to have applied; compare with delivery_version, independently of the guest-init report version."
          },
          "application_ack": {
            "type": "string",
            "enum": [
              "applied",
              "failed"
            ],
            "description": "Explicit application-owned outcome after rereading and applying FAAS_SECRETS_FILE. Missing means unknown, not failed."
          },
          "application_ack_at": {
            "type": "string",
            "format": "date-time"
          },
          "application_ack_error_code": {
            "type": "string",
            "enum": [
              "application_reload_failed"
            ],
            "description": "Closed, non-sensitive application-reported failure code."
          }
        }
      },
      "ScopedAppSecretResponse": {
        "description": "Per-row shape for the nested `secrets_by_scope` response\n(the env_by_scope).\nSame posture as AppSecretResponse but with an explicit\n`scope` field that carries the scope name on the wire\nso a CLI / dashboard can render \"scope: staging\" without\na second lookup. Value is NEVER echoed (same posture as\nAppSecretResponse).\n",
        "type": "object",
        "required": [
          "scope",
          "key",
          "secret_class",
          "created_at",
          "updated_at",
          "delivery_version",
          "delivery_status"
        ],
        "properties": {
          "scope": {
            "type": "string",
            "pattern": "^([a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?|__all__)$",
            "maxLength": 40,
            "example": "staging"
          },
          "key": {
            "type": "string",
            "pattern": "^[A-Z][A-Z0-9_]*$",
            "maxLength": 128,
            "example": "DATABASE_URL"
          },
          "secret_class": {
            "type": "string",
            "enum": [
              "persistent",
              "ephemeral"
            ],
            "description": "Retention class applied to the named secret in this scope; ephemeral disables init and warm captures."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "kid": {
            "type": "string",
            "description": "age-1.. recipient string of the host identity that sealed this row. Empty for rows sealed before migration 00166. Mirrors the `kid` field on the parent `AppSecretResponse` — see that schema for the cross-reference.",
            "example": "age1q..."
          },
          "value_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{16}$",
            "maxLength": 16,
            "description": "16-hex HMAC-SHA256(plaintext) keyed by the per-host host.hmac.key. Empty for older rows.",
            "example": "abcdef0123456789"
          },
          "delivery_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Opaque monotonic version of the runtime value."
          },
          "delivered_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Newest version confirmed in a successfully started runtime."
          },
          "delivery_status": {
            "type": "string",
            "enum": [
              "pending",
              "delivered",
              "failed"
            ]
          },
          "last_delivery_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_delivered_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_delivery_error_code": {
            "type": "string",
            "enum": [
              "runtime_start_failed"
            ]
          },
          "last_delivered_wake_id": {
            "type": "string"
          },
          "last_delivered_instance_id": {
            "type": "string"
          },
          "last_runtime_reload_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Secret version associated with the latest guest-init projection/signal observation; compare with delivery_version to detect stale status. Not an application acknowledgement."
          },
          "last_runtime_reload_projection": {
            "type": "string",
            "enum": [
              "updated",
              "unchanged",
              "failed"
            ]
          },
          "last_runtime_reload_signal": {
            "type": "string",
            "enum": [
              "sent",
              "queued",
              "failed",
              "not_attempted"
            ],
            "description": "Guest-init sent/queued signal outcome; does not mean the application applied the new credentials."
          },
          "last_runtime_reload_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_runtime_reload_error_code": {
            "type": "string",
            "enum": [
              "projection_failed",
              "signal_failed"
            ]
          },
          "last_runtime_reload_instance_id": {
            "type": "string"
          },
          "runtime_reload_observations": {
            "type": "array",
            "description": "For this scope, includes every active runtime authorized for the secret by its deployment, even before the runtime reports.",
            "items": {
              "$ref": "#/components/schemas/SecretRuntimeReloadObservation"
            }
          },
          "runtime_reload_targets_complete": {
            "type": "boolean",
            "description": "Indicates whether this scoped row contains a complete authorized target set. Older control planes omit the marker, so acknowledgement waiters must fail closed."
          }
        }
      },
      "AppSecretListResponse": {
        "description": "Paginated list of sealed-secret envelopes (no plaintext). Discriminated union: `secrets` is the flat arm; `secrets_by_scope` is the `?scope=__all__` arm.",
        "type": "object",
        "required": [
          "secrets",
          "quota_max",
          "count"
        ],
        "properties": {
          "secrets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppSecretResponse"
            }
          },
          "secrets_by_scope": {
            "type": "object",
            "description": "Nested per-scope map of secrets. Populated only when `?scope=__all__` is passed; keys are scope names, values are per-scope row lists ordered by key ASC.",
            "additionalProperties": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/ScopedAppSecretResponse"
              }
            }
          },
          "quota_max": {
            "type": "integer"
          },
          "count": {
            "type": "integer"
          }
        }
      },
      "AppSecretRevocationResponse": {
        "description": "Value-free deletion status plus the exact active authorized runtime roster captured when deletion committed.",
        "type": "object",
        "required": [
          "id",
          "scope",
          "key",
          "created_at",
          "status",
          "target_count",
          "acknowledged_count",
          "pending_count",
          "targets"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "key": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": [
              "complete",
              "pending",
              "failed",
              "blocked"
            ]
          },
          "target_count": {
            "type": "integer",
            "minimum": 0
          },
          "acknowledged_count": {
            "type": "integer",
            "minimum": 0
          },
          "pending_count": {
            "type": "integer",
            "minimum": 0
          },
          "targets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SecretRevocationTarget"
            }
          }
        }
      },
      "SecretRevocationTarget": {
        "description": "Non-sensitive snapshot of one authorized workload's deletion acknowledgement state.",
        "type": "object",
        "required": [
          "instance_id",
          "runtime_state",
          "reload_support",
          "status"
        ],
        "properties": {
          "instance_id": {
            "type": "string",
            "format": "uuid"
          },
          "workload_name": {
            "type": "string"
          },
          "runtime_state": {
            "type": "string"
          },
          "reload_support": {
            "type": "string",
            "enum": [
              "enabled",
              "disabled",
              "unknown"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "applied",
              "failed"
            ]
          },
          "ack_revision": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "ack_at": {
            "type": "string",
            "format": "date-time"
          },
          "error_code": {
            "type": "string",
            "enum": [
              "application_reload_failed"
            ]
          }
        }
      },
      "PutAppRegistryCredentialRequest": {
        "description": "Set a private-registry Basic Auth credential: normalized registry\nhost + username + plaintext password. The password is sealed\nserver-side under namespace `\"registry_creds\"` against the host\nX25519 recipient and never persisted in plaintext.\n",
        "type": "object",
        "required": [
          "registry",
          "username",
          "password"
        ],
        "properties": {
          "registry": {
            "type": "string",
            "description": "Registry host. Must include explicit `https://` prefix (schemeless + http:// are rejected §https-only clarification; customer's Basic Auth never leaves the box over cleartext). Trailing slash optional; embedded path / query / fragment rejected.",
            "pattern": "^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*(:([1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?$",
            "maxLength": 253,
            "example": "https://registry.gregale.dev"
          },
          "username": {
            "type": "string",
            "description": "Basic Auth username (metadata, NOT sealed).",
            "maxLength": 256,
            "example": "alice"
          },
          "password": {
            "type": "string",
            "description": "Plaintext Basic Auth password. Sealed server-side; never persisted or returned.",
            "maxLength": 4096,
            "format": "password",
            "example": "s3cret-basic-auth-pw"
          }
        }
      },
      "AppRegistryCredentialResponse": {
        "description": "A sealed private-registry credential envelope: registry + username\n+ timestamps. Plaintext password NEVER appears in this shape.\n",
        "type": "object",
        "required": [
          "registry",
          "username",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "registry": {
            "type": "string",
            "example": "registry.gregale.dev"
          },
          "username": {
            "type": "string",
            "example": "alice"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_used_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of the last successful authenticated pull. Omitted when the credential has not been used yet."
          }
        }
      },
      "AppRegistryCredentialListResponse": {
        "description": "Wrapped list response: rows + quota metadata. The Free plan\nreturns 403 on PUT and an empty list on GET.\n",
        "type": "object",
        "required": [
          "credentials",
          "quota_max",
          "count"
        ],
        "properties": {
          "credentials": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppRegistryCredentialResponse"
            }
          },
          "quota_max": {
            "type": "integer",
            "description": "Per-app cap from the customer's plan (Free 0, Hobby 2, Pro 5, Scale 20)."
          },
          "count": {
            "type": "integer"
          }
        }
      },
      "PutAppEnvRequest": {
        "description": "Set an env var: plaintext value (persisted verbatim in app_envs, non-sensitive by contract).",
        "type": "object",
        "required": [
          "value"
        ],
        "properties": {
          "value": {
            "type": "string",
            "description": "Plaintext env-var value. Stored as-is; do NOT use this surface for credentials.",
            "example": "debug"
          }
        }
      },
      "ConfigGuardSummary": {
        "description": "The config guard an env or secret write opened or joined.",
        "type": "object",
        "required": [
          "id",
          "status",
          "base_revision"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "watching",
              "clean",
              "restored",
              "regressed",
              "no_traffic",
              "superseded"
            ]
          },
          "base_revision": {
            "type": "integer",
            "format": "int64"
          },
          "window_minutes": {
            "type": "integer"
          }
        }
      },
      "ConfigChangeReceipt": {
        "description": "The config revision an env or secret write recorded and the guard watching it.",
        "type": "object",
        "required": [
          "revision"
        ],
        "properties": {
          "revision": {
            "type": "integer",
            "format": "int64"
          },
          "guard": {
            "$ref": "#/components/schemas/ConfigGuardSummary"
          }
        }
      },
      "ConfigGuardDecision": {
        "description": "Why a config guard closed: the rule, a one-line summary and the new-config and old-config samples.",
        "type": "object",
        "required": [
          "rule",
          "summary",
          "new_requests",
          "new_server_errors",
          "old_requests",
          "old_server_errors"
        ],
        "properties": {
          "rule": {
            "type": "string",
            "example": "fail_first_wake_5xx"
          },
          "summary": {
            "type": "string"
          },
          "new_requests": {
            "type": "integer",
            "format": "int64"
          },
          "new_server_errors": {
            "type": "integer",
            "format": "int64"
          },
          "old_requests": {
            "type": "integer",
            "format": "int64"
          },
          "old_server_errors": {
            "type": "integer",
            "format": "int64"
          },
          "restored_revision": {
            "type": "integer",
            "format": "int64"
          },
          "not_restorable": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "ConfigGuard": {
        "description": "A scope's config guard.",
        "type": "object",
        "required": [
          "id",
          "scope",
          "status",
          "base_revision",
          "head_revision",
          "restorable",
          "opened_at",
          "last_change_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "watching",
              "clean",
              "restored",
              "regressed",
              "no_traffic",
              "superseded"
            ]
          },
          "base_revision": {
            "type": "integer",
            "format": "int64"
          },
          "head_revision": {
            "type": "integer",
            "format": "int64"
          },
          "restorable": {
            "type": "boolean"
          },
          "opened_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_change_at": {
            "type": "string",
            "format": "date-time"
          },
          "window_ends_at": {
            "type": "string",
            "format": "date-time"
          },
          "closed_at": {
            "type": "string",
            "format": "date-time"
          },
          "decision": {
            "$ref": "#/components/schemas/ConfigGuardDecision"
          }
        }
      },
      "EnvBatchRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "request_id",
          "expected_revision"
        ],
        "description": "At least one set or delete is required. Keys must be distinct across both collections; plan limits bound collection counts and value sizes.",
        "properties": {
          "expected_app_id": {
            "type": "string",
            "format": "uuid",
            "description": "Optional immutable app identity; required when expected_environment_id is supplied."
          },
          "expected_environment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Immutable named-environment identity for an identity-pinned batch; omit for the default scope."
          },
          "receipt_proof": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "writeOnly": true,
            "description": "Optional private random proof required to read this batch receipt; never returned in a receipt. Requires expected_app_id."
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "values": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Non-secret variable values to set, omitted from receipts."
          },
          "delete": {
            "type": "array",
            "uniqueItems": true,
            "items": {
              "type": "string"
            }
          }
        }
      },
      "EnvBatchResponse": {
        "description": "Durable value-free receipt of an atomic variable batch.",
        "type": "object",
        "required": [
          "request_id",
          "app_id",
          "scope",
          "updated_keys",
          "deleted_keys",
          "config_change"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "environment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Immutable environment identity when the original named batch was pinned."
          },
          "updated_keys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "deleted_keys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "config_change": {
            "$ref": "#/components/schemas/ConfigChangeReceipt"
          }
        }
      },
      "ConfigRevision": {
        "description": "One recorded config change, without values.",
        "type": "object",
        "required": [
          "revision",
          "scope",
          "source",
          "actor",
          "created_at",
          "variable_count",
          "secret_count"
        ],
        "properties": {
          "revision": {
            "type": "integer",
            "format": "int64"
          },
          "scope": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "baseline",
              "env.set",
              "env.delete",
              "env.batch",
              "secret.set",
              "secret.delete",
              "secret.rotate",
              "config.rollback",
              "config.guard_restore"
            ]
          },
          "key": {
            "type": "string"
          },
          "actor": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "variable_count": {
            "type": "integer"
          },
          "secret_count": {
            "type": "integer"
          },
          "guard_id": {
            "type": "string",
            "format": "uuid"
          },
          "guard_status": {
            "type": "string"
          },
          "restored_revision": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "ConfigRevisionDetail": {
        "description": "A config revision with its variables and secret versions. Secret values are never returned.",
        "allOf": [
          {
            "$ref": "#/components/schemas/ConfigRevision"
          },
          {
            "type": "object",
            "required": [
              "variables",
              "secret_versions"
            ],
            "properties": {
              "variables": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "secret_versions": {
                "type": "object",
                "additionalProperties": {
                  "type": "integer",
                  "format": "int64"
                }
              }
            }
          }
        ]
      },
      "ListConfigRevisionsResponse": {
        "description": "A scope's config revisions, newest first, and its newest config guard.",
        "type": "object",
        "required": [
          "revisions"
        ],
        "properties": {
          "revisions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConfigRevision"
            }
          },
          "guard": {
            "$ref": "#/components/schemas/ConfigGuard"
          }
        }
      },
      "ReleaseFreezeWeekly": {
        "description": "A weekly freeze window: it opens on each listed day at `start` in `time_zone` and lasts `duration_minutes`, so it may run past midnight or into the next week.",
        "type": "object",
        "required": [
          "days",
          "start",
          "duration_minutes",
          "time_zone"
        ],
        "properties": {
          "days": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "enum": [
                "sun",
                "mon",
                "tue",
                "wed",
                "thu",
                "fri",
                "sat"
              ]
            },
            "description": "Weekdays the window opens on."
          },
          "start": {
            "type": "string",
            "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$",
            "description": "Local opening time, HH:MM."
          },
          "duration_minutes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10080,
            "description": "How long each window lasts."
          },
          "time_zone": {
            "type": "string",
            "maxLength": 64,
            "description": "IANA time zone, such as Europe/Istanbul or UTC."
          }
        }
      },
      "ReleaseFreeze": {
        "description": "A deploy freeze on production releases of one app or, without `app`, of every app of its owner. An account's freezes cover its personal apps; a company organization's freezes (`org`) cover the organization's apps.",
        "type": "object",
        "required": [
          "id",
          "kind",
          "reason",
          "source",
          "created_by",
          "created_at",
          "active"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app": {
            "type": "string",
            "description": "The covered app's slug; omitted for a freeze on all of the owner's apps."
          },
          "org": {
            "type": "string",
            "description": "Slug of the company organization that owns the freeze; omitted for an account's freeze."
          },
          "kind": {
            "type": "string",
            "enum": [
              "window",
              "weekly",
              "after_rollback"
            ]
          },
          "starts_at": {
            "type": "string",
            "format": "date-time",
            "description": "Window start."
          },
          "ends_at": {
            "type": "string",
            "format": "date-time",
            "description": "Window end; omitted for a window that lasts until lifted."
          },
          "weekly": {
            "$ref": "#/components/schemas/ReleaseFreezeWeekly"
          },
          "after_rollback_minutes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1440,
            "description": "How long an after-rollback policy freezes an app Gregale rolled back automatically."
          },
          "reason": {
            "type": "string",
            "maxLength": 200
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "automatic_rollback"
            ],
            "description": "automatic_rollback for the window an after-rollback policy created."
          },
          "source_deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "The rolled-back deployment behind an automatic freeze."
          },
          "created_by": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "active": {
            "type": "boolean",
            "description": "Whether the freeze withholds production releases now."
          },
          "next_starts_at": {
            "type": "string",
            "format": "date-time",
            "description": "When an inactive window or weekly freeze next starts, within a week."
          }
        }
      },
      "CreateReleaseFreezeRequest": {
        "description": "Creates a freeze. A window takes `starts_at` (default now) and optional `ends_at`; a weekly freeze takes `weekly`; an after-rollback policy takes `after_rollback_minutes`.",
        "type": "object",
        "required": [
          "kind",
          "reason"
        ],
        "properties": {
          "app": {
            "type": "string",
            "description": "App slug. On `/v1/freezes`, omit to freeze every personal app of the account; a company app is refused with 409 (use `/v1/apps/{slug}/freezes`). On an app route, empty or that app; on an organization route, empty."
          },
          "kind": {
            "type": "string",
            "enum": [
              "window",
              "weekly",
              "after_rollback"
            ]
          },
          "starts_at": {
            "type": "string",
            "format": "date-time",
            "description": "Window start; default now."
          },
          "ends_at": {
            "type": "string",
            "format": "date-time",
            "description": "Window end; omit to freeze until lifted."
          },
          "weekly": {
            "$ref": "#/components/schemas/ReleaseFreezeWeekly"
          },
          "after_rollback_minutes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1440,
            "description": "Freeze length after each automatic rollback."
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        }
      },
      "ListReleaseFreezesResponse": {
        "description": "Unlifted freezes that have not ended, oldest first.",
        "type": "object",
        "required": [
          "freezes"
        ],
        "properties": {
          "freezes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReleaseFreeze"
            }
          }
        }
      },
      "ReleaseFreezeStatus": {
        "description": "Whether a production release of the app would be refused now.",
        "type": "object",
        "required": [
          "app",
          "frozen",
          "active"
        ],
        "properties": {
          "app": {
            "type": "string"
          },
          "frozen": {
            "type": "boolean"
          },
          "active": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReleaseFreeze"
            },
            "description": "The freezes refusing a production release now."
          },
          "next": {
            "$ref": "#/components/schemas/ReleaseFreeze"
          }
        }
      },
      "ReleaseGate": {
        "description": "One of an app's release gates.",
        "type": "object",
        "required": [
          "name",
          "kind",
          "min_samples",
          "created_by",
          "created_at"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_-]{0,62}$"
          },
          "kind": {
            "type": "string",
            "enum": [
              "slo",
              "new_errors",
              "custom_metric",
              "ai",
              "synthetic",
              "metric_change"
            ]
          },
          "slo": {
            "type": "string",
            "description": "slo gates: the SLO judged."
          },
          "max_burn_rate": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000,
            "description": "slo gates: the burn rate that fails the gate."
          },
          "max_new_groups": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "new_errors gates: new error groups allowed."
          },
          "min_events": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100000,
            "description": "new_errors gates: events before a group counts."
          },
          "metric": {
            "type": "string",
            "description": "custom_metric and metric_change gates: the custom metric. ai gates: error_rate, flagged_rate, cost_per_call or ttfb_ms."
          },
          "comparison": {
            "type": "string",
            "enum": [
              "below",
              "above"
            ],
            "description": "custom_metric gates: which side of the threshold fails; metric_change gates: which direction of change fails."
          },
          "threshold": {
            "type": "number",
            "description": "custom_metric gates: the bound on the metric's average."
          },
          "max_increase_percent": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000,
            "description": "ai gates: the largest increase over the baseline, in percent."
          },
          "check": {
            "type": "string",
            "description": "synthetic gates: the synthetic check probed on the canary and its stable revision."
          },
          "max_failure_percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "synthetic gates: the share of the candidate's probes that may fail."
          },
          "max_change_percent": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000,
            "description": "metric_change gates: how far the metric may move from its average before the rollout, in percent."
          },
          "labels": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "custom_metric and metric_change gates: the labelled series judged. Absent when the gate judges the aggregate."
          },
          "min_samples": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000,
            "description": "Requests, probes, metric values or AI calls (on each side, for ai gates) needed before the gate is judged."
          },
          "created_by": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreateReleaseGateRequest": {
        "description": "Adds a release gate. Give exactly one kind's fields; omitted numbers take Gregale's defaults.",
        "type": "object",
        "required": [
          "name",
          "kind"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_-]{0,62}$"
          },
          "kind": {
            "type": "string",
            "enum": [
              "slo",
              "new_errors",
              "custom_metric",
              "ai",
              "synthetic",
              "metric_change"
            ]
          },
          "slo": {
            "type": "string",
            "description": "slo gates: the name of one of the app's SLOs."
          },
          "max_burn_rate": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000,
            "description": "slo gates: default 10."
          },
          "max_new_groups": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "new_errors gates: default 0."
          },
          "min_events": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100000,
            "description": "new_errors gates: default 3."
          },
          "metric": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,62}$",
            "description": "custom_metric and metric_change gates: the custom metric's name. ai gates: error_rate, flagged_rate, cost_per_call or ttfb_ms."
          },
          "comparison": {
            "type": "string",
            "enum": [
              "below",
              "above"
            ],
            "description": "custom_metric gates: fail when the average is below or above the threshold. metric_change gates: fail when the average fell (below) or rose (above) too far."
          },
          "threshold": {
            "type": "number",
            "description": "custom_metric gates: the bound."
          },
          "max_increase_percent": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000,
            "description": "ai gates: fail when the release's metric is this many percent above its baseline's, and above a floor (1 percentage point, 50 ms or 1 millicent). Default 50."
          },
          "check": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_-]{0,62}$",
            "description": "synthetic gates: the name of one of the app's synthetic checks."
          },
          "max_failure_percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "synthetic gates: default 10."
          },
          "max_change_percent": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000,
            "description": "metric_change gates: the change, in percent of the average before the rollout, that fails the gate."
          },
          "labels": {
            "type": "object",
            "maxProperties": 3,
            "additionalProperties": {
              "type": "string",
              "maxLength": 128
            },
            "description": "custom_metric and metric_change gates: judge the one labelled series with exactly these labels instead of the metric's aggregate. Keys match ^[a-z_][a-z0-9_]{0,62}$."
          },
          "min_samples": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000,
            "description": "Default 20; 6 probes for synthetic gates."
          }
        }
      },
      "ListReleaseGatesResponse": {
        "description": "An app's release gates, by name.",
        "type": "object",
        "required": [
          "gates"
        ],
        "properties": {
          "gates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReleaseGate"
            }
          }
        }
      },
      "ReleaseApprovalPolicy": {
        "description": "An app's release approval policy.",
        "type": "object",
        "required": [
          "app",
          "required_approvals",
          "after_stage",
          "timeout_minutes",
          "approvers",
          "allow_self_approval",
          "notify_channels",
          "updated_by",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "app": {
            "type": "string"
          },
          "required_approvals": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5,
            "description": "Distinct eligible people who must approve each production release."
          },
          "after_stage": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10,
            "description": "The canary stage a release waits in, counted from 1."
          },
          "timeout_minutes": {
            "type": "integer",
            "minimum": 10,
            "maximum": 10080,
            "description": "How long a release may wait before its rollout is aborted."
          },
          "approvers": {
            "type": "string",
            "enum": [
              "admin",
              "developer"
            ],
            "description": "admin: organization owners and admins; developer: developers too."
          },
          "allow_self_approval": {
            "type": "boolean",
            "description": "Whether the deployer's own approval counts."
          },
          "notify_channels": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "type": "string"
            },
            "description": "Notification channels told when a release waits, is approved or rejected, or times out."
          },
          "updated_by": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SetReleaseApprovalPolicyRequest": {
        "description": "Sets an app's approval policy. Omitted fields take the defaults: stage 1, a 24-hour timeout, owner or admin approvers, no self-approval.",
        "type": "object",
        "required": [
          "required_approvals"
        ],
        "properties": {
          "required_approvals": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5
          },
          "after_stage": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10,
            "description": "Default 1."
          },
          "timeout_minutes": {
            "type": "integer",
            "minimum": 10,
            "maximum": 10080,
            "description": "Default 1440."
          },
          "approvers": {
            "type": "string",
            "enum": [
              "admin",
              "developer"
            ],
            "description": "Default admin."
          },
          "allow_self_approval": {
            "type": "boolean",
            "description": "Default false; always true for an app outside an organization."
          },
          "notify_channels": {
            "type": "array",
            "maxItems": 5,
            "uniqueItems": true,
            "items": {
              "type": "string"
            },
            "description": "Names of Slack or email notification channels; at least one is needed, so the approvers learn a release waits, and PagerDuty channels are refused. Slack messages link to the approval page."
          }
        }
      },
      "DecideReleaseApprovalRequest": {
        "description": "One person's decision on a release. A rejection needs a comment.",
        "type": "object",
        "required": [
          "decision"
        ],
        "properties": {
          "decision": {
            "type": "string",
            "enum": [
              "approve",
              "reject"
            ]
          },
          "comment": {
            "type": "string",
            "maxLength": 200,
            "description": "Recorded with the decision; required to reject."
          }
        }
      },
      "ReleaseApprovalDecision": {
        "description": "A decision recorded on a release.",
        "type": "object",
        "required": [
          "approver",
          "role",
          "decision",
          "counted",
          "decided_at"
        ],
        "properties": {
          "approver": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "developer",
              "personal"
            ],
            "description": "The approver's organization role when they decided; personal for an app outside an organization."
          },
          "decision": {
            "type": "string",
            "enum": [
              "approve",
              "reject"
            ]
          },
          "comment": {
            "type": "string"
          },
          "counted": {
            "type": "boolean",
            "description": "Whether the approval counts toward the policy; the deployer's own approval does not unless self-approval is allowed."
          },
          "decided_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "RecordReleaseOutcomeCheckRequest": {
        "description": "What a person checked in the database after a release command with an unknown outcome.",
        "type": "object",
        "required": [
          "note"
        ],
        "properties": {
          "note": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000,
            "description": "What was checked, for example which migrations are applied."
          }
        }
      },
      "ReleaseOutcomeCheck": {
        "description": "A recorded database check after a release command with an unknown outcome. Later release commands of the scope run again.",
        "type": "object",
        "required": [
          "deployment_id",
          "task_id",
          "task_status",
          "checked_by",
          "note",
          "checked_at"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "task_id": {
            "type": "string",
            "format": "uuid",
            "description": "The release command's task."
          },
          "task_status": {
            "type": "string",
            "enum": [
              "failed",
              "timed_out",
              "cancelled"
            ],
            "description": "How the release command ended, without an exit code."
          },
          "checked_by": {
            "type": "string",
            "description": "The person or API key that recorded the check."
          },
          "note": {
            "type": "string",
            "description": "What the person recorded about the database."
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DatabaseSwitch": {
        "description": "A rollback that restores the app's managed PostgreSQL database with the code. The database is restored to restore_point as a new database, and the app moves to it and to the target release while it is fenced.",
        "type": "object",
        "required": [
          "id",
          "app_id",
          "scope",
          "phase",
          "target_deployment_id",
          "undone_deployment_ids",
          "source_database_id",
          "target_name",
          "restore_point",
          "drain",
          "phase_started_at",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string",
            "description": "The deployment scope the rollback restores."
          },
          "phase": {
            "type": "string",
            "enum": [
              "restoring",
              "staging",
              "verifying",
              "fencing",
              "settling",
              "draining",
              "switching",
              "resuming",
              "aborting",
              "completed",
              "failed",
              "cancelled"
            ],
            "description": "From fencing until completed the app does not serve. aborting unwinds everything done before the bindings switched."
          },
          "from_deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "The release serving when the switch was requested; the switch aborts if another one serves before it switches."
          },
          "from_revision": {
            "type": "integer",
            "minimum": 0
          },
          "target_deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "The rollback target."
          },
          "target_revision": {
            "type": "integer",
            "minimum": 0
          },
          "undone_deployment_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Deployments whose release commands the restore undoes; rolling back to them is refused afterwards."
          },
          "source_database_id": {
            "type": "string",
            "format": "uuid",
            "description": "The database the app leaves. It keeps every write."
          },
          "source_database_name": {
            "type": "string"
          },
          "target_database_id": {
            "type": "string",
            "format": "uuid",
            "description": "The restored copy, once its restore has started."
          },
          "target_name": {
            "type": "string",
            "description": "Name of the restored copy."
          },
          "restore_point": {
            "type": "string",
            "format": "date-time",
            "description": "Writes after this moment stay only in the source database."
          },
          "drain": {
            "$ref": "#/components/schemas/DatabaseSwitchDrain"
          },
          "failure_code": {
            "type": "string",
            "description": "Why a switch failed or was cancelled, or why it is aborting."
          },
          "failure_detail": {
            "type": "string"
          },
          "last_error_code": {
            "type": "string",
            "description": "The latest transient error the switch is retrying."
          },
          "requested_by": {
            "type": "string"
          },
          "cancel_requested_at": {
            "type": "string",
            "format": "date-time"
          },
          "fenced_at": {
            "type": "string",
            "format": "date-time"
          },
          "release_switched_at": {
            "type": "string",
            "format": "date-time"
          },
          "activated_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the bindings moved to the copy; there is no way back after it."
          },
          "finished_at": {
            "type": "string",
            "format": "date-time"
          },
          "phase_started_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DatabaseSwitchDrain": {
        "description": "A fenced app's instances by outcome: retired with a native receipt, parked (no process; snapshot invalidated), still pending, or blocking the switch.",
        "type": "object",
        "required": [
          "retired",
          "parked",
          "pending",
          "blocked"
        ],
        "properties": {
          "retired": {
            "type": "integer",
            "minimum": 0
          },
          "parked": {
            "type": "integer",
            "minimum": 0
          },
          "pending": {
            "type": "integer",
            "minimum": 0
          },
          "blocked": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "DatabaseSwitchList": {
        "description": "A page of an app's database switches, newest first.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DatabaseSwitch"
            }
          }
        }
      },
      "ScheduledCachePreparation": {
        "description": "Prepare a saved GET route group for a scheduled cutover to all traffic.",
        "type": "object",
        "properties": {
          "plan_version": {
            "type": "string",
            "format": "date-time",
            "description": "Exact version of the saved enabled cache plan. Omit when turning preparation off."
          },
          "failure_policy": {
            "type": "string",
            "enum": [
              "hold",
              "regular_refresh",
              "off"
            ],
            "default": "hold",
            "description": "Hold the release and notify its selected channels, continue with regular refresh, or remove preparation from this schedule."
          },
          "start_candidate": {
            "type": "boolean",
            "description": "Allow a bounded start of the exact candidate shortly before this schedule is due. Starting it can incur compute usage."
          }
        }
      },
      "ScheduledCacheStaging": {
        "description": "Private cache preparation and serving gateway readiness for a pending release.",
        "type": "object",
        "required": [
          "state",
          "ready_gateways",
          "serving_gateways"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "waiting",
              "preparing",
              "staging",
              "ready",
              "refresh_needed"
            ]
          },
          "ready_gateways": {
            "type": "integer",
            "minimum": 0
          },
          "serving_gateways": {
            "type": "integer",
            "minimum": 0
          },
          "fresh_until": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ScheduledRelease": {
        "description": "A release built ahead of time that starts its rollout at release_at.",
        "type": "object",
        "required": [
          "id",
          "app",
          "deployment_id",
          "release_at",
          "state",
          "notify_channels",
          "scheduled_by",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "minimum": 0
          },
          "release_at": {
            "type": "string",
            "format": "date-time"
          },
          "state": {
            "type": "string",
            "enum": [
              "scheduled",
              "started",
              "blocked",
              "expired",
              "cancelled",
              "superseded"
            ]
          },
          "canary": {
            "$ref": "#/components/schemas/CanaryPresetSpec"
          },
          "notify_channels": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "override_freeze": {
            "type": "string",
            "maxLength": 200,
            "description": "The reason given for releasing into the freezes in overridden_freezes."
          },
          "overridden_freezes": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "outcome_code": {
            "type": "string",
            "description": "Why a schedule ended without starting, such as release_frozen or not_ready."
          },
          "outcome_detail": {
            "type": "string",
            "maxLength": 500
          },
          "scheduled_by": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "cache_preparation": {
            "$ref": "#/components/schemas/ScheduledCachePreparation"
          },
          "cache_outcome": {
            "type": "string",
            "enum": [
              "prepared",
              "regular_refresh",
              "hold"
            ],
            "description": "Cache result once the schedule has been decided."
          },
          "cache_detail": {
            "type": "string",
            "maxLength": 500,
            "description": "Why preparation held the release or why it started with regular refresh."
          },
          "cache_candidate_start": {
            "type": "string",
            "enum": [
              "starting",
              "already_running",
              "started",
              "failed"
            ],
            "description": "Progress or result of the optional scheduled candidate start."
          },
          "cache_candidate_start_detail": {
            "type": "string",
            "maxLength": 500,
            "description": "Why the candidate start could not be confirmed."
          },
          "cache_staging": {
            "$ref": "#/components/schemas/ScheduledCacheStaging"
          },
          "cache_used_prestage": {
            "type": "boolean",
            "description": "The cutover used responses prepared before the scheduled time."
          },
          "cache_cutover_delay_reason": {
            "type": "string",
            "enum": [
              "candidate",
              "cache_preparation",
              "release_gate"
            ],
            "description": "The first observed reason the cutover waited. Omitted if no cause was recorded."
          }
        }
      },
      "ScheduledReleaseListResponse": {
        "description": "Scheduled releases, pending ones first.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ScheduledRelease"
            }
          }
        }
      },
      "ScheduleReleaseRequest": {
        "description": "When and how a release waiting without traffic starts its rollout.",
        "type": "object",
        "required": [
          "release_at"
        ],
        "properties": {
          "release_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the rollout starts; at most 7 days ahead. A time that has passed starts it on the API's next pass."
          },
          "canary": {
            "$ref": "#/components/schemas/CanaryPresetSpec"
          },
          "notify_channels": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          "override_freeze": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Release into the deploy freezes active at release_at; audited when the release starts."
          },
          "cache_preparation": {
            "description": "Optional for an all-traffic-at-once release. Omission keeps the cache settings of a pending schedule for the same deployment.",
            "$ref": "#/components/schemas/ScheduledCachePreparation"
          }
        }
      },
      "ReleaseApprovalStatus": {
        "description": "A release's approval state.",
        "type": "object",
        "required": [
          "deployment_id",
          "app",
          "state",
          "approvals",
          "decisions"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "app": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "not_required",
              "waiting",
              "approved",
              "rejected",
              "expired"
            ]
          },
          "required_approvals": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5
          },
          "approvals": {
            "type": "integer",
            "minimum": 0,
            "description": "Approvals that count toward the policy."
          },
          "after_stage": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10
          },
          "deployed_by": {
            "type": "string"
          },
          "waiting_since": {
            "type": "string",
            "format": "date-time",
            "description": "When the canary entered its waiting stage."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "When a release still waiting is aborted."
          },
          "decisions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReleaseApprovalDecision"
            }
          }
        }
      },
      "ListReleaseApprovalsResponse": {
        "description": "An app's releases waiting for approval.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReleaseApprovalStatus"
            }
          }
        }
      },
      "ReleaseTimeline": {
        "description": "One release's phase and what happened to it.",
        "type": "object",
        "required": [
          "deployment_id",
          "app",
          "status",
          "phase",
          "summary",
          "traffic_percent",
          "created_at",
          "events"
        ],
        "properties": {
          "canary_cache_preparation": {
            "$ref": "#/components/schemas/CanaryCachePreparation"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "app": {
            "type": "string"
          },
          "revision": {
            "type": "integer",
            "minimum": 0
          },
          "scope": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "description": "The deployment's status, such as live or superseded."
          },
          "phase": {
            "type": "string",
            "enum": [
              "building",
              "failed",
              "cancelled",
              "rolled_back",
              "scheduled",
              "awaiting_approval",
              "superseded",
              "held",
              "rolling_out",
              "watching",
              "released"
            ],
            "description": "Where the release is, matched in this order."
          },
          "summary": {
            "type": "string",
            "description": "One line, such as \"Rolling out: step 2 of 4, 10% of traffic\"."
          },
          "traffic_percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "canary_step": {
            "type": "integer",
            "minimum": 0,
            "description": "Zero-based current canary step."
          },
          "canary_total_steps": {
            "type": "integer",
            "minimum": 0
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "deployed_by": {
            "type": "string"
          },
          "commit_sha": {
            "type": "string"
          },
          "pr_number": {
            "type": "integer",
            "minimum": 0
          },
          "tag": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "stable_deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "The release this one replaces; an abort returns traffic to it."
          },
          "stable_revision": {
            "type": "integer",
            "minimum": 0
          },
          "replaced_by_deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "The newer release of the same scope that took over."
          },
          "replaced_by_revision": {
            "type": "integer",
            "minimum": 0
          },
          "watch_until": {
            "type": "string",
            "format": "date-time",
            "description": "When the post-release watch stops judging the release."
          },
          "approval": {
            "$ref": "#/components/schemas/ReleaseApprovalStatus"
          },
          "schedule": {
            "$ref": "#/components/schemas/ScheduledRelease"
          },
          "gates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReleaseGateResult"
            },
            "description": "The results of the newest decision that judged release gates."
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReleaseTimelineEvent"
            }
          },
          "truncated": {
            "type": "boolean",
            "description": "Older audit history was left out."
          }
        }
      },
      "ReleaseTimelineEvent": {
        "description": "One thing that happened to a release.",
        "type": "object",
        "required": [
          "at",
          "summary",
          "kind"
        ],
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "kind": {
            "type": "string",
            "enum": [
              "created",
              "scheduled",
              "schedule_started",
              "schedule_blocked",
              "schedule_cancelled",
              "approval_requested",
              "approved",
              "rejected",
              "approval_expired",
              "rollout_started",
              "advanced",
              "traffic_changed",
              "held",
              "completed",
              "aborted",
              "rollback_requested",
              "rolled_back",
              "watch_passed",
              "watch_regressed",
              "superseded",
              "note"
            ]
          },
          "summary": {
            "type": "string",
            "description": "What happened, in one sentence."
          },
          "actor": {
            "type": "string",
            "description": "A person's email, or Gregale for automatic steps."
          },
          "traffic_percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "The release's traffic share after this event."
          },
          "repeats": {
            "type": "integer",
            "minimum": 0,
            "description": "Further holds with the same rule this event stands for."
          },
          "decision": {
            "$ref": "#/components/schemas/RolloutDecision"
          }
        }
      },
      "ReleaseDiff": {
        "description": "What changed between two releases of one app.",
        "type": "object",
        "required": [
          "app",
          "to",
          "summary",
          "code",
          "config",
          "dependencies",
          "runtime",
          "database"
        ],
        "properties": {
          "app": {
            "type": "string"
          },
          "from": {
            "$ref": "#/components/schemas/ReleaseDiffSide"
          },
          "to": {
            "$ref": "#/components/schemas/ReleaseDiffSide"
          },
          "summary": {
            "type": "string",
            "description": "One line, such as \"new code, 2 config keys, 5 packages\"."
          },
          "code": {
            "$ref": "#/components/schemas/ReleaseDiffCode"
          },
          "config": {
            "$ref": "#/components/schemas/ReleaseDiffConfig"
          },
          "dependencies": {
            "$ref": "#/components/schemas/ReleaseDiffDependencies"
          },
          "runtime": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReleaseDiffField"
            }
          },
          "database": {
            "$ref": "#/components/schemas/ReleaseDiffDatabase"
          }
        }
      },
      "ReleaseDiffSide": {
        "description": "One of the two compared releases.",
        "type": "object",
        "required": [
          "deployment_id",
          "created_at"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "minimum": 0
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "deployed_by": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          },
          "pr_number": {
            "type": "integer",
            "minimum": 0
          },
          "commit": {
            "type": "string"
          }
        }
      },
      "ReleaseDiffCode": {
        "description": "How the releases' source and image differ.",
        "type": "object",
        "required": [
          "changed",
          "image_changed"
        ],
        "properties": {
          "changed": {
            "type": "boolean"
          },
          "from_commit": {
            "type": "string"
          },
          "to_commit": {
            "type": "string"
          },
          "compare_url": {
            "type": "string",
            "format": "uri",
            "description": "GitHub's compare page when both releases came from the same GitHub repository."
          },
          "image_changed": {
            "type": "boolean"
          }
        }
      },
      "ReleaseDiffKey": {
        "description": "A configuration key that differs; values are never included.",
        "type": "object",
        "required": [
          "key",
          "change"
        ],
        "properties": {
          "key": {
            "type": "string"
          },
          "change": {
            "type": "string",
            "enum": [
              "added",
              "removed",
              "changed"
            ]
          }
        }
      },
      "ReleaseDiffConfig": {
        "description": "How the configuration each release started with differs, by key.",
        "type": "object",
        "required": [
          "known",
          "variables",
          "secrets"
        ],
        "properties": {
          "known": {
            "type": "boolean",
            "description": "False when the retained config history no longer reaches one of the releases."
          },
          "note": {
            "type": "string"
          },
          "variables": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReleaseDiffKey"
            }
          },
          "secrets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReleaseDiffKey"
            }
          }
        }
      },
      "ReleaseDiffPackage": {
        "description": "A package whose presence or version differs between the builds.",
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "The package's purl without its version, or its group and name."
          },
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          }
        }
      },
      "ReleaseDiffDependencies": {
        "description": "How the builds' SBOM packages differ. Each list holds at most 100 entries.",
        "type": "object",
        "required": [
          "known",
          "added",
          "removed",
          "changed"
        ],
        "properties": {
          "known": {
            "type": "boolean",
            "description": "False when either release has no build SBOM."
          },
          "note": {
            "type": "string"
          },
          "added": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReleaseDiffPackage"
            }
          },
          "removed": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReleaseDiffPackage"
            }
          },
          "changed": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReleaseDiffPackage"
            }
          },
          "truncated": {
            "type": "boolean"
          }
        }
      },
      "ReleaseDiffField": {
        "description": "A runtime setting that differs; env overrides compare by key.",
        "type": "object",
        "required": [
          "field",
          "from",
          "to"
        ],
        "properties": {
          "field": {
            "type": "string",
            "enum": [
              "kind",
              "handler",
              "runtime_base",
              "port",
              "entrypoint",
              "command",
              "min_instances",
              "healthcheck",
              "liveness_probe",
              "readiness_probe",
              "sidecars",
              "workflows",
              "env_override_keys"
            ]
          },
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          }
        }
      },
      "ReleaseDiffDatabase": {
        "description": "How the releases' release commands, which run database migrations, differ.",
        "type": "object",
        "required": [
          "changed"
        ],
        "properties": {
          "changed": {
            "type": "boolean"
          },
          "from_release_command": {
            "type": "string"
          },
          "to_release_command": {
            "type": "string"
          }
        }
      },
      "ReleaseGateResult": {
        "description": "One judged release gate in a rollout decision. Aggregates only: no routes, messages or metric labels.",
        "type": "object",
        "required": [
          "name",
          "kind",
          "passed",
          "summary",
          "observed",
          "bound",
          "samples"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "slo",
              "new_errors",
              "custom_metric",
              "ai",
              "synthetic",
              "metric_change"
            ]
          },
          "passed": {
            "type": "boolean"
          },
          "observed": {
            "type": "number",
            "description": "The burn rate, new error groups, metric average, the release's AI metric, failed-probe percentage, or signed change in percent."
          },
          "bound": {
            "type": "number",
            "description": "The value that fails the gate."
          },
          "samples": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "The release's requests, new-error events, probes, metric values or AI calls."
          },
          "baseline_bad_fraction": {
            "type": "number",
            "description": "slo gates: the predecessor's bad fraction."
          },
          "baseline": {
            "type": "number",
            "description": "synthetic gates: the stable revision's failed-probe percentage; metric_change gates: the metric's average before the rollout."
          },
          "error_classes": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "type": "string"
            },
            "description": "new_errors gates: the new groups' error classes."
          },
          "summary": {
            "type": "string",
            "description": "What the gate measured, in one line."
          },
          "not_judged": {
            "type": "boolean",
            "description": "True when the gate had too few samples or unreadable evidence. It did not hold the rollout; summary says what it was waiting for."
          }
        }
      },
      "ConfigRollbackRequest": {
        "description": "The config revision whose variables a rollback restores.",
        "type": "object",
        "required": [
          "revision"
        ],
        "properties": {
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Current configuration revision reviewed before rollback."
          },
          "expected_app_id": {
            "type": "string",
            "format": "uuid",
            "description": "Immutable reviewed app identity."
          },
          "expected_environment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Immutable reviewed named environment identity."
          },
          "request_id": {
            "type": "string",
            "format": "uuid",
            "description": "Original reviewed rollback request identity."
          },
          "receipt_proof": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "writeOnly": true,
            "description": "Private proof required for receipt recovery."
          }
        }
      },
      "ConfigRollbackReceipt": {
        "description": "Value-free evidence of a reviewed configuration rollback.",
        "type": "object",
        "required": [
          "request_id",
          "app_id",
          "scope",
          "restored_revision",
          "config_revision",
          "changed"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "environment_id": {
            "type": "string",
            "format": "uuid"
          },
          "restored_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "config_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "changed": {
            "type": "boolean"
          }
        }
      },
      "ConfigSecretDifference": {
        "description": "A secret a config rollback could not restore.",
        "type": "object",
        "required": [
          "key"
        ],
        "properties": {
          "key": {
            "type": "string"
          },
          "target_version": {
            "type": "integer",
            "format": "int64"
          },
          "current_version": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "ConfigRollbackResponse": {
        "description": "What a config rollback changed, and the secrets it could not restore.",
        "type": "object",
        "required": [
          "restored_revision",
          "set",
          "deleted",
          "secrets_not_restored"
        ],
        "properties": {
          "restored_revision": {
            "type": "integer",
            "format": "int64"
          },
          "change": {
            "$ref": "#/components/schemas/ConfigChangeReceipt"
          },
          "set": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "deleted": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "secrets_not_restored": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConfigSecretDifference"
            }
          }
        }
      },
      "AppEnvResponse": {
        "description": "An env var envelope: key name + scope + timestamps. The plaintext value never appears here.",
        "type": "object",
        "required": [
          "key",
          "scope",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[A-Z][A-Z0-9_]*$",
            "maxLength": 128,
            "example": "LOG_LEVEL"
          },
          "scope": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$",
            "maxLength": 40,
            "description": "Env-var scope. Always 'default' for the legacy flat response; varies for the nested `env_by_scope` response.",
            "example": "default"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "config_change": {
            "$ref": "#/components/schemas/ConfigChangeReceipt",
            "description": "Present on env writes: the revision this write recorded and the config guard watching it."
          }
        }
      },
      "ScopedAppEnvResponse": {
        "description": "An env var envelope scoped to one named environment. The plaintext value never appears here.",
        "type": "object",
        "required": [
          "scope",
          "key",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "scope": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$",
            "maxLength": 40,
            "example": "staging"
          },
          "key": {
            "type": "string",
            "pattern": "^[A-Z][A-Z0-9_]*$",
            "maxLength": 128,
            "example": "DB_URL"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AppEnvListResponse": {
        "description": "List of env var envelopes (no plaintext values). Discriminated\nunion:\n\n  * `env` array populated, `env_by_scope` omitted: the\n    default-scope or per-scope read (omitted or `?scope=<slug>`).\n    `count` is the per-scope row count.\n  * `env` empty, `env_by_scope` populated: the `?scope=__all__`\n    read. `count` is the cross-scope row total.\n\nBoth arms are valid wire shapes for a GET; the `?scope=`\nquery discriminates.\n",
        "type": "object",
        "required": [
          "env",
          "quota_max",
          "count"
        ],
        "properties": {
          "env": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppEnvResponse"
            }
          },
          "env_by_scope": {
            "type": "object",
            "description": "Nested per-scope map of env vars. Populated only when `?scope=__all__` is passed; keys are scope names, values are per-scope row lists ordered by key ASC.",
            "additionalProperties": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/ScopedAppEnvResponse"
              }
            }
          },
          "quota_max": {
            "type": "integer"
          },
          "count": {
            "type": "integer"
          }
        }
      },
      "PutDataUpstreamRequest": {
        "type": "object",
        "required": [
          "kind",
          "host",
          "port"
        ],
        "description": "Upsert payload for a customer data upstream. The (kind, host, port,\nscope, deployment_scope) tuple is the deduplication key — repeating\nthe PUT updates the existing row's `last_seen_at` and (if\n`FAAS_DATA_PLACEMENT=1`) the inferred-source tag. Plaintext host is\nnever persisted; the on-disk column is `host_redacted_hash`.\n",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "postgres",
              "redis",
              "mongo",
              "cassandra",
              "clickhouse",
              "elasticsearch",
              "opensearch",
              "rabbitmq",
              "kafka",
              "nats",
              "minio",
              "memcached",
              "etcd",
              "s3",
              "https_api"
            ],
            "description": "Closed vocabulary. Adding a new kind requires an ADR."
          },
          "host": {
            "type": "string",
            "description": "RFC 952/1123 hostname (no IPv4). Hashed server-side; the hashed form is what's persisted."
          },
          "port": {
            "type": "integer",
            "minimum": 1,
            "maximum": 65535
          },
          "scope": {
            "type": "string",
            "description": "Deployment-scope filter (1..40 chars, lowercase alnum + dash). Omitted = default scope."
          },
          "deployment_scope": {
            "type": "string",
            "description": "Widens the dedupe key to include `deployment_scope` so staging-vs-prod upstreams don't collide on the same app. Same shape as `scope` (1..40 chars, lowercase alnum + dash). Omitted = default scope, the migration's SQL DEFAULT stamp."
          }
        }
      },
      "EgressCircuitBreakerPolicy": {
        "description": "Per-upstream egress circuit-breaker policy.\n\nWhen enabled, your app's NEW connections to this upstream are\nrejected with a TCP reset while the circuit is open, instead of\nhanging for a full TCP connect timeout. That is the point of the\nfeature: a blackholed dependency otherwise burns the per-request\nbudget and then holds the wake slot on every request, turning one\ndependency outage into an app-wide capacity outage. Connections\nalready established are never torn down.\n\nThe circuit is driven by the platform's own 30-second TCP+TLS\nprobe of the upstream, not by your traffic, so the half-open trial\nthat decides recovery costs your app nothing.\n\nDisabled by default. This rule can cut an app off from its own\ndatabase, so it is never inferred — you opt in per upstream.\n",
        "type": "object",
        "required": [
          "enabled"
        ],
        "properties": {
          "enabled": {
            "type": "boolean",
            "default": false,
            "description": "Whether egress breaking is active for this upstream."
          },
          "failure_threshold": {
            "type": "number",
            "format": "double",
            "exclusiveMinimum": 0,
            "maximum": 1,
            "description": "Failure RATIO (not a count) at or above which the circuit\nopens. Omitted tracks the platform default (0.5), so the\nupstream follows the default as it evolves rather than\nfreezing today's value.\n"
          },
          "min_samples": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000,
            "description": "Probe samples required inside the window before the ratio is\nconsulted. Omitted tracks the platform default (3). The probe\nsamples every 30s, so a high value can take a long time to\naccumulate — or never will on a short-lived app.\n"
          },
          "open_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3600,
            "description": "First open interval before a half-open probe is offered.\nOmitted tracks the platform default (30). Each failed probe\ndoubles the interval, up to the platform ceiling.\n"
          },
          "state": {
            "type": "string",
            "readOnly": true,
            "enum": [
              "closed",
              "open",
              "half_open"
            ],
            "description": "Observed circuit state. Absent when the breaker is disabled or\nthe scheduler has not yet reported one.\n"
          }
        }
      },
      "UpdateUpstreamCircuitBreakerRequest": {
        "description": "Partial update of an upstream's egress circuit-breaker policy. Omitted fields are left unchanged.\n\nSetting `enabled` to false leaves the threshold fields intact, so\ntoggling protection off does not discard your tuning.\n",
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "Turn egress breaking on or off for this upstream."
          },
          "failure_threshold": {
            "type": "number",
            "format": "double",
            "exclusiveMinimum": 0,
            "maximum": 1
          },
          "min_samples": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000
          },
          "open_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3600
          }
        }
      },
      "DataUpstreamResponse": {
        "type": "object",
        "required": [
          "id",
          "source",
          "kind",
          "host_redacted_hash",
          "port",
          "created_at",
          "last_seen_at"
        ],
        "description": "A single customer data upstream. The plaintext host is replaced by\n`host_redacted_hash` (sha256(salt||host) 8-hex prefix); the barrier means the wire format never carries the customer's DSN.\n",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "source": {
            "type": "string",
            "enum": [
              "inferred",
              "explicit"
            ],
            "description": "Whether the row was captured by the classifier (FAAS_DATA_PLACEMENT=1) or added via PUT (explicit)."
          },
          "kind": {
            "type": "string",
            "enum": [
              "postgres",
              "redis",
              "mongo",
              "cassandra",
              "clickhouse",
              "elasticsearch",
              "opensearch",
              "rabbitmq",
              "kafka",
              "nats",
              "minio",
              "memcached",
              "etcd",
              "s3",
              "https_api"
            ]
          },
          "host_redacted_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "SHA-256 hex of (HostHashSalt||host). 64 lowercase hex chars, matching the schema CHECK constraint."
          },
          "host_last4": {
            "type": "string",
            "description": "Compatibility field name. First 8 hex chars of host_redacted_hash; safe for operator correlation (8 chars = ~4B capacity)."
          },
          "port": {
            "type": "integer",
            "minimum": 1,
            "maximum": 65535
          },
          "scope": {
            "type": "string",
            "description": "Deployment-scope filter (1..40 chars, lowercase alnum + dash). Echoes the value persisted on the row; absent when the default scope applies."
          },
          "deployment_scope": {
            "type": "string",
            "description": "Widens the dedupe key to include `deployment_scope` so staging-vs-prod upstreams don't collide on the same app. Echoes the value persisted on the row; absent when the default scope applies."
          },
          "declared_region": {
            "type": "string",
            "description": "Region hint (nullable). Empty on capture; populated by the operator or the classify-flow follow-up."
          },
          "last_rtt_ms": {
            "type": "integer",
            "description": "Most recent probe RTT (ms). Omitted when no probe yet."
          },
          "last_probed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of the most recent probe. Omitted when no probe yet."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_seen_at": {
            "type": "string",
            "format": "date-time"
          },
          "circuit_breaker": {
            "$ref": "#/components/schemas/EgressCircuitBreakerPolicy"
          }
        }
      },
      "DataUpstreamListResponse": {
        "type": "object",
        "required": [
          "upstreams",
          "quota_max",
          "count"
        ],
        "description": "List response wrapper. `quota_max` is the per-plan cap; `count` is the\nnumber of rows in `upstreams` (may be less than `quota_max`).\n",
        "properties": {
          "upstreams": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DataUpstreamResponse"
            }
          },
          "quota_max": {
            "type": "integer"
          },
          "count": {
            "type": "integer"
          }
        }
      },
      "DataUpstreamHistoryBucket": {
        "type": "object",
        "required": [
          "sampled_at",
          "sample_count"
        ],
        "description": "One server-side probe aggregation bucket. Percentiles are omitted when every probe in the bucket failed.",
        "properties": {
          "sampled_at": {
            "type": "string",
            "format": "date-time",
            "description": "UTC start of the aggregation bucket."
          },
          "p50_ms": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Successful probe RTT p50 in milliseconds."
          },
          "p95_ms": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Successful probe RTT p95 in milliseconds."
          },
          "sample_count": {
            "type": "integer",
            "minimum": 1,
            "description": "Total probes in the bucket, including failures."
          }
        }
      },
      "DataUpstreamHistoryResponse": {
        "type": "object",
        "required": [
          "host_redacted_hash",
          "kind",
          "port",
          "region",
          "buckets"
        ],
        "description": "Historical probe series for one redacted upstream and region.",
        "properties": {
          "host_redacted_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "SHA-256 hex of (HostHashSalt||host); plaintext hosts never appear on this surface."
          },
          "kind": {
            "type": "string",
            "enum": [
              "postgres",
              "redis",
              "mongo",
              "cassandra",
              "clickhouse",
              "elasticsearch",
              "opensearch",
              "rabbitmq",
              "kafka",
              "nats",
              "minio",
              "memcached",
              "etcd",
              "s3",
              "https_api"
            ]
          },
          "port": {
            "type": "integer",
            "minimum": 1,
            "maximum": 65535
          },
          "scope": {
            "type": "string",
            "description": "Env scope associated with the upstream."
          },
          "deployment_scope": {
            "type": "string",
            "description": "Deployment scope from the overlay."
          },
          "region": {
            "type": "string",
            "pattern": "^[a-z0-9_-]{1,32}$"
          },
          "buckets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DataUpstreamHistoryBucket"
            }
          }
        }
      },
      "UsageResponse": {
        "description": "Per-app usage for one month: GB-hours consumed, request count, and an informational CPU-µs field. The CPU dimension is observable but not yet billed.",
        "type": "object",
        "required": [
          "app_id",
          "mb_seconds",
          "requests",
          "included_gb_hours"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "mb_seconds": {
            "type": "integer",
            "format": "int64"
          },
          "requests": {
            "type": "integer",
            "format": "int64"
          },
          "included_gb_hours": {
            "type": "integer",
            "format": "int64"
          },
          "cpu_usec": {
            "type": "integer",
            "format": "int64",
            "description": "Cumulative host cgroup CPU-µs (informational; not billed).",
            "x-since": "2026-07",
            "x-issue": "279"
          },
          "tx_bytes": {
            "type": "integer",
            "format": "int64",
            "description": "Per-app monthly HTTP response bytes the gateway forwarded (informational; not billed). Diagnostic subset of canonical net_tx_bytes and never added to it.",
            "x-since": "2026-08",
            "x-issue": "415"
          },
          "net_tx_bytes": {
            "type": "integer",
            "format": "int64",
            "description": "Per-app monthly byte delta on root-side vethHost.rx_bytes. Canonical optional egress-billing source; informational while the provider policy is off. Includes Ethernet framing — the same kernel counter used by shaping.",
            "x-since": "2026-08",
            "x-issue": "415"
          },
          "net_rx_bytes": {
            "type": "integer",
            "format": "int64",
            "description": "Per-app monthly byte delta on root-side vethHost.tx_bytes (root→guest = ingress; informational; not billed). Mirror of `net_tx_bytes` for the inbound direction. Same sysfs source — `/sys/class/net/<vethHost>/statistics/tx_bytes`.",
            "x-since": "2026-08",
            "x-issue": "436"
          },
          "cold_boots": {
            "type": "integer",
            "format": "int64",
            "description": "Per-app monthly count of WAKE_RESTORE→WAKE_COLD_BOOT transitions observed (informational; not billed). Source: The scheduler instancestats.Poller → the metering service Sampler.",
            "x-since": "2026-08",
            "x-issue": "436"
          }
        }
      },
      "AppHealthChangedWebhookPayload": {
        "type": "object",
        "additionalProperties": false,
        "description": "Versioned app.health.changed data. Explicit app-owned subscriptions\nreceive sampled status changes after a silent baseline. At most one\nevent per app every five minutes; pending changes combine to the latest\nobserved status, and returning to the last announced status cancels them.\nEvidence gaps reset the comparison without inferring recovery. Unknown\nis a confidence change, never a confirmed outage or recovery. The\ntransition points to retained history; evaluated_at describes the fresh\nassessment used to queue this event. Delivery remains at least once.\n",
        "required": [
          "version",
          "app_id",
          "scope",
          "transition_id",
          "transition_observed_at",
          "previous_status",
          "status",
          "change",
          "phase",
          "evaluated_at",
          "queued_at",
          "coalesced",
          "cooldown_seconds",
          "serving_deployment_ids",
          "history_path"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "app_id": {
            "type": "string"
          },
          "scope": {
            "type": "string",
            "enum": [
              "default"
            ]
          },
          "transition_id": {
            "type": "string",
            "format": "uuid"
          },
          "transition_observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "previous_status": {
            "type": "string",
            "enum": [
              "healthy",
              "degraded",
              "unhealthy",
              "unknown"
            ],
            "description": "Last announced or silently established comparison status."
          },
          "status": {
            "type": "string",
            "enum": [
              "healthy",
              "degraded",
              "unhealthy",
              "unknown"
            ]
          },
          "change": {
            "type": "string",
            "enum": [
              "worsened",
              "improved",
              "unconfirmed",
              "confirmed"
            ]
          },
          "phase": {
            "type": "string",
            "enum": [
              "serving",
              "idle",
              "deploying",
              "not_deployed",
              "maintenance",
              "unsupported",
              "unknown"
            ]
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time"
          },
          "queued_at": {
            "type": "string",
            "format": "date-time"
          },
          "coalesced": {
            "type": "boolean",
            "description": "Changes were combined during the notification cooldown."
          },
          "cooldown_seconds": {
            "type": "integer",
            "minimum": 1,
            "description": "Minimum spacing between app health notification intents."
          },
          "latest_deployment_id": {
            "type": "string"
          },
          "serving_deployment_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "history_path": {
            "type": "string",
            "description": "Authenticated cursor-paged history; locate transition_id while retained."
          }
        }
      },
      "AppChangeTimelineResponse": {
        "description": "Change timeline for one app over [since, until), newest first.",
        "type": "object",
        "required": [
          "app_id",
          "app_slug",
          "since",
          "until",
          "events",
          "truncated",
          "unavailable_sources"
        ],
        "properties": {
          "app_id": {
            "type": "string"
          },
          "app_slug": {
            "type": "string"
          },
          "since": {
            "type": "string",
            "format": "date-time"
          },
          "until": {
            "type": "string",
            "format": "date-time"
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppChangeEvent"
            }
          },
          "truncated": {
            "type": "boolean",
            "description": "Older events in the window were dropped at the 200-event cap."
          },
          "unavailable_sources": {
            "type": "array",
            "description": "Sources that could not be read; their events are missing, not absent.",
            "items": {
              "type": "string",
              "enum": [
                "deployment",
                "edge_rule",
                "runtime_config",
                "incident",
                "health",
                "activity"
              ]
            }
          }
        }
      },
      "AppChangeEvent": {
        "description": "One change timeline entry with a platform-generated summary.",
        "type": "object",
        "required": [
          "at",
          "source",
          "kind",
          "summary"
        ],
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "source": {
            "type": "string",
            "enum": [
              "deployment",
              "edge_rule",
              "runtime_config",
              "incident",
              "health",
              "activity"
            ]
          },
          "kind": {
            "type": "string",
            "description": "Source-specific kind such as deploy.rolled_back or env.set."
          },
          "deployment_id": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          }
        }
      },
      "AppHealthHistoryPage": {
        "description": "Retained default HTTP health observations with independent background collection freshness.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "app_id",
          "scope",
          "entries",
          "collector_fresh",
          "interval_seconds"
        ],
        "properties": {
          "app_id": {
            "type": "string"
          },
          "scope": {
            "type": "string",
            "enum": [
              "default"
            ]
          },
          "entries": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/AppHealthHistoryEntry"
            }
          },
          "next_cursor": {
            "type": "string",
            "format": "uuid"
          },
          "latest": {
            "description": "Latest background assessment with its original timestamp; may be stale.",
            "allOf": [
              {
                "$ref": "#/components/schemas/AppHealthResponse"
              }
            ]
          },
          "collector_fresh": {
            "type": "boolean",
            "description": "Latest background assessment exists and has not expired. This is collection freshness, not app health."
          },
          "interval_seconds": {
            "type": "integer",
            "description": "Minimum target spacing per app; fleet load and failures can delay observations."
          }
        }
      },
      "AppHealthHistoryEntry": {
        "description": "Original baseline, meaningful transition, or expired-evidence gap; times do not imply continuous incident duration.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "kind",
          "observed_at",
          "assessment"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "baseline",
              "transition",
              "gap"
            ]
          },
          "observed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Assessment time, or previous evidence expiry for a gap entry."
          },
          "previous_status": {
            "type": "string",
            "enum": [
              "healthy",
              "degraded",
              "unhealthy",
              "unknown"
            ]
          },
          "assessment": {
            "$ref": "#/components/schemas/AppHealthResponse"
          }
        }
      },
      "LabelChange": {
        "description": "Labels to set and keys to remove, applied together. Setting a key to its current value and removing an absent key change nothing. A key may not be both set and removed, and keys under gregale.dev/ cannot be changed.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "set": {
            "description": "Keys to set and their values.",
            "type": "object",
            "maxProperties": 32,
            "additionalProperties": {
              "type": "string",
              "maxLength": 63
            }
          },
          "remove": {
            "description": "Keys to remove.",
            "type": "array",
            "maxItems": 32,
            "items": {
              "type": "string",
              "maxLength": 317
            }
          }
        },
        "example": {
          "set": {
            "team": "billing"
          },
          "remove": [
            "tier"
          ]
        }
      },
      "LabelsResponse": {
        "description": "Every label the resource carries after a write.",
        "type": "object",
        "required": [
          "labels"
        ],
        "properties": {
          "labels": {
            "description": "Key/value labels with Kubernetes syntax, at most 32. A key is an optional DNS-subdomain prefix and a slash, then a name of 1-63 letters, digits, '.', '_' or '-' that starts and ends with a letter or digit; a value is empty or 1-63 of the same. Keys under gregale.dev/ belong to Gregale. Labels are not secret: they appear in lists and audit events.",
            "type": "object",
            "maxProperties": 32,
            "additionalProperties": {
              "type": "string",
              "maxLength": 63
            },
            "example": {
              "team": "billing",
              "tier": "web"
            }
          }
        }
      },
      "ResourceStatus": {
        "type": "object",
        "description": "A resource's status subresource: conditions derived when read, never stored.",
        "required": [
          "kind",
          "name",
          "observed_at",
          "conditions"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "app",
              "deployment",
              "database",
              "domain",
              "cron",
              "job_run"
            ]
          },
          "name": {
            "type": "string",
            "description": "The app slug, deployment ID, database name, domain, cron ID or job run ID."
          },
          "observed_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the evidence behind the conditions was read."
          },
          "conditions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Condition"
            }
          }
        }
      },
      "Condition": {
        "type": "object",
        "description": "One aspect of a resource's state, in the shape of a Kubernetes status condition.",
        "required": [
          "type",
          "status",
          "reason",
          "message"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "Ready",
              "Progressing",
              "Degraded",
              "RolledOut",
              "Verified",
              "CertificateReady",
              "LastRunSucceeded",
              "Succeeded"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "True",
              "False",
              "Unknown"
            ]
          },
          "reason": {
            "type": "string",
            "description": "Stable snake_case code, safe to branch on: an app health phase or check code; a deployment, database, certificate or job run status; a cron suspension or run outcome; a database health error code; or one of not_assessed, deploying, complete, latest_deployment_failed, healthy, verifying, rolling_out, rolled_out, rollout_aborted, suspended, stale, verified, dns_pending, serving, scheduled, disabled, never_run."
          },
          "message": {
            "type": "string",
            "description": "For people; may change."
          },
          "since": {
            "type": "string",
            "format": "date-time",
            "description": "When the condition last changed",
            "only when a recorded time says so.": null
          },
          "terminal": {
            "type": "boolean",
            "description": "True when the condition will not change without a new request."
          }
        }
      },
      "AppHealthResponse": {
        "description": "Read-only observed health of selected-scope HTTP serving workloads.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "app_id",
          "status",
          "phase",
          "summary",
          "scope",
          "evaluated_at",
          "valid_for_seconds",
          "serving_deployment_ids",
          "capacity",
          "checks"
        ],
        "properties": {
          "project_id": {
            "type": "string"
          },
          "environment_id": {
            "type": "string"
          },
          "app_id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "healthy",
              "degraded",
              "unhealthy",
              "unknown"
            ]
          },
          "phase": {
            "type": "string",
            "enum": [
              "serving",
              "idle",
              "starting",
              "deploying",
              "stopped",
              "not_deployed",
              "maintenance",
              "unsupported",
              "unknown"
            ]
          },
          "summary": {
            "type": "string"
          },
          "scope": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,39}$"
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time"
          },
          "valid_for_seconds": {
            "type": "integer",
            "minimum": 1,
            "description": "Maximum age before clients must reconfirm this assessment."
          },
          "metrics_as_of": {
            "type": "string",
            "format": "date-time",
            "description": "Actual telemetry sample time; absent when unconfirmed."
          },
          "serving_deployment_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "latest_deployment_id": {
            "type": "string"
          },
          "capacity": {
            "$ref": "#/components/schemas/AppHealthCapacity"
          },
          "checks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppHealthCheck"
            }
          },
          "requests": {
            "$ref": "#/components/schemas/AppHealthRequests"
          }
        }
      },
      "AppHealthCapacity": {
        "description": "Measured serving replica counts, with explicit evidence availability.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "known",
          "required",
          "ready",
          "starting",
          "unready",
          "unknown"
        ],
        "properties": {
          "known": {
            "type": "boolean",
            "description": "False when instance evidence is unavailable or truncated."
          },
          "required": {
            "type": "integer",
            "minimum": 0
          },
          "ready": {
            "type": "integer",
            "minimum": 0
          },
          "starting": {
            "type": "integer",
            "minimum": 0
          },
          "unready": {
            "type": "integer",
            "minimum": 0
          },
          "unknown": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "AppHealthCheck": {
        "description": "Safe evidence explanation and an optional inspection destination.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "code",
          "status",
          "detail"
        ],
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "workload",
              "deployment",
              "latest_deployment",
              "readiness",
              "traffic_readiness",
              "maintenance",
              "requests",
              "collection",
              "replicas",
              "queue",
              "backlog",
              "dead_letters",
              "memory"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pass",
              "warning",
              "fail",
              "unknown",
              "not_applicable"
            ]
          },
          "detail": {
            "type": "string",
            "description": "Safe explanation without raw backend errors or probe output."
          },
          "reason": {
            "type": "string",
            "enum": [
              "collection_gap",
              "capacity_below_target",
              "request_plan_restricted",
              "request_scope_unavailable",
              "request_evidence_unavailable",
              "request_coverage_incomplete",
              "request_evidence_stale",
              "request_evidence_invalid",
              "requests_unexercised",
              "request_volume_insufficient",
              "request_error_rate_severe",
              "request_error_rate_elevated",
              "request_errors_below_threshold",
              "requests_observed",
              "memory_pressure"
            ],
            "description": "Stable diagnostic reason, when available."
          },
          "action": {
            "type": "string",
            "enum": [
              "deployments",
              "configuration",
              "logs",
              "metrics",
              "errors"
            ]
          },
          "deployment_id": {
            "type": "string"
          },
          "findings": {
            "type": "array",
            "maxItems": 64,
            "description": "Independent replica readiness failures and missing evidence, with failures first and stable target order within severity.",
            "items": {
              "$ref": "#/components/schemas/AppHealthFinding"
            }
          },
          "findings_truncated": {
            "type": "boolean",
            "description": "Additional findings were omitted; capacity counts still cover the complete bounded instance scan."
          }
        }
      },
      "AppHealthFinding": {
        "description": "A safe, independent readiness finding for a serving replica.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "reason",
          "status",
          "detail",
          "deployment_id",
          "instance_id",
          "source"
        ],
        "properties": {
          "reason": {
            "type": "string",
            "enum": [
              "readiness_configuration_unavailable",
              "readiness_missing",
              "readiness_timestamp_invalid",
              "required_probe_unready",
              "node_evidence_missing",
              "node_unavailable",
              "node_timestamp_invalid",
              "node_heartbeat_stale",
              "node_recovering"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "fail",
              "unknown"
            ]
          },
          "detail": {
            "type": "string",
            "description": "Safe explanation without probe output or infrastructure addresses."
          },
          "deployment_id": {
            "type": "string"
          },
          "instance_id": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "description": "node, configuration, primary_app, or sidecar followed by a colon and the declared companion name."
          },
          "observed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Recorded readiness transition or last node heartbeat; absent for missing evidence. A transition time is not a probe heartbeat."
          }
        }
      },
      "AppHealthRequests": {
        "description": "Scoped request evidence; counts are confirmed only when known is true. Covers current serving releases, excluding previous releases and other scopes.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "known",
          "coverage",
          "window_seconds",
          "deployment_ids",
          "request_count",
          "server_errors",
          "error_rate_pct",
          "policy"
        ],
        "properties": {
          "known": {
            "type": "boolean"
          },
          "coverage": {
            "type": "string",
            "enum": [
              "serving_deployments"
            ]
          },
          "window_seconds": {
            "type": "integer",
            "minimum": 1
          },
          "deployment_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "request_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "server_errors": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_rate_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "policy": {
            "$ref": "#/components/schemas/AppHealthRequestPolicy"
          }
        }
      },
      "AppHealthRequestPolicy": {
        "description": "Diagnostic severity defaults, independent of customer SLO configuration. Error thresholds require both minimum request and server-error counts.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "minimum_requests",
          "minimum_server_errors",
          "warning_error_rate_pct",
          "unhealthy_error_rate_pct"
        ],
        "properties": {
          "minimum_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "minimum_server_errors": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "warning_error_rate_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "unhealthy_error_rate_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          }
        }
      },
      "AppMetricsResponse": {
        "description": "Per-app metrics snapshot. Latencies are\nmilliseconds for the 2xx class only; failures surface as\n`error_rate_pct`. `wake_p95_ms` is the FLEET p95 — the\nunderlying `gateway_wake_latency_seconds` histogram is\nunlabeled. On Prometheus failure the endpoint returns 200 with\nzeroed fields and `source: \"degraded: <reason>\"`.\n",
        "type": "object",
        "required": [
          "app_id",
          "range",
          "source",
          "as_of",
          "request_count",
          "latency_p50_ms",
          "latency_p95_ms",
          "latency_p99_ms",
          "error_rate_pct",
          "cold_start_pct",
          "wake_p95_ms"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef",
            "x-since": "2026-07",
            "x-issue": "273"
          },
          "range": {
            "type": "string",
            "enum": [
              "5m",
              "15m",
              "1h",
              "6h",
              "24h",
              "7d",
              "15d"
            ],
            "description": "Echoed window.",
            "x-since": "2026-07",
            "x-issue": "273"
          },
          "source": {
            "type": "string",
            "description": "\"prometheus\" on success, \"degraded: <reason>\" otherwise.",
            "x-since": "2026-07",
            "x-issue": "273"
          },
          "as_of": {
            "type": "string",
            "format": "date-time",
            "description": "RFC3339Nano UTC.",
            "x-since": "2026-07",
            "x-issue": "273"
          },
          "request_count": {
            "type": "integer",
            "format": "int64",
            "description": "Share of requests in the window. Drives the dashboard empty state.",
            "x-since": "2026-07",
            "x-issue": "273"
          },
          "latency_p50_ms": {
            "type": "number",
            "description": "p50 of `gateway_request_duration_seconds_bucket{class=\"2xx\"}` over the window, in ms.",
            "x-since": "2026-07",
            "x-issue": "273"
          },
          "latency_p95_ms": {
            "type": "number",
            "description": "p95 over 2xx traffic in the window, in ms.",
            "x-since": "2026-07",
            "x-issue": "273"
          },
          "latency_p99_ms": {
            "type": "number",
            "description": "p99 over 2xx traffic in the window, in ms.",
            "x-since": "2026-07",
            "x-issue": "273"
          },
          "error_rate_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "Share of 5xx requests in the window. Client-caused 4xx responses do not consume availability budget.",
            "x-since": "2026-07",
            "x-issue": "273"
          },
          "cold_start_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "Share of requests that triggered a cold boot (the WakeGate\nleader). Followers waiting on the gate see zero cold\ncontribution; their wait is on the dashboard via\n`gateway_wake_queue_wait_seconds`.\n",
            "x-since": "2026-07",
            "x-issue": "273"
          },
          "wake_p95_ms": {
            "type": "number",
            "description": "FLEET p95 wake latency (the unlabeled histogram). Labelled as such in the UI.",
            "x-since": "2026-07",
            "x-issue": "273"
          },
          "wake_samples": {
            "type": "integer",
            "format": "int64",
            "description": "Number of fleet wakes wake_p95_ms was computed from. Below 20 the p95 is not meaningful and clients show it as unavailable. Omitted when the count is unknown.",
            "x-since": "2026-10"
          },
          "queue_depth": {
            "type": "integer",
            "format": "int64",
            "description": "Current wake-queue depth\n(`gateway_queue_depth{app, account_id}` — `account_id`\nadmitted via accountLabelSet, overflow=`__other__`,\nadded). Backs the `queue_backlog_growing`\nalert preset: comparison `gt 50` over the\nchosen window. Best-effort: absent on Prometheus\nfailure (the field is `null`); the evaluator's\ndegraded-source contract skips firing rather than\nguessing.\n",
            "x-since": "2026-08",
            "x-issue": "1233"
          },
          "egress_bytes": {
            "type": "integer",
            "format": "int64",
            "description": "Per-app egress byte delta over the window (informational; not billed). It is not collected yet and stays 0.",
            "x-since": "2026-08",
            "x-issue": "415"
          },
          "tx_bytes": {
            "type": "integer",
            "format": "int64",
            "description": "Per-app egress byte delta over the window, gateway-side mirror (informational; not billed). Source: gateway_egress_tx_bytes_total{app} (Prom rollup; the gateway-local per-instance egress ring populates the counter on each raw-stream chunk). Distinct from `egress_bytes` (the scheduler-side mirror) so a divergence between the two surfaces immediately on the dashboard. Best-effort: query failure does NOT flip the response to degraded — matches the `egress_bytes` semantics.",
            "x-since": "2026-08",
            "x-issue": "415"
          },
          "routes": {
            "type": "array",
            "description": "Per-route breakdown for opt-in apps. Absent when\n`route_metrics_enabled` is false on the app — the dashboard\ndistinguishes \"feature off\" (field absent) from \"feature\non, no traffic\" (empty array). Each row is the bounded\ndetail from the gateway in-memory reader: max\n50 distinct routes + the `__route_other__` wildcard-path\noverflow bucket. The route label is method + declared template\nwhen available, otherwise a best-effort inferred public path.\n",
            "items": {
              "$ref": "#/components/schemas/RouteRow"
            },
            "x-since": "2026-08",
            "x-issue": "273"
          },
          "wakes_24h": {
            "type": "integer",
            "format": "int64",
            "description": "Count of `wake.boot_started` events the scheduler recorded for\nthis app in the trailing 24 hours. Sourced from the\n`events` table via the events_wake_id_idx jsonb expression\nindex — sub-second on a healthy app.\nBest-effort: 0 on a degraded store call, an empty app, or\nwhen the events table predates per-app wake events\n(older wake events carry no app ID and count as 0). The\ndashboard surfaces this as the \"wakes today\" line item;\ncombined with `cold_start_pct` it answers \"is my app\nwake-bound or sleep-bound\". Field absent on Free\n(the per-app dashboard is Hobby+ only —\n",
            "x-since": "2026-08",
            "x-issue": "TBD"
          },
          "cache_hit_rate_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "Share of cache-eligible requests served from\n`gateway_response_cache` over the selected\nwindow. The value is sourced from the additive\n`gateway_response_cache_app_total{app,outcome}` metric\nand counts only `hit / (hit + miss)`. Absence means the\napp had no cache telemetry in the window, not an observed\n0% hit rate.\n",
            "x-since": "2026-08",
            "x-issue": "2362"
          },
          "error_budget_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "API-availability error budget remaining over the selected\nmetrics window, using the current 99.5% API-availability\ntarget. 100 means the full budget remains and 0 means it is\nexhausted. Absence means the app had no requests in the\nwindow, not an observed exhausted budget.\n",
            "x-since": "2026-08",
            "x-issue": "2362"
          }
        }
      },
      "RouteRow": {
        "description": "Per-route detail row. The `route` field is the\nbounded label: `\"GET /users/4f8a\"` for an admitted route, or\n`\"__route_other__\"` for the overflow bucket. Latency fields\nare milliseconds over the full request duration (status-\nagnostic — failures included). Same zero-on-degraded\ncontract as `AppMetricsResponse`.\n",
        "type": "object",
        "required": [
          "route",
          "count",
          "p50_ms",
          "p95_ms",
          "p99_ms",
          "error_pct"
        ],
        "properties": {
          "route": {
            "type": "string",
            "description": "Bounded route label (method + raw path, or `__route_other__`).",
            "x-since": "2026-08",
            "x-issue": "273"
          },
          "count": {
            "type": "integer",
            "format": "int64",
            "description": "Number of requests with this route in the window.",
            "x-since": "2026-08",
            "x-issue": "273"
          },
          "p50_ms": {
            "type": "number",
            "description": "p50 of `gateway_request_duration_seconds_bucket{app, route, class}` over the window, in ms.",
            "x-since": "2026-08",
            "x-issue": "273"
          },
          "p95_ms": {
            "type": "number",
            "description": "p95 over all classes in the window, in ms.",
            "x-since": "2026-08",
            "x-issue": "273"
          },
          "p99_ms": {
            "type": "number",
            "description": "p99 over all classes in the window, in ms.",
            "x-since": "2026-08",
            "x-issue": "273"
          },
          "error_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "Share of 5xx requests with this route in the window. Client-caused 4xx responses do not consume availability budget.",
            "x-since": "2026-08",
            "x-issue": "273"
          }
        }
      },
      "AppOpenAPIImportResponse": {
        "description": "Response body for `POST /v1/apps/{slug}/openapi`. One row per app in `app_openapi_docs`,\nlast-write-wins. Source is always `manual_import` — cold-\nboot captures go to `deployment_openapi_docs` (item #1).\n`endpoint_count` is the number of HTTP operations in the\nimported doc's `paths.*`; `byte_size` is the raw body size\nthe handler enforced against\n`state.OpenAPIImportMaxDocBytes` (256 KiB).\n",
        "type": "object",
        "required": [
          "app_id",
          "source",
          "openapi_version",
          "endpoint_count",
          "byte_size",
          "captured_at",
          "updated_at"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid",
            "description": "App UUID the import row is bound to.",
            "x-since": "2026-08",
            "x-issue": "975"
          },
          "source": {
            "type": "string",
            "enum": [
              "manual_import"
            ],
            "description": "Row source. Always `manual_import` for this endpoint.",
            "x-since": "2026-08",
            "x-issue": "975"
          },
          "openapi_version": {
            "type": "string",
            "enum": [
              "3.0.0",
              "3.0.1",
              "3.0.2",
              "3.0.3",
              "3.0.4",
              "3.1.0",
              "3.1.1"
            ],
            "description": "OpenAPI spec version the imported doc declares.",
            "x-since": "2026-08",
            "x-issue": "975"
          },
          "endpoint_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 50,
            "description": "Number of HTTP operations in the imported doc.",
            "x-since": "2026-08",
            "x-issue": "975"
          },
          "byte_size": {
            "type": "integer",
            "minimum": 1,
            "maximum": 262144,
            "description": "Raw body size in bytes (state.OpenAPIImportMaxDocBytes = 256 KiB).",
            "x-since": "2026-08",
            "x-issue": "975"
          },
          "captured_at": {
            "type": "string",
            "format": "date-time",
            "description": "First-import timestamp; preserved across re-imports.",
            "x-since": "2026-08",
            "x-issue": "975"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Most-recent write timestamp; bumped on every import.",
            "x-since": "2026-08",
            "x-issue": "975"
          }
        }
      },
      "EdgeRuleSuggestion": {
        "description": "Single read-only candidate row in the dry-run response. Mirrors the\ncreate-edge-rule request body fields so the customer can\ncopy-paste the suggestion into the existing endpoint.\n`kind` + `action` union shape matches the existing\n`EdgeRule*Action` types.\n",
        "type": "object",
        "required": [
          "path",
          "methods",
          "kind",
          "action"
        ],
        "properties": {
          "path": {
            "type": "string",
            "description": "Operation path (e.g. `/users/{id}`).",
            "x-since": "2026-08",
            "x-issue": "975"
          },
          "methods": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "get",
                "put",
                "post",
                "delete",
                "options",
                "head",
                "patch",
                "trace"
              ]
            },
            "description": "HTTP methods the suggestion applies to.",
            "x-since": "2026-08",
            "x-issue": "975"
          },
          "kind": {
            "type": "string",
            "enum": [
              "validate",
              "cors",
              "throttle",
              "jwt",
              "headers",
              "cache",
              "redirect",
              "rewrite"
            ],
            "description": "Edge-rule kind the suggestion produces.",
            "x-since": "2026-08",
            "x-issue": "975"
          },
          "action": {
            "type": "object",
            "additionalProperties": true,
            "description": "Action payload (matches EdgeRule*Action types).",
            "x-since": "2026-08",
            "x-issue": "975"
          }
        }
      },
      "AppOpenAPIImportDryRunResponse": {
        "description": "Response body for `POST /v1/apps/{slug}/openapi/dry-run`. Read-only; no persist,\nno `pg_notify`, no MFA. Empty `suggestions` array when the\ndoc is fully covered by existing validate edge rules.\n",
        "type": "object",
        "required": [
          "suggestions",
          "openapi_version",
          "endpoint_count"
        ],
        "properties": {
          "suggestions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EdgeRuleSuggestion"
            },
            "description": "Suggested EdgeRuleSuggestion rows.",
            "x-since": "2026-08",
            "x-issue": "975"
          },
          "openapi_version": {
            "type": "string",
            "description": "OpenAPI version declared by the dry-run doc.",
            "x-since": "2026-08",
            "x-issue": "975"
          },
          "endpoint_count": {
            "type": "integer",
            "description": "Number of operations in the dry-run doc.",
            "x-since": "2026-08",
            "x-issue": "975"
          }
        }
      },
      "OpenAPIContractDiffResponse": {
        "description": "Read-only OpenAPI contract comparison for the authoritative imported\napp document (or the projected edge-rule fallback) and the latest\ncaptured deployment snapshot.\n`blocking` is true when a production promotion would be rejected\nwhile the contract-diff feature flag is enabled. This includes\nconfirmed response breaks and changed response schemas the comparator\ncannot classify as breaking or additive; those findings appear in\n`unknowns` and remain distinct from confirmed breaks.\n",
        "type": "object",
        "required": [
          "app_id",
          "scope",
          "source",
          "proposed_sha256",
          "blocking",
          "breaks",
          "unknowns",
          "additions"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "manual_import",
              "edge_rules"
            ],
            "description": "Contract source used for the proposed snapshot."
          },
          "baseline_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "baseline_sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "proposed_sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "baseline_captured_at": {
            "type": "string",
            "format": "date-time"
          },
          "blocking": {
            "type": "boolean"
          },
          "breaks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OpenAPIContractBreak"
            }
          },
          "unknowns": {
            "type": "array",
            "description": "Changed unsupported response-schema features or incomplete legacy baselines whose compatibility could not be classified; these block promotion while the contract gate is enabled.",
            "items": {
              "$ref": "#/components/schemas/OpenAPIContractUnknown"
            }
          },
          "additions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OpenAPIContractAddition"
            }
          }
        }
      },
      "OpenAPIContractBreak": {
        "description": "One structural breaking change in an API response schema.",
        "type": "object",
        "required": [
          "path",
          "method",
          "kind"
        ],
        "properties": {
          "path": {
            "type": "string"
          },
          "method": {
            "type": "string",
            "enum": [
              "get",
              "put",
              "post",
              "delete",
              "options",
              "head",
              "patch",
              "trace"
            ]
          },
          "status": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "type_change",
              "field_removed",
              "required_added",
              "required_removed",
              "nullability_change"
            ]
          },
          "path_in_schema": {
            "type": "string"
          },
          "before": {},
          "after": {}
        }
      },
      "OpenAPIContractUnknown": {
        "description": "One changed unsupported response-schema feature or incomplete baseline that the current comparator cannot classify as breaking or additive.",
        "type": "object",
        "required": [
          "path",
          "method",
          "code"
        ],
        "properties": {
          "path": {
            "type": "string"
          },
          "method": {
            "type": "string",
            "description": "HTTP method for the affected operation."
          },
          "status": {
            "type": "string"
          },
          "path_in_schema": {
            "type": "string"
          },
          "code": {
            "type": "string",
            "description": "Stable classification code for the unsupported schema change."
          }
        }
      },
      "OpenAPIContractAddition": {
        "description": "One additive, non-blocking schema change.",
        "type": "object",
        "required": [
          "kind",
          "path",
          "method"
        ],
        "properties": {
          "kind": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "path_in_schema": {
            "type": "string"
          },
          "field": {
            "type": "string"
          }
        }
      },
      "ApplyAppOpenAPIPolicyRequest": {
        "description": "Controls the explicit OpenAPI policy plan/apply workflow. Omit the\nbody (or set confirm=false) to request a read-only plan. A confirmed\napply must include the preview_sha256 returned by that plan.\n",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "confirm": {
            "type": "boolean",
            "default": false,
            "description": "Authorize creation of the generated validation rules."
          },
          "preview_sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Approval token returned by the current plan."
          },
          "match_host": {
            "type": "string",
            "maxLength": 253,
            "description": "Hostname for generated rules; defaults to the app hostname."
          }
        }
      },
      "AppOpenAPIPolicyApplyResponse": {
        "description": "Deterministic OpenAPI policy plan or the result of an explicit apply.\nPlanned=true means no mutation occurred. AppliedCount is zero for an\nidempotent no-op.\n",
        "type": "object",
        "required": [
          "app_id",
          "match_host",
          "preview_sha256",
          "suggestions",
          "planned",
          "applied",
          "applied_count"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "match_host": {
            "type": "string"
          },
          "preview_sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "suggestions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EdgeRuleSuggestion"
            }
          },
          "planned": {
            "type": "boolean"
          },
          "applied": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EdgeRuleResponse"
            }
          },
          "applied_count": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "AppOpenAPIPolicyPreviewResponse": {
        "description": "Read-only declared-vs-observed route and edge-policy preview\n(API-hosting roadmap item 11). The response\nnever writes an OpenAPI document or edge rule.\n",
        "type": "object",
        "required": [
          "app_id",
          "source",
          "observed_available",
          "observed_source",
          "observed_inventory_available",
          "observed_cap_hit",
          "collectors_expected",
          "collectors_healthy",
          "routes"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "source": {
            "type": "string",
            "description": "preview, empty: no_import, degraded: routes_partial, or degraded: routes_unavailable."
          },
          "observed_available": {
            "type": "boolean",
            "description": "Whether current route telemetry or a persisted discovered-route inventory is available."
          },
          "observed_source": {
            "type": "string",
            "enum": [
              "live",
              "partial",
              "unavailable"
            ],
            "description": "Completeness of the current fleet-wide telemetry input; persisted inventory availability is reported separately."
          },
          "observed_inventory_available": {
            "type": "boolean",
            "description": "Whether durable, opt-in discovered routes contributed to the observed route set."
          },
          "observed_cap_hit": {
            "type": "boolean",
            "description": "Whether the live route snapshot or durable discovered-route inventory reached its route cap."
          },
          "collectors_expected": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of registry compute gateways expected to contribute route observations."
          },
          "collectors_healthy": {
            "type": "integer",
            "minimum": 0,
            "description": "Expected compute route collectors currently healthy in Prometheus."
          },
          "openapi_version": {
            "type": "string",
            "description": "OpenAPI version from the persisted declaration, when present."
          },
          "routes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppOpenAPIPolicyPreviewRoute"
            }
          },
          "suggestions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EdgeRuleSuggestion"
            }
          }
        }
      },
      "AppOpenAPIPolicyPreviewRoute": {
        "description": "One declared/observed path-method row with policy coverage and drift status.",
        "type": "object",
        "required": [
          "path",
          "method",
          "status",
          "declared",
          "observed",
          "covered"
        ],
        "properties": {
          "path": {
            "type": "string"
          },
          "method": {
            "type": "string",
            "enum": [
              "get",
              "put",
              "post",
              "delete",
              "options",
              "head",
              "patch",
              "trace"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "matched",
              "declared_only",
              "observed_only"
            ]
          },
          "declared": {
            "type": "boolean"
          },
          "observed": {
            "type": "boolean"
          },
          "covered": {
            "type": "boolean",
            "description": "True when at least one enabled edge rule matches this path and method."
          },
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppOpenAPIPolicyPreviewRule"
            }
          }
        }
      },
      "AppOpenAPIPolicyPreviewRule": {
        "description": "Read-only edge-rule subset explaining why a preview route is covered.",
        "type": "object",
        "required": [
          "id",
          "match_host",
          "match_path",
          "match_methods",
          "priority",
          "enabled",
          "kind",
          "action"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "match_host": {
            "type": "string"
          },
          "match_path": {
            "type": "string"
          },
          "match_methods": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "priority": {
            "type": "integer"
          },
          "enabled": {
            "type": "boolean"
          },
          "kind": {
            "type": "string"
          },
          "validate_mode": {
            "type": "string"
          },
          "action": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "AppRoutesResponse": {
        "description": "Fleet-wide per-route label snapshot. The control-plane\nPrometheus instance aggregates every active, scrape-ready compute\ngateway; collector counts distinguish complete, partial, and\nunavailable observations from a healthy no-traffic result.\nEach item is `\"<METHOD> <PATH>\"` (pre-edge-rule-rewrite) for\nan admitted route, or the reserved `\"__route_other__\"` overflow\nbucket label. The fleet union is bounded again at 50 distinct real\nroutes plus the reserved overflow bucket.\n\n`cap_hit` is true when a compute collector emitted the overflow\nbucket or the fleet union reached the 50-route bound. It is false\non `source: unavailable`, where cap state is unknown.\n",
        "type": "object",
        "required": [
          "slug",
          "routes",
          "source",
          "collectors_expected",
          "collectors_healthy",
          "cap_hit"
        ],
        "properties": {
          "scope": {
            "type": "string"
          },
          "project_id": {
            "type": "string"
          },
          "environment_id": {
            "type": "string"
          },
          "coverage": {
            "type": "string",
            "description": "Explicit scopes use deployment_attributed_history over the supplied observation window."
          },
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "window_end": {
            "type": "string",
            "format": "date-time"
          },
          "slug": {
            "type": "string",
            "x-since": "2026-08",
            "x-issue": "273"
          },
          "app_id": {
            "type": "string",
            "x-since": "2026-08",
            "x-issue": "273"
          },
          "routes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "x-since": "2026-08",
            "x-issue": "273"
          },
          "source": {
            "type": "string",
            "enum": [
              "live",
              "partial",
              "unavailable"
            ],
            "x-since": "2026-08",
            "x-issue": "273"
          },
          "collectors_expected": {
            "type": "integer",
            "minimum": 0,
            "x-since": "2026-09",
            "x-issue": "2416",
            "description": "Active scrape-ready compute route collectors in the registry."
          },
          "collectors_healthy": {
            "type": "integer",
            "minimum": 0,
            "x-since": "2026-09",
            "x-issue": "2416",
            "description": "Expected collectors with a current successful Prometheus scrape."
          },
          "cap_hit": {
            "type": "boolean",
            "default": false,
            "x-since": "2026-08",
            "x-issue": "273",
            "description": "True when the fleet route union reaches `RouteMetricsPerAppCap`\n(50) or a collector reports `__route_other__`. False on\n`source: unavailable`, where cap state is unknown.\n"
          }
        }
      },
      "RequestAuditRecord": {
        "type": "object",
        "description": "One non-collapsed completed request observed at the gateway.",
        "required": [
          "event_id",
          "account_id",
          "app_id",
          "route_template",
          "method",
          "http_status",
          "latency_ms",
          "occurred_at"
        ],
        "properties": {
          "event_id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "route_template": {
            "type": "string",
            "maxLength": 256
          },
          "method": {
            "type": "string",
            "maxLength": 16
          },
          "http_status": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599
          },
          "latency_ms": {
            "type": "integer",
            "minimum": 0
          },
          "trace_id": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "commit_sha": {
            "type": "string"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "request_id": {
            "type": "string"
          },
          "source_ip": {
            "type": "string",
            "description": "Verified public-gateway client IP when available."
          }
        }
      },
      "RequestAuditListResponse": {
        "type": "object",
        "description": "Bounded exact gateway-request audit window, newest first.",
        "required": [
          "app_id",
          "records",
          "since",
          "until"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "records": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RequestAuditRecord"
            }
          },
          "since": {
            "type": "string",
            "format": "date-time"
          },
          "until": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DiscoveredAPIRoute": {
        "type": "object",
        "description": "One durable, replay-safe observed route candidate.",
        "required": [
          "route_template",
          "first_seen",
          "last_seen",
          "request_count"
        ],
        "properties": {
          "route_template": {
            "type": "string",
            "maxLength": 256
          },
          "first_seen": {
            "type": "string",
            "format": "date-time"
          },
          "last_seen": {
            "type": "string",
            "format": "date-time"
          },
          "request_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        }
      },
      "DiscoveredRoutesResponse": {
        "type": "object",
        "description": "Bounded API route inventory independent of exact audit retention.",
        "required": [
          "app_id",
          "routes",
          "cap_hit",
          "source"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "routes": {
            "type": "array",
            "maxItems": 500,
            "items": {
              "$ref": "#/components/schemas/DiscoveredAPIRoute"
            }
          },
          "cap_hit": {
            "type": "boolean",
            "description": "True once new candidates overflow the 500-route cap."
          },
          "source": {
            "type": "string",
            "enum": [
              "usage_outbox"
            ]
          }
        }
      },
      "ThrottleSuggestionRow": {
        "description": "One (route → suggested rate) row in the payload returned by\n`GET /v1/apps/{slug}/throttle-suggestions`. The recommender is read-only — it\nnever auto-applies — and the suggestion is always ≤ the\ncustomer's plan ceiling so a customer can act on it\nwithout a 422 from the API's sub-plan validator.\n",
        "type": "object",
        "required": [
          "route",
          "observed_rps",
          "suggested_rps",
          "suggested_burst",
          "multiplier"
        ],
        "properties": {
          "route": {
            "type": "string",
            "description": "The bounded label exactly as emitted on the Prometheus\nside: `<METHOD> <PATH>` (pre-edge-rule-rewrite), or\nthe reserved `__route_other__` overflow bucket label.\n",
            "example": "GET /users/4f8a",
            "x-since": "2026-08",
            "x-issue": "881"
          },
          "observed_rps": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "description": "The `rate()` value over the window (already per-second).\n",
            "example": 1.5,
            "x-since": "2026-08",
            "x-issue": "881"
          },
          "suggested_rps": {
            "type": "number",
            "format": "double",
            "minimum": 1,
            "description": "`ceil(observed_rps * multiplier)` clamped into\n`[1, plan.RateLimitRPS]`. The 2× headroom is echoed\non the wire so the value is auditable rather than\nmagic.\n",
            "example": 3,
            "x-since": "2026-08",
            "x-issue": "881"
          },
          "suggested_burst": {
            "type": "integer",
            "minimum": 1,
            "description": "`ceil(suggested_rps * 1.5)` clamped into\n`[1, plan.RateLimitBurst]`. The 1.5× factor is a\nsofter version of the rate headroom — burst oversize\nis the most common cause of customer-flapping 429s.\n",
            "example": 5,
            "x-since": "2026-08",
            "x-issue": "881"
          },
          "multiplier": {
            "type": "number",
            "format": "double",
            "description": "The headroom factor the recommender applied to\n`observed_rps`. Pinned on the wire so a future\nstrategy change is distinguishable from drift.\n",
            "example": 2,
            "x-since": "2026-08",
            "x-issue": "881"
          }
        }
      },
      "ThrottleSuggestionsResponse": {
        "description": "Per-route throttle recommendation payload. Source is `prometheus` on success\nor `degraded: <reason>` on Prometheus failure (response is\nstill 200 with empty Suggestions — the dashboard's\nempty-state branch handles it).\n\nWhen the request\nsupplies `dry_run=true` + `candidate_rps` + (optional)\n`candidate_burst`, the response ALSO carries a per-route\n`would_have_rejected` array + the static\n`per_consumer_limit_note` literal that names the\n`gateway_requests_by_route_total` label gap. Dry-run is a\nguard-rail for the customer's own probe value — not\nauto-apply.\n",
        "type": "object",
        "required": [
          "app_id",
          "range",
          "source",
          "route_metrics_disabled",
          "routes_collapsed",
          "plan_ceiling_rps",
          "plan_ceiling_burst",
          "multiplier",
          "suggestions"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "x-since": "2026-08",
            "x-issue": "881"
          },
          "range": {
            "type": "string",
            "x-since": "2026-08",
            "x-issue": "881"
          },
          "source": {
            "type": "string",
            "description": "`prometheus` on success, `degraded: <reason>` on\nPromQL failure.\n",
            "x-since": "2026-08",
            "x-issue": "881"
          },
          "as_of": {
            "type": "string",
            "format": "date-time",
            "description": "RFC 3339 UTC timestamp the response was assembled.",
            "x-since": "2026-08",
            "x-issue": "881"
          },
          "route_metrics_disabled": {
            "type": "boolean",
            "default": false,
            "description": "True when `apps.route_metrics_enabled=false` (Free\nplan). The response carries empty Suggestions plus\nthis flag so the dashboard can render the upsell\nrather than a misleading zero.\n",
            "x-since": "2026-08",
            "x-issue": "881"
          },
          "routes_collapsed": {
            "type": "integer",
            "minimum": 0,
            "description": "Count of routes that collapsed into the reserved\n`__route_other__` overflow bucket during the window\n(cap = 50). A non-zero value indicates the\nthrottle is partial-coverage regardless of the\nconfigured limit.\n",
            "x-since": "2026-08",
            "x-issue": "881"
          },
          "plan_ceiling_rps": {
            "type": "integer",
            "minimum": 0,
            "description": "`plan.RateLimitRPS` — the sub-plan ceiling the\nsuggestion is clamped to. 0 on unknown plans (fail\nOPEN — the API sub-plan validator is the\nauthoritative gate).\n",
            "x-since": "2026-08",
            "x-issue": "881"
          },
          "plan_ceiling_burst": {
            "type": "integer",
            "minimum": 0,
            "description": "`plan.RateLimitBurst` — the sub-plan ceiling for\nburst. 0 on unknown plans.\n",
            "x-since": "2026-08",
            "x-issue": "881"
          },
          "multiplier": {
            "type": "number",
            "format": "double",
            "description": "The headroom factor the recommender applied to every\nroute (`Multiplier` constant). Echoed on the wire\nso the strategy is auditable.\n",
            "example": 2,
            "x-since": "2026-08",
            "x-issue": "881"
          },
          "suggestions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ThrottleSuggestionRow"
            },
            "x-since": "2026-08",
            "x-issue": "881"
          },
          "dry_run": {
            "type": "boolean",
            "description": "True iff the request supplied `dry_run=true`. The\n`would_have_rejected` + `per_consumer_limit_note`\nfields are only populated when this is true.\n",
            "x-since": "2026-08",
            "x-issue": "881-phase-4-d1"
          },
          "candidate_rps": {
            "type": "number",
            "format": "double",
            "description": "Echo of the customer's probe value (request\n`candidate_rps`). Surfaced so a customer reading\nthe wire doesn't have to correlate the preview\nrows with the request they sent.\n",
            "x-since": "2026-08",
            "x-issue": "881-phase-4-d1"
          },
          "candidate_burst": {
            "type": "integer",
            "minimum": 0,
            "description": "Echo of the customer's probe burst (request\n`candidate_burst`, optional).\n",
            "x-since": "2026-08",
            "x-issue": "881-phase-4-d1"
          },
          "would_have_rejected": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ThrottlePreviewRow"
            },
            "description": "One row per surviving route with the count of\nsub-windows where observed rps exceeded\n`candidate_rps` over the recommendation window.\nThe preview counts at rule scope — see\n`per_consumer_limit_note` for the label-gap\ncaveat.\n",
            "x-since": "2026-08",
            "x-issue": "881-phase-4-d1"
          },
          "per_consumer_limit_note": {
            "type": "string",
            "description": "Static literal naming the\n`gateway_requests_by_route_total` label gap (no\nper-consumer labels today). Surfaced so dashboards\n/ CLIs reading the preview don't silently\nmis-attribute a rule-scope count to a\nper-consumer scope.\n",
            "x-since": "2026-08",
            "x-issue": "881-phase-4-d1"
          }
        }
      },
      "ThrottlePreviewRow": {
        "description": "One row of the dry-run preview. For each surviving route we\nreport the count of sub-windows where the observed rate\nexceeded the candidate rps — a count of \"would-have-\nrejected\" requests over the window.\n",
        "type": "object",
        "required": [
          "route",
          "candidate_rps",
          "over_cap_count",
          "window_start",
          "window_end"
        ],
        "properties": {
          "route": {
            "type": "string",
            "x-since": "2026-08",
            "x-issue": "881-phase-4-d1"
          },
          "candidate_rps": {
            "type": "number",
            "format": "double",
            "description": "Echo of the candidate rps the preview evaluated against.",
            "x-since": "2026-08",
            "x-issue": "881-phase-4-d1"
          },
          "over_cap_count": {
            "type": "number",
            "format": "double",
            "description": "Count of sub-windows in the recommendation window\nwhere observed rps exceeded the candidate. NaN/Inf\nfrom Prometheus are coerced to 0.\n",
            "x-since": "2026-08",
            "x-issue": "881-phase-4-d1"
          },
          "window_start": {
            "type": "string",
            "format": "date-time",
            "description": "RFC 3339 UTC window-start the preview was evaluated against.",
            "x-since": "2026-08",
            "x-issue": "881-phase-4-d1"
          },
          "window_end": {
            "type": "string",
            "format": "date-time",
            "description": "RFC 3339 UTC window-end the preview was evaluated against.",
            "x-since": "2026-08",
            "x-issue": "881-phase-4-d1"
          }
        }
      },
      "AppStreamingStatus": {
        "description": "Per-app streaming classification. The probe\nreturns the same `Streaming-Status` enum value the\ngateway handler would stamp on the response header for a\nrepresentative request to this app, plus the effective\nresponse-body cap and the per-gate flags that produced it.\n\n`status` values (closed enum):\n\n  - `streaming` — request will stream. `effective_cap_bytes`\n    is the cap `capWriter` will enforce.\n  - `accept-json-downgrade` — pre-D3 customers with\n    `Accept: application/json` would have been buffered.\n    Post-D3 (this PR), the request streams regardless of\n    Accept; the enum variant survives one cycle so pinned\n    SDKs can grep for it.\n  - `flag-disabled` — `streaming_enabled=false` on the app.\n  - `plan-disallows` — plan tier forbids `streaming_enabled=true`;\n    CreateApp already returns 403 on this combination,\n    so this value should be unreachable on a properly-validated\n    app.\n  - `operator-disabled` — operator opt-in env is off; visible\n    only on the gateway side, not this probe.\n  - `upgrade-bypass` — request is an HTTP/1.1 Upgrade (e.g.\n    WebSocket) and bypasses the streaming path.\n\n`effective_cap_bytes` is the plan cap (`cap_kind=\"plan\"`) when\nno route shape is supplied. A route-aware probe may return\n`cap_kind=\"endpoint-rule\"` when the compiled gateway rule\nmatches; the gateway failures and non-matches fall back to the\nplan cap. A customer who needs the canonical live status still\nfires a real request and reads the `Streaming-Status` response\nheader.\n",
        "type": "object",
        "required": [
          "app_id",
          "status",
          "effective_cap_bytes",
          "plan_cap_bytes",
          "flag_enabled",
          "plan_allowed"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "x-since": "2026-08",
            "x_issue": "102"
          },
          "status": {
            "type": "string",
            "enum": [
              "streaming",
              "accept-json-downgrade",
              "flag-disabled",
              "plan-disallows",
              "operator-disabled",
              "upgrade-bypass"
            ],
            "x-since": "2026-08",
            "x_issue": "102"
          },
          "effective_cap_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "x-since": "2026-08",
            "x_issue": "102"
          },
          "plan_cap_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "x-since": "2026-08",
            "x_issue": "102"
          },
          "flag_enabled": {
            "type": "boolean",
            "x-since": "2026-08",
            "x_issue": "102"
          },
          "plan_allowed": {
            "type": "boolean",
            "x-since": "2026-08",
            "x_issue": "102"
          },
          "cap_kind": {
            "type": "string",
            "enum": [
              "plan",
              "endpoint-rule",
              "none"
            ],
            "x-since": "2026-08",
            "x_issue": "102",
            "description": "`plan` is the plan-level fallback, `endpoint-rule` is a\nmatching compiled the gateway response cap, and `none` is\nreserved for a future explicit no-cap result.\n"
          }
        }
      },
      "ListInstancesResponse": {
        "description": "Page shape for `GET /v1/instances`. `instances`\nis the page in started_at DESC, id DESC order. `next_before`\nis the cursor the caller passes on the next request to fetch\nthe older page; empty when the page is the end.\n",
        "type": "object",
        "required": [
          "instances"
        ],
        "properties": {
          "instances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InstanceResponse"
            }
          },
          "next_before": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Cursor (instances.id UUIDv7) for the next older page. Empty / null at the end."
          }
        }
      },
      "AccountAppSecretResponse": {
        "description": "One row in `GET /v1/secrets` — a sealed envelope on a specific\napp. Plaintext NEVER appears here: only the\nage-sealed envelope (base64). `app_id` and `app_slug` let the\ndashboard render \"foo-app / DATABASE_URL\" without a parallel\n`/v1/apps` round-trip. `scope` carries the\nenv-scope the row belongs to; the account-wide list\ncrosses scopes.\n",
        "type": "object",
        "required": [
          "app_id",
          "app_slug",
          "key",
          "scope",
          "secret_class",
          "ciphertext",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef",
            "x-since": "2026-07",
            "x-issue": "393"
          },
          "app_slug": {
            "type": "string",
            "x-since": "2026-07",
            "x-issue": "393"
          },
          "key": {
            "type": "string",
            "x-since": "2026-07",
            "x-issue": "393"
          },
          "scope": {
            "type": "string",
            "pattern": "^([a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?|__all__)$",
            "maxLength": 40,
            "x-since": "2026-08",
            "x-issue": "adr-92"
          },
          "secret_class": {
            "type": "string",
            "enum": [
              "persistent",
              "ephemeral"
            ],
            "description": "Retention treatment for this envelope: persistent values may be present in VM state, while ephemeral values prohibit init and warm snapshot publication for the app scope.",
            "x-since": "2026-09",
            "x-issue": "secrets-ephemeral"
          },
          "ciphertext": {
            "type": "string",
            "description": "base64 age-sealed envelope. Plaintext NEVER appears on this wire.",
            "x-since": "2026-07",
            "x-issue": "393"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "x-since": "2026-07",
            "x-issue": "393"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "x-since": "2026-07",
            "x-issue": "393"
          },
          "value_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{16}$",
            "maxLength": 16,
            "x-since": "2026-08",
            "x-issue": "adr-117",
            "description": "16-hex HMAC-SHA256(plaintext) keyed by the per-host host.hmac.key. Empty for older rows. Mirror of the AccountAppSecretResponse / ScopedAppSecretResponse field.",
            "example": "abcdef0123456789"
          }
        }
      },
      "EnvDiffKind": {
        "type": "string",
        "description": "Discriminator for an env-diff matrix row. 'secret' rows carry {present, value_hash}; 'env' rows carry {present, value}. The cell shape is uniform but the field population is kind-aware.",
        "enum": [
          "secret",
          "env"
        ],
        "example": "secret"
      },
      "EnvDiffCell": {
        "description": "One (scope, row) cell in the env-diff matrix. The shape is\nclosed and uniform across row kinds; the difference is which\noptional fields are populated. Security: secret cells never\nemit a `value` field; env cells never emit a `value_hash`\nfield. Older rows have value_hash = '' and emit no field.\n",
        "type": "object",
        "required": [
          "present"
        ],
        "properties": {
          "present": {
            "type": "boolean",
            "description": "True if the (row.key, scope) pair is stamped on the app; false if missing."
          },
          "value_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{16}$",
            "maxLength": 16,
            "description": "16-hex HMAC-SHA256(plaintext) keyed by the per-host host.hmac.key. Secret cells only.",
            "example": "abcdef0123456789"
          },
          "value": {
            "type": "string",
            "description": "Plaintext env var. Env cells only; NEVER populated on secret cells (the load-bearing security property of the endpoint).",
            "example": "info"
          }
        }
      },
      "EnvDiffRow": {
        "description": "One (key, kind) row in the env-diff matrix. The Cells map is keyed by scope.",
        "type": "object",
        "required": [
          "key",
          "kind",
          "cells"
        ],
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[A-Z][A-Z0-9_]*$",
            "maxLength": 128,
            "example": "DATABASE_URL"
          },
          "kind": {
            "$ref": "#/components/schemas/EnvDiffKind"
          },
          "cells": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/EnvDiffCell"
            },
            "description": "scope → cell. The handler populates the unioned set of scopes; consumers iterate EnvDiffResponse.Scopes for the canonical order."
          }
        }
      },
      "EnvDiffResponse": {
        "description": "Top-level response shape for GET /v1/apps/{slug}/env-diff. The matrix is always full (no `?scope=`\nfilter in v1). Rows are sorted ASC by key; scopes are\nsorted ASC. Bounded payload: row count <= SecretCountMax +\nEnvCountMax (200 on Scale), column count = customer's\nscope set (1-3 typical).\n",
        "type": "object",
        "required": [
          "app_slug",
          "scopes",
          "rows",
          "generated_at"
        ],
        "properties": {
          "app_slug": {
            "type": "string",
            "description": "Echoes the URL path parameter so the dashboard can render a header without re-parsing the URL.",
            "example": "demo"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
            },
            "description": "Sorted ASC list of scopes present in the matrix. Consumers iterate this list for column ordering."
          },
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EnvDiffRow"
            },
            "description": "Sorted ASC (by key) list of env-diff rows."
          },
          "generated_at": {
            "type": "string",
            "format": "date-time",
            "description": "RFC3339Nano timestamp the response was built. Dashboards use this to display stale badges."
          }
        }
      },
      "ListSecretsForAccountResponse": {
        "description": "Page shape for `GET /v1/secrets`. `secrets` is\nthe page in (app_slug ASC, key ASC) order. `next_before` is\nthe cursor the caller passes on the next request — encoded as\n`<slug>|<key>`. Empty / null at the end.\n",
        "type": "object",
        "required": [
          "secrets"
        ],
        "properties": {
          "secrets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccountAppSecretResponse"
            }
          },
          "next_before": {
            "type": [
              "string",
              "null"
            ],
            "description": "Cursor in the form `<slug>|<key>`. Empty / null at the end."
          }
        }
      },
      "AppsMetricsResponse": {
        "description": "Account-wide per-app metrics rollup for `GET /v1/apps/metrics?range=`. One call replaces N per-app\n`/v1/apps/{slug}/metrics` calls.\n\n`apps` is keyed by `app_slug` so the dashboard can render the\nrows without a parallel `/v1/apps` lookup. The per-app values\nare `AppMetricsResponse` — the same shape as the per-app\nendpoint emits, so the dashboard renders the rollup with one\ncode path.\n\n`wake_p95_ms` per app is the FLEET p95 (the underlying\n`gateway_wake_latency_seconds` histogram is unlabeled — there\nis no per-app wake histogram).\n\nOn Prometheus failure the endpoint returns 200 with `apps:\nnull` and `source: \"degraded: <reason>\"`, matching the\nper-app contract exactly so the dashboard has one empty-state\nbranch across both endpoints.\n",
        "type": "object",
        "required": [
          "range",
          "source",
          "as_of",
          "apps"
        ],
        "properties": {
          "range": {
            "type": "string",
            "enum": [
              "5m",
              "15m",
              "1h",
              "6h",
              "24h",
              "7d",
              "15d"
            ],
            "description": "Time window that was queried for every per-app rollup row.",
            "x-since": "2026-07",
            "x-issue": "393"
          },
          "source": {
            "type": "string",
            "description": "\"prometheus\" on success; \"degraded: <reason>\" otherwise.",
            "x-since": "2026-07",
            "x-issue": "393"
          },
          "as_of": {
            "type": "string",
            "format": "date-time",
            "description": "RFC3339Nano UTC stamp at which the rollup was assembled.",
            "x-since": "2026-07",
            "x-issue": "393"
          },
          "apps": {
            "type": [
              "object",
              "null"
            ],
            "description": "Per-app `AppMetricsResponse`, keyed by app_slug. Null when degraded.",
            "additionalProperties": {
              "$ref": "#/components/schemas/AppMetricsResponse"
            },
            "x-since": "2026-07",
            "x-issue": "393"
          }
        }
      },
      "SLODuration": {
        "description": "Shared latency sub-shape used by `AppSLOResponse` and\n`AccountSLOResponse`. Three percentiles over the SLO\nwindow (2xx class only); NaN/Inf from `histogram_quantile`\non an empty window is coerced to 0 by the handler.\n",
        "type": "object",
        "required": [
          "p50_ms",
          "p95_ms",
          "p99_ms"
        ],
        "properties": {
          "p50_ms": {
            "type": "number",
            "description": "p50 latency in milliseconds."
          },
          "p95_ms": {
            "type": "number",
            "description": "p95 latency in milliseconds."
          },
          "p99_ms": {
            "type": "number",
            "description": "p99 latency in milliseconds."
          }
        },
        "x-since": "2026-08",
        "x-issue": "696"
      },
      "WakeTimelineApp": {
        "description": "Slim per-app identification embedded in `AppWakeTimelineResponse`.\nCarries only the fields the dashboard SPA needs for the\nwake-timeline header (slug + app_id). The dashboard's wider\napp list item carries template-specific\nglyph/badge fields (SLO badge, StateBadge*, QuotaLabel) that\ndon't belong on the wire.\n",
        "type": "object",
        "required": [
          "app_id",
          "slug"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$",
            "description": "DNS-safe app slug (matches apps.slug)."
          },
          "status": {
            "type": "string",
            "description": "Optional deployment status (active/paused). Empty until a deployment is bound."
          },
          "url": {
            "type": "string",
            "description": "Optional public URL once a deployment is bound."
          }
        }
      },
      "WakeTimelineJSONRow": {
        "description": "One row of `AppWakeTimelineResponse.rows`. Mirrors\nthe dashboard wake-timeline row's fields so the JSON\nmirror can render the same dashboard page 1:1. The\nnullable fields (Trigger / QueuedCount / ConcurrencyAtAdmit\n/ ReadyInMS) use omitempty so the dashboard SPA can\ndistinguish \"absent\" (jsonb key missing — older rows\nrow) from \"explicit zero\" (jsonb key present and 0).\n`ready_in_ms = -1` is the em-dash sentinel for \"no\nboot_completed row yet\" (still booting or rejected) — the\ndashboard SPA renders \"—\" on -1, mirroring the HTML page\ncell-empty branch.\n",
        "type": "object",
        "required": [
          "kind",
          "state",
          "at_capacity",
          "at_capacity_present"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "wake.boot_started"
            ],
            "description": "Event kind. Today always wake.boot_started; the field is open for future wake.boot_completed/_failed rows."
          },
          "state": {
            "type": "string",
            "description": "Mirror of the instance.state column on the per-app-detail recent-wakes table."
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "RFC3339 UTC timestamp of the wake."
          },
          "wake_id": {
            "type": "string",
            "description": "Wake-attempt correlation ID."
          },
          "trigger": {
            "type": "string",
            "description": "Closed-enum trigger that admitted the wake (manual.cron / manual.api / scheduled.idle / …). Empty/absent on older rows."
          },
          "trigger_class": {
            "type": "string",
            "enum": [
              "user",
              "monitor",
              "crawler",
              "preview_bot",
              "unknown"
            ],
            "description": "Bounded User-Agent classification for the request that caused the wake. Empty/absent on pre-M3 fleet rows."
          },
          "method": {
            "type": "string",
            "description": "Wake method the VM manager ran (restore or cold_boot), when telemetry is available. A planned restore that fell back to a cold boot reads cold_boot."
          },
          "tier": {
            "type": "string",
            "enum": [
              "warm",
              "init",
              "cold_boot_fallback"
            ],
            "description": "Snapshot tier selected for the wake; cold_boot_fallback when a planned restore fell back to a cold boot."
          },
          "queued_count": {
            "type": "integer",
            "format": "int32",
            "description": "ledger.Concurrency at admit. 0 when absent."
          },
          "concurrency_at_admit": {
            "type": "integer",
            "format": "int32",
            "description": "Same reading; 0 is the cold-start case."
          },
          "at_capacity": {
            "type": "boolean",
            "description": "True when admitted at the plan's per-app MaxConcurrency ceiling. Only meaningful when at_capacity_present is true."
          },
          "at_capacity_present": {
            "type": "boolean",
            "description": "True when the at_capacity key was in jsonb; false = absent (older rows). The dashboard renders em-dash when false."
          },
          "ready_in_ms": {
            "type": "integer",
            "format": "int32",
            "description": "Wall-clock boot_started → boot_completed delta in ms. -1 when still booting or rejected. 0 is impossible (a 0ms wake would round to a positive integer)."
          },
          "planned_method": {
            "type": "string",
            "description": "The method scheduler planned when the VM manager ran another one, for example restore on a wake that fell back to a cold boot. Absent otherwise."
          },
          "restore_fallback_reason": {
            "type": "string",
            "enum": [
              "after_restore_failed"
            ],
            "description": "Closed reason for a restore that fell back to a cold boot, when one is reported. Absent for other fallbacks, such as a snapshot made from an older base."
          }
        }
      },
      "AppWakeTimelineResponse": {
        "description": "JSON mirror of the dashboard per-app wake-timeline page.\nPlan-gated Hobby+ (same code as /v1/apps/{slug}/metrics:\nplan_per_app_metrics_not_allowed).\n\n`trigger_histogram` is a JSON object (map[string]int) — empty\n`{}` on a fresh app, never null. The dashboard SPA must\ntreat missing keys as 0 (JSON.parse returns undefined for\nmissing keys, not 0 — the render code adds the explicit\n`?? 0` fallback).\n\n`at_capacity_pct` is the share of `wake_count_with_meta`\nrows where the events.wake.boot_started join succeeded AND\nthe at_capacity flag is true. Older rows\ncontribute to `wake_count_24h` but not the denominator.\n",
        "type": "object",
        "required": [
          "app",
          "wake_count_24h",
          "wake_count_with_meta",
          "at_capacity_count",
          "at_capacity_pct",
          "trigger_histogram",
          "trigger_class_histogram",
          "rows",
          "as_of"
        ],
        "properties": {
          "page": {
            "$ref": "#/components/schemas/AppWakeHistoryPage"
          },
          "app": {
            "$ref": "#/components/schemas/WakeTimelineApp"
          },
          "wake_count_24h": {
            "type": "integer",
            "description": "Selected retained instance count; keyset_v1 counts only this page. Legacy mode examines 100 recent candidates before filtering."
          },
          "wake_count_with_meta": {
            "type": "integer",
            "description": "Denominator for at_capacity_pct — count of rows where the events.wake.boot_started LEFT JOIN succeeded."
          },
          "at_capacity_count": {
            "type": "integer",
            "description": "Numerator for at_capacity_pct."
          },
          "at_capacity_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "Share of meta-bearing rows admitted at the per-app MaxConcurrency ceiling."
          },
          "trigger_histogram": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            },
            "description": "trigger → N count of WakeBootMeta.Trigger values across the meta-bearing rows. Empty {} on a fresh app, never null."
          },
          "trigger_class_histogram": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            },
            "description": "trigger_class → N count of known user/monitor/crawler/preview_bot/unknown classifications. Empty {} on a fresh app, never null."
          },
          "rows": {
            "type": "array",
            "description": "Retained instance records in descending started_at order. keyset_v1 breaks ties by instance ID and filters before limiting; legacy mode filters 100 recent candidates.",
            "items": {
              "$ref": "#/components/schemas/WakeTimelineJSONRow"
            }
          },
          "as_of": {
            "type": "string",
            "format": "date-time",
            "description": "RFC3339Nano UTC timestamp marking the JSON envelope's authoritative 'as of' instant."
          }
        }
      },
      "AppWakeHistoryPage": {
        "type": "object",
        "description": "Live retained instance-history page. App/window filtering precedes the bound; missing start times are excluded. Counts describe this page only. Source success does not prove capture completeness, freshness or a snapshot. Instance IDs stay in opaque cursors.",
        "required": [
          "mode",
          "since",
          "until",
          "limit",
          "complete",
          "source_status",
          "count_scope"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "keyset_v1"
            ]
          },
          "since": {
            "type": "string",
            "format": "date-time"
          },
          "until": {
            "type": "string",
            "format": "date-time"
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "cursor": {
            "type": "string",
            "maxLength": 2048
          },
          "next_cursor": {
            "type": "string",
            "maxLength": 2048
          },
          "complete": {
            "type": "boolean"
          },
          "source_status": {
            "type": "string",
            "enum": [
              "read_succeeded"
            ]
          },
          "count_scope": {
            "type": "string",
            "enum": [
              "returned_page"
            ]
          }
        }
      },
      "AppUsageSummaryResponse": {
        "description": "Wire shape for `GET /v1/apps/{slug}/usage?since=&until=`\n(commit 4 of the per-app observability PR series).\nPlan-gated Hobby+; Free falls through with\n`plan_app_usage_summary_not_allowed`.\n\n`gb_hours` is the rounded float of `mb_seconds / 1024 /\n3600` (mirror of `meter.MonthlyUsageGB`'s 6-decimal\nrounding). `overage_gb_hours = max(0, gb_hours -\nplan_included_gb_hours)` — 0 when the customer is under\ntheir included band, the billable overage above the band\notherwise. The Stripe pusher bills overage at $0.05/GB-h\n(CLAUDE.md integer-cents-only rule).\n",
        "type": "object",
        "required": [
          "slug",
          "period_start",
          "period_end",
          "mb_seconds",
          "gb_hours",
          "requests",
          "tx_bytes",
          "net_tx_bytes",
          "builder_seconds",
          "cold_boot_count",
          "plan_included_gb_hours",
          "overage_gb_hours",
          "source",
          "as_of"
        ],
        "properties": {
          "slug": {
            "type": "string",
            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$"
          },
          "period_start": {
            "type": "string",
            "format": "date-time",
            "description": "Half-open [period_start, period_end) window's inclusive lower bound. UTC."
          },
          "period_end": {
            "type": "string",
            "format": "date-time",
            "description": "Half-open window's exclusive upper bound. UTC midnight snap (handler defaults)."
          },
          "mb_seconds": {
            "type": "integer",
            "format": "int64",
            "description": "Sum of usage_minutes.mb_seconds for this app in the window (billable unit)."
          },
          "gb_hours": {
            "type": "number",
            "description": "mb_seconds / 1024 / 3600, rounded to 6 decimal places (mirror of meter.MonthlyUsageGB)."
          },
          "requests": {
            "type": "integer",
            "format": "int64",
            "description": "Cumulative HTTP request count (informational; not billed)."
          },
          "tx_bytes": {
            "type": "integer",
            "format": "int64",
            "description": "Cumulative HTTP response body bytes (diagnostic subset of net_tx_bytes; never add both)."
          },
          "net_tx_bytes": {
            "type": "integer",
            "format": "int64",
            "description": "Canonical cumulative host-interface egress bytes for the window (includes framing)."
          },
          "builder_seconds": {
            "type": "number",
            "description": "Cumulative builder-microVM CPU-seconds (informational; surfaced as a sidebar line on the dashboard)."
          },
          "cold_boot_count": {
            "type": "integer",
            "format": "int64",
            "description": "WAKE_RESTORE→WAKE_COLD_BOOT transitions in the window."
          },
          "plan_included_gb_hours": {
            "type": "number",
            "description": "Echoed from acct.Plan.PlanIncludedGBHours() — plan's per-month included band so the dashboard renders the included-band badge without a second round-trip."
          },
          "overage_gb_hours": {
            "type": "number",
            "description": "max(0, gb_hours - plan_included_gb_hours). 0 when the customer is under their included band; the billable overage above the band otherwise."
          },
          "source": {
            "type": "string",
            "enum": [
              "usage_minutes",
              "usage_daily",
              "mixed"
            ],
            "description": "Which rollup reader produced this summary. usage_minutes today (30d retention); usage_daily lands with the trail-period follow-up."
          },
          "as_of": {
            "type": "string",
            "format": "date-time",
            "description": "RFC3339Nano UTC stamping the envelope's authoritative 'as of' instant."
          }
        }
      },
      "RequestAnalyticsRoute": {
        "type": "object",
        "description": "Aggregated request analytics for one route and HTTP method. Counts include collapsed telemetry row weights.",
        "required": [
          "route",
          "method",
          "requests",
          "error_requests",
          "error_rate_pct",
          "cold_boots",
          "p50_ms",
          "p95_ms",
          "p99_ms"
        ],
        "properties": {
          "route": {
            "type": "string",
            "description": "Route template, not an expanded URL."
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE",
              "HEAD",
              "OPTIONS",
              "OTHER"
            ]
          },
          "requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_rate_pct": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 100
          },
          "cold_boots": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "p50_ms": {
            "type": "integer",
            "minimum": 0
          },
          "p95_ms": {
            "type": "integer",
            "minimum": 0
          },
          "p99_ms": {
            "type": "integer",
            "minimum": 0
          },
          "cold_request_p95_ms": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "description": "Weighted p95 gateway-observed request duration among requests that woke a cold instance. Includes handler time; not an isolated wake-phase duration."
          },
          "wake_boot_p95_ms": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "description": "p95 from the scheduler wake.boot_started to wake.boot_completed (instance RUNNING) for distinct wake IDs correlated to this route; null when event pairs are unavailable."
          },
          "guest_execution_p50_ms": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "description": "Weighted p50 wall time from platform-runner execution evidence; not CPU time. Null when runtime evidence is unavailable."
          },
          "guest_execution_p95_ms": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "description": "Weighted p95 wall time from platform-runner execution evidence; not CPU time. Null when runtime evidence is unavailable."
          },
          "guest_cpu_avg_ms": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "description": "Request-weighted average child-process user+system CPU time for Linux one-shot invocations. Includes runtime startup and uses bounded upward buckets; null for persistent workers and arbitrary HTTP containers."
          },
          "guest_cpu_p95_ms": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "description": "Weighted p95 child-process CPU time from Linux one-shot invocations, using bounded upward buckets; null when process usage is unavailable."
          },
          "guest_peak_rss_max_mb": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "description": "Maximum process high-water RSS across measured invocations, rounded into an upper MiB bucket; null when process usage is unavailable."
          },
          "dependency_samples": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Count of retained, platform-classified dependency span samples for this route; not a complete call count."
          },
          "dependency_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Collapsed request weight represented by rows with at least one classified dependency span."
          },
          "dependencies": {
            "type": "array",
            "description": "Top classified dependencies ranked by sampled exclusive p95. Values are bounded and sample-based.",
            "items": {
              "$ref": "#/components/schemas/RequestAnalyticsDependency"
            }
          },
          "deployment_observations": {
            "type": "array",
            "description": "At most the five highest-request deployments for this route/method, with request-share compute estimates and measured guest CPU comparisons against the preceding comparable revision.",
            "items": {
              "$ref": "#/components/schemas/RequestAnalyticsRouteDeploymentObservation"
            }
          },
          "other_deployment_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Route requests from deployments outside the top-five list."
          },
          "other_deployment_estimated_compute_cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "This route's estimated compute value allocated to deployments outside the top-five list by request share."
          },
          "estimated_compute_cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Estimated raw RAM-hour value allocated to this route by its share of observed request time, or by request share when no timing exists; excludes account-level included allowance and egress."
          },
          "request_share_pct": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 100
          },
          "request_time_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Total gateway-observed request time for this route in the window, in milliseconds."
          },
          "request_time_share_pct": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 100,
            "description": "This route's share of all observed app request time in the window."
          }
        }
      },
      "RequestAnalyticsRouteDeploymentObservation": {
        "type": "object",
        "description": "One route/method's bounded request and estimated-compute share for an immutable deployment. CPU comparisons are advisory, require at least 20 measured requests on both revisions, and remain sensitive to traffic mix.",
        "required": [
          "deployment_id",
          "requests",
          "request_share_pct",
          "estimated_compute_cost_millicents",
          "guest_cpu_measured_requests",
          "guest_cpu_regression"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "description": "Stable UUID identifying the immutable revision that served this route."
          },
          "commit_sha": {
            "type": "string"
          },
          "deployment_tag": {
            "type": "string"
          },
          "deployment_created_at": {
            "type": "string",
            "description": "RFC 3339 timestamp used to order same-route CPU comparisons."
          },
          "requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "request_share_pct": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 100,
            "description": "This route/deployment cell's share of all observed app requests in the window."
          },
          "estimated_compute_cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Estimated raw RAM-hour value allocated to this route/deployment cell by request share; not an invoice amount."
          },
          "guest_cpu_avg_ms": {
            "type": "integer",
            "minimum": 0,
            "description": "Request-weighted mean measured guest CPU time for this route under this deployment; supported Linux one-shot runtimes only."
          },
          "guest_cpu_measured_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "guest_cpu_change_pct": {
            "type": "number",
            "format": "double",
            "description": "Change in measured mean guest CPU/request from the preceding comparable deployment for this same route/method."
          },
          "guest_cpu_compared_to": {
            "type": "string",
            "description": "Tag, commit SHA, or deployment UUID of the preceding comparable revision."
          },
          "guest_cpu_regression": {
            "type": "boolean",
            "description": "True when measured guest CPU/request rose by at least 25% from the preceding comparable revision."
          }
        }
      },
      "RequestAnalyticsDependency": {
        "type": "object",
        "description": "Sampled aggregate of platform-classified dependency spans observed under one route. Exclusive duration subtracts overlapping direct child spans; it approximates dependency-owned wait and is not additive request latency. Calls are weighted by collapsed request count and are not a complete span call count. Deployment observations compare the same route and dependency across immutable revisions when chronology and sample size permit.",
        "required": [
          "type",
          "name",
          "samples",
          "calls",
          "error_calls",
          "error_rate_pct",
          "p50_ms",
          "p95_ms",
          "p99_ms",
          "exclusive_p95_ms"
        ],
        "properties": {
          "type": {
            "type": "string",
            "description": "Allowlisted dependency category."
          },
          "kind": {
            "type": "string",
            "description": "Allowlisted dependency kind when available."
          },
          "name": {
            "type": "string",
            "description": "Redacted span name."
          },
          "samples": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Number of retained span observations."
          },
          "calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Observed span sample count weighted by the collapsed request-row count; not a full call count."
          },
          "error_calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_rate_pct": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 100,
            "description": "Error calls divided by observed weighted calls."
          },
          "p50_ms": {
            "type": "integer",
            "minimum": 0,
            "description": "Weighted p50 inclusive span duration."
          },
          "p95_ms": {
            "type": "integer",
            "minimum": 0,
            "description": "Weighted p95 inclusive span duration."
          },
          "p99_ms": {
            "type": "integer",
            "minimum": 0,
            "description": "Weighted p99 inclusive span duration."
          },
          "exclusive_p95_ms": {
            "type": "integer",
            "minimum": 0,
            "description": "Weighted p95 span duration excluding overlapping direct child spans."
          },
          "deployment_observations": {
            "type": "array",
            "description": "At most the five newest deployment observations for this route/dependency pair; comparisons are advisory and require at least 20 retained span observations on each deployment.",
            "items": {
              "$ref": "#/components/schemas/RequestAnalyticsDependencyDeploymentObservation"
            }
          }
        }
      },
      "RequestAnalyticsDependencyDeploymentObservation": {
        "type": "object",
        "description": "Sampled latency and error measurements for one route dependency under a single immutable deployment, with an advisory comparison to a prior sampled revision when possible.",
        "required": [
          "deployment_id",
          "samples",
          "calls",
          "error_calls",
          "error_rate_pct",
          "p50_ms",
          "p95_ms",
          "p99_ms",
          "exclusive_p95_ms",
          "regression"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "description": "Immutable deployment owning these sampled dependency observations."
          },
          "commit_sha": {
            "type": "string"
          },
          "deployment_tag": {
            "type": "string"
          },
          "deployment_created_at": {
            "type": "string",
            "description": "RFC 3339 creation time used to order comparable revisions."
          },
          "samples": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Retained dependency span observations attached to this deployment."
          },
          "calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Observed span sample count weighted by collapsed request-row count."
          },
          "error_calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_rate_pct": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 100,
            "description": "Error share among this deployment's observed weighted calls."
          },
          "p50_ms": {
            "type": "integer",
            "minimum": 0
          },
          "p95_ms": {
            "type": "integer",
            "minimum": 0
          },
          "p99_ms": {
            "type": "integer",
            "minimum": 0
          },
          "exclusive_p95_ms": {
            "type": "integer",
            "minimum": 0
          },
          "p95_change_pct": {
            "type": "number",
            "format": "double",
            "description": "Percentage change from the preceding comparable deployment, when its baseline is non-zero."
          },
          "error_rate_change_pct": {
            "type": "number",
            "format": "double",
            "description": "Error-rate change in percentage points from the preceding comparable deployment."
          },
          "compared_to": {
            "type": "string",
            "description": "Tag, commit SHA, or deployment UUID used as the preceding revision baseline."
          },
          "regression": {
            "type": "boolean",
            "description": "True when p95 rose by at least 25% or error rate rose by at least 2 percentage points."
          }
        }
      },
      "RequestAnalyticsComputeCost": {
        "type": "object",
        "description": "Estimated app compute value over the analytics window, allocated by observed request share. This is not an invoice amount; it values raw RAM-hours before the account's included allowance and excludes egress.",
        "required": [
          "estimated_millicents",
          "allocated_millicents",
          "unallocated_millicents",
          "other_route_millicents",
          "other_route_requests",
          "other_route_request_share_pct",
          "rate_millicents_per_gb_hour",
          "currency",
          "allocation_method",
          "basis",
          "request_count"
        ],
        "properties": {
          "estimated_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "allocated_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unallocated_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Estimated compute value not assigned because the window has no observed route requests."
          },
          "other_route_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Value allocated to requests outside the top route list."
          },
          "other_route_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "other_route_request_share_pct": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 100
          },
          "rate_millicents_per_gb_hour": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "currency": {
            "type": "string",
            "enum": [
              "EUR"
            ]
          },
          "allocation_method": {
            "type": "string",
            "enum": [
              "request_time_share",
              "request_share"
            ],
            "description": "request_time_share splits by observed request time; request_share is the fallback when the window has no timing."
          },
          "basis": {
            "type": "string",
            "enum": [
              "raw_ram_hours_at_current_overage_rate_before_allowance"
            ]
          },
          "request_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "RequestAnalyticsDeploymentCost": {
        "type": "object",
        "description": "One deployment's estimated share of app raw compute value, allocated by its observed request share, with optional measured CPU/request comparison. CPU regression comparisons are advisory, traffic-mix sensitive, and only available for supported runtimes.",
        "required": [
          "deployment_id",
          "requests",
          "request_share_pct",
          "estimated_compute_cost_millicents",
          "guest_cpu_measured_requests",
          "guest_cpu_regression"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "description": "Immutable deployment UUID."
          },
          "commit_sha": {
            "type": "string"
          },
          "deployment_tag": {
            "type": "string"
          },
          "deployment_created_at": {
            "type": "string"
          },
          "requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "request_share_pct": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 100
          },
          "estimated_compute_cost_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "guest_cpu_avg_ms": {
            "type": "integer",
            "minimum": 0,
            "description": "Mean measured guest CPU time per request in the analytics window; only populated for supported Linux one-shot runtimes."
          },
          "guest_cpu_measured_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Request-weighted number of requests with measured guest CPU data."
          },
          "guest_cpu_change_pct": {
            "type": "number",
            "format": "double",
            "description": "Percentage change in mean guest CPU time from the earlier comparable deployment in this analytics window. Only computed when both deployments have at least 20 measured requests and the baseline is non-zero."
          },
          "guest_cpu_compared_to": {
            "type": "string",
            "description": "Tag, commit SHA, or deployment UUID for the earlier measured deployment used as the CPU comparison baseline."
          },
          "guest_cpu_regression": {
            "type": "boolean",
            "description": "True when measured guest CPU/request increased by at least 25% from the comparison baseline. Advisory and sensitive to traffic mix."
          }
        }
      },
      "RequestAnalyticsDeploymentCostBreakdown": {
        "type": "object",
        "description": "Bounded deployment allocation of the app's estimated raw compute value for the analytics window. It is not an invoice amount.",
        "required": [
          "estimated_millicents",
          "allocated_millicents",
          "unallocated_millicents",
          "other_millicents",
          "other_requests",
          "other_request_share_pct",
          "request_count",
          "deployments"
        ],
        "properties": {
          "estimated_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "allocated_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unallocated_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "other_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Value allocated to deployments outside the top-N list."
          },
          "other_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "other_request_share_pct": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 100
          },
          "request_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "deployments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RequestAnalyticsDeploymentCost"
            }
          }
        }
      },
      "RequestAnalyticsGroup": {
        "type": "object",
        "description": "Bounded aggregate for a selected analytics dimension. Value is a route, country, hostname, normalized client family, status code, stable consumer UUID, __anonymous__, or __other__.",
        "required": [
          "value",
          "requests",
          "error_requests",
          "error_rate_pct",
          "cold_boots",
          "p50_ms",
          "p95_ms",
          "p99_ms"
        ],
        "properties": {
          "value": {
            "type": "string"
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE",
              "HEAD",
              "OPTIONS",
              "OTHER"
            ]
          },
          "requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_rate_pct": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 100
          },
          "cold_boots": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "p50_ms": {
            "type": "integer",
            "minimum": 0
          },
          "p95_ms": {
            "type": "integer",
            "minimum": 0
          },
          "p99_ms": {
            "type": "integer",
            "minimum": 0
          },
          "cold_request_p95_ms": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "wake_boot_p95_ms": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "guest_execution_p50_ms": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "guest_execution_p95_ms": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "guest_cpu_avg_ms": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "guest_cpu_p95_ms": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "guest_peak_rss_max_mb": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          }
        }
      },
      "RouteCustomerObservation": {
        "type": "object",
        "description": "One request-time consumer and tenant identity group; either or both IDs may be present.",
        "required": [
          "requests",
          "last_observed_at"
        ],
        "properties": {
          "consumer_id": {
            "type": "string",
            "format": "uuid",
            "description": "Stable authenticated consumer ID owned by the selected app, if recorded and resolvable."
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid",
            "description": "Account-owned tenant ID recorded when these requests occurred, if resolvable."
          },
          "requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Weighted retained requests attributed to this identity pair."
          },
          "last_observed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Latest recorded telemetry timestamp for this identity group; may be a minute bucket."
          }
        }
      },
      "RouteCustomerUsage": {
        "type": "object",
        "description": "Observed customer exposure for one exact route label and HTTP method on the selected deployment.",
        "required": [
          "route",
          "method",
          "requests",
          "identified_requests",
          "anonymous_requests",
          "unresolved_identity_requests",
          "consumer_count",
          "platform_tenant_count",
          "last_observed_at",
          "customers",
          "customers_truncated",
          "other_customer_requests"
        ],
        "properties": {
          "route": {
            "type": "string",
            "description": "Exact recorded route label; may include its HTTP method prefix."
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE",
              "HEAD",
              "OPTIONS",
              "OTHER"
            ],
            "description": "HTTP method for this route observation."
          },
          "requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "All weighted retained requests for this route and deployment."
          },
          "identified_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Requests with at least one resolvable account-owned consumer or tenant identity."
          },
          "anonymous_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Requests with neither consumer nor tenant identity recorded."
          },
          "unresolved_identity_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Requests with recorded identities that cannot be resolved within the app and account boundary."
          },
          "consumer_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Distinct observed app-owned consumers before detail caps; overlaps tenant count."
          },
          "platform_tenant_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Distinct observed account-owned request-time tenants before detail caps; overlaps consumer count."
          },
          "last_observed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Latest recorded timestamp for this route; may be a minute bucket."
          },
          "customers": {
            "type": "array",
            "maxItems": 20,
            "description": "Top recorded identity pairs by request count, with deterministic ID tie ordering.",
            "items": {
              "$ref": "#/components/schemas/RouteCustomerObservation"
            }
          },
          "customers_truncated": {
            "type": "boolean",
            "description": "More identity pairs matched than the customer detail limit."
          },
          "other_customer_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Identified requests belonging to identity pairs omitted by the detail cap."
          }
        }
      },
      "RouteCustomerUsageResponse": {
        "type": "object",
        "description": "Bounded observed customer usage for one app, deployment and half-open retained telemetry window.",
        "required": [
          "slug",
          "deployment_id",
          "from",
          "until",
          "as_of",
          "window_clamped",
          "coverage",
          "routes",
          "routes_limit",
          "routes_truncated",
          "customers_limit"
        ],
        "properties": {
          "slug": {
            "type": "string",
            "description": "App whose deployment and telemetry were read."
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Selected immutable deployment owned by this app."
          },
          "from": {
            "type": "string",
            "format": "date-time",
            "description": "Effective inclusive lower bound after retention clamping."
          },
          "until": {
            "type": "string",
            "format": "date-time",
            "description": "Exclusive upper bound of the observation window."
          },
          "as_of": {
            "type": "string",
            "format": "date-time",
            "description": "UTC time at which the read window was assembled."
          },
          "window_clamped": {
            "type": "boolean",
            "description": "Requested start was older than current retained telemetry."
          },
          "coverage": {
            "type": "string",
            "enum": [
              "observed_only"
            ],
            "description": "Complete capture cannot be established from retained telemetry."
          },
          "routes": {
            "type": "array",
            "maxItems": 200,
            "description": "Top route/method observations ordered by weighted requests, route, then method.",
            "items": {
              "$ref": "#/components/schemas/RouteCustomerUsage"
            }
          },
          "routes_limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 200,
            "description": "Maximum route observations returned."
          },
          "routes_truncated": {
            "type": "boolean",
            "description": "More route observations matched than the route limit; missing routes remain unknown."
          },
          "customers_limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20,
            "description": "Maximum identity groups returned per route; aggregate counts precede this cap."
          }
        }
      },
      "RequestAnalyticsResponse": {
        "type": "object",
        "description": "Bounded historical request analytics for\n`GET /v1/apps/{slug}/analytics?since=`. The window is half-open\n`[from, until)`, and the route list is capped at 50 rows.\n",
        "required": [
          "slug",
          "since",
          "from",
          "until",
          "window_clamped",
          "requests",
          "error_requests",
          "error_rate_pct",
          "cold_boots",
          "p50_ms",
          "p95_ms",
          "p99_ms",
          "group_by",
          "groups",
          "groups_limit",
          "groups_truncated",
          "routes",
          "routes_limit",
          "routes_truncated",
          "dependencies_truncated",
          "as_of"
        ],
        "properties": {
          "omitted": {
            "type": "array",
            "description": "Optional enrichment sections unavailable within their query budgets; traffic totals remain available.",
            "items": {
              "type": "string"
            }
          },
          "slug": {
            "type": "string"
          },
          "since": {
            "type": "string",
            "description": "Effective lookback duration after retention clamping."
          },
          "from": {
            "type": "string",
            "format": "date-time",
            "description": "Inclusive lower bound of the analytics window."
          },
          "until": {
            "type": "string",
            "format": "date-time",
            "description": "Exclusive upper bound of the analytics window."
          },
          "window_clamped": {
            "type": "boolean",
            "description": "True when the requested lookback exceeded plan retention."
          },
          "requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_rate_pct": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 100
          },
          "cold_boots": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "p50_ms": {
            "type": "integer",
            "minimum": 0
          },
          "p95_ms": {
            "type": "integer",
            "minimum": 0
          },
          "p99_ms": {
            "type": "integer",
            "minimum": 0
          },
          "group_by": {
            "type": "string",
            "enum": [
              "route",
              "country",
              "referrer_host",
              "ua_family",
              "status",
              "consumer_id"
            ]
          },
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RequestAnalyticsGroup"
            }
          },
          "groups_limit": {
            "type": "integer",
            "minimum": 1,
            "description": "Maximum number of top groups before __other__."
          },
          "groups_truncated": {
            "type": "boolean",
            "description": "True when __other__ contains groups outside the top-N."
          },
          "routes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RequestAnalyticsRoute"
            }
          },
          "routes_limit": {
            "type": "integer",
            "minimum": 1,
            "description": "Maximum number of route rows returned."
          },
          "routes_truncated": {
            "type": "boolean",
            "description": "True when more route rows matched than routes_limit."
          },
          "dependencies_truncated": {
            "type": "boolean",
            "description": "True when dependency span rows, route dependency groups, or route dependency outputs were capped."
          },
          "compute_cost": {
            "$ref": "#/components/schemas/RequestAnalyticsComputeCost"
          },
          "deployment_costs": {
            "$ref": "#/components/schemas/RequestAnalyticsDeploymentCostBreakdown"
          },
          "as_of": {
            "type": "string",
            "format": "date-time",
            "description": "RFC3339Nano UTC assembly timestamp."
          },
          "telemetry_complete": {
            "type": "boolean",
            "description": "True when every gateway delivered this window's request telemetry, so the totals include every request.\nJudged up to two minutes before `as_of`, because the newest minutes are still arriving. Absent when it could not be judged.\n"
          },
          "telemetry_gaps": {
            "type": "array",
            "description": "Why requests in this window may be missing from the totals. Empty or absent when the window is complete.",
            "items": {
              "$ref": "#/components/schemas/RequestAnalyticsTelemetryGap"
            }
          },
          "sampled_measures": {
            "type": "string",
            "enum": [
              "included",
              "omitted"
            ],
            "description": "Whether the detail only sampled raw rows carry is in this response: group CPU and sampled latency,\n`deployment_costs`, and per-route deployment splits. `omitted` when reading it failed or ran past its\ntime budget; request counts, error rates and percentiles never depend on it.\n"
          }
        }
      },
      "RequestAnalyticsTelemetryGap": {
        "type": "string",
        "description": "One reason request analytics may be missing requests: a gateway with no or a stale delivery report\n(`telemetry_coverage_missing`, `telemetry_coverage_stale`), telemetry switched off or sampled\n(`telemetry_disabled`, `telemetry_sampled`), requests still waiting to be delivered\n(`telemetry_ingestion_pending`), or requests lost or a gateway restarted during the window (`telemetry_window_incomplete`).\n",
        "enum": [
          "telemetry_coverage_unknown",
          "telemetry_coverage_missing",
          "telemetry_coverage_stale",
          "telemetry_disabled",
          "telemetry_sampled",
          "telemetry_ingestion_pending",
          "telemetry_window_incomplete"
        ]
      },
      "RequestAnalyticsTimeseriesPoint": {
        "type": "object",
        "description": "One UTC-aligned hourly request analytics bucket.",
        "required": [
          "start",
          "requests",
          "error_requests",
          "error_rate_pct",
          "cold_boots",
          "p50_ms",
          "p95_ms",
          "p99_ms"
        ],
        "properties": {
          "start": {
            "type": "string",
            "format": "date-time",
            "description": "Inclusive UTC start of the one-hour bucket."
          },
          "requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_rate_pct": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 100
          },
          "cold_boots": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "p50_ms": {
            "type": "integer",
            "minimum": 0
          },
          "p95_ms": {
            "type": "integer",
            "minimum": 0
          },
          "p99_ms": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "RequestAnalyticsTimeseriesSeries": {
        "type": "object",
        "description": "A grouped request analytics series with its hourly points.",
        "required": [
          "value",
          "points"
        ],
        "properties": {
          "value": {
            "type": "string"
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE",
              "HEAD",
              "OPTIONS",
              "OTHER"
            ]
          },
          "points": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RequestAnalyticsTimeseriesPoint"
            }
          }
        }
      },
      "RequestAnalyticsTimeseriesResponse": {
        "type": "object",
        "description": "Zero-filled UTC hourly request analytics for\n`GET /v1/apps/{slug}/analytics/timeseries`. The effective window is\nhalf-open [from, until) and bounded by plan retention.\n",
        "required": [
          "slug",
          "since",
          "from",
          "until",
          "window_clamped",
          "bucket",
          "points",
          "as_of"
        ],
        "properties": {
          "slug": {
            "type": "string"
          },
          "route": {
            "type": "string",
            "maxLength": 256,
            "description": "Exact bounded route-label filter when a route-level series was requested."
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE",
              "HEAD",
              "OPTIONS",
              "OTHER"
            ],
            "description": "Exact method filter when a route-level series was requested."
          },
          "since": {
            "type": "string",
            "description": "Effective series lookback after retention clamping."
          },
          "from": {
            "type": "string",
            "format": "date-time",
            "description": "First instant represented by the hourly series."
          },
          "until": {
            "type": "string",
            "format": "date-time",
            "description": "Exclusive end instant represented by the hourly series."
          },
          "window_clamped": {
            "type": "boolean",
            "description": "Indicates the series start was limited by plan retention."
          },
          "bucket": {
            "type": "string",
            "enum": [
              "1h"
            ],
            "description": "UTC bucket size."
          },
          "points": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RequestAnalyticsTimeseriesPoint"
            }
          },
          "group_by": {
            "type": "string",
            "enum": [
              "route",
              "country",
              "referrer_host",
              "ua_family",
              "status",
              "consumer_id"
            ]
          },
          "series": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RequestAnalyticsTimeseriesSeries"
            }
          },
          "as_of": {
            "type": "string",
            "format": "date-time",
            "description": "UTC time when the series response was assembled."
          },
          "telemetry_complete": {
            "type": "boolean",
            "description": "Same as on the analytics overview: true when every gateway delivered the series window, judged up to two minutes before `as_of`."
          },
          "telemetry_gaps": {
            "type": "array",
            "description": "Why requests in the series window may be missing. Empty or absent when the window is complete.",
            "items": {
              "$ref": "#/components/schemas/RequestAnalyticsTelemetryGap"
            }
          }
        }
      },
      "AppSLOResponse": {
        "description": "Per-app SLO panel returned by `GET /v1/apps/{slug}/slo?window=`. Distinct from `AppMetricsResponse`: the SLO surface is a fixed-window\n(1h/24h/7d) summary of the customer-facing SLO signals,\nnot a 5m slice for the dashboard. The fields overlap only\non latency percentiles, error rate, and cold-boot rate — the\nremaining fields (`throttled_total`, `instance_hours`,\n`gb_hours`) are net-new per the issue. `wake_queue_p95_ms` is\nnullable and paired with `wake_queue_sample_status`; the value is\nunavailable until the underlying histogram has a tenant label.\n\nOn Prometheus failure the endpoint returns 200 with\nzeroed fields and `source: \"degraded: <reason>\"`. When\nPostgres is down but the PromQL pass succeeded, only\n`instance_hours` / `gb_hours` are zeroed and `source` is\n`\"degraded: postgres unavailable\"`.\n",
        "type": "object",
        "required": [
          "app_id",
          "app_slug",
          "window",
          "source",
          "as_of",
          "request_duration",
          "error_rate_pct",
          "cold_boot_rate_pct",
          "instance_hours",
          "gb_hours",
          "wake_queue_p95_ms",
          "wake_queue_sample_status",
          "requests_total",
          "throttled_total"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "app_slug": {
            "type": "string"
          },
          "window": {
            "type": "string",
            "enum": [
              "1h",
              "24h",
              "7d"
            ],
            "description": "Echoed SLO window, e.g. `24h`."
          },
          "source": {
            "type": "string",
            "description": "\"prometheus\" on success; \"degraded: <reason>\" otherwise. Per-app shape: when Postgres fails only instance_hours/gb_hours are zeroed."
          },
          "as_of": {
            "type": "string",
            "format": "date-time",
            "description": "RFC3339Nano UTC stamp at which the SLO panel was assembled."
          },
          "request_duration": {
            "$ref": "#/components/schemas/SLODuration"
          },
          "error_rate_pct": {
            "type": "number",
            "description": "Share of 5xx requests in the window for this app. Client-caused 4xx responses do not consume availability budget."
          },
          "cold_boot_rate_pct": {
            "type": "number",
            "description": "Share of requests that triggered a cold boot."
          },
          "instance_hours": {
            "type": "number",
            "description": "Sum of instance × minute / 60 over the window (from `usage_minutes`)."
          },
          "gb_hours": {
            "type": "number",
            "description": "Sum of mb_seconds / 3600 / 1024 over the window (from `usage_minutes`)."
          },
          "wake_queue_p95_ms": {
            "type": [
              "number",
              "null"
            ],
            "description": "Tenant-scoped wake-queue p95, or null when the source is unavailable or has no sample."
          },
          "wake_queue_sample_status": {
            "type": "string",
            "enum": [
              "available",
              "no_sample",
              "unavailable"
            ],
            "description": "Availability of wake_queue_p95_ms. unavailable means tenant-scoped telemetry is not emitted."
          },
          "requests_total": {
            "type": "integer",
            "format": "int64"
          },
          "throttled_total": {
            "type": "integer",
            "format": "int64",
            "description": "Per-app rate-limit count over the window."
          }
        },
        "x-since": "2026-08",
        "x-issue": "696"
      },
      "AppErrorsSummaryResponse": {
        "description": "Grouped error summary returned by `GET /v1/apps/{slug}/errors/summary`. One row per fingerprint over the\nrequested `[since, until]` window. Distinct from\n`AppSLOResponse` which is the closed-set SLO\nsummary — the errors summary uses a continuous window\nwith explicit RFC3339Nano stamps.\n\nEmpty result returns 200 with `items: []` and the\nwindow echo set. `window_clamped` is true when the\nrequested span was clamped to `AppErrorsWindowMaxHours`\n(168h). `next_cursor` is empty when the page is the\nlast one.\n",
        "type": "object",
        "required": [
          "generated_at",
          "app_id",
          "app_slug",
          "window_start",
          "window_end",
          "window_clamped",
          "items",
          "limit"
        ],
        "properties": {
          "generated_at": {
            "type": "string",
            "format": "date-time",
            "description": "RFC3339Nano UTC stamp at which the summary was assembled."
          },
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "app_slug": {
            "type": "string"
          },
          "window_start": {
            "type": "string",
            "format": "date-time",
            "description": "Echoed (clamped) window start, RFC3339Nano UTC."
          },
          "window_end": {
            "type": "string",
            "format": "date-time",
            "description": "Echoed (clamped) window end, RFC3339Nano UTC."
          },
          "window_clamped": {
            "type": "boolean",
            "description": "True when the requested span was clamped to AppErrorsWindowMaxHours (168h)."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppErrorSummaryItem"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Opaque base64 cursor for the next page. Empty when the current page is the last."
          },
          "limit": {
            "type": "integer",
            "description": "Echoed limit applied (post-clamp to AppErrorsSummaryMaxLimit=100)."
          }
        },
        "x-since": "2026-08",
        "x-issue": "ADR-096"
      },
      "AppErrorSummaryItem": {
        "description": "One row of the errors summary.",
        "type": "object",
        "required": [
          "fingerprint",
          "error_class",
          "route",
          "http_status",
          "count",
          "request_count",
          "first_seen_at",
          "last_seen_at",
          "sample_message"
        ],
        "properties": {
          "fingerprint": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "64-hex-char SHA-256 fingerprint identifying this error group; stable across requests with the same (route, status, error_class)."
          },
          "error_class": {
            "type": "string",
            "enum": [
              "db_timeout",
              "stripe_timeout",
              "null_pointer",
              "invalid_json",
              "wake_failed",
              "upstream_5xx",
              "unhandled",
              "client_error"
            ],
            "description": "Closed-vocabulary error class. 'unhandled' is collapsed under 'Other' in the UI; the DB stores the precise class."
          },
          "route": {
            "type": "string",
            "description": "Matched route template (e.g. `/users/{id}`), NEVER the expanded URL."
          },
          "http_status": {
            "type": "integer",
            "format": "int32",
            "minimum": 400,
            "maximum": 599
          },
          "count": {
            "type": "integer",
            "format": "int64",
            "description": "Issue count (deduped within AppErrorsDedupeWindowSeconds=3600)."
          },
          "request_count": {
            "type": "integer",
            "format": "int64",
            "description": "Total distinct request rows for this fingerprint."
          },
          "first_seen_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_seen_at": {
            "type": "string",
            "format": "date-time"
          },
          "sample_message": {
            "type": "string",
            "description": "PII-redacted sample message (already-redacted at write time; ≤AppErrorsSampleMessageCapBytes=512 bytes)."
          },
          "last_instance_id": {
            "type": "string",
            "description": "Most recent platform instance that produced this fingerprint."
          },
          "last_node_id": {
            "type": "string",
            "description": "Most recent compute node that produced this fingerprint."
          },
          "last_region": {
            "type": "string"
          },
          "last_commit_sha": {
            "type": "string"
          },
          "last_deployment_tag": {
            "type": "string"
          },
          "last_deployment_created_at": {
            "type": "string"
          },
          "last_image_digest": {
            "type": "string"
          }
        },
        "x-since": "2026-08",
        "x-issue": "ADR-096"
      },
      "AppErrorRequestsResponse": {
        "description": "Drill-down page returned by `GET /v1/apps/{slug}/errors/{fingerprint}`. The header fields (fingerprint,\nerror_class, route, http_status) are denormalised from the\nparent summary row so the dashboard renders the page header\nwithout a second round-trip. Does NOT include\n`headers_sample` or `redactions` — those are on the\n`/first` endpoint only.\n",
        "type": "object",
        "required": [
          "fingerprint",
          "error_class",
          "route",
          "http_status",
          "requests"
        ],
        "properties": {
          "fingerprint": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "error_class": {
            "type": "string"
          },
          "route": {
            "type": "string"
          },
          "http_status": {
            "type": "integer",
            "format": "int32"
          },
          "requests": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppErrorRequestItem"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "x-since": "2026-08",
        "x-issue": "ADR-096"
      },
      "AppErrorRequestItem": {
        "description": "One row of the drill-down page.",
        "type": "object",
        "required": [
          "request_id",
          "received_at",
          "route",
          "http_status",
          "error_class",
          "sample_message"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "description": "Public x-faas-request-id of the failed request; GET /v1/apps/{slug}/debug/requests/{request_id}/evidence opens its debugger evidence while the request is retained."
          },
          "received_at": {
            "type": "string",
            "format": "date-time"
          },
          "route": {
            "type": "string"
          },
          "http_status": {
            "type": "integer",
            "format": "int32"
          },
          "error_class": {
            "type": "string"
          },
          "sample_message": {
            "type": "string"
          },
          "deployment_id": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[a-f0-9]{32}$",
            "description": "Nullable — the FK is ON DELETE SET NULL so an evicted deployment leaves the drill-down row intact."
          },
          "instance_id": {
            "type": "string"
          },
          "node_id": {
            "type": "string"
          },
          "region": {
            "type": "string"
          },
          "commit_sha": {
            "type": "string"
          },
          "deployment_tag": {
            "type": "string"
          },
          "deployment_created_at": {
            "type": "string"
          },
          "image_digest": {
            "type": "string"
          }
        },
        "x-since": "2026-08",
        "x-issue": "ADR-096"
      },
      "AppErrorSampleResponse": {
        "description": "Single sample row returned by `GET /v1/apps/{slug}/errors/{fingerprint}/first`. Embeds `AppErrorRequestItem` plus the\nredacted `headers_sample` (jsonb-decoded to map) and the\n`redactions_applied` pattern names so the dashboard can\nrender a \"we redacted X / Y / Z\" badge.\n",
        "type": "object",
        "required": [
          "request_id",
          "received_at",
          "route",
          "http_status",
          "error_class",
          "sample_message",
          "headers_sample",
          "redactions_applied"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "received_at": {
            "type": "string",
            "format": "date-time"
          },
          "route": {
            "type": "string"
          },
          "http_status": {
            "type": "integer",
            "format": "int32"
          },
          "error_class": {
            "type": "string"
          },
          "sample_message": {
            "type": "string"
          },
          "deployment_id": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[a-f0-9]{32}$"
          },
          "instance_id": {
            "type": "string"
          },
          "node_id": {
            "type": "string"
          },
          "region": {
            "type": "string"
          },
          "commit_sha": {
            "type": "string"
          },
          "deployment_tag": {
            "type": "string"
          },
          "deployment_created_at": {
            "type": "string"
          },
          "image_digest": {
            "type": "string"
          },
          "headers_sample": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "PII-redacted request headers (≤8 keys)."
          },
          "redactions_applied": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Names of the redactor patterns that fired (e.g. `email`, `card`, `bearer`)."
          }
        },
        "x-since": "2026-08",
        "x-issue": "ADR-096"
      },
      "AccountSLOResponse": {
        "description": "Flat account-wide SLO rollup returned by\n`GET /v1/account/slo?window=`.\nMirrors `AppSLOResponse` field-for-field except for\n`app_id` / `app_slug` (the rollup is account-wide). The\nfields are scalar sums/rates across the account; per-app\ndrill-down is served by the existing `/v1/apps/metrics`\nendpoint.\n\n`source` follows the same `\"degraded: <reason>\"` contract\nas the per-app endpoint.\n",
        "type": "object",
        "required": [
          "window",
          "source",
          "as_of",
          "request_duration",
          "error_rate_pct",
          "cold_boot_rate_pct",
          "instance_hours",
          "gb_hours",
          "wake_queue_p95_ms",
          "wake_queue_sample_status",
          "requests_total",
          "throttled_total"
        ],
        "properties": {
          "window": {
            "type": "string",
            "enum": [
              "1h",
              "24h",
              "7d"
            ]
          },
          "source": {
            "type": "string",
            "description": "\"prometheus\" on success; \"degraded: <reason>\" otherwise. Account-wide shape: when Postgres fails only instance_hours/gb_hours are zeroed."
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "request_duration": {
            "$ref": "#/components/schemas/SLODuration"
          },
          "error_rate_pct": {
            "type": "number"
          },
          "cold_boot_rate_pct": {
            "type": "number"
          },
          "instance_hours": {
            "type": "number",
            "description": "Sum of instance-minutes / 60 across all apps for the account."
          },
          "gb_hours": {
            "type": "number",
            "description": "Sum of mb_seconds / 3600 / 1024 across all apps for the account."
          },
          "wake_queue_p95_ms": {
            "type": [
              "number",
              "null"
            ],
            "description": "Account-scoped wake-queue p95, or null when the source is unavailable or has no sample."
          },
          "wake_queue_sample_status": {
            "type": "string",
            "enum": [
              "available",
              "no_sample",
              "unavailable"
            ],
            "description": "Availability of the account wake-queue p95. unavailable means account-scoped telemetry is not emitted."
          },
          "requests_total": {
            "type": "integer",
            "format": "int64"
          },
          "throttled_total": {
            "type": "integer",
            "format": "int64"
          }
        },
        "x-since": "2026-08",
        "x-issue": "696"
      },
      "DailyUsagePoint": {
        "description": "One day in the account's trailing 30 UTC calendar day usage trend.",
        "type": "object",
        "required": [
          "date",
          "gb_hours"
        ],
        "properties": {
          "date": {
            "type": "string",
            "format": "date",
            "description": "UTC calendar day."
          },
          "gb_hours": {
            "type": "number",
            "description": "Account-wide GB-hours consumed on this day. Informational; uses the usage summary conversion."
          },
          "top_app_slug": {
            "type": "string",
            "description": "Slug of the app contributing the most GB-hours on this day."
          },
          "top_app_gb_hours": {
            "type": "number",
            "description": "GB-hours consumed by top_app_slug on this day."
          }
        },
        "x-since": "2026-09",
        "x-issue": "308"
      },
      "ExecutionUsageSummaryResponse": {
        "description": "Account-level usage roll-up for terminal disposable executions in one UTC calendar month. Payload cleanup does not remove these ledger-backed facts.",
        "type": "object",
        "required": [
          "runs",
          "wall_time_ms",
          "cpu_time_ms",
          "peak_memory_mb",
          "output_bytes",
          "succeeded",
          "failed",
          "timed_out",
          "out_of_memory",
          "cancelled"
        ],
        "properties": {
          "runs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "wall_time_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Sum of host-measured wall time across terminal runs."
          },
          "cpu_time_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Sum of host-measured CPU time across terminal runs."
          },
          "peak_memory_mb": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Maximum host-measured peak memory across terminal runs."
          },
          "output_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Sum of result, stdout, and stderr bytes across terminal runs."
          },
          "succeeded": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "failed": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "timed_out": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "out_of_memory": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cancelled": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        },
        "x-since": "2026-09",
        "x-issue": "execution-usage-ledger"
      },
      "UsageSummaryResponse": {
        "description": "Account-level monthly roll-up: included GB-hours, used, overage math, remaining balance, informational usage dimensions, and a trailing 30-day daily trend. The GB-hours fields drive the overage math; the other dimensions are informational.",
        "type": "object",
        "required": [
          "month",
          "used_gb_hours",
          "included_gb_hours",
          "overage_gb_hours",
          "overage_cents"
        ],
        "properties": {
          "month": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}$",
            "example": "2026-07"
          },
          "used_gb_hours": {
            "type": "number",
            "example": 1.234
          },
          "included_gb_hours": {
            "type": "integer",
            "format": "int64"
          },
          "overage_gb_hours": {
            "type": "number"
          },
          "overage_cents": {
            "type": "integer",
            "format": "int64",
            "description": "Integer cents. Includes compute at $0.05/GB-h and configured live egress overage; shadow egress is excluded."
          },
          "quiet_paused_gb_hours": {
            "type": "number",
            "description": "GB-hours this month that instances spent quiet-paused between requests and were not billed for, in the same plan RAM + 8 MB unit as used_gb_hours and not included in it. Absent while zero.",
            "x-since": "2026-10"
          },
          "used_cpu_hours": {
            "type": "number",
            "description": "Per-month CPU-hours (informational; not billed).",
            "x-since": "2026-07",
            "x-issue": "279"
          },
          "used_egress_gb": {
            "type": "number",
            "description": "Per-month canonical interface egress GB. Σ net_tx_bytes across all apps; tx_bytes is a diagnostic subset and is not added. Informational while egress_billing_mode is absent.",
            "x-since": "2026-08",
            "x-issue": "415"
          },
          "egress_billing_mode": {
            "type": "string",
            "enum": [
              "shadow",
              "live"
            ],
            "description": "Absent when egress billing is off. Shadow quantities are audited locally but are not sent to Polar."
          },
          "egress_billing_from": {
            "type": "string",
            "format": "date-time",
            "description": "Explicit non-retroactive UTC-hour activation boundary."
          },
          "included_egress_gb": {
            "type": "number",
            "description": "UTC-calendar-month included egress in provider billing units (GiB for Polar). Present when egress billing is configured."
          },
          "egress_overage_gb": {
            "type": "number",
            "description": "Current monthly egress above the included amount. Shadow values are not charged."
          },
          "egress_millicents_per_gb": {
            "type": "integer",
            "format": "int64",
            "description": "Configured price per egress billing unit in millicents."
          },
          "used_ingress_gb": {
            "type": "number",
            "description": "Per-month ingress GB (informational; not billed). Σ net_rx_bytes across all apps, converted to GB. Mirror of `used_egress_gb` for the inbound direction.",
            "x-since": "2026-08",
            "x-issue": "436"
          },
          "cold_boots": {
            "type": "integer",
            "format": "int64",
            "description": "Per-month sum of WAKE_RESTORE→WAKE_COLD_BOOT transitions across every app on the account (informational; not billed).",
            "x-since": "2026-08",
            "x-issue": "436"
          },
          "executions": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ExecutionUsageSummaryResponse"
              }
            ],
            "description": "Terminal disposable execution usage for this UTC calendar month. Omitted when the backing store does not expose the execution usage read seam.",
            "x-since": "2026-09",
            "x-issue": "execution-usage-ledger"
          },
          "daily": {
            "type": "array",
            "description": "Trailing 30 UTC calendar days, oldest first, grouped across the account. Empty when no daily rollup rows exist.",
            "items": {
              "$ref": "#/components/schemas/DailyUsagePoint"
            },
            "x-since": "2026-09",
            "x-issue": "308"
          }
        }
      },
      "AccountUsageResponse": {
        "description": "Account-level usage projection across compute and the optional object-storage and managed-PostgreSQL services.",
        "type": "object",
        "required": [
          "month",
          "compute"
        ],
        "properties": {
          "month": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}$"
          },
          "compute": {
            "$ref": "#/components/schemas/UsageSummaryResponse"
          },
          "object_storage": {
            "type": [
              "object",
              "null"
            ],
            "description": "Object-storage usage and safety policy when object storage is configured; omitted otherwise.",
            "allOf": [
              {
                "$ref": "#/components/schemas/ObjectStorageUsageResponse"
              }
            ]
          },
          "managed_postgres": {
            "type": [
              "object",
              "null"
            ],
            "description": "Managed-PostgreSQL usage and guardrail state when the account plan includes it; omitted otherwise.",
            "allOf": [
              {
                "$ref": "#/components/schemas/ManagedPostgresUsageResponse"
              }
            ]
          }
        }
      },
      "AsyncInvokeResponse": {
        "description": "202-side of async-invoke. The id is the invocations row id; status_url is the well-known read endpoint.",
        "type": "object",
        "required": [
          "id",
          "status_url"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "status_url": {
            "type": "string",
            "example": "/v1/invocations/0123456789abcdef0123456789abcdef"
          }
        }
      },
      "DurableEntityInspectResponse": {
        "description": "Metadata-only observation of entity state, recovery work and retained head-delivery history.",
        "type": "object",
        "required": [
          "entity",
          "version",
          "recovery_revision",
          "state_committed",
          "alarm",
          "outbox"
        ],
        "properties": {
          "recovery_revision": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Opaque comparison value that changes on any manifest write; not ownership authority."
          },
          "entity": {
            "$ref": "#/components/schemas/DurableEntityScope"
          },
          "version": {
            "type": "integer",
            "minimum": 0,
            "description": "Business state uint64 version; zero means no transition has committed."
          },
          "state_committed": {
            "type": "boolean",
            "description": "Whether a business transition has committed; does not imply delivery."
          },
          "alarm": {
            "$ref": "#/components/schemas/DurableEntityAlarmInspection"
          },
          "outbox": {
            "$ref": "#/components/schemas/DurableEntityOutboxInspection"
          }
        }
      },
      "DurableEntityScope": {
        "description": "Immutable account, application, environment and optional customer identity of a logical entity.",
        "type": "object",
        "required": [
          "account_id",
          "app_id",
          "environment_id",
          "namespace",
          "key"
        ],
        "properties": {
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "environment_id": {
            "type": "string",
            "format": "uuid"
          },
          "tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "namespace": {
            "type": "string"
          },
          "key": {
            "type": "string"
          }
        }
      },
      "DurableEntityAlarmInspection": {
        "description": "Observed alarm timing and bounded recovery attempt metadata.",
        "type": "object",
        "required": [
          "attempts",
          "exhausted"
        ],
        "properties": {
          "alarm_at": {
            "type": "string",
            "format": "date-time"
          },
          "attempts": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "exhausted": {
            "type": "boolean"
          }
        }
      },
      "DurableEntityOutboxInspection": {
        "description": "Pending outgoing work and retry metadata for the current queue head.",
        "type": "object",
        "required": [
          "pending",
          "attempts",
          "exhausted"
        ],
        "properties": {
          "pending": {
            "type": "integer",
            "minimum": 0,
            "maximum": 128
          },
          "head_id": {
            "type": "string",
            "format": "uuid"
          },
          "attempts": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "exhausted": {
            "type": "boolean"
          },
          "head_delivery": {
            "$ref": "#/components/schemas/DurableEntityHeadDelivery"
          }
        }
      },
      "DurableEntityHeadDelivery": {
        "description": "Separate observation for the pending head only; absent when no head is pending. Unknown includes unavailable/pruned history, not proof of non-acceptance.",
        "type": "object",
        "required": [
          "status"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "unknown",
              "pending",
              "in_flight",
              "succeeded",
              "failed",
              "dead"
            ]
          }
        }
      },
      "DurableEntityBackup": {
        "description": "Private application-state export captured in a retained hourly backup slot.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "captured_at",
          "export"
        ],
        "properties": {
          "captured_at": {
            "type": "string",
            "format": "date-time",
            "description": "UTC hourly slot start."
          },
          "export": {
            "$ref": "#/components/schemas/DurableEntityStateExport"
          }
        }
      },
      "DurableEntityBackupInfo": {
        "description": "Backup identifier, capture slot and business version without application data.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "captured_at",
          "version"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "captured_at": {
            "type": "string",
            "format": "date-time"
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        }
      },
      "DurableEntityBackupPage": {
        "description": "Bounded page of retained backup metadata with an optional continuation cursor.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DurableEntityBackupInfo"
            }
          },
          "next_cursor": {
            "type": "string"
          }
        }
      },
      "DurableEntityRestorePreview": {
        "description": "Read-only comparison of candidate and current state; compatibility remains unverified.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "current_version",
          "source_version",
          "expected_version_matches",
          "schema_relation",
          "compatibility",
          "alarm_pending",
          "outbox_pending",
          "alarm_exhausted",
          "outbox_exhausted"
        ],
        "properties": {
          "current_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "source_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "expected_version_matches": {
            "type": "boolean"
          },
          "current_schema_version": {
            "type": "integer",
            "minimum": 1
          },
          "source_schema_version": {
            "type": "integer",
            "minimum": 1
          },
          "schema_relation": {
            "type": "string",
            "enum": [
              "same",
              "older",
              "newer",
              "unknown"
            ]
          },
          "compatibility": {
            "type": "string",
            "enum": [
              "unverified"
            ]
          },
          "alarm_pending": {
            "type": "boolean"
          },
          "outbox_pending": {
            "type": "integer",
            "minimum": 0
          },
          "alarm_exhausted": {
            "type": "boolean"
          },
          "outbox_exhausted": {
            "type": "boolean"
          }
        }
      },
      "DurableEntityStateExport": {
        "description": "Checksummed committed application data with immutable entity identity; excludes recovery and delivery history.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "format",
          "entity",
          "version",
          "data",
          "checksum"
        ],
        "properties": {
          "format": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "entity": {
            "$ref": "#/components/schemas/DurableEntityScope"
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "data": {
            "description": "Opaque application JSON, including any application schema envelope."
          },
          "checksum": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          }
        }
      },
      "DurableEntityRestoreRequest": {
        "description": "Candidate export and comparison identity used for restore preview, validation or fenced publication.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "namespace",
          "key",
          "request_id",
          "expected_version",
          "export"
        ],
        "properties": {
          "namespace": {
            "type": "string",
            "minLength": 1
          },
          "key": {
            "type": "string",
            "minLength": 1
          },
          "environment": {
            "type": "string"
          },
          "platform_tenant_id": {
            "type": "string"
          },
          "request_id": {
            "type": "string",
            "minLength": 1
          },
          "validation_bundle_sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Registered validator bundle digest. Required for isolated restores."
          },
          "validation_deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Explicit deployment pin. Required for restores when application validation is enabled."
          },
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "export": {
            "$ref": "#/components/schemas/DurableEntityStateExport"
          }
        }
      },
      "DurableEntityRestoreValidationResponse": {
        "description": "Application validator verdict and deployment pin; does not reserve or commit entity state.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "valid",
          "deployment_id",
          "expected_version",
          "source_version"
        ],
        "properties": {
          "bundle_sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "isolation": {
            "type": "string",
            "enum": [
              "networkless"
            ]
          },
          "valid": {
            "type": "boolean"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "source_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        }
      },
      "DurableEntityRestoreResponse": {
        "description": "Acknowledged business version and whether an existing restore receipt was replayed.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "replayed"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "DurableEntityRetryRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "namespace",
          "key",
          "target",
          "expected_version",
          "expected_recovery_revision"
        ],
        "description": "For target alarm provide alarm_at and omit head_id; for outbox provide\nhead_id and omit alarm_at. Copy comparison fields from fresh inspection.\n",
        "properties": {
          "namespace": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "environment": {
            "type": "string",
            "minLength": 1
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "target": {
            "type": "string",
            "enum": [
              "alarm",
              "outbox"
            ]
          },
          "expected_version": {
            "type": "integer",
            "minimum": 1,
            "description": "Exact business uint64 version from inspection."
          },
          "expected_recovery_revision": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Opaque revision from the same inspection, invalidated by every manifest write."
          },
          "head_id": {
            "type": "string",
            "format": "uuid"
          },
          "alarm_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DurableEntityRetryResponse": {
        "description": "Acknowledged recovery metadata reset for one exhausted alarm or outgoing message.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "target",
          "rearmed"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "minimum": 1
          },
          "target": {
            "type": "string",
            "enum": [
              "alarm",
              "outbox"
            ]
          },
          "rearmed": {
            "type": "boolean",
            "description": "Retry metadata was reset; no execution or receiver completion is implied."
          }
        }
      },
      "DurableEntityInvokeRequest": {
        "description": "Preview entity invocation; request_id and payload identify durable retries.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "namespace",
          "key",
          "request_id",
          "payload"
        ],
        "properties": {
          "namespace": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "request_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "payload": {
            "description": "JSON payload; replay fingerprints the exact decoded JSON bytes."
          },
          "environment": {
            "type": "string",
            "description": "Registered project environment; defaults to production. Standalone apps use their default scope."
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid",
            "description": "Optional active customer owned by the authenticated account."
          }
        }
      },
      "DurableEntityInvokeResponse": {
        "description": "The acknowledged entity result. Replay returns the original value and version.",
        "type": "object",
        "required": [
          "value",
          "version",
          "replayed"
        ],
        "properties": {
          "value": {
            "description": "JSON result from the committed transition."
          },
          "version": {
            "type": "integer",
            "minimum": 1,
            "description": "Committed transition version, or original version on replay."
          },
          "replayed": {
            "type": "boolean",
            "description": "True when an existing receipt supplied the result."
          }
        }
      },
      "InvokeResponse": {
        "description": "Sync-invoke result. Status is the drain-driven terminal state (`completed` | `failed` | `cancelled`). Result is the handler response. Error contains the terminal delivery error when status is failed.",
        "type": "object",
        "required": [
          "id",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "dispatching",
              "completed",
              "failed",
              "cancelled"
            ]
          },
          "result": {
            "type": "object",
            "additionalProperties": true
          },
          "error": {
            "type": "string"
          }
        }
      },
      "QueueSendResponse": {
        "description": "201 — body of a freshly-enqueued queue row.",
        "type": "object",
        "required": [
          "id"
        ],
        "properties": {
          "environment": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{0,31}[a-z0-9])?$",
            "description": "Environment recorded for the newly accepted queue message."
          },
          "queue_binding_id": {
            "type": "string",
            "description": "Binding identity captured for this accepted message; absent for unbound legacy sends."
          },
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "trace_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "description": "Canonical platform trace id when the request carried a valid trace context."
          }
        }
      },
      "QueueReceiveResponse": {
        "description": "200 — a completed queue invocation observed by the long-poll feed. 204 (no body) on timeout.",
        "type": "object",
        "required": [
          "id",
          "payload"
        ],
        "properties": {
          "environment": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{0,31}[a-z0-9])?$",
            "description": "Original environment of the completed invocation in this queue feed."
          },
          "queue_binding_id": {
            "type": "string",
            "description": "Retained binding identity of the completed queue invocation; absent for legacy work."
          },
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "payload": {
            "type": "object",
            "additionalProperties": true
          },
          "result": {
            "type": "object",
            "additionalProperties": true
          },
          "trace_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "traceparent": {
            "type": "string",
            "description": "W3C traceparent propagated from the producer."
          }
        }
      },
      "QueueLeaseRequest": {
        "description": "Pull lease. Zero values lease one message for the default visibility timeout (30s) and return at once.",
        "type": "object",
        "properties": {
          "max_messages": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "A lease also stops once its payloads and headers would pass 8 MiB; it always returns at least one ready message."
          },
          "visibility_timeout_seconds": {
            "type": "integer",
            "minimum": 0,
            "description": "At most the plan's async invocation deadline."
          },
          "wait_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 20,
            "description": "When no message is ready, hold the call until one arrives or this many seconds pass, then return an empty list."
          }
        }
      },
      "QueueLeaseMessage": {
        "description": "One leased message. Its receipt acts only while this lease is current.",
        "type": "object",
        "required": [
          "id",
          "receipt",
          "payload",
          "attempt",
          "enqueued_at",
          "lease_expires_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "receipt": {
            "type": "string",
            "description": "Opaque; acts only while this lease is current."
          },
          "payload": {
            "type": "object",
            "additionalProperties": true
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "attempt": {
            "type": "integer",
            "minimum": 1
          },
          "enqueued_at": {
            "type": "string",
            "format": "date-time"
          },
          "lease_expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "QueueLeaseResponse": {
        "description": "Leased messages; empty when none were ready before the wait ended.",
        "type": "object",
        "required": [
          "messages"
        ],
        "properties": {
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QueueLeaseMessage"
            }
          }
        }
      },
      "QueueLeaseReceiptsRequest": {
        "description": "Receipts for ack, nack or extend. delay_seconds and error apply to nack; visibility_timeout_seconds to extend.",
        "type": "object",
        "required": [
          "receipts"
        ],
        "properties": {
          "receipts": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "type": "string"
            }
          },
          "delay_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400
          },
          "error": {
            "type": "string",
            "maxLength": 1024
          },
          "visibility_timeout_seconds": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "QueueLeaseReceiptFailure": {
        "description": "A receipt that was not applied. lease_expired means it no longer owns its message.",
        "type": "object",
        "required": [
          "receipt",
          "reason"
        ],
        "properties": {
          "receipt": {
            "type": "string"
          },
          "reason": {
            "type": "string",
            "enum": [
              "lease_expired",
              "invalid_receipt"
            ]
          }
        }
      },
      "QueueLeaseReceiptsResponse": {
        "description": "Per-receipt outcome of an ack, nack or extend call.",
        "type": "object",
        "required": [
          "succeeded",
          "failed"
        ],
        "properties": {
          "succeeded": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "failed": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QueueLeaseReceiptFailure"
            }
          }
        }
      },
      "AccountTraceLookupResponse": {
        "type": "object",
        "description": "Tenant-scoped distributed-trace correlation envelope.",
        "required": [
          "trace_id",
          "generated_at",
          "limit",
          "matches",
          "invocations",
          "logs",
          "logs_truncated",
          "spans",
          "spans_truncated"
        ],
        "properties": {
          "trace_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          },
          "matches": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccountTraceMatch"
            }
          },
          "invocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccountTraceInvocation"
            }
          },
          "logs": {
            "type": "array",
            "maxItems": 200,
            "items": {
              "$ref": "#/components/schemas/LogQueryEvent"
            }
          },
          "logs_truncated": {
            "type": "boolean"
          },
          "spans": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/DebugTelemetrySpan"
            }
          },
          "spans_truncated": {
            "type": "boolean"
          },
          "partial": {
            "type": "boolean"
          },
          "errors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccountTraceLookupError"
            }
          }
        }
      },
      "LogEventsResponse": {
        "description": "One newest-first page of an app's log ledger.",
        "type": "object",
        "required": [
          "since",
          "until",
          "events"
        ],
        "properties": {
          "since": {
            "type": "string",
            "format": "date-time",
            "description": "Effective window start after clamping to retention."
          },
          "until": {
            "type": "string",
            "format": "date-time"
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LogQueryEvent"
            }
          },
          "next_cursor": {
            "type": "string",
            "description": "Present when more events match; pass it back as cursor."
          }
        }
      },
      "LogFacetCount": {
        "description": "One facet value and how many events carry it.",
        "type": "object",
        "required": [
          "value",
          "count"
        ],
        "properties": {
          "value": {
            "type": "string"
          },
          "count": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "LogEventFacetsResponse": {
        "description": "Log event counts by facet over one window.",
        "type": "object",
        "required": [
          "since",
          "until",
          "total",
          "sources",
          "levels",
          "status_classes",
          "routes",
          "routes_truncated"
        ],
        "properties": {
          "since": {
            "type": "string",
            "format": "date-time",
            "description": "Facet window start after clamping to retention."
          },
          "until": {
            "type": "string",
            "format": "date-time"
          },
          "total": {
            "type": "integer",
            "format": "int64"
          },
          "sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LogFacetCount"
            }
          },
          "levels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LogFacetCount"
            }
          },
          "status_classes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LogFacetCount"
            }
          },
          "routes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LogFacetCount"
            }
          },
          "routes_truncated": {
            "type": "boolean",
            "description": "More routes matched than the ten returned."
          }
        }
      },
      "DashboardWidget": {
        "type": "object",
        "description": "One typed reference to a signal. app_metric and custom_metric use metric, log_count uses query, slo uses slo_id.",
        "required": [
          "title",
          "kind",
          "app"
        ],
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "kind": {
            "type": "string",
            "enum": [
              "app_metric",
              "log_count",
              "custom_metric",
              "slo"
            ]
          },
          "app": {
            "type": "string",
            "description": "Slug of an app the account owns."
          },
          "metric": {
            "type": "string",
            "description": "app_metric: request_count, error_rate_pct, latency_p50_ms, latency_p95_ms, latency_p99_ms or cold_start_pct. custom_metric: the pushed metric name."
          },
          "query": {
            "type": "string",
            "description": "log_count: log search filters as a URL query string (source, level, status, route, deployment_id, request_id, trace_id, q)."
          },
          "slo_id": {
            "type": "string",
            "format": "uuid",
            "description": "slo: the SLO id."
          },
          "window": {
            "type": "string",
            "enum": [
              "5m",
              "1h",
              "6h",
              "24h",
              "7d"
            ],
            "description": "Defaults to 1h; ignored by slo widgets."
          }
        }
      },
      "Dashboard": {
        "type": "object",
        "description": "An account's saved dashboard.",
        "required": [
          "id",
          "name",
          "widgets",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "widgets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DashboardWidget"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DashboardRequest": {
        "type": "object",
        "description": "Body of a dashboard create or replace.",
        "required": [
          "name",
          "widgets"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          },
          "widgets": {
            "type": "array",
            "maxItems": 24,
            "items": {
              "$ref": "#/components/schemas/DashboardWidget"
            }
          }
        }
      },
      "Incident": {
        "type": "object",
        "description": "An alert rule's firing period, a route monitor incident, or a platform incident.",
        "required": [
          "id",
          "source",
          "status",
          "title",
          "opened_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "alert",
              "route_monitor",
              "platform"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "resolved"
            ]
          },
          "title": {
            "type": "string"
          },
          "app": {
            "type": "string",
            "description": "The app's slug; absent for account-wide alerts and platform incidents."
          },
          "opened_at": {
            "type": "string",
            "format": "date-time"
          },
          "resolved_at": {
            "type": "string",
            "format": "date-time"
          },
          "rule_id": {
            "type": "string",
            "format": "uuid",
            "description": "An alert incident's rule."
          },
          "metric": {
            "type": "string",
            "description": "An alert incident's rule metric."
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "The deployment a route monitor incident watched."
          },
          "impact": {
            "type": "string",
            "description": "A platform incident's status page impact."
          },
          "acknowledged_at": {
            "type": "string",
            "format": "date-time",
            "description": "When someone in the account acknowledged the incident."
          },
          "acknowledged_by": {
            "type": "string",
            "description": "Who acknowledged it, an email or api_key:<id>."
          }
        }
      },
      "IncidentNote": {
        "type": "object",
        "description": "An account's acknowledgement (no body) or note on an incident.",
        "required": [
          "id",
          "kind",
          "author",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "acknowledged",
              "note"
            ]
          },
          "body": {
            "type": "string",
            "maxLength": 2000
          },
          "author": {
            "type": "string",
            "description": "An email or api_key:<id>."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "IncidentNoteRequest": {
        "type": "object",
        "description": "A note to append to an incident.",
        "required": [
          "body"
        ],
        "properties": {
          "body": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000
          }
        }
      },
      "IncidentsResponse": {
        "type": "object",
        "description": "The account's open incidents and those resolved since `since`, open first.",
        "required": [
          "since",
          "incidents",
          "truncated",
          "unavailable_sources"
        ],
        "properties": {
          "since": {
            "type": "string",
            "format": "date-time"
          },
          "incidents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Incident"
            }
          },
          "truncated": {
            "type": "boolean"
          },
          "unavailable_sources": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "IncidentFire": {
        "type": "object",
        "description": "One notification an alert incident sent.",
        "required": [
          "at",
          "observed",
          "status"
        ],
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "observed": {
            "type": "number",
            "format": "double"
          },
          "status": {
            "type": "string"
          }
        }
      },
      "IncidentUpdate": {
        "type": "object",
        "description": "One status page update of a platform incident.",
        "required": [
          "at",
          "state",
          "message"
        ],
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "state": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "IncidentDetail": {
        "type": "object",
        "description": "An incident with the evidence the platform has for it and the account's notes.",
        "required": [
          "incident",
          "notes",
          "unavailable_sources"
        ],
        "properties": {
          "incident": {
            "$ref": "#/components/schemas/Incident"
          },
          "fires": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IncidentFire"
            }
          },
          "log_context": {
            "type": "object",
            "additionalProperties": true,
            "description": "What the logs showed at the newest fire, when log search was on."
          },
          "updates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IncidentUpdate"
            }
          },
          "changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppChangeEvent"
            }
          },
          "changes_truncated": {
            "type": "boolean"
          },
          "notes": {
            "type": "array",
            "description": "The account's acknowledgement and notes, oldest first.",
            "items": {
              "$ref": "#/components/schemas/IncidentNote"
            }
          },
          "unavailable_sources": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "DashboardPoint": {
        "type": "object",
        "description": "One time-series sample.",
        "required": [
          "at",
          "value"
        ],
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "value": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "DashboardWidgetValue": {
        "description": "A widget with its resolved value, or the reason it has none.",
        "allOf": [
          {
            "$ref": "#/components/schemas/DashboardWidget"
          },
          {
            "type": "object",
            "properties": {
              "value": {
                "type": "number",
                "format": "double",
                "description": "The headline number, in unit."
              },
              "unit": {
                "type": "string",
                "description": "ms, %, requests, events, gauge, per second, or % budget left."
              },
              "detail": {
                "type": "string",
                "description": "Context: log counts by level, SLO attainment."
              },
              "series": {
                "type": "array",
                "description": "The custom metric's points over the window.",
                "items": {
                  "$ref": "#/components/schemas/DashboardPoint"
                }
              },
              "error": {
                "type": "string",
                "description": "Why the widget has no value: an unavailable app or source, no data, or a plan gate."
              }
            }
          }
        ]
      },
      "DashboardData": {
        "type": "object",
        "description": "A dashboard with every widget resolved.",
        "required": [
          "id",
          "name",
          "as_of",
          "widgets"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "widgets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DashboardWidgetValue"
            }
          }
        }
      },
      "DashboardsResponse": {
        "type": "object",
        "description": "The account's dashboards by name.",
        "required": [
          "dashboards"
        ],
        "properties": {
          "dashboards": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Dashboard"
            }
          }
        }
      },
      "LogSavedSearch": {
        "type": "object",
        "description": "One app's named log search filters.",
        "required": [
          "name",
          "query",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "Unique within the app."
          },
          "query": {
            "type": "string",
            "description": "Canonical URL query string of filters, e.g. level=error&q=timeout."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "LogSavedSearchRequest": {
        "type": "object",
        "description": "Body of a saved log search create or replace.",
        "required": [
          "query"
        ],
        "properties": {
          "query": {
            "type": "string",
            "maxLength": 2048,
            "description": "URL query string of filters: source, level, status, route, deployment_id, request_id, trace_id, q."
          }
        }
      },
      "LogSavedSearchesResponse": {
        "type": "object",
        "description": "An app's saved log searches by name.",
        "required": [
          "searches"
        ],
        "properties": {
          "searches": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LogSavedSearch"
            }
          }
        }
      },
      "LogQueryEvent": {
        "type": "object",
        "description": "Safe source-neutral log query event; trace lookup returns the HTTP access-log projection.",
        "required": [
          "id",
          "timestamp",
          "source",
          "message"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app": {
            "type": "string"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          },
          "source": {
            "type": "string",
            "enum": [
              "runtime",
              "http"
            ]
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "instance_id": {
            "type": "string"
          },
          "request_id": {
            "type": "string"
          },
          "trace_id": {
            "type": "string"
          },
          "route": {
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "status": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599
          },
          "level": {
            "type": "string",
            "enum": [
              "trace",
              "debug",
              "info",
              "warn",
              "error",
              "fatal"
            ]
          },
          "stream": {
            "type": "string",
            "enum": [
              "stdout",
              "stderr",
              "system",
              "access"
            ]
          },
          "message": {
            "type": "string",
            "minLength": 1,
            "maxLength": 16384
          },
          "latency_ms": {
            "type": "integer",
            "minimum": 0
          },
          "count": {
            "type": "integer",
            "minimum": 1
          },
          "cold_boot": {
            "type": "boolean"
          }
        }
      },
      "AccountTraceMatch": {
        "type": "object",
        "description": "One retained request-telemetry match for the trace.",
        "required": [
          "app",
          "request"
        ],
        "properties": {
          "app": {
            "type": "string"
          },
          "request": {
            "$ref": "#/components/schemas/DebugTelemetryRequestItem"
          },
          "wake": {
            "$ref": "#/components/schemas/AccountTraceWake"
          }
        }
      },
      "AccountTraceWake": {
        "type": "object",
        "description": "How a matched request's app was woken, when its wake history is still retained. Omitted for warm requests.",
        "required": [
          "wake_id"
        ],
        "properties": {
          "wake_id": {
            "type": "string"
          },
          "method": {
            "type": "string",
            "description": "How the instance started, for example restore or cold_boot. A planned restore that fell back to a cold boot reads cold_boot."
          },
          "ready_in_ms": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "description": "Milliseconds from boot start to ready; omitted until the wake completed."
          },
          "planned_method": {
            "type": "string",
            "description": "What the scheduler planned for this wake when it differs from method, such as restore for a restore that fell back to a cold boot."
          },
          "restore_fallback_reason": {
            "type": "string",
            "enum": [
              "after_restore_failed"
            ],
            "description": "Closed reason for a restore that fell back to a cold boot, when one is reported."
          },
          "thawed": {
            "type": "boolean",
            "description": "True when the request resumed this wake's frozen instance instead of waiting for its boot. A thaw keeps the instance's original wake ID; method and ready_in_ms, which describe the original boot, are then omitted."
          },
          "thaw_ms": {
            "type": "integer",
            "format": "int32",
            "minimum": 0,
            "description": "Milliseconds the thaw took from the wake request to the answer, when thawed."
          }
        }
      },
      "AccountTraceInvocation": {
        "type": "object",
        "description": "Safe durable invocation lifecycle projection linked to the trace.",
        "required": [
          "app",
          "id",
          "source",
          "state",
          "attempts",
          "created_at"
        ],
        "properties": {
          "app": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "source": {
            "type": "string"
          },
          "queue_name": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "attempts": {
            "type": "integer",
            "minimum": 0
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "started_at": {
            "type": "string",
            "format": "date-time",
            "description": "Most recent claim/delivery time; updated on retry and omitted before the first claim."
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          },
          "traceparent": {
            "type": "string"
          }
        }
      },
      "AccountTraceLookupError": {
        "type": "object",
        "description": "Non-fatal enrichment error for one app in the lookup.",
        "required": [
          "app",
          "detail"
        ],
        "properties": {
          "app": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          }
        }
      },
      "QueueStateResponse": {
        "description": "200 — queue depth / in-flight / oldest-pending stats. Read-only.",
        "type": "object",
        "required": [
          "app_slug",
          "plan",
          "plan_cap",
          "depth",
          "in_flight",
          "generated_at"
        ],
        "properties": {
          "app_slug": {
            "type": "string"
          },
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "hobby",
              "pro",
              "scale"
            ]
          },
          "plan_cap": {
            "type": "integer",
            "description": "MaxQueueDepth for the plan."
          },
          "depth": {
            "type": "integer",
            "description": "Pending + dispatching row count."
          },
          "in_flight": {
            "type": "integer",
            "description": "Rows with a live dispatch lease (state=dispatching, lease_expires_at > now or NULL)."
          },
          "oldest_pending_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Oldest pending row's created_at; null when the queue is empty."
          },
          "oldest_pending_age_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Convenience field — seconds since oldest_pending_at; null when the queue is empty."
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "backlog_by_source": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "format": "int64"
            },
            "description": "Every pending or in-delivery invocation of the app per source (async_invoke, inbound_webhook, queue, ...), so async work waiting for the scheduler is visible beside the queue's depth. Omitted when nothing waits."
          }
        }
      },
      "QueuePeekMessage": {
        "description": "One pending row. No lease was acquired and `attempts` was not incremented.",
        "type": "object",
        "required": [
          "id",
          "created_at",
          "attempts",
          "payload"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "attempts": {
            "type": "integer"
          },
          "payload": {
            "type": "string",
            "description": "Stored payload rendered as a JSON string (verbatim from the jsonb column)."
          },
          "last_error": {
            "type": "string",
            "description": "Most recent failure reason, when attempts > 0."
          }
        }
      },
      "QueuePeekResponse": {
        "description": "200 — a page of pending rows ordered by created_at ASC, id ASC. Pass `next_before` as `?before=<id>` for the next page.",
        "type": "object",
        "required": [
          "app_slug",
          "messages"
        ],
        "properties": {
          "app_slug": {
            "type": "string"
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QueuePeekMessage"
            }
          },
          "next_before": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "description": "Omitted when the page is the final one."
          }
        }
      },
      "QueueDeadLetterMessage": {
        "description": "One row that exhausted the plan's retry budget (state='dead_letter').",
        "type": "object",
        "required": [
          "id",
          "created_at",
          "failed_at",
          "attempts",
          "last_error",
          "payload"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "failed_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the drain transitioned the row to dead_letter."
          },
          "attempts": {
            "type": "integer"
          },
          "last_error": {
            "type": "string"
          },
          "payload": {
            "type": "string"
          }
        }
      },
      "QueueDeadLetterResponse": {
        "description": "200 — a page of dead-letter rows ordered by created_at DESC, id DESC.",
        "type": "object",
        "required": [
          "app_slug",
          "messages"
        ],
        "properties": {
          "app_slug": {
            "type": "string"
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QueueDeadLetterMessage"
            }
          },
          "next_before": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "description": "Cursor for the previous page; absent on the final page."
          }
        }
      },
      "DeadLetterEvent": {
        "description": "One unified queue invocation, broker trigger, outbound webhook, job run, workflow run, or event routing failure dead-letter event.",
        "type": "object",
        "required": [
          "id",
          "source",
          "source_id",
          "payload",
          "headers",
          "error_kind",
          "error_detail",
          "retry_count",
          "first_failed_at",
          "last_failed_at",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "description": "Owning app when the event is app-scoped."
          },
          "app_slug": {
            "type": "string",
            "description": "Owning app slug when the event is app-scoped."
          },
          "source": {
            "type": "string",
            "enum": [
              "invocation",
              "trigger_record",
              "webhook_delivery",
              "job_run",
              "workflow_run",
              "event_route"
            ],
            "description": "event_route is an event recipient whose routing failed and whose receipt was pruned; payload is the published envelope, error_kind the failure_code, and it cannot be replayed."
          },
          "source_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "origin": {
            "type": "string",
            "description": "Invocation source or trigger kind."
          },
          "trigger_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "payload": {
            "type": "object",
            "additionalProperties": true
          },
          "headers": {
            "type": "object",
            "additionalProperties": true
          },
          "error_kind": {
            "type": "string"
          },
          "error_detail": {
            "type": "object",
            "additionalProperties": true
          },
          "retry_count": {
            "type": "integer",
            "minimum": 0
          },
          "first_failed_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_failed_at": {
            "type": "string",
            "format": "date-time"
          },
          "replayed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DeadLetterEventsResponse": {
        "description": "A page of unified dead-letter events ordered newest-first.",
        "type": "object",
        "required": [
          "app_slug",
          "events"
        ],
        "properties": {
          "app_slug": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeadLetterEvent"
            }
          },
          "next_before": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          }
        }
      },
      "DeadLetterReplayAllResponse": {
        "description": "Count of unified dead-letter events accepted for replay.",
        "type": "object",
        "required": [
          "app_slug",
          "replayed"
        ],
        "properties": {
          "app_slug": {
            "type": "string"
          },
          "replayed": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "DeadLetterPurgeResponse": {
        "description": "Count of unified dead-letter ledger rows purged.",
        "type": "object",
        "required": [
          "app_slug",
          "purged"
        ],
        "properties": {
          "app_slug": {
            "type": "string"
          },
          "purged": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "AccountDeadLetterEventsResponse": {
        "description": "A page of account-wide unified dead-letter events ordered newest-first.",
        "type": "object",
        "required": [
          "events"
        ],
        "properties": {
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeadLetterEvent"
            }
          },
          "next_before": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          }
        }
      },
      "AccountDeadLetterReplayAllResponse": {
        "description": "Count of account-wide dead-letter events accepted for replay.",
        "type": "object",
        "required": [
          "replayed"
        ],
        "properties": {
          "replayed": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "AccountDeadLetterPurgeResponse": {
        "description": "Count of account-wide unified dead-letter ledger rows purged.",
        "type": "object",
        "required": [
          "purged"
        ],
        "properties": {
          "purged": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "DelayedTaskResponse": {
        "description": "Delayed task create/get/list shape with lifecycle and result metadata.",
        "type": "object",
        "required": [
          "id",
          "scheduled_at",
          "state"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "scheduled_at": {
            "type": "string",
            "format": "date-time"
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "dispatching",
              "completed",
              "failed",
              "cancelled",
              "dead_letter"
            ]
          },
          "method": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "attempts": {
            "type": "integer",
            "minimum": 0
          },
          "last_error": {
            "type": "string"
          },
          "result": {},
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ListDelayedTasksResponse": {
        "description": "One newest-first page of delayed tasks for an app.",
        "type": "object",
        "required": [
          "tasks"
        ],
        "properties": {
          "tasks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DelayedTaskResponse"
            }
          },
          "next_before": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          }
        }
      },
      "ExecutionCapabilitiesResponse": {
        "description": "Supported Runs admission contract for the authenticated account.\nadmission_available reports plan entitlement and the control-plane\nAPI gate only. It does not report scheduler dispatcher or profile image\nreadiness.\n",
        "type": "object",
        "required": [
          "plan",
          "admission_available",
          "plan_entitled",
          "control_plane_enabled",
          "runtimes",
          "profiles",
          "network_modes"
        ],
        "properties": {
          "plan": {
            "type": "string",
            "description": "Account plan identifier."
          },
          "admission_available": {
            "type": "boolean",
            "description": "True when the account is entitled and the control-plane admission gate is enabled."
          },
          "plan_entitled": {
            "type": "boolean",
            "description": "Whether the account plan allows Runs."
          },
          "control_plane_enabled": {
            "type": "boolean",
            "description": "Whether the API Runs admission gate is enabled."
          },
          "unavailable_reasons": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "plan_not_entitled",
                "control_plane_disabled"
              ]
            }
          },
          "runtimes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "node22",
                "node24",
                "python312",
                "python313"
              ]
            }
          },
          "profiles": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExecutionProfileCapability"
            }
          },
          "network_modes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "none"
              ]
            }
          },
          "limits": {
            "$ref": "#/components/schemas/ExecutionCapabilityLimits"
          }
        }
      },
      "ExecutionProfileCapability": {
        "description": "One dependency profile and its accepted runtime versions.",
        "type": "object",
        "required": [
          "profile",
          "runtimes"
        ],
        "properties": {
          "profile": {
            "type": "string",
            "enum": [
              "standard",
              "python-data-v1"
            ]
          },
          "runtimes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "node22",
                "node24",
                "python312",
                "python313"
              ]
            }
          },
          "packages": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Immutable preinstalled package versions, when the profile includes packages."
          }
        }
      },
      "ExecutionCapabilityLimits": {
        "description": "Plan limits and fixed request-shape caps for Runs.",
        "type": "object",
        "required": [
          "max_concurrent_runs",
          "max_source_bytes",
          "max_input_bytes",
          "default_output_bytes",
          "max_output_bytes",
          "default_timeout_ms",
          "max_timeout_ms",
          "default_memory_mb",
          "max_memory_mb",
          "default_cpu_millicores",
          "max_cpu_millicores",
          "default_ephemeral_disk_mb",
          "max_ephemeral_disk_mb",
          "pids_max",
          "max_bundle_files",
          "max_artifact_inputs",
          "max_output_files",
          "max_artifact_path_bytes"
        ],
        "properties": {
          "max_concurrent_runs": {
            "type": "integer",
            "minimum": 0
          },
          "max_source_bytes": {
            "type": "integer",
            "minimum": 0
          },
          "max_input_bytes": {
            "type": "integer",
            "minimum": 0
          },
          "default_output_bytes": {
            "type": "integer",
            "minimum": 0
          },
          "max_output_bytes": {
            "type": "integer",
            "minimum": 0
          },
          "default_timeout_ms": {
            "type": "integer",
            "minimum": 0
          },
          "max_timeout_ms": {
            "type": "integer",
            "minimum": 0
          },
          "default_memory_mb": {
            "type": "integer",
            "minimum": 0
          },
          "max_memory_mb": {
            "type": "integer",
            "minimum": 0
          },
          "default_cpu_millicores": {
            "type": "integer",
            "minimum": 0
          },
          "max_cpu_millicores": {
            "type": "integer",
            "minimum": 0
          },
          "default_ephemeral_disk_mb": {
            "type": "integer",
            "minimum": 0
          },
          "max_ephemeral_disk_mb": {
            "type": "integer",
            "minimum": 0
          },
          "pids_max": {
            "type": "integer",
            "minimum": 0
          },
          "max_bundle_files": {
            "type": "integer",
            "minimum": 0
          },
          "max_artifact_inputs": {
            "type": "integer",
            "minimum": 0
          },
          "max_output_files": {
            "type": "integer",
            "minimum": 0
          },
          "max_artifact_path_bytes": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "CreateExecutionRequest": {
        "description": "Source and JSON input for one disposable execution. Send either the\nlegacy `source` string or an ephemeral `files` bundle with an\n`entrypoint`. `artifact_inputs` may add files from successful runs in\nthe same key family for Runs-only credentials, or from the same account\nfor broad credentials; they are copied into the new\nencrypted request and staged only in its ephemeral guest filesystem.\nOptional `workflow_id` and `step_label` values group run receipts in\ncontrol-plane metadata; the guest does not receive them.\nOptional `integration_ids` explicitly select managed integrations\ngranted for this Run; the IDs remain control-plane metadata and are\nnot delivered to the guest payload.\nv1 supports only the listed interpreter runtimes and\n`network.mode=none`; dependencies, secrets, environment injection, and\npersistent disks are not part of this contract.\n",
        "type": "object",
        "required": [
          "runtime"
        ],
        "oneOf": [
          {
            "required": [
              "source"
            ]
          },
          {
            "required": [
              "entrypoint"
            ],
            "anyOf": [
              {
                "required": [
                  "files"
                ]
              },
              {
                "required": [
                  "artifact_inputs"
                ]
              }
            ]
          }
        ],
        "additionalProperties": false,
        "properties": {
          "workflow_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 96,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,95}$",
            "description": "Optional caller-generated grouping id; control-plane metadata only."
          },
          "step_label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "description": "Optional bounded label for this run within its workflow; requires workflow_id. Agent workflow labels beginning with gwf: are unique per workflow and API-key family."
          },
          "integration_ids": {
            "type": "array",
            "maxItems": 25,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Optional account integration IDs explicitly granted for this Run; control-plane metadata only."
          },
          "profile": {
            "type": "string",
            "enum": [
              "standard",
              "python-data-v1"
            ],
            "default": "standard",
            "description": "Immutable preinstalled dependency profile. python-data-v1 requires python313; standard preserves standard-library-only execution."
          },
          "runtime": {
            "type": "string",
            "enum": [
              "node22",
              "node24",
              "python312",
              "python313"
            ]
          },
          "source": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1048576,
            "description": "Single-file source code; never returned by execution reads."
          },
          "entrypoint": {
            "type": "string",
            "maxLength": 256,
            "description": "Normalized relative path of the file to execute when `files` is supplied."
          },
          "files": {
            "type": "array",
            "maxItems": 256,
            "items": {
              "$ref": "#/components/schemas/ExecutionFile"
            },
            "description": "Regular files staged into the guest's ephemeral scratch filesystem."
          },
          "artifact_inputs": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/ExecutionArtifactInput"
            },
            "description": "Artifacts from successful executions visible to this credential, copied to paths in the ephemeral files bundle before sealing."
          },
          "output_files": {
            "type": "array",
            "maxItems": 8,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "description": "Explicit normalized relative paths below context.output_dir to export on success. No globs. Missing, symlink, and special files fail the run."
          },
          "input": {
            "description": "One complete JSON value delivered to the guest as input."
          },
          "limits": {
            "$ref": "#/components/schemas/ExecutionLimitRequest"
          },
          "network": {
            "$ref": "#/components/schemas/ExecutionNetworkPolicy"
          }
        }
      },
      "ExecutionFile": {
        "description": "One regular file in an ephemeral execution bundle. Content is base64-encoded in JSON.",
        "type": "object",
        "required": [
          "path",
          "content"
        ],
        "additionalProperties": false,
        "properties": {
          "path": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Normalized relative POSIX path; absolute paths, dot segments, and symlinks are rejected."
          },
          "content": {
            "type": "string",
            "format": "byte",
            "description": "File bytes, base64-encoded by JSON clients."
          }
        }
      },
      "ExecutionArtifactInput": {
        "description": "One same-family artifact reference or a one-time cross-agent grant, staged at a normalized path in the next run's ephemeral bundle.",
        "type": "object",
        "required": [
          "path"
        ],
        "additionalProperties": false,
        "properties": {
          "execution_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of a successful execution owned by this key family (omit when using grant_token)."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Exact artifact name from the source execution receipt (omit when using grant_token)."
          },
          "grant_token": {
            "type": "string",
            "minLength": 47,
            "maxLength": 47,
            "pattern": "^rag_[A-Za-z0-9_-]{43}$",
            "writeOnly": true,
            "description": "Single-use token created for one artifact by another Runs key family."
          },
          "path": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Normalized relative destination path in the new execution bundle."
          }
        }
      },
      "CreateExecutionArtifactGrantRequest": {
        "description": "Request to create a short-lived, one-time capability for one output artifact.",
        "type": "object",
        "required": [
          "artifact_name"
        ],
        "additionalProperties": false,
        "properties": {
          "artifact_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Exact output artifact to grant."
          },
          "expires_in_seconds": {
            "type": "integer",
            "minimum": 30,
            "maximum": 3600,
            "default": 300,
            "description": "Grant lifetime. Defaults to five minutes."
          }
        }
      },
      "ExecutionArtifactGrantResponse": {
        "description": "One-time artifact bearer capability. The token is returned once; the server stores only its hash.",
        "type": "object",
        "required": [
          "id",
          "source_execution_id",
          "artifact_name",
          "token",
          "expires_at"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "source_execution_id": {
            "type": "string",
            "format": "uuid"
          },
          "artifact_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "token": {
            "type": "string",
            "minLength": 47,
            "maxLength": 47,
            "pattern": "^rag_[A-Za-z0-9_-]{43}$",
            "readOnly": true,
            "description": "Bearer capability returned once; the server stores only its hash."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "RevokeExecutionArtifactGrantResponse": {
        "description": "Confirmation that an artifact grant is revoked.",
        "type": "object",
        "required": [
          "id",
          "revoked_at"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "revoked_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ExecutionArtifact": {
        "description": "An explicitly exported file. Its compact JSON metadata and base64 contents share the execution output budget.",
        "type": "object",
        "required": [
          "name",
          "size_bytes",
          "sha256",
          "content"
        ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "size_bytes": {
            "type": "integer",
            "minimum": 0
          },
          "sha256": {
            "type": "string",
            "pattern": "^sha256:[a-f0-9]{64}$"
          },
          "content": {
            "type": "string",
            "format": "byte",
            "description": "File bytes encoded as base64."
          }
        }
      },
      "ExecutionLimitRequest": {
        "description": "Caller-selected execution resource limits; zero selects the plan default.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "timeout_ms": {
            "type": "integer",
            "minimum": 0,
            "maximum": 30000,
            "description": "Zero uses the plan default."
          },
          "memory_mb": {
            "type": "integer",
            "enum": [
              0,
              128,
              256,
              512,
              1024
            ]
          },
          "cpu_millicores": {
            "type": "integer",
            "enum": [
              0,
              250,
              500,
              1000
            ]
          },
          "ephemeral_disk_mb": {
            "type": "integer",
            "enum": [
              0,
              64,
              128,
              256,
              512,
              1024,
              2048
            ]
          },
          "max_output_bytes": {
            "type": "integer",
            "minimum": 0,
            "description": "Combined result/stdout/stderr/serialized-artifacts cap; zero uses the plan default."
          }
        }
      },
      "ExecutionNetworkPolicy": {
        "description": "Network policy for a disposable run; v1 is loopback-only.",
        "type": "object",
        "required": [
          "mode"
        ],
        "additionalProperties": false,
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "none"
            ],
            "description": "Loopback only; no tenant bridge, DNS, or public egress."
          }
        }
      },
      "ResolvedExecutionLimits": {
        "description": "Immutable limits admitted and enforced for one execution.",
        "type": "object",
        "required": [
          "timeout_ms",
          "memory_mb",
          "cpu_millicores",
          "ephemeral_disk_mb",
          "max_output_bytes",
          "pids_max"
        ],
        "properties": {
          "timeout_ms": {
            "type": "integer",
            "minimum": 100
          },
          "memory_mb": {
            "type": "integer",
            "minimum": 1
          },
          "cpu_millicores": {
            "type": "integer",
            "minimum": 1
          },
          "ephemeral_disk_mb": {
            "type": "integer",
            "minimum": 1
          },
          "max_output_bytes": {
            "type": "integer",
            "minimum": 1024
          },
          "pids_max": {
            "type": "integer",
            "minimum": 1
          }
        }
      },
      "ExecutionUsage": {
        "description": "Host-measured resource usage for a terminal execution.",
        "type": "object",
        "required": [
          "wall_time_ms",
          "cpu_time_ms",
          "peak_memory_mb"
        ],
        "properties": {
          "wall_time_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cpu_time_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "peak_memory_mb": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "ExecutionFailure": {
        "description": "Caller-safe terminal failure classification.",
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string",
            "description": "Stable caller-safe failure vocabulary."
          },
          "message": {
            "type": "string",
            "description": "Host paths and VM command lines are never exposed."
          }
        }
      },
      "ExecutionResponse": {
        "description": "Disposable execution receipt. Runs-only keys can read only receipts\ncreated by their key family; broad credentials retain account-wide\naccess. Source and input are intentionally omitted. A terminal response is written only after the\nexecution VM has been destroyed. Optional workflow metadata is echoed\nas a grouping aid and remains subject to the same ownership boundary.\n",
        "type": "object",
        "required": [
          "id",
          "status",
          "runtime",
          "limits",
          "output_truncated",
          "created_at"
        ],
        "properties": {
          "profile": {
            "type": "string",
            "enum": [
              "standard",
              "python-data-v1"
            ]
          },
          "runtime_image_digest": {
            "type": "string",
            "pattern": "^sha256:[a-f0-9]{64}$",
            "description": "Scheduler-pinned base image digest, recorded before dispatch of a dependency profile."
          },
          "packages": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Immutable versions declared by the selected profile and verified by its guest before caller code runs."
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "workflow_id": {
            "type": "string",
            "maxLength": 96,
            "description": "Caller-generated workflow grouping id, when assigned."
          },
          "step_label": {
            "type": "string",
            "maxLength": 128,
            "description": "Optional step label, when assigned."
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "restoring",
              "running",
              "succeeded",
              "failed",
              "timed_out",
              "out_of_memory",
              "cancelled"
            ]
          },
          "runtime": {
            "type": "string",
            "enum": [
              "node22",
              "node24",
              "python312",
              "python313"
            ]
          },
          "limits": {
            "$ref": "#/components/schemas/ResolvedExecutionLimits"
          },
          "artifacts": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/ExecutionArtifact"
            },
            "description": "Selected output files, present only after successful execution and VM teardown."
          },
          "result": {
            "description": "Terminal JSON result, omitted when unavailable."
          },
          "stdout": {
            "type": "string"
          },
          "stderr": {
            "type": "string"
          },
          "output_truncated": {
            "type": "boolean"
          },
          "exit_code": {
            "type": [
              "integer",
              "null"
            ]
          },
          "usage": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ExecutionUsage"
              },
              {
                "type": "null"
              }
            ]
          },
          "failure": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ExecutionFailure"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "ExecutionWorkflowStatusCounts": {
        "description": "Number of runs in each lifecycle state.",
        "type": "object",
        "required": [
          "queued",
          "restoring",
          "running",
          "succeeded",
          "failed",
          "timed_out",
          "out_of_memory",
          "cancelled"
        ],
        "properties": {
          "queued": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "restoring": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "running": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "succeeded": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "failed": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "timed_out": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "out_of_memory": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cancelled": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ExecutionWorkflowUsage": {
        "description": "Host-measured usage summed over terminal runs; peak memory is the maximum individual run peak.",
        "type": "object",
        "required": [
          "wall_time_ms",
          "cpu_time_ms",
          "peak_memory_mb",
          "output_bytes"
        ],
        "properties": {
          "wall_time_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cpu_time_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "peak_memory_mb": {
            "type": "integer",
            "minimum": 0
          },
          "output_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ExecutionWorkflowResponse": {
        "description": "Workflow lifecycle and usage aggregate visible to the authenticated principal.",
        "type": "object",
        "required": [
          "workflow_id",
          "run_count",
          "status_counts",
          "usage"
        ],
        "properties": {
          "workflow_id": {
            "type": "string",
            "maxLength": 96
          },
          "run_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "status_counts": {
            "$ref": "#/components/schemas/ExecutionWorkflowStatusCounts"
          },
          "usage": {
            "$ref": "#/components/schemas/ExecutionWorkflowUsage"
          },
          "managed": {
            "type": "array",
            "description": "Managed plans matching the workflow id and visible to this principal. Broad credentials can see plans submitted by multiple key families.",
            "items": {
              "$ref": "#/components/schemas/ManagedExecutionWorkflowResponse"
            }
          }
        }
      },
      "CreateManagedExecutionWorkflowRequest": {
        "description": "Encrypted, server-managed DAG. Every step runs in its own disposable\nRun. Independent steps may run in parallel up to max_parallel_steps\nand the account's concurrent Run limit. The full JSON body must not\nexceed 4 MiB. An account can have at most 16 active managed workflows.\n",
        "type": "object",
        "required": [
          "workflow_id",
          "version",
          "steps"
        ],
        "additionalProperties": false,
        "properties": {
          "workflow_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 96,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,95}$"
          },
          "version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 24,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,23}$"
          },
          "max_parallel_steps": {
            "type": "integer",
            "minimum": 0,
            "maximum": 8,
            "default": 1,
            "description": "Maximum number of this workflow's Runs active at once; 0 uses the default of 1."
          },
          "failure_policy": {
            "type": "string",
            "enum": [
              "fail_fast",
              "continue_independent"
            ],
            "default": "fail_fast",
            "description": "Stop new admissions on a failed Run, or continue steps independent of failed branches."
          },
          "steps": {
            "type": "array",
            "minItems": 1,
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/CreateManagedExecutionWorkflowStep"
            }
          }
        }
      },
      "CreateManagedExecutionWorkflowStep": {
        "description": "One disposable Run in the DAG and its dependency, result, and artifact handoff rules.",
        "type": "object",
        "required": [
          "label",
          "request"
        ],
        "additionalProperties": false,
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 96
          },
          "depends_on": {
            "type": "array",
            "uniqueItems": true,
            "maxItems": 16,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 96
            },
            "description": "Earlier step labels that must succeed before this step is admitted."
          },
          "input_from_previous_result": {
            "type": "boolean",
            "default": false,
            "description": "Use the immediately preceding successful Run's JSON result as this step's input; adds that step as a dependency."
          },
          "include_dependency_results": {
            "type": "boolean",
            "default": false,
            "description": "Set input to a JSON object keyed by dependency label, with each dependency's terminal status and successful JSON result when available."
          },
          "artifact_inputs": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/ManagedExecutionWorkflowArtifactInput"
            },
            "description": "Artifacts from earlier successful steps to stage in this Run's fresh ephemeral files bundle; each producer becomes an implicit dependency."
          },
          "result_schema": {
            "description": "Optional JSON Schema Draft 2020-12 contract for this Run's JSON result. The control plane enforces it before dependents can consume the result. Local fragment references are supported; external resources are not loaded. Each schema is limited to 64 KiB and all schemas in a workflow together are limited to 1 MiB.",
            "oneOf": [
              {
                "type": "object"
              },
              {
                "type": "boolean"
              }
            ]
          },
          "request": {
            "$ref": "#/components/schemas/CreateExecutionRequest",
            "description": "Must not include workflow_id, step_label, or artifact_inputs."
          }
        }
      },
      "ManagedExecutionWorkflowArtifactInput": {
        "description": "Select a declared output from an earlier workflow step and stage it at a relative path in this step's ephemeral bundle.",
        "type": "object",
        "required": [
          "from_step",
          "name",
          "path"
        ],
        "additionalProperties": false,
        "properties": {
          "from_step": {
            "type": "string",
            "minLength": 1,
            "maxLength": 96
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Normalized output_files name declared by the producer step."
          },
          "path": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Normalized relative destination path in the consumer Run's ephemeral files bundle."
          }
        }
      },
      "ManagedExecutionWorkflowResponse": {
        "description": "Server-managed workflow lifecycle metadata. Source and input are not\nreturned. `next_step` is the number of steps already admitted as Runs,\nincluding parallel admissions.\n",
        "type": "object",
        "required": [
          "workflow_id",
          "plan_id",
          "status",
          "step_count",
          "next_step",
          "created_at"
        ],
        "properties": {
          "workflow_id": {
            "type": "string",
            "maxLength": 96
          },
          "plan_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{24}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "succeeded",
              "failed"
            ]
          },
          "step_count": {
            "type": "integer",
            "minimum": 1,
            "maximum": 16
          },
          "next_step": {
            "type": "integer",
            "minimum": 0,
            "maximum": 16
          },
          "error": {
            "type": "string",
            "maxLength": 2048
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ExecutionListResponse": {
        "description": "Page of disposable execution receipts visible to the caller. `next_offset`\nis -1 when there is no following page; otherwise pass it as `offset`.\n",
        "type": "object",
        "required": [
          "executions",
          "limit",
          "offset",
          "next_offset"
        ],
        "properties": {
          "executions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExecutionResponse"
            }
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 200
          },
          "offset": {
            "type": "integer",
            "minimum": 0
          },
          "next_offset": {
            "type": "integer",
            "description": "Next offset, or -1 at the end of the result set."
          }
        }
      },
      "CreateAppTaskRequest": {
        "description": "One manual command to execute against the app's live deployment.\nverification_deployment_id optionally selects an exact app-owned,\nmaterialized live deployment for the reserved service, PostgreSQL,\nobject-storage or configured outbound verification probes only.\nsmoke_deployment_id selects an exact app-owned, materialized live caller\ndeployment for the reserved service smoke GET command. The service must\nbe declared on the caller; target authorization remains enforced by the gateway.\nGeneric commands cannot select a deployment. The selectors are mutually\nexclusive and require the selected deployment to remain live at atomic\ntask admission. An explicit verification probe also requires authorized,\nmanaged binding metadata. Both selectors are supported only on direct\nPOST /v1/apps/{slug}/tasks; exclusive-operation task admission rejects them.\n`command_shell=false` executes argv directly. Shell mode requires one\ncommand string and is explicit so clients preserve quoting semantics.\n`__gregale_service_binding_probe_v2__ <service> <target_uuid>` requires\nverification_deployment_id and qualifies only that exact live target in\nthe caller scope. It sends a safe HEAD without waking or invoking the target.\n`__gregale_service_binding_probe_v1__ <service>` is reserved for the\nGregale HTTPS service-binding canary and is handled by guest-init.\n`__gregale_outbound_binding_probe_v1__ <integration-id>` selects a\nconfigured outbound probe; the server supplies immutable gateway routing metadata.\n`interactive=true` admits an session (operator-gated): the\ncommand defaults to `/bin/sh`, the timeout defaults to 3600 seconds\nand bounds the session, no output is retained, and the create\nresponse carries a one-time `attach` credential for\nGET /v1/apps/{slug}/tasks/{id}/attach. `tty` allocates a terminal.\n",
        "type": "object",
        "required": [],
        "additionalProperties": false,
        "properties": {
          "verification_deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Exact source deployment for a reserved binding verification probe; omit for the current manual-task selection."
          },
          "smoke_deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Exact caller deployment for a reserved service smoke GET; mutually exclusive with verification_deployment_id. Omit for automatic caller selection."
          },
          "command": {
            "type": "array",
            "minItems": 1,
            "maxItems": 64,
            "items": {
              "type": "string",
              "maxLength": 4096
            }
          },
          "command_shell": {
            "type": "boolean",
            "default": false
          },
          "timeout_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 3600,
            "description": "Zero uses the 600-second default."
          },
          "max_output_bytes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 16777216,
            "description": "Zero uses the 1 MiB default; non-zero values must be at least 1024. Must be omitted for interactive sessions."
          },
          "interactive": {
            "type": "boolean",
            "default": false,
            "description": "Admit an interactive session. The command is required unless interactive."
          },
          "tty": {
            "type": "boolean",
            "default": false,
            "description": "Allocate a pseudo-terminal; requires interactive."
          }
        }
      },
      "AppTaskAttachInfo": {
        "description": "One-time attach credential for an interactive app task. Returned only in the create response.",
        "type": "object",
        "required": [
          "token",
          "path",
          "subprotocol"
        ],
        "properties": {
          "token": {
            "type": "string",
            "description": "Send in X-Gregale-Attach-Token with the account credential; consumed by the first attach."
          },
          "path": {
            "type": "string",
            "description": "Gateway WebSocket path for this task."
          },
          "subprotocol": {
            "type": "string",
            "enum": [
              "gregale-app-task-attach-v1"
            ]
          }
        }
      },
      "AppTaskFailure": {
        "description": "Bounded customer-visible failure details for an app task.",
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string",
            "maxLength": 64
          },
          "message": {
            "type": "string",
            "maxLength": 4096
          }
        }
      },
      "CrashSnapshotSettingsRequest": {
        "description": "Body of `PUT /v1/apps/{slug}/crash-snapshots/settings`.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "enabled"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          }
        }
      },
      "CrashSnapshotSettingsResponse": {
        "description": "Whether 5xx crash snapshots are on for the app.",
        "type": "object",
        "required": [
          "enabled"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CrashCaptureResponse": {
        "description": "One crash snapshot. `status` moves from `requested` through\n`capturing` to `ready`, then `expired`, or ends as `failed`. Storage\nlocations are never returned; open a ready capture as a fork.\n",
        "type": "object",
        "required": [
          "id",
          "app_id",
          "deployment_id",
          "trigger",
          "status",
          "requested_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "trigger": {
            "type": "string",
            "enum": [
              "http_5xx",
              "manual",
              "sdk",
              "live_fork"
            ],
            "description": "`http_5xx` after a 5xx response, `manual` from this API, `sdk` from the\napp itself through the guest metadata endpoint\n(`POST http://169.254.169.254/v1/crash-snapshots:capture`), `live_fork`\nfor the capture a live fork took (kept only as long as a fork can live).\n"
          },
          "status_code": {
            "type": "integer",
            "minimum": 500,
            "maximum": 599
          },
          "route": {
            "type": "string",
            "description": "Request path of the failing request (http_5xx",
            "or sdk when the app passes one).": null
          },
          "reason": {
            "type": "string",
            "maxLength": 256,
            "description": "The app's label for an sdk capture."
          },
          "status": {
            "type": "string",
            "enum": [
              "requested",
              "capturing",
              "ready",
              "failed",
              "expired"
            ]
          },
          "mem_bytes": {
            "type": "integer",
            "format": "int64"
          },
          "failure": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          },
          "requested_at": {
            "type": "string",
            "format": "date-time"
          },
          "captured_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the capture is deleted."
          }
        }
      },
      "CrashCaptureListResponse": {
        "description": "An app's crash snapshots, newest first.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CrashCaptureResponse"
            }
          }
        }
      },
      "CreateAppForkExecRequest": {
        "description": "Body of `POST /v1/apps/{slug}/forks/{id}/execs`.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "command"
        ],
        "properties": {
          "command": {
            "type": "array",
            "minItems": 1,
            "maxItems": 64,
            "items": {
              "type": "string",
              "maxLength": 4096
            },
            "description": "The argv to run. With `shell`, exactly one string run by the app's shell."
          },
          "shell": {
            "type": "boolean",
            "description": "Run the single command string through the app's shell."
          },
          "timeout_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 600,
            "description": "Default 60."
          },
          "max_output_bytes": {
            "type": "integer",
            "minimum": 1024,
            "maximum": 1048576,
            "description": "Combined stdout/stderr kept (the tail). Default 65536."
          }
        }
      },
      "AppForkExecResponse": {
        "description": "One command run inside a production fork and, once finished, its result.",
        "type": "object",
        "required": [
          "id",
          "fork_id",
          "command",
          "timeout_seconds",
          "max_output_bytes",
          "status",
          "output_truncated",
          "stdout",
          "stderr",
          "requested_by",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "fork_id": {
            "type": "string",
            "format": "uuid"
          },
          "command": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "shell": {
            "type": "boolean"
          },
          "timeout_seconds": {
            "type": "integer"
          },
          "max_output_bytes": {
            "type": "integer"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "succeeded",
              "failed",
              "timed_out"
            ]
          },
          "exit_code": {
            "type": "integer"
          },
          "output_truncated": {
            "type": "boolean"
          },
          "stdout": {
            "type": "string",
            "description": "Tail of standard output."
          },
          "stderr": {
            "type": "string",
            "description": "Tail of standard error."
          },
          "failure": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          },
          "requested_by": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AppForkExecListResponse": {
        "description": "A fork's commands, newest first.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppForkExecResponse"
            }
          }
        }
      },
      "CreateAppForkRequest": {
        "description": "Body of `POST /v1/apps/{slug}/forks`. Every field is optional.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "ttl_seconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 14400,
            "description": "How long the fork lives. Default 3600 (1 h), maximum 14400 (4 h)."
          },
          "live": {
            "type": "boolean",
            "description": "Capture the app's newest running instance now and fork that\ncapture, instead of the deployment's last snapshot. The capture\npauses the instance briefly. Refused (409 `live_fork_refused`)\nwhen no instance is running, a capture is in flight, or one was\ntaken in the last minute.\n"
          }
        }
      },
      "AppForkResponse": {
        "description": "One production fork. `status` moves from `queued` through\n`restoring` to `running`, and ends as `expired`, `cancelled` or\n`failed`. Scheduler leases and instance identifiers are never\nreturned.\n",
        "type": "object",
        "required": [
          "id",
          "app_id",
          "deployment_id",
          "status",
          "ttl_seconds",
          "expires_at",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "access_token": {
            "type": "string",
            "description": "Returned only by `POST /v1/apps/{slug}/forks`, never again. To\nreach the running fork, send a request to the app's hostname with\n`X-Gregale-Fork: <id>` and `X-Gregale-Fork-Token: <access_token>`.\nThe gateway routes it to the fork, strips both headers, and never\nwakes the app for it.\n"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "The live deployment pinned when the fork was requested."
          },
          "crash_capture_id": {
            "type": "string",
            "format": "uuid",
            "description": "The capture the fork restores, for a crash snapshot fork or a live fork."
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "restoring",
              "running",
              "expired",
              "cancelled",
              "failed"
            ]
          },
          "ttl_seconds": {
            "type": "integer"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the fork is destroyed (created_at + ttl_seconds)."
          },
          "cancel_requested_at": {
            "type": "string",
            "format": "date-time"
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": "string",
            "format": "date-time"
          },
          "failure": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AppForkListResponse": {
        "description": "An app's production forks, newest first.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppForkResponse"
            }
          }
        }
      },
      "AppTaskResponse": {
        "description": "App-scoped receipt for a deployment-attached command. Scheduler lease\ndata, rootfs storage keys, and image digests are intentionally omitted.\n",
        "type": "object",
        "required": [
          "id",
          "app_id",
          "deployment_id",
          "deployment_scope",
          "kind",
          "command",
          "command_shell",
          "status",
          "timeout_seconds",
          "max_output_bytes",
          "attempt_count",
          "output_truncated",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "work_decision": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/WorkDecision"
              },
              {
                "type": "null"
              }
            ]
          },
          "outcome_code": {
            "type": "string",
            "maxLength": 64,
            "pattern": "^[a-z0-9_.-]*$"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "deployment_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "deployment_scope": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "manual",
              "release",
              "cron"
            ]
          },
          "command": {
            "type": "array",
            "minItems": 1,
            "maxItems": 64,
            "items": {
              "type": "string",
              "maxLength": 4096
            }
          },
          "command_shell": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "restoring",
              "running",
              "succeeded",
              "failed",
              "timed_out",
              "cancelled"
            ]
          },
          "timeout_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3600
          },
          "max_output_bytes": {
            "type": "integer",
            "minimum": 1024,
            "maximum": 16777216
          },
          "retry_max": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5
          },
          "retry_backoff_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3600
          },
          "attempt_count": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of command executions started for this logical task."
          },
          "retry_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When a failed command task will be eligible for its next attempt; omitted otherwise."
          },
          "stdout_tail": {
            "type": "string"
          },
          "stderr_tail": {
            "type": "string"
          },
          "output_truncated": {
            "type": "boolean"
          },
          "exit_code": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 255
          },
          "failure": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AppTaskFailure"
              },
              {
                "type": "null"
              }
            ]
          },
          "cancel_requested_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "interactive": {
            "type": "boolean",
            "description": "Present on the create response of an interactive session."
          },
          "attach": {
            "$ref": "#/components/schemas/AppTaskAttachInfo"
          }
        }
      },
      "AppTaskListResponse": {
        "description": "App-scoped page of task receipts. `next_offset` is -1 when there is no\nfollowing page; otherwise pass it as `offset`.\n",
        "type": "object",
        "required": [
          "tasks",
          "limit",
          "offset",
          "next_offset"
        ],
        "properties": {
          "tasks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppTaskResponse"
            }
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 200
          },
          "offset": {
            "type": "integer",
            "minimum": 0
          },
          "next_offset": {
            "type": "integer",
            "description": "Offset for the following app-task page, or -1 when this page is final."
          }
        }
      },
      "Invocation": {
        "description": "A single invocations row. Account-scoped; cross-account reads return 404.",
        "type": "object",
        "required": [
          "id",
          "app_id",
          "account_id",
          "source",
          "state",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid",
            "description": "Immutable verified downstream customer identity for async HTTP work."
          },
          "account_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "example": "0123456789abcdef0123456789abcdef"
          },
          "source": {
            "type": "string",
            "enum": [
              "async_invoke",
              "inbound_webhook",
              "queue",
              "delayed_task",
              "cron",
              "replay"
            ]
          },
          "queue_name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$",
            "description": "Logical queue name for queue-source invocations; empty retains the legacy app-scoped queue."
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "dispatching",
              "completed",
              "failed",
              "cancelled",
              "dead_letter"
            ]
          },
          "method": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "payload": {
            "type": "object",
            "additionalProperties": true
          },
          "headers": {
            "type": "object",
            "additionalProperties": true
          },
          "scheduled_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "due_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "instance_id": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[a-f0-9]{32}$"
          },
          "result": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "last_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "ack_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "Optional ack URL for queueReceive consumers; populated on queue-sourced rows."
          },
          "attempts": {
            "type": "integer",
            "description": "Number of dispatch attempts so far; 0 on the first try."
          },
          "work_policy_name": {
            "type": "string",
            "description": "Named policy under which this invocation was admitted."
          },
          "work_policy_revision": {
            "type": "integer",
            "minimum": 1,
            "description": "Policy revision captured at admission."
          },
          "work_expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Pending work expiry; running work is never expired by this policy."
          },
          "lease_expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the in-flight dispatch lease expires; null when no lease is held."
          },
          "received_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the drain first claimed the row; null until claimed."
          },
          "deadline_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Optional hard-stop. Drain transitions the row to dead_letter when this time passes while still pending|dispatching."
          },
          "retry_policy": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true,
            "description": "Optional per-row retry curve override; decodes into dispatch.RetryPolicy (max_attempts, base_seconds, max_seconds, jitter_seconds)."
          },
          "result_retention_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Optional explicit retention horizon. NULL means 'use plan default' (Limits.MaxAsyncResultRetentionSeconds)."
          },
          "last_replayed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When this row was most recently replayed from dead_letter via POST /v1/apps/{slug}/queues/dead_letter/{id}/replay. NULL until first replay."
          },
          "on_success_destination_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "EPIC #1278. App webhook subscription selected for a completed invocation."
          },
          "on_failure_destination_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "EPIC #1278. App webhook subscription selected for a terminal failure or dead-lettered invocation."
          }
        }
      },
      "ListInvocationsResponse": {
        "description": "Page of invocations; ordered by created_at DESC, id DESC. When present, pass next_before as `?before=` to load older rows.",
        "type": "object",
        "required": [
          "invocations"
        ],
        "properties": {
          "invocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Invocation"
            }
          },
          "next_before": {
            "type": "string",
            "description": "ID cursor for the next older page; omitted when this page contains fewer rows than requested."
          }
        }
      },
      "InvocationDestinations": {
        "description": "EPIC #1278. Optional terminal callbacks for an async invocation. Values are app webhook subscription IDs owned by the invoking app.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "on_success": {
            "type": "string",
            "format": "uuid",
            "description": "Webhook subscription receiving a job.finished event after completion."
          },
          "on_failure": {
            "type": "string",
            "format": "uuid",
            "description": "Webhook subscription receiving a job.finished event after permanent failure or DLQ routing."
          }
        }
      },
      "DeploymentResponseCheckCapabilities": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "protocol_version",
          "available"
        ],
        "description": "Installed deployment-check protocol and forwarding configuration; no workload admission is performed.",
        "properties": {
          "protocol_version": {
            "type": "integer",
            "minimum": 1,
            "description": "Protocol implemented by this API; clients require a compatible version."
          },
          "available": {
            "type": "boolean"
          },
          "unavailable_reason": {
            "type": "string",
            "description": "Stable gateway_unsupported, gateway_unconfigured, or gateway_unavailable code when unavailable."
          }
        }
      },
      "DeploymentResponseCheckRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "app_id",
          "scope",
          "path"
        ],
        "description": "Explicit identity and one GET path; named scopes require project_id and environment_id.",
        "properties": {
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9-]{32,36}$"
          },
          "scope": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,39}$"
          },
          "project_id": {
            "type": "string",
            "pattern": "^[a-f0-9-]{32,36}$"
          },
          "environment_id": {
            "type": "string",
            "pattern": "^[a-f0-9-]{32,36}$"
          },
          "path": {
            "type": "string",
            "maxLength": 2048,
            "description": "App-relative GET path with optional query; no fragment or controls."
          }
        }
      },
      "DeploymentResponseCheckResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "app_id",
          "deployment_id",
          "scope",
          "instance_id",
          "http_status",
          "body",
          "body_truncated"
        ],
        "description": "Ephemeral owner-authorized HTTP evidence; does not establish public ingress access.",
        "properties": {
          "app_id": {
            "type": "string",
            "pattern": "^[a-f0-9-]{32,36}$"
          },
          "deployment_id": {
            "type": "string",
            "pattern": "^[a-f0-9-]{32,36}$"
          },
          "scope": {
            "type": "string"
          },
          "project_id": {
            "type": "string",
            "pattern": "^[a-f0-9-]{32,36}$"
          },
          "environment_id": {
            "type": "string",
            "pattern": "^[a-f0-9-]{32,36}$"
          },
          "instance_id": {
            "type": "string",
            "pattern": "^[a-f0-9-]{32,36}$"
          },
          "http_status": {
            "type": "integer",
            "minimum": 200,
            "maximum": 599
          },
          "body": {
            "type": "string",
            "maxLength": 4096,
            "description": "UTF-8 response preview bounded to 4096 bytes."
          },
          "body_truncated": {
            "type": "boolean"
          }
        }
      },
      "InvokeRequest": {
        "description": "Body for POST /v1/apps/{slug}/invoke[/async]. Method defaults to POST; path defaults to `/`.",
        "type": "object",
        "properties": {
          "payload": {
            "type": "object",
            "additionalProperties": true
          },
          "headers": {
            "type": "object",
            "additionalProperties": true
          },
          "method": {
            "type": "string",
            "default": "POST"
          },
          "path": {
            "type": "string",
            "default": "/"
          },
          "deadline_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Hard-stop timestamp. Must be within now+Limits.MaxAsyncInvocationDeadlineSeconds."
          },
          "retry_policy": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true,
            "description": "Per-row retry curve override. max_attempts counts the original, is capped by the account plan, and 0 inherits that finite cap.",
            "properties": {
              "max_attempts": {
                "type": "integer",
                "minimum": 0,
                "maximum": 25
              },
              "base_seconds": {
                "type": "number"
              },
              "max_seconds": {
                "type": "number"
              },
              "jitter_seconds": {
                "type": "number",
                "description": "Fraction (0..1). 0.2 means ±20%."
              }
            }
          },
          "retention_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Retention horizon in seconds. NULL/0 means 'use plan default' (Limits.MaxAsyncResultRetentionSeconds)."
          },
          "destinations": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/InvocationDestinations"
              },
              {
                "type": "null"
              }
            ],
            "description": "EPIC #1278. Optional terminal callbacks."
          },
          "work": {
            "allOf": [
              {
                "$ref": "#/components/schemas/InvokeWork"
              }
            ],
            "description": "Async invocation only. Assigns a named policy and application key."
          }
        }
      },
      "InvokeWork": {
        "description": "Named policy and typed application key for one durable invocation.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "policy",
          "key"
        ],
        "properties": {
          "policy": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "key": {
            "description": "A bounded JSON string, number, or boolean. Equal typed values share one work lane."
          },
          "fairness_key": {
            "description": "Optional scalar shared by multiple work keys, such as a tenant ID. Defaults to key when the policy has a fairness cap."
          }
        }
      },
      "UpsertWorkPolicyRequest": {
        "description": "App work policy settings; durations use whole milliseconds.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "max_running_per_key"
        ],
        "properties": {
          "max_running_per_key": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "max_running_per_fairness_key": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000,
            "default": 0
          },
          "pending_updates": {
            "type": "string",
            "enum": [
              "all",
              "keep_latest"
            ],
            "default": "all"
          },
          "debounce_ms": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400000,
            "default": 0
          },
          "expires_after_ms": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2592000000,
            "default": 0
          }
        }
      },
      "WorkPolicyResponse": {
        "description": "Saved policy definition and revision. For stage desired settings, created_at and updated_at identify the containing immutable workload configuration revision; stage execution remains gated.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "revision",
          "max_running_per_key",
          "max_running_per_fairness_key",
          "pending_updates",
          "debounce_ms",
          "expires_after_ms",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "max_running_per_key": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "max_running_per_fairness_key": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000
          },
          "pending_updates": {
            "type": "string",
            "enum": [
              "all",
              "keep_latest"
            ]
          },
          "debounce_ms": {
            "type": "integer"
          },
          "expires_after_ms": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WorkPolicyListResponse": {
        "description": "All named work policies for one app.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "policies"
        ],
        "properties": {
          "policies": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkPolicyResponse"
            }
          }
        }
      },
      "CancelPendingWorkRequest": {
        "description": "Typed application key identifying pending work in one policy lane.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "key"
        ],
        "properties": {
          "key": {
            "description": "A bounded JSON string, number, or boolean."
          }
        }
      },
      "CancelPendingWorkResponse": {
        "description": "Durable receipt for a cancel-pending operation.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "cancelled_count"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "cancelled_count": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "QueueSendRequest": {
        "description": "Body for POST /v1/apps/{slug}/queues/send. Cap-checked against MaxQueueDepth. Unkeyed messages retain legacy FIFO dispatch; keyed messages use per-key ordering.",
        "type": "object",
        "properties": {
          "environment": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{0,31}[a-z0-9])?$",
            "description": "Target registered environment with an enabled scoped queue binding. Omission sends through the default environment and legacy shared queues."
          },
          "payload": {
            "type": "object",
            "additionalProperties": true
          },
          "flag_context": {
            "type": "string",
            "maxLength": 12288,
            "description": "Optional bounded Gregale Flags context produced by the Node SDK from decisions marked used. The platform validates the envelope, binds it to its active customer, and restores it on the queued request."
          },
          "queue_name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$",
            "description": "Optional logical queue name. Required when an app has multiple enabled queue consumers."
          },
          "retry_policy": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RetryPolicyDTO"
              }
            ],
            "description": "Optional per-message retry curve override."
          },
          "work": {
            "allOf": [
              {
                "$ref": "#/components/schemas/InvokeWork"
              }
            ],
            "description": "Optional keyed ordering policy for a queue message. Scoped environment bindings reject this option until their policy adapter is available."
          }
        }
      },
      "QueueSendBatchRequest": {
        "description": "Body for POST /v1/apps/{slug}/queues/send-batch: up to 100 messages for one queue, sent in order. The body is at most 8 MiB; each message meets its plan's message size.",
        "type": "object",
        "required": [
          "messages"
        ],
        "properties": {
          "environment": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{0,31}[a-z0-9])?$",
            "description": "Target registered environment with an enabled scoped queue binding. Omission sends through the default environment."
          },
          "queue_name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$",
            "description": "Logical queue that receives every message in the batch. Required when an app has multiple enabled queue consumers."
          },
          "retry_policy": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RetryPolicyDTO"
              }
            ],
            "description": "Optional retry curve override for every message of the batch."
          },
          "messages": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/QueueSendBatchMessage"
            }
          }
        }
      },
      "QueueSendBatchMessage": {
        "description": "One message of a batch send.",
        "type": "object",
        "properties": {
          "payload": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "QueueSendBatchResult": {
        "description": "The outcome of one message by its zero-based input index: accepted, rejected with the problem, or not attempted after an earlier rejection.",
        "type": "object",
        "required": [
          "index",
          "status"
        ],
        "properties": {
          "index": {
            "type": "integer",
            "minimum": 0,
            "description": "Zero-based position of the message in the request's messages array."
          },
          "status": {
            "type": "string",
            "enum": [
              "accepted",
              "rejected",
              "not_attempted"
            ]
          },
          "message": {
            "$ref": "#/components/schemas/QueueSendResponse"
          },
          "problem": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "QueueSendBatchResponse": {
        "description": "Per-message outcomes in the original input order.",
        "type": "object",
        "required": [
          "results"
        ],
        "properties": {
          "results": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/QueueSendBatchResult"
            }
          }
        }
      },
      "QueueWorkloadProfileRequest": {
        "description": "Declarative setup for the common queue worker profile. The server\nreconciles the default push binding, consumer projection, and\nqueue-depth scaling policy as one idempotent operation.\n",
        "type": "object",
        "properties": {
          "queue_name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$",
            "default": "default"
          },
          "workload_class": {
            "type": "string",
            "enum": [
              "worker",
              "job"
            ],
            "description": "Defaults to the app workload class."
          },
          "max_concurrency": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000,
            "default": 1
          },
          "target_depth": {
            "type": "number",
            "exclusiveMinimum": 0,
            "default": 10
          },
          "retry_policy": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RetryPolicyDTO"
              }
            ],
            "description": "Optional per-binding retry curve."
          },
          "force": {
            "type": "boolean",
            "default": false,
            "description": "Replace an existing default binding that points at another queue."
          }
        }
      },
      "QueueWorkloadProfileResponse": {
        "description": "The converged queue binding and queue-depth scaling policy.",
        "type": "object",
        "required": [
          "app",
          "binding",
          "scaling_policy",
          "created"
        ],
        "properties": {
          "app": {
            "$ref": "#/components/schemas/AppResponse"
          },
          "binding": {
            "$ref": "#/components/schemas/QueueBindingResponse"
          },
          "scaling_policy": {
            "$ref": "#/components/schemas/ScalingPolicy"
          },
          "created": {
            "type": "boolean",
            "description": "True when the default binding was created by this request."
          }
        }
      },
      "CreateQueueBindingRequest": {
        "description": "Durable queue mapping. HTTP functions may use push mode; pull mode remains for worker/job workloads.",
        "type": "object",
        "required": [
          "name",
          "queue_name"
        ],
        "properties": {
          "environment": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{0,31}[a-z0-9])?$",
            "description": "Immutable registered project environment. The binding captures its catalog UUID; omitted creates a shared legacy binding."
          },
          "name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "queue_name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "mode": {
            "type": "string",
            "enum": [
              "pull",
              "push"
            ],
            "default": "pull"
          },
          "workload_class": {
            "type": "string",
            "enum": [
              "worker",
              "job",
              "http"
            ],
            "default": "worker"
          },
          "enabled": {
            "type": "boolean",
            "default": true
          },
          "max_concurrency": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000,
            "default": 1
          },
          "retry_policy": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RetryPolicyDTO"
              }
            ],
            "description": "Optional per-binding retry curve; zero values use platform defaults."
          }
        }
      },
      "UpdateQueueBindingRequest": {
        "description": "Partial queue-binding update; omitted fields are unchanged.",
        "type": "object",
        "properties": {
          "queue_name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "mode": {
            "type": "string",
            "enum": [
              "pull",
              "push"
            ]
          },
          "workload_class": {
            "type": "string",
            "enum": [
              "worker",
              "job",
              "http"
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "max_concurrency": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000
          },
          "retry_policy": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RetryPolicyDTO"
              }
            ]
          }
        }
      },
      "QueueBindingResponse": {
        "description": "Durable queue-to-workload binding.",
        "type": "object",
        "required": [
          "id",
          "app_id",
          "account_id",
          "name",
          "queue_name",
          "mode",
          "workload_class",
          "enabled",
          "max_concurrency",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "environment": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{0,31}[a-z0-9])?$",
            "description": "Immutable project environment slug; omitted for a shared legacy binding."
          },
          "environment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Original catalog environment identity; omitted for a shared legacy binding."
          },
          "id": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          },
          "app_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "queue_name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "mode": {
            "type": "string",
            "enum": [
              "pull",
              "push"
            ]
          },
          "workload_class": {
            "type": "string",
            "enum": [
              "worker",
              "job",
              "http"
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "max_concurrency": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000
          },
          "retry_policy": {
            "$ref": "#/components/schemas/RetryPolicyDTO"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "retired_at": {
            "type": "string",
            "format": "date-time",
            "description": "Retirement hold timestamp; present only for a retained retired binding."
          }
        }
      },
      "QueueBindingStatusResponse": {
        "description": "Read-only queue binding consumer projection and queue counters.",
        "type": "object",
        "required": [
          "binding_id",
          "name",
          "queue_name",
          "mode",
          "workload_class",
          "enabled",
          "consumer_state",
          "consumer_liveness",
          "depth",
          "in_flight",
          "dead_letter",
          "generated_at"
        ],
        "properties": {
          "environment": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{0,31}[a-z0-9])?$",
            "description": "Captured environment slug of the observed consumer; absent for legacy shared consumers."
          },
          "environment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Original environment catalog UUID of this consumer status; absent for a shared legacy consumer."
          },
          "binding_id": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "queue_name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "mode": {
            "type": "string",
            "enum": [
              "pull",
              "push"
            ]
          },
          "workload_class": {
            "type": "string",
            "enum": [
              "worker",
              "job",
              "http"
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "consumer_state": {
            "type": "string",
            "enum": [
              "active",
              "paused",
              "not_configured",
              "external"
            ]
          },
          "consumer_state_reason": {
            "type": "string"
          },
          "consumer_liveness": {
            "type": "string",
            "enum": [
              "healthy",
              "degraded",
              "stale",
              "not_observed",
              "external"
            ]
          },
          "trigger_id": {
            "type": "string"
          },
          "last_poll_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_success_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_error_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_error": {
            "type": "string"
          },
          "lag_messages": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "lag_age_seconds": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "depth": {
            "type": "integer",
            "minimum": 0
          },
          "in_flight": {
            "type": "integer",
            "minimum": 0
          },
          "dead_letter": {
            "type": "integer",
            "minimum": 0
          },
          "oldest_pending_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "oldest_pending_age_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "RetryPolicyDTO": {
        "description": "Wire shape for dispatch.RetryPolicy. max_attempts\nis a requested total-attempt count; zero inherits the applicable\naccount plan and never means unlimited. Durable invocation\nproducers materialize the effective plan-capped value, and the\nscheduler re-clamps it at dispatch time to account for later plan\ndowngrades.\n",
        "type": "object",
        "properties": {
          "max_attempts": {
            "type": "integer",
            "minimum": 0,
            "maximum": 25,
            "description": "Total delivery attempts including the original. 0 inherits the current plan cap; it never means unlimited."
          },
          "base_seconds": {
            "type": "number"
          },
          "max_seconds": {
            "type": "number"
          },
          "jitter_seconds": {
            "type": "number",
            "description": "Fraction (0..1) added to the backoff delay. 0.2 means ±20% jitter on top of the exponential curve."
          }
        }
      },
      "DelayedTaskRequest": {
        "description": "Body for POST /v1/apps/{slug}/delayed-tasks. Supply exactly one scheduling form; the maximum delay is 31,536,000 seconds (365 days).",
        "oneOf": [
          {
            "$ref": "#/components/schemas/DelayedTaskAtRequest"
          },
          {
            "$ref": "#/components/schemas/DelayedTaskAfterRequest"
          }
        ]
      },
      "DelayedTaskAtRequest": {
        "description": "Schedule a delayed task at an absolute RFC 3339 timestamp.",
        "type": "object",
        "required": [
          "scheduled_at"
        ],
        "properties": {
          "payload": {
            "type": "object",
            "additionalProperties": true
          },
          "work": {
            "$ref": "#/components/schemas/InvokeWork"
          },
          "scheduled_at": {
            "type": "string",
            "format": "date-time"
          },
          "headers": {
            "type": "object",
            "additionalProperties": true
          },
          "method": {
            "type": "string",
            "default": "POST"
          },
          "path": {
            "type": "string",
            "default": "/"
          },
          "retry_policy": {
            "$ref": "#/components/schemas/RetryPolicyDTO"
          },
          "retention_seconds": {
            "type": "integer",
            "minimum": 0
          },
          "destinations": {
            "$ref": "#/components/schemas/InvocationDestinations"
          }
        }
      },
      "DelayedTaskAfterRequest": {
        "description": "Schedule a delayed task after a relative whole-second delay.",
        "type": "object",
        "required": [
          "delay_seconds"
        ],
        "properties": {
          "payload": {
            "type": "object",
            "additionalProperties": true
          },
          "work": {
            "$ref": "#/components/schemas/InvokeWork"
          },
          "delay_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 31536000
          },
          "headers": {
            "type": "object",
            "additionalProperties": true
          },
          "method": {
            "type": "string",
            "default": "POST"
          },
          "path": {
            "type": "string",
            "default": "/"
          },
          "retry_policy": {
            "$ref": "#/components/schemas/RetryPolicyDTO"
          },
          "retention_seconds": {
            "type": "integer",
            "minimum": 0
          },
          "destinations": {
            "$ref": "#/components/schemas/InvocationDestinations"
          }
        }
      },
      "SessionInfo": {
        "description": "One row per dashboard login. The\ncookie envelope carries the row's `id` as `sid`;\nevery authenticated request re-validates the row.\nRevoked rows are filtered out of the\n`GET /v1/auth/sessions` response.\n",
        "type": "object",
        "required": [
          "id",
          "account_id",
          "issued_at",
          "current_session"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Session id. Also stamped as `sid` in the cookie envelope."
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "issued_ip": {
            "type": "string",
            "description": "Client IP captured at login (host portion only; IPv4 or IPv6). Empty when the request's RemoteAddr was unparseable.",
            "example": "192.0.2.10"
          },
          "issued_ua": {
            "type": "string",
            "description": "User-Agent header captured at login. May be empty when the client suppressed the header."
          },
          "issued_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the session was minted (RFC 3339, UTC)."
          },
          "last_seen_at": {
            "type": "string",
            "format": "date-time",
            "description": "Last time the cookie cross-validated this row. Updated with a 5-minute debounce; continues post-revoke (operational signal only, not authorization)."
          },
          "current_session": {
            "type": "boolean",
            "description": "True when this row's id matches the calling cookie's sid. Exactly one row per list response has this flag set."
          }
        }
      },
      "SessionListResponse": {
        "description": "Body for `GET /v1/auth/sessions`.",
        "type": "object",
        "required": [
          "sessions"
        ],
        "properties": {
          "sessions": {
            "type": "array",
            "description": "Active sessions, newest first. Revoked rows are not returned.",
            "items": {
              "$ref": "#/components/schemas/SessionInfo"
            }
          }
        }
      },
      "AccountProfileUpdate": {
        "description": "Body for `PATCH /v1/account`.",
        "type": "object",
        "required": [
          "display_name"
        ],
        "properties": {
          "display_name": {
            "type": "string",
            "maxLength": 80,
            "description": "Empty clears the display name."
          }
        }
      },
      "AccountEmailChangeRequest": {
        "description": "Body for `POST /v1/account/email`.",
        "type": "object",
        "required": [
          "email"
        ],
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 254
          },
          "current_password": {
            "type": "string",
            "description": "Required when the account has a password and no two-factor authentication."
          },
          "csrf_token": {
            "type": "string"
          }
        }
      },
      "EmailVerificationResendResponse": {
        "description": "Result of `POST /v1/auth/verify-email/resend`.",
        "type": "object",
        "required": [
          "status"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "sent",
              "already_verified"
            ]
          },
          "email": {
            "type": "string",
            "format": "email"
          }
        }
      },
      "SecurityActivityResponse": {
        "description": "Body of `GET /v1/account/security-activity`.",
        "type": "object",
        "required": [
          "events"
        ],
        "properties": {
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SecurityActivityEvent"
            }
          }
        }
      },
      "SecurityActivityEvent": {
        "description": "One sign-in, credential or account-security change.",
        "type": "object",
        "required": [
          "at",
          "summary",
          "kind"
        ],
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "kind": {
            "type": "string",
            "description": "Audit event kind, e.g. auth.session.created or api_key.created."
          },
          "summary": {
            "type": "string",
            "description": "Fixed English phrase for the kind."
          },
          "ip": {
            "type": "string",
            "description": "Client address recorded with the event."
          },
          "detail": {
            "type": "string",
            "description": "Sign-in method, provider or key label, when recorded."
          }
        }
      },
      "SignInMethodsResponse": {
        "description": "The ways the account can sign in.",
        "type": "object",
        "required": [
          "password",
          "mfa",
          "providers"
        ],
        "properties": {
          "password": {
            "type": "boolean"
          },
          "mfa": {
            "type": "boolean"
          },
          "providers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LinkedSignIn"
            }
          }
        }
      },
      "LinkedSignIn": {
        "description": "A Google or GitHub identity linked to the account.",
        "type": "object",
        "required": [
          "provider",
          "email",
          "linked_at"
        ],
        "properties": {
          "provider": {
            "type": "string",
            "enum": [
              "google",
              "github"
            ]
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "linked_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "RecoveryCodesResponse": {
        "description": "New MFA recovery codes, shown once.",
        "type": "object",
        "required": [
          "recovery_codes"
        ],
        "properties": {
          "recovery_codes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "SessionsRevokeAllResponse": {
        "description": "Body for `POST /v1/auth/sessions/revoke_all`.",
        "type": "object",
        "required": [
          "revoked"
        ],
        "properties": {
          "revoked": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of sibling sessions revoked. The caller's session is NOT included in this count."
          }
        }
      },
      "OIDCExchangeRequest": {
        "description": "Body for `POST /v1/auth/oidc/exchange`.",
        "type": "object",
        "required": [
          "provider",
          "token",
          "aud"
        ],
        "properties": {
          "provider": {
            "type": "string",
            "description": "IdP identifier (`github`, `gitlab`, `circleci`, or generic `oidc`). Used for audit attribution only — the issuer is pinned in the JWT `iss` claim.",
            "example": "github"
          },
          "token": {
            "type": "string",
            "description": "Raw IdP-issued JWT (the IdP token from `ACTIONS_ID_TOKEN_REQUEST_TOKEN` etc.)."
          },
          "aud": {
            "type": "string",
            "description": "The `aud` claim the customer pinned in the action. Must match the trust policy's `audience` array verbatim."
          },
          "app": {
            "type": "string",
            "description": "Optional app slug for audit attribution. Empty skips the audit app attribution."
          },
          "capability": {
            "type": "string",
            "enum": [
              "environment-preflight"
            ],
            "description": "Optional closed OIDC capability profile. Omit to retain the historical deploy:write bearer; environment-preflight grants only project-environment read and qualification scopes."
          }
        }
      },
      "OIDCExchangeResponse": {
        "description": "Body for `POST /v1/auth/oidc/exchange` success response.",
        "type": "object",
        "required": [
          "bearer",
          "expires_in",
          "token_id"
        ],
        "properties": {
          "bearer": {
            "type": "string",
            "description": "Opaque bearer, format `fp_oidc_<48 hex>`. Use in `Authorization: Bearer …` on routes allowed by the returned scope profile."
          },
          "expires_in": {
            "type": "integer",
            "description": "Seconds until the bearer expires (300 today).",
            "example": 300
          },
          "token_id": {
            "type": "string",
            "description": "Opaque row id (UUID). Useful for log correlation / audit reads."
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The fixed scopes granted to this bearer."
          }
        }
      },
      "OAuthTokenExchangeRequest": {
        "description": "RFC 8693 form-encoded request profile for the OIDC exchange endpoint.\nGregale requires one `audience` because it selects the account trust\npolicy, accepts JWT subject tokens only, and issues only deploy:write\naccess tokens. `resource` and actor-token delegation are unsupported.\n",
        "type": "object",
        "required": [
          "grant_type",
          "subject_token",
          "subject_token_type",
          "audience"
        ],
        "properties": {
          "grant_type": {
            "type": "string",
            "enum": [
              "urn:ietf:params:oauth:grant-type:token-exchange"
            ]
          },
          "subject_token": {
            "type": "string",
            "description": "IdP-issued JWT to exchange for a short-lived deploy bearer."
          },
          "subject_token_type": {
            "type": "string",
            "enum": [
              "urn:ietf:params:oauth:token-type:jwt"
            ]
          },
          "audience": {
            "type": "string",
            "minLength": 1,
            "description": "Trust-policy audience pinned in the subject JWT."
          },
          "requested_token_type": {
            "type": "string",
            "enum": [
              "urn:ietf:params:oauth:token-type:access_token"
            ]
          },
          "scope": {
            "type": "string",
            "enum": [
              "deploy:write"
            ]
          }
        }
      },
      "OAuthTokenExchangeResponse": {
        "description": "RFC 8693 token exchange response with an opaque deploy bearer.",
        "type": "object",
        "required": [
          "access_token",
          "issued_token_type",
          "token_type",
          "expires_in",
          "scope"
        ],
        "properties": {
          "access_token": {
            "type": "string",
            "description": "Opaque `fp_oidc_…` bearer for deploy routes."
          },
          "issued_token_type": {
            "type": "string",
            "enum": [
              "urn:ietf:params:oauth:token-type:access_token"
            ]
          },
          "token_type": {
            "type": "string",
            "enum": [
              "Bearer"
            ]
          },
          "expires_in": {
            "type": "integer",
            "minimum": 1,
            "description": "Seconds until the bearer expires."
          },
          "scope": {
            "type": "string",
            "enum": [
              "deploy:write"
            ]
          }
        }
      },
      "OAuthTokenExchangeError": {
        "description": "RFC 8693 / OAuth 2.0 token endpoint error response.",
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "enum": [
              "invalid_request",
              "invalid_grant",
              "invalid_target",
              "invalid_scope",
              "unsupported_subject_token_type",
              "unsupported_token_type",
              "temporarily_unavailable"
            ]
          },
          "error_description": {
            "type": "string"
          }
        }
      },
      "FieldError": {
        "type": "object",
        "description": "Per-field entry of `Problem.errors`. The shape mirrors\nCloudflare's API Shield 422 / Stripe's `card_errors` family so\nan SDK can iterate `errors[]` to drive form-field UI without\nparsing prose. `field` uses JSON Pointer notation for nested\nkeys (`address.zip`). `expected` and `got` are short stable\nstrings; consumers should not depend on the prose.\n",
        "required": [
          "field",
          "expected"
        ],
        "properties": {
          "field": {
            "type": "string",
            "example": "name"
          },
          "expected": {
            "type": "string",
            "example": "string"
          },
          "got": {
            "type": "string",
            "example": "integer"
          }
        }
      },
      "SecretFinding": {
        "type": "object",
        "description": "Per-line entry of `Problem.secret_findings` AND\n`SecretScanResult.findings` (the surfaced shape is extended via the new\n`layer` field). The shape mirrors the secret scanner's findings\nbut is decoupled so the wire schema can evolve\nindependently of the scanner's internal fields. `snippet`\nis the pre-truncated safe representation (first 6 chars +\n\"…\" + last 4) — never the raw value, matching the snippet\npolicy documented. Closed-set\n`provider` keys: stripe_live, stripe_test, github_pat,\naws_access, openai, anthropic, private_key_block. The\noptional `layer` field names the per-walk source\nlabel — \"app\" for the main image, \"sidecar-<slug>\" for\neach sidecar, or absent for the API source-tree\nrejection path (legacy).\n",
        "required": [
          "file",
          "line",
          "provider",
          "severity",
          "snippet"
        ],
        "properties": {
          "file": {
            "type": "string",
            "example": ".env.production"
          },
          "line": {
            "type": "integer",
            "example": 2
          },
          "key": {
            "type": "string",
            "example": "STRIPE_SECRET_KEY"
          },
          "provider": {
            "type": "string",
            "example": "stripe_live"
          },
          "severity": {
            "type": "string",
            "enum": [
              "high",
              "medium"
            ],
            "example": "high"
          },
          "snippet": {
            "type": "string",
            "example": "sk_liv…XXXX"
          },
          "layer": {
            "type": "string",
            "description": "Per-walk source label. \"app\" for findings in\nthe main image; \"sidecar-<slug>\" for findings in a\nsidecar (e.g. \"sidecar-redis\"); absent or \"\" for\nfindings from the legacy API source-tree rejection\npath.\n",
            "example": "app"
          }
        }
      },
      "SecretScanResult": {
        "type": "object",
        "description": "Customer-facing wire shape of one deployment's secret-scan\naudit row. Mirrors the `ScanResult` shape but for the\nsecret-scan pipeline. The `status` enum is the closed set\nthe image service-side writer stamps: `complete` for a\nclean walk, `complete_with_redactions` for a hit (mirrors\nthe v2 widening on `deployments_scan_status_chk`). `image_digest` is the OCI digest the\nscan ran against — mirrors\n`ScanResult.image_digest` so a side-by-side compare\nrenders both scans against the same bytes. `findings[]`\nmay be empty (clean walk); the field is always present\nfor round-trip JSON stability.\n",
        "required": [
          "status",
          "findings"
        ],
        "properties": {
          "status": {
            "type": "string",
            "example": "complete"
          },
          "scanned_at": {
            "type": "string",
            "format": "date-time",
            "description": "RFC 3339 UTC. Empty when the deployment hasn't been\nsecret-scanned yet.\n"
          },
          "image_digest": {
            "type": "string",
            "description": "OCI digest the scan ran against. Mirrors\n`ScanResult.image_digest` for cross-pipeline\ncomparison. Empty for older rows.\n",
            "example": "sha256:abc..."
          },
          "findings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SecretFinding"
            }
          },
          "error": {
            "type": "string",
            "description": "In-band explanation when the audit row is unreadable\n(jsonb decode failed). Mirrors `ScanResult.error`.\nEmpty on the success path — `status` carries the\nclosed-set signal there.\n"
          }
        }
      },
      "Problem": {
        "type": "object",
        "required": [
          "title",
          "status",
          "code"
        ],
        "description": "RFC 9457 problem+json envelope. The `code` field is the stable\nmachine-readable identifier; clients branch on it. `limit` and\n`observed` are populated on quota errors. `docs_url` points the\nuser at the next action. Common customer-facing codes and recovery\nguidance are listed in `docs/errors.md`. `billing_portal_url` is\npopulated on `code: payment_required` when the customer already has a\nprovider subscription and must update it in the provider\nportal. `checkout_url` is populated when a new hosted checkout\nis required. `paddle_checkout_url` is retained as a legacy\nalias for Paddle clients, and `tx_id` carries the provider\ncheckout handle when one exists.\n\n`errors` carries per-field detail (Cloudflare / Stripe shape)\nfor 422 sites that emit a list of field-level failures — used\ntoday by the kind=validate edge rule so a JSON Schema\nrejection renders as a form-field list the dashboard can\niterate without parsing prose. Optional + omitempty so every\nother problem+json site keeps its existing flat shape unchanged.\n",
        "example": {
          "type": "https://gregale.dev/docs/errors/validation_failed",
          "title": "Validation failed",
          "status": 422,
          "code": "validation_failed",
          "detail": "ram_mb must be one of [128, 256, 512, 1024, 2048]",
          "limit": null,
          "observed": null,
          "docs_url": "https://gregale.dev/docs/errors/validation_failed"
        },
        "properties": {
          "current_sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Observed channel head on realtime_sequence_conflict."
          },
          "agent_approval": {
            "$ref": "#/components/schemas/AgentApprovalPendingInfo"
          },
          "condition_field": {
            "type": "string"
          },
          "condition_index": {
            "type": "integer",
            "minimum": 0
          },
          "field_exists": {
            "type": "boolean"
          },
          "entity_key": {
            "type": "string"
          },
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "current_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "entity_exists": {
            "type": "boolean"
          },
          "message_index": {
            "type": "integer",
            "minimum": 0
          },
          "expected_sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Requested channel head precondition."
          },
          "bindings_check": {
            "$ref": "#/components/schemas/BindingCheckReport"
          },
          "crossed_releases": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RollbackCrossedRelease"
            },
            "description": "rollback_crosses_release: release commands the rollback would not undo."
          },
          "restore_points": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReleaseRestorePoint"
            },
            "description": "rollback_crosses_release: how to restore each managed PostgreSQL database to before those releases."
          },
          "freezes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReleaseFreeze"
            },
            "description": "release_frozen: the freezes refusing the release."
          },
          "release_approval": {
            "$ref": "#/components/schemas/ReleaseApprovalStatus"
          },
          "type": {
            "type": "string",
            "format": "uri-reference",
            "example": "https://gregale.dev/docs/errors/validation_failed"
          },
          "title": {
            "type": "string",
            "example": "Validation failed"
          },
          "status": {
            "type": "integer",
            "example": 422
          },
          "instance": {
            "type": "string",
            "format": "uri-reference",
            "description": "URI reference identifying this problem occurrence when supplied by the caller."
          },
          "code": {
            "type": "string",
            "description": "Stable machine-readable error code. See StatusForCode."
          },
          "detail": {
            "type": "string"
          },
          "limit": {
            "type": [
              "integer",
              "null"
            ]
          },
          "observed": {
            "type": [
              "integer",
              "null"
            ]
          },
          "limit_bytes": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Explicit byte limit for request-body and other byte-oriented errors."
          },
          "observed_bytes": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Observed byte count for request-body and other byte-oriented errors."
          },
          "docs_url": {
            "type": "string",
            "format": "uri"
          },
          "retry_after_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Retry delay promoted from the HTTP Retry-After header by SDK clients when the header uses delta-seconds."
          },
          "checkout_url": {
            "type": "string",
            "format": "uri",
            "description": "Provider-neutral hosted checkout URL on a `payment_required`\n402 when a paid plan upgrade requires a new subscription.\n"
          },
          "billing_portal_url": {
            "type": "string",
            "format": "uri"
          },
          "paddle_checkout_url": {
            "type": "string",
            "format": "uri",
            "description": "Legacy Paddle-hosted checkout URL on a `payment_required`\n402. Prefer the provider-neutral `checkout_url` field.\n"
          },
          "tx_id": {
            "type": "string",
            "description": "Paddle transaction handle (`txn_…`) on a `payment_required`\n402. Empty on the Stripe path. The dashboard renders this as\na confirmation id after the customer completes checkout.\n"
          },
          "errors": {
            "type": "array",
            "description": "Per-field validation detail. Populated by 422 sites that\nemit a list of field-level failures. Each entry is a\n`FieldError` (Cloudflare / Stripe shape: field + expected\n+ got) so an SDK can drive form-field UI without parsing\nprose.\n",
            "items": {
              "$ref": "#/components/schemas/FieldError"
            }
          },
          "secret_findings": {
            "type": "array",
            "description": "Per-line secret-scan detail. Populated by 422 sites with\n`code: secret_scan_strict` (the server-side scan rejection,\nand the CLI's `--secret-scan=strict` client-side rejection). The shape\nis shared with the on-disk `SecretScanResult` so a\nprogrammatic consumer can render the same UI for both\nrejection paths. Optional + omitempty.\n",
            "items": {
              "$ref": "#/components/schemas/SecretFinding"
            }
          },
          "secret_hint": {
            "type": "string",
            "description": "Customer-facing remediation nudge attached to a\n`code: secret_scan_strict` 422 envelope (e.g. \"move\ndetected secrets to `gregale secrets set`\"). Mirrors\nthe `FieldError` shape's prose pattern so the dashboard\n/ SDK can render the hint as a one-line footer without\nparsing prose. Optional + omitempty.\n",
            "example": "move detected secrets to `gregale secrets set` (see https://gregale.dev/docs/secrets)"
          },
          "hint": {
            "type": "string",
            "description": "Single short next-action line lifted from the\nerror-explanation catalog. Populated by the 9 cluster-\nowned RFC 7807 codes (app_not_listening,\napp_loopback_bound, app_arch_mismatch,\nenv_var_missing, app_healthz_unauthorized,\napp_runtime_oom, dep_install_failed,\napp_startup_timeout, stateless_only_violation). The\nCLI renders this as the first line of the 5-line\nerror shape (`hint: <hint>`). Optional + omitempty\nso every other problem+json site keeps its existing\n3-line shape unchanged.\n",
            "example": "your app isn't accepting traffic on the port we expect"
          },
          "why": {
            "type": "string",
            "description": "Human-readable cause with the observed value templated\nin (error-explanations cluster).\nDistinct from `detail`: `detail` is the platform's\nmachine-stable message; `why` is the customer-facing\nexplanation. Multi-line (≤512 bytes per catalog row). Optional + omitempty.\n",
            "example": "the wake readiness probe found no listener on $PORT after the wake timeout"
          },
          "fix": {
            "type": "string",
            "description": "Prescriptive remediation (1-3 lines, error-explanations\ncluster). Distinct from `hint`:\n`hint` is a single line, `fix` is the bulleted\nremediation list. The CLI renders this as\n`→ fix: <fix>` with literal newlines preserved so the\nmulti-line shape survives. Optional + omitempty.\n",
            "example": "• make sure your app listens on process.env.PORT (or 8080)\n• if you bind manually, bind to 0.0.0.0 not 127.0.0.1"
          },
          "relevant_logs": {
            "type": "array",
            "description": "Per-line log excerpts that explain the failure (error-\nexplanations cluster). The\ndetection site attaches the last N log lines that\ncaused the failure (capped at 20 entries × 512 bytes\neach per CLI tripwire). The CLI renders the first 5\ninline as a fenced block. Optional + omitempty.\n",
            "items": {
              "$ref": "#/components/schemas/LogExcerpt"
            }
          }
        }
      },
      "LogExcerpt": {
        "type": "object",
        "description": "One log entry attached to a `Problem` (error-explanations\ncluster) or persisted on\n`deployments.error_relevant_logs`. The shape mirrors the\ncluster's per-line log wire: `ts` is RFC3339 (apids\nstamp format), `level` is one of `info|warn|error`,\n`source` is the cluster's source discriminator\n(build|vm-init|app|gateway), `message` is ≤512 bytes.\n",
        "properties": {
          "ts": {
            "type": "string",
            "example": "2026-08-18T10:00:00Z"
          },
          "level": {
            "type": "string",
            "enum": [
              "info",
              "warn",
              "error"
            ],
            "example": "error"
          },
          "source": {
            "type": "string",
            "enum": [
              "build",
              "vm-init",
              "app",
              "gateway"
            ],
            "example": "app"
          },
          "message": {
            "type": "string",
            "example": "the kernel OOM-killer fired on the workload"
          }
        }
      },
      "MFAEnrollRequest": {
        "description": "Empty body — the customer brings only their session cookie.\nKept as a real struct (not `additionalProperties: false`) so\n`{}` decodes cleanly without a \"no JSON object\" parse error.\n",
        "type": "object",
        "additionalProperties": false
      },
      "CSRFTokenResponse": {
        "description": "Action-bound CSRF token for browser clients.",
        "type": "object",
        "required": [
          "csrf_token"
        ],
        "properties": {
          "csrf_token": {
            "type": "string",
            "description": "Opaque token to echo in the mutation's JSON body."
          }
        }
      },
      "MFAEnrollResponse": {
        "description": "One-shot enrollment payload. Returned exactly once on\n/enroll. The server persists `mfa_secret_encrypted` (sealed)\nand `mfa_recovery_codes_hash` (SHA-256d); subsequent calls\nto /enroll overwrite the secret + codes but do NOT\nre-surface the plaintexts to the dashboard.\n",
        "type": "object",
        "required": [
          "otpauth_url",
          "secret",
          "qr_code_png_base64",
          "recovery_codes"
        ],
        "properties": {
          "otpauth_url": {
            "type": "string",
            "description": "Standard `otpauth://totp/...` URL with the issuer = FaaS.\nThe customer's authenticator app ingests this on its own;\nthe dashboard also embeds the QR for camera-based setup.\n",
            "example": "otpauth://totp/FaaS:alice@example.com?secret=JBSWY3DPEHPK3PXP&issuer=FaaS"
          },
          "secret": {
            "type": "string",
            "pattern": "^[A-Z2-7]{32}$",
            "description": "Base32-encoded TOTP secret, 32 chars (no padding). Same\nvalue embedded in the otpauth URL; surfaced here so the\ndashboard can render the secret directly for\ncopy-paste into an authenticator app that doesn't read\nURLs.\n"
          },
          "qr_code_png_base64": {
            "type": "string",
            "format": "byte",
            "description": "Base64-encoded PNG bytes of the QR code (256×256). The\nserver base64-encodes the raw PNG for JSON transport;\nthe dashboard decodes the string back to bytes before\nrendering it in an `<img>` tag. The authenticator scans\nthe decoded PNG.\n"
          },
          "recovery_codes": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[A-Z0-9]{10}$"
            },
            "minItems": 10,
            "maxItems": 10,
            "description": "Ten single-use 10-character base32 strings. The\ndashboard renders them in the \"save these somewhere\"\nstep. Each code is hashed (SHA-256) before storage;\nthe plaintext never reappears.\n"
          }
        }
      },
      "MFAConfirmRequest": {
        "description": "Body for /confirm — a TOTP code and the existing password, if set.",
        "type": "object",
        "required": [
          "totp"
        ],
        "properties": {
          "totp": {
            "type": "string",
            "pattern": "^[0-9]{6}$",
            "description": "6-digit rotating code from the authenticator app."
          },
          "current_password": {
            "type": "string",
            "format": "password",
            "description": "Required when the account already has a password; authorizes the new factor."
          },
          "csrf_token": {
            "type": "string",
            "description": "Dashboard CSRF token. The dashboard sets a\n`faas_csrf` cookie on every authenticated response; the\nsame value rides in this JSON-body field so the\nserver can compare them.\nThe token is opaque to the wire (sealed session\nreference); size matches the cookie value.\n"
          }
        }
      },
      "MFAConfirmResponse": {
        "description": "Empty success body. The meaningful side effect is the\n`Set-Cookie: faas_sid=…` header — re-issued without the\n`mfa_pending` flag — and the stamp of `mfa_enrolled_at`.\n",
        "type": "object",
        "additionalProperties": false
      },
      "MFAVerifyRequest": {
        "description": "Body for /verify — same 6-digit code as /confirm. The\naccount is already enrolled; the verify path does NOT re-\nstamp enrolled_at, only re-issues the cookie without\nmfa_pending.\n",
        "type": "object",
        "required": [
          "totp"
        ],
        "properties": {
          "totp": {
            "type": "string",
            "pattern": "^[0-9]{6}$"
          },
          "csrf_token": {
            "type": "string",
            "description": "Dashboard CSRF token (absorbed from the body for\nparity with /confirm; /verify is not token-gated\nbecause the TOTP code itself IS the second factor).\n"
          }
        }
      },
      "MFAVerifyResponse": {
        "description": "Empty success body. Same semantics as /confirm response.",
        "type": "object",
        "additionalProperties": false
      },
      "MFARecoverRequest": {
        "description": "Body for /recover — one of the 10 recovery codes the\ncustomer received on /enroll. The hash is removed from\nthe stored set; subsequent /recover calls with the same\ncode return 401.\n",
        "type": "object",
        "required": [
          "code"
        ],
        "properties": {
          "code": {
            "type": "string",
            "pattern": "^[A-Z0-9]{10}$"
          },
          "csrf_token": {
            "type": "string",
            "description": "Dashboard CSRF token for the recover mutation."
          }
        }
      },
      "MFARecoverResponse": {
        "description": "Empty success body. Side effects: the matching hash is\nremoved from `mfa_recovery_codes_hash`; the session cookie\nis re-issued without `mfa_pending` and with recent MFA verification.\nThe last remaining code returns `mfa_last_recovery_code`; use it\nto reset the authenticator instead, then enroll a replacement.\n",
        "type": "object",
        "additionalProperties": false
      },
      "MFADisableRequest": {
        "description": "Body for /disable. Exactly one of `password` or\n`recovery_code` is required — both empty and both set are\nrejected with 400 CodeValidation. Password is verified\nagainst the existing `account_passwords.hash`; the\nrecovery code is consumed (one-time).\n",
        "type": "object",
        "properties": {
          "password": {
            "type": "string",
            "minLength": 12,
            "maxLength": 256
          },
          "recovery_code": {
            "type": "string",
            "pattern": "^[A-Z0-9]{10}$"
          },
          "csrf_token": {
            "type": "string",
            "description": "Dashboard CSRF token for the disable mutation."
          }
        }
      },
      "MFADisableResponse": {
        "description": "Empty success body. Side effects: mfa_secret_encrypted,\nmfa_recovery_codes_hash, and mfa_enrolled_at are all NULL.\nmfa_required is left as-is so an explicit policy remains in\nforce after disable. The browser cookie is refreshed with the\ncurrent enrollment requirement and its recent-verification stamp cleared.\n",
        "type": "object",
        "additionalProperties": false
      },
      "MFADisableEmailRequest": {
        "description": "Body for requesting email-assisted MFA disable.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "csrf_token": {
            "type": "string"
          }
        }
      },
      "MFADisableEmailResponse": {
        "description": "Empty success body; the confirmation link is sent by email.",
        "type": "object",
        "additionalProperties": false
      },
      "MFADisableEmailConfirmRequest": {
        "description": "Body for consuming the emailed token after the cooldown.",
        "type": "object",
        "required": [
          "token"
        ],
        "additionalProperties": false,
        "properties": {
          "token": {
            "type": "string",
            "description": "Opaque base64url token from the confirmation email."
          },
          "csrf_token": {
            "type": "string"
          }
        }
      },
      "MFADisableEmailConfirmResponse": {
        "description": "Empty success body; MFA state is cleared.",
        "type": "object",
        "additionalProperties": false
      },
      "TrustedSigner": {
        "description": "One entry in the per-app cosign trusted-publisher list. `name` is the\nAPI-side label (matches `app_trusted_signers.signer_name`); `public_key_pem`\nis the base64-encoded DER SubjectPublicKeyInfo bytes — NOT a PEM-armoured\nblock. The wire form strips the PEM armour at upload time so the\non-disk mirror (the image service reads `/etc/faas/secrets/trusted-publishers/`) is\na single blob per publisher. ECDSA P-256 only; the API rejects\nother curves at PUT time with `trusted_signer_invalid`.\n",
        "type": "object",
        "required": [
          "name",
          "public_key_pem",
          "added_at"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$",
            "example": "ci-bot",
            "description": "Lower-case label. Matches `app_trusted_signers.signer_name`. The label is the on-disk filename (without .pem) under /etc/faas/secrets/trusted-publishers/."
          },
          "public_key_pem": {
            "type": "string",
            "description": "Base64-encoded DER SubjectPublicKeyInfo. Bytes length must be in [64, 1024] (DB CHECK).",
            "example": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE..."
          },
          "added_at": {
            "type": "string",
            "format": "date-time",
            "description": "RFC3339 timestamp of when the operator onboarded this publisher."
          },
          "added_by": {
            "type": "string",
            "description": "Account ID of the admin who onboarded this publisher (omit when not yet in audit log).",
            "example": "0123456789abcdef0123456789abcdef"
          }
        }
      },
      "AddTrustedSignerRequest": {
        "description": "PUT body for `/v1/apps/{slug}/trusted_signers/{name}`. `public_key_pem` is\nthe base64-encoded DER blob (the API side strips PEM armour). The DER must\nparse as an ECDSA P-256 SPKI; any other curve or non-ECDSA key returns\n400 `trusted_signer_invalid`. Bytes length must land in [64, 1024].\n",
        "type": "object",
        "required": [
          "public_key_pem"
        ],
        "properties": {
          "public_key_pem": {
            "type": "string",
            "minLength": 88,
            "maxLength": 1400,
            "description": "Base64-encoded DER SubjectPublicKeyInfo. Length bounds match the DB CHECK.",
            "example": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE..."
          }
        }
      },
      "AppTrustedSignerListResponse": {
        "description": "GET /v1/apps/{slug}/trusted_signers response body. Empty list is the EXPECTED state for any app with require_signed=false.",
        "type": "object",
        "required": [
          "signers"
        ],
        "properties": {
          "signers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TrustedSigner"
            }
          }
        }
      },
      "AppSecurityRequest": {
        "description": "PATCH body for `/v1/apps/{slug}/security`. Both fields are optional\nso an operator can change signature enforcement and deploy posture\nindependently.\n",
        "type": "object",
        "properties": {
          "require_signed": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Operator-only toggle. nil = no change. *true = opt in to signature enforcement (requires the trust list to be non-empty). *false = opt out.",
            "example": true
          },
          "security_policy": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "off",
              "warn",
              "enforce"
            ],
            "description": "Deploy-time response to high-severity configuration findings. off = advisory report only; warn = non-blocking; enforce = reject new deploys until remediated and require a trusted signature for OCI images.",
            "example": "enforce"
          }
        }
      },
      "AppSecurityResponse": {
        "description": "PATCH /v1/apps/{slug}/security response body — the updated security controls.",
        "type": "object",
        "required": [
          "require_signed",
          "security_policy"
        ],
        "properties": {
          "require_signed": {
            "type": "boolean",
            "description": "The current state of the require_signed flag after the patch.",
            "example": true
          },
          "security_policy": {
            "type": "string",
            "enum": [
              "off",
              "warn",
              "enforce"
            ],
            "description": "The current deploy-time posture policy after the patch.",
            "example": "enforce"
          }
        }
      },
      "AppSecurityPostureResponse": {
        "description": "Read-only configuration posture and live-image scan-evidence coverage for an app, including an active image-scan quarantine when present.",
        "type": "object",
        "required": [
          "app_id",
          "slug",
          "profile",
          "score",
          "security_policy",
          "findings"
        ],
        "properties": {
          "app_id": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "profile": {
            "type": "string",
            "enum": [
              "public",
              "authenticated",
              "internal"
            ]
          },
          "score": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "security_policy": {
            "type": "string",
            "enum": [
              "off",
              "warn",
              "enforce"
            ],
            "description": "The app's deploy-time response to high-severity configuration findings."
          },
          "findings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppSecurityFinding"
            }
          },
          "quarantine": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AppSecurityQuarantine"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "AppSecurityQuarantine": {
        "description": "Active image-scan quarantine details. Vulnerability findings remain on the deployment scan resource.",
        "type": "object",
        "required": [
          "deployment_id",
          "image_digest",
          "reason"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "description": "Deployment whose scan regression caused the quarantine."
          },
          "image_digest": {
            "type": "string",
            "description": "Immutable image digest that was quarantined."
          },
          "reason": {
            "type": "string",
            "enum": [
              "security_scan_regressed"
            ]
          },
          "parked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "SecurityQuarantineRecoveryRequest": {
        "description": "The clean live deployment to use when recovering an app from image-scan quarantine.",
        "type": "object",
        "required": [
          "deployment_id"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "description": "Live replacement deployment with complete, digest-matched clean scan evidence."
          }
        }
      },
      "SecurityQuarantineRecoveryResponse": {
        "description": "The app's post-recovery active state.",
        "type": "object",
        "required": [
          "app_id",
          "slug",
          "deployment_id",
          "image_digest",
          "recovered_at",
          "status"
        ],
        "properties": {
          "app_id": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string"
          },
          "image_digest": {
            "type": "string"
          },
          "recovered_at": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": [
              "active"
            ]
          }
        }
      },
      "AppSecurityFinding": {
        "description": "One actionable security posture finding. Codes beginning with image_scan_ describe live-image scan-evidence coverage.",
        "type": "object",
        "required": [
          "code",
          "severity",
          "title",
          "detail",
          "remediation"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "severity": {
            "type": "string",
            "enum": [
              "critical",
              "high",
              "medium",
              "low",
              "info"
            ]
          },
          "title": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          },
          "remediation": {
            "type": "string"
          }
        }
      },
      "AppStaticEgressIPResponse": {
        "description": "GET /v1/apps/{slug}/static-egress-ip response body.\nIP / SetAt are pointers so the wire shape is stable: a Scale\ncustomer with no pin yet sees `ip=null`, `set_at=null`,\n`plan_cap=1`, `plan_allowed=true`. PlanCap is the\nLimits.StaticEgressIPsPerApp value (1 in v1) so the dashboard\ncan render \"you can use 1 static IP per app\" without the CLI\nround-tripping the plan table.\n",
        "type": "object",
        "required": [
          "ip",
          "set_at",
          "plan_cap",
          "plan_allowed"
        ],
        "properties": {
          "ip": {
            "type": [
              "string",
              "null"
            ],
            "format": "ipv4",
            "description": "The pinned IPv4 (dotted-quad). `null` when the customer\nhas not pinned an IP yet. The DB family=4 CHECK\nguarantees this is never IPv6.\n",
            "example": "203.0.113.42"
          },
          "set_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "RFC 3339 timestamp for when the customer pinned the IP.\n`null` when IP is `null`.\n",
            "example": "2026-08-19T12:00:00.000Z"
          },
          "plan_cap": {
            "type": "integer",
            "minimum": 0,
            "description": "Per-app quota cap (Limits.StaticEgressIPsPerApp). 1 in v1\nfor Scale; 0 for plans that don't allow static egress IPs.\n",
            "example": 1
          },
          "plan_allowed": {
            "type": "boolean",
            "description": "Whether the account's plan permits static egress IPs\n(Plan.StaticEgressIPAllowed). `true` for Scale; `false`\nfor Free / Hobby / Pro so the CLI can render the upsell.\n",
            "example": true
          }
        }
      },
      "SetAppStaticEgressIPRequest": {
        "description": "PUT /v1/apps/{slug}/static-egress-ip body. IP is\nthe canonical customer-supplied IPv4 (dotted-quad string).\nThe handler validates the family=4 + non-RFC1918 +\nnon-link-local + non-multicast shape before the column\nwrite. Set=false with empty IP means \"clear\" — the same\nwire body covers the DELETE /keep-IP promotion path\nwithout a third endpoint.\n",
        "type": "object",
        "required": [
          "ip",
          "set"
        ],
        "properties": {
          "ip": {
            "type": "string",
            "description": "Customer-supplied IPv4 (dotted-quad). Required when\n`set=true`. Empty string when `set=false`.\n",
            "example": "203.0.113.42"
          },
          "set": {
            "type": "boolean",
            "description": "`true` to pin the IP; `false` to clear the pin.\n",
            "example": true
          }
        }
      },
      "AppPrivateNetworkAttachment": {
        "description": "Provider-neutral private-network attachment intent for one app.\n`pending` and `error` are fail-closed; only `ready` admits private\nnetwork traffic after a connector has reconciled the request.\n",
        "type": "object",
        "required": [
          "id",
          "network_id",
          "region",
          "cidrs",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "network_id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$",
            "example": "prod-vpc"
          },
          "region": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$",
            "example": "fra1"
          },
          "cidrs": {
            "type": "array",
            "minItems": 1,
            "maxItems": 64,
            "items": {
              "type": "string",
              "format": "ipv4-cidr"
            },
            "example": [
              "10.20.0.0/16",
              "10.30.0.0/16"
            ]
          },
          "allowed_cidrs": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "type": "string",
              "format": "ipv4-cidr"
            },
            "description": "Optional private-network policy. Empty preserves allow-all behavior; populated ranges are admitted symmetrically for private egress and ingress."
          },
          "address": {
            "type": "string",
            "format": "ipv4",
            "description": "Stable Gregale member address for this app when the fabric is enabled."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "ready",
              "error"
            ]
          },
          "status_detail": {
            "type": "string"
          },
          "nodes": {
            "type": "array",
            "description": "Last durable convergence result for each compute node serving this attachment.",
            "items": {
              "$ref": "#/components/schemas/AppPrivateNetworkNodeStatus"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AppPrivateNetworkNodeStatus": {
        "description": "Last durable fabric and route convergence result for one compute node.",
        "type": "object",
        "required": [
          "node_id"
        ],
        "properties": {
          "node_id": {
            "type": "string",
            "description": "Compute-node identity that reported the observation."
          },
          "fabric_status": {
            "type": "string",
            "enum": [
              "ready",
              "error"
            ]
          },
          "fabric_detail": {
            "type": "string"
          },
          "route_status": {
            "type": "string",
            "enum": [
              "ready",
              "error"
            ]
          },
          "route_detail": {
            "type": "string"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AppPrivateNetworkAttachmentResponse": {
        "description": "Capability metadata and the current private-network intent.",
        "type": "object",
        "required": [
          "feature_enabled",
          "plan_allowed",
          "max_cidrs",
          "attachment"
        ],
        "properties": {
          "feature_enabled": {
            "type": "boolean"
          },
          "plan_allowed": {
            "type": "boolean"
          },
          "max_cidrs": {
            "type": "integer",
            "minimum": 0,
            "maximum": 64
          },
          "attachment": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AppPrivateNetworkAttachment"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "PrivateNetworkPeering": {
        "description": "Durable, provider-neutral peering intent between two Gregale-owned networks.",
        "type": "object",
        "required": [
          "id",
          "network_id",
          "peer_network_id",
          "region",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "network_id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "peer_network_id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "region": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "ready",
              "error"
            ]
          },
          "status_detail": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PrivateNetworkPeeringListResponse": {
        "description": "Peerings involving one account-scoped private network.",
        "type": "object",
        "required": [
          "peerings"
        ],
        "properties": {
          "peerings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PrivateNetworkPeering"
            }
          }
        }
      },
      "CreatePrivateNetworkPeeringRequest": {
        "description": "POST /v1/networks/{id}/peerings body.",
        "type": "object",
        "required": [
          "peer_network_id"
        ],
        "properties": {
          "peer_network_id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$",
            "description": "Another Gregale-owned network in the same account and region."
          }
        }
      },
      "PrivateNetwork": {
        "description": "Gregale-owned private-network definition.",
        "type": "object",
        "required": [
          "id",
          "name",
          "region",
          "cidr",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "region": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "cidr": {
            "type": "string",
            "format": "ipv4-cidr",
            "description": "Canonical IPv4 RFC1918 range, /16 through /28."
          },
          "allowed_cidrs": {
            "type": "array",
            "maxItems": 64,
            "description": "Optional reusable CIDR allowlist for all attached workloads.",
            "items": {
              "type": "string",
              "format": "ipv4-cidr"
            }
          },
          "firewall_rules": {
            "type": "array",
            "maxItems": 64,
            "description": "Optional protocol/port allow rules applied to every attachment.",
            "items": {
              "$ref": "#/components/schemas/PrivateNetworkFirewallRule"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "ready",
              "error"
            ]
          },
          "status_detail": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PrivateNetworkListResponse": {
        "description": "Account-scoped collection of Gregale-owned private networks.",
        "type": "object",
        "required": [
          "networks"
        ],
        "properties": {
          "networks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PrivateNetwork"
            }
          }
        }
      },
      "PrivateNetworkMember": {
        "description": "Stable address reservation for one member of a Gregale-owned network.",
        "type": "object",
        "required": [
          "id",
          "owner_type",
          "owner_id",
          "address"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "owner_type": {
            "type": "string",
            "description": "Platform resource kind that owns the reservation, such as app."
          },
          "owner_id": {
            "type": "string",
            "description": "Opaque platform resource identifier."
          },
          "address": {
            "type": "string",
            "format": "ipv4"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PrivateNetworkMembersResponse": {
        "description": "Account-scoped member inventory and address capacity for one network.",
        "type": "object",
        "required": [
          "network_id",
          "cidr",
          "capacity",
          "used",
          "available",
          "members"
        ],
        "properties": {
          "network_id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "cidr": {
            "type": "string",
            "format": "ipv4-cidr"
          },
          "capacity": {
            "type": "integer",
            "minimum": 0,
            "description": "Allocatable member addresses after network, gateway, and broadcast reservations."
          },
          "used": {
            "type": "integer",
            "minimum": 0
          },
          "available": {
            "type": "integer",
            "minimum": 0
          },
          "members": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PrivateNetworkMember"
            }
          }
        }
      },
      "CreatePrivateNetworkRequest": {
        "description": "POST /v1/networks body for a Gregale-owned network.",
        "type": "object",
        "required": [
          "name",
          "region",
          "cidr"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "region": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "cidr": {
            "type": "string",
            "format": "ipv4-cidr"
          },
          "allowed_cidrs": {
            "type": "array",
            "maxItems": 64,
            "description": "Optional reusable CIDR allowlist contained by cidr.",
            "items": {
              "type": "string",
              "format": "ipv4-cidr"
            }
          },
          "firewall_rules": {
            "type": "array",
            "maxItems": 64,
            "description": "Optional protocol/port allow rules contained by cidr.",
            "items": {
              "$ref": "#/components/schemas/PrivateNetworkFirewallRule"
            }
          }
        }
      },
      "UpdatePrivateNetworkPolicyRequest": {
        "description": "PUT /v1/networks/{id}/policy body.",
        "type": "object",
        "required": [
          "allowed_cidrs"
        ],
        "properties": {
          "allowed_cidrs": {
            "type": "array",
            "maxItems": 64,
            "description": "CIDRs reachable by attached workloads; empty disables the CIDR restriction.",
            "items": {
              "type": "string",
              "format": "ipv4-cidr"
            }
          },
          "firewall_rules": {
            "type": "array",
            "maxItems": 64,
            "description": "Protocol/port allow rules contained by the network CIDR; empty disables the rule restriction.",
            "items": {
              "$ref": "#/components/schemas/PrivateNetworkFirewallRule"
            }
          }
        }
      },
      "PrivateNetworkFirewallRule": {
        "description": "Provider-neutral private-network allow rule.",
        "type": "object",
        "required": [
          "direction",
          "protocol"
        ],
        "properties": {
          "direction": {
            "type": "string",
            "enum": [
              "ingress",
              "egress"
            ]
          },
          "protocol": {
            "type": "string",
            "enum": [
              "tcp",
              "udp",
              "icmp"
            ]
          },
          "cidrs": {
            "type": "array",
            "maxItems": 64,
            "description": "Source CIDRs for ingress or destination CIDRs for egress; empty means the network CIDR.",
            "items": {
              "type": "string",
              "format": "ipv4-cidr"
            }
          },
          "ports": {
            "type": "array",
            "maxItems": 16,
            "description": "TCP/UDP ports or inclusive ranges such as 443 or 8000-8080; omit for ICMP.",
            "items": {
              "type": "string",
              "pattern": "^[0-9]{1,5}(-[0-9]{1,5})?$"
            }
          }
        }
      },
      "AppPrivateNetworkAttachmentRequest": {
        "description": "PUT body for /v1/apps/{slug}/network/private.",
        "type": "object",
        "required": [
          "network_id"
        ],
        "properties": {
          "network_id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "region": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$",
            "description": "Optional when attaching a Gregale-owned network; it must match the network region."
          },
          "cidrs": {
            "type": "array",
            "minItems": 0,
            "maxItems": 64,
            "items": {
              "type": "string",
              "format": "ipv4-cidr"
            }
          },
          "allowed_cidrs": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "type": "string",
              "format": "ipv4-cidr"
            },
            "description": "Optional private-network policy ranges. Each range must be contained by the attached network CIDR."
          }
        }
      },
      "CreateOrgRequest": {
        "description": "POST /v1/orgs body. Slug matches `OrgSlugPattern`\n(lowercase alphanumeric + dashes, 3..32 chars); name is\ntrimmed-non-empty, capped at 256 chars. Personal orgs\ncannot be created via this endpoint — every account\nalready owns an immutable personal org (backfill).\n",
        "type": "object",
        "required": [
          "slug",
          "name"
        ],
        "properties": {
          "slug": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{1,30})[a-z0-9]$",
            "minLength": 3,
            "maxLength": 32,
            "example": "acme"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "example": "Acme Inc."
          }
        }
      },
      "PatchOrgRequest": {
        "description": "PATCH /v1/orgs/{slug} body. Both fields are pointer-typed\nso the handler distinguishes \"omitted\" (leave alone) from\n\"zero\" (clear/empty). Authz routing:\n  - name → org.manage_billing (owner + billing roles)\n  - plan → org.change_plan (owner only)\n",
        "type": "object",
        "properties": {
          "name": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 256,
            "example": "Acme Inc. (renamed)"
          },
          "plan": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "free",
              "hobby",
              "pro",
              "scale"
            ],
            "example": "pro"
          }
        }
      },
      "OrgResponse": {
        "description": "Canonical org wire shape. RFC3339 timestamps; zero-time\nserialises as empty string.\n",
        "type": "object",
        "required": [
          "id",
          "slug",
          "name",
          "personal",
          "plan",
          "status",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
            "description": "Org UUID (stable across renames)."
          },
          "slug": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{1,30})[a-z0-9]$",
            "minLength": 3,
            "maxLength": 32,
            "description": "Lowercase slug. Personal orgs use `u-<12hex>`."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "personal": {
            "type": "boolean",
            "description": "True iff this is the caller's personal org (every account has exactly one)."
          },
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "hobby",
              "pro",
              "scale"
            ],
            "description": "Plan tier. Personal orgs default to `free`."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "past_due",
              "suspended",
              "deleted_pending"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OrgListResponse": {
        "description": "GET /v1/orgs response. Sorted by slug.",
        "type": "object",
        "required": [
          "orgs"
        ],
        "properties": {
          "orgs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrgResponse"
            }
          }
        }
      },
      "OrgAppSummary": {
        "description": "Deliberately small inventory projection for an organization app.\nDoes not expose creator identity, environment, secrets, or app\nconfiguration while app-specific routes remain creator-scoped.\n",
        "type": "object",
        "required": [
          "id",
          "slug",
          "type",
          "status",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "app",
              "function"
            ]
          },
          "runtime": {
            "type": "string",
            "description": "Runtime identifier for functions when configured."
          },
          "project_id": {
            "type": "string",
            "format": "uuid",
            "description": "Parent project as a canonical hyphenated UUID. Omitted when the app is standalone."
          },
          "status": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreateApplicationStandardLogDestinationRequest": {
        "type": "object",
        "description": "A logging endpoint and optional write-only credential to seal.",
        "additionalProperties": false,
        "required": [
          "name",
          "kind",
          "target_url"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "kind": {
            "type": "string",
            "enum": [
              "http_json",
              "otlp"
            ]
          },
          "target_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048,
            "description": "HTTPS endpoint without userinfo, query string or fragment. Put credentials in auth_header."
          },
          "auth_header": {
            "type": "string",
            "maxLength": 4096,
            "writeOnly": true,
            "description": "One Name/value header, sealed server-side and never returned."
          }
        }
      },
      "ApplicationStandardLogDestination": {
        "type": "object",
        "description": "An immutable logging endpoint with credential presence and a configuration hash.",
        "additionalProperties": false,
        "required": [
          "id",
          "org_id",
          "name",
          "kind",
          "target_url",
          "has_auth_header",
          "config_hash",
          "created_by",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "http_json",
              "otlp"
            ]
          },
          "target_url": {
            "type": "string",
            "format": "uri"
          },
          "has_auth_header": {
            "type": "boolean"
          },
          "config_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "created_by": {
            "type": "string",
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ApplicationStandardLogDestinationList": {
        "type": "object",
        "description": "A page of immutable logging destinations.",
        "additionalProperties": false,
        "required": [
          "destinations"
        ],
        "properties": {
          "destinations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApplicationStandardLogDestination"
            }
          },
          "next_page_after": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "CreateApplicationStandardPublisherRequest": {
        "type": "object",
        "description": "An approved ECDSA P-256 public signing key.",
        "additionalProperties": false,
        "required": [
          "name",
          "public_key_der"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "public_key_der": {
            "type": "string",
            "format": "byte",
            "description": "Base64 ECDSA P-256 SubjectPublicKeyInfo DER; private keys and unsupported curves are rejected."
          }
        }
      },
      "ApplicationStandardPublisher": {
        "type": "object",
        "description": "An immutable signing key with its public fingerprint.",
        "additionalProperties": false,
        "required": [
          "id",
          "org_id",
          "name",
          "public_key_der",
          "fingerprint",
          "created_by",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "public_key_der": {
            "type": "string",
            "format": "byte"
          },
          "fingerprint": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "created_by": {
            "type": "string",
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ApplicationStandardPublisherList": {
        "type": "object",
        "description": "A page of approved publisher keys.",
        "additionalProperties": false,
        "required": [
          "publishers"
        ],
        "properties": {
          "publishers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApplicationStandardPublisher"
            }
          },
          "next_page_after": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "ApplicationStandardLogDestinationRule": {
        "type": "object",
        "description": "Organization-owned logging destination references. Modes and override combinations are validated on publication.",
        "additionalProperties": false,
        "required": [
          "mode",
          "value"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "default",
              "mandatory"
            ]
          },
          "override": {
            "type": "string",
            "enum": [
              "none",
              "extend"
            ]
          },
          "value": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      },
      "ApplicationStandardSignatureRule": {
        "type": "object",
        "description": "Image signature requirement. Modes and override combinations are validated on publication.",
        "additionalProperties": false,
        "required": [
          "mode",
          "value"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "default",
              "mandatory",
              "restricted"
            ]
          },
          "override": {
            "type": "string",
            "enum": [
              "none",
              "narrow"
            ]
          },
          "value": {
            "type": "boolean"
          }
        }
      },
      "ApplicationStandardSecurityPolicyRule": {
        "type": "object",
        "description": "Deploy-time security posture requirement. Modes and override combinations are validated on publication.",
        "additionalProperties": false,
        "required": [
          "mode",
          "value"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "default",
              "mandatory",
              "restricted"
            ]
          },
          "override": {
            "type": "string",
            "enum": [
              "none",
              "narrow"
            ]
          },
          "value": {
            "type": "string",
            "enum": [
              "off",
              "warn",
              "enforce"
            ]
          }
        }
      },
      "ApplicationStandardPublisherRule": {
        "type": "object",
        "description": "Permitted organization-owned signing keys. Modes and override combinations are validated on publication.",
        "additionalProperties": false,
        "required": [
          "mode",
          "value"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "default",
              "mandatory",
              "restricted"
            ]
          },
          "override": {
            "type": "string",
            "enum": [
              "none",
              "narrow"
            ]
          },
          "value": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      },
      "ApplicationStandardCIDRRule": {
        "type": "object",
        "description": "Approved outbound CIDR ranges. Modes and override combinations are validated on publication.",
        "additionalProperties": false,
        "required": [
          "mode",
          "value"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "default",
              "mandatory",
              "restricted"
            ]
          },
          "override": {
            "type": "string",
            "enum": [
              "none",
              "narrow"
            ]
          },
          "value": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "type": "string"
            }
          }
        }
      },
      "ApplicationStandardExtraPortRule": {
        "type": "object",
        "description": "Approved extra outbound TCP ports. Modes and override combinations are validated on publication.",
        "additionalProperties": false,
        "required": [
          "mode",
          "value"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "default",
              "mandatory",
              "restricted"
            ]
          },
          "override": {
            "type": "string",
            "enum": [
              "none",
              "narrow"
            ]
          },
          "value": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 65535
            }
          }
        }
      },
      "ApplicationStandardDefinition": {
        "type": "object",
        "additionalProperties": false,
        "minProperties": 1,
        "description": "Supported versioned application requirements. Resource UUIDs must belong to the organization.\nEnforced destination, publisher and CIDR sets cannot be empty.\nEmpty local CIDRs mean unrestricted access and cannot satisfy a restriction.\n",
        "properties": {
          "log_destinations": {
            "$ref": "#/components/schemas/ApplicationStandardLogDestinationRule"
          },
          "require_signed": {
            "$ref": "#/components/schemas/ApplicationStandardSignatureRule"
          },
          "security_policy": {
            "$ref": "#/components/schemas/ApplicationStandardSecurityPolicyRule"
          },
          "trusted_publishers": {
            "$ref": "#/components/schemas/ApplicationStandardPublisherRule"
          },
          "egress_cidrs": {
            "$ref": "#/components/schemas/ApplicationStandardCIDRRule"
          },
          "egress_extra_ports": {
            "$ref": "#/components/schemas/ApplicationStandardExtraPortRule"
          }
        }
      },
      "CreateApplicationStandardVersionRequest": {
        "type": "object",
        "description": "A strictly decoded candidate publication with an explicit concurrency version.",
        "additionalProperties": false,
        "required": [
          "expected_version",
          "definition"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740990
          },
          "description": {
            "type": "string",
            "maxLength": 512,
            "description": "UTF-8 description limited to 512 bytes."
          },
          "definition": {
            "$ref": "#/components/schemas/ApplicationStandardDefinition"
          }
        }
      },
      "ApplicationStandardVersion": {
        "type": "object",
        "description": "One immutable canonical standard version and publishing provenance.",
        "required": [
          "standard_id",
          "org_id",
          "slug",
          "version",
          "definition",
          "definition_hash",
          "description",
          "created_by",
          "created_at"
        ],
        "properties": {
          "standard_id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "definition": {
            "$ref": "#/components/schemas/ApplicationStandardDefinition"
          },
          "definition_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "description": {
            "type": "string"
          },
          "created_by": {
            "type": "string",
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SetApplicationStandardLocalIntentRequest": {
        "type": "object",
        "description": "Replacement local settings and additional log destinations bound to the current enrollment revision.",
        "additionalProperties": false,
        "required": [
          "expected_revision",
          "settings",
          "additional_log_destinations"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740990
          },
          "settings": {
            "$ref": "#/components/schemas/ApplicationStandardSettings"
          },
          "additional_log_destinations": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      },
      "ApproveApplicationStandardExceptionRequest": {
        "type": "object",
        "description": "Time-limited, reasoned exception for one adopted standard field, bound to the enrollment revision.",
        "additionalProperties": false,
        "required": [
          "expected_revision",
          "standard_id",
          "version",
          "field",
          "value",
          "reason",
          "expires_at"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740990
          },
          "standard_id": {
            "type": "string",
            "format": "uuid"
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "field": {
            "type": "string",
            "enum": [
              "log_destinations",
              "require_signed",
              "security_policy",
              "trusted_publishers",
              "egress_cidrs",
              "egress_extra_ports"
            ]
          },
          "value": {
            "description": "Non-null value for the selected field, validated by the server against that field and the full inherited controls.",
            "oneOf": [
              {
                "type": "boolean"
              },
              {
                "type": "string",
                "enum": [
                  "off",
                  "warn",
                  "enforce"
                ]
              },
              {
                "type": "array",
                "maxItems": 64,
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "array",
                "maxItems": 64,
                "items": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 65535
                }
              }
            ]
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512,
            "description": "Trimmed nonempty UTF-8 reason bounded to 512 bytes."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "Future expiry within 30 days of server time."
          }
        }
      },
      "ApproveApplicationStandardReviewRequest": {
        "type": "object",
        "description": "Exact approval hash of the saved review whose authoritative inputs must still match.",
        "additionalProperties": false,
        "required": [
          "approval_hash"
        ],
        "properties": {
          "approval_hash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          }
        }
      },
      "ControlApplicationStandardOperationRequest": {
        "type": "object",
        "description": "Current operation timestamp required to pause, resume or abort retained rollout intent.",
        "additionalProperties": false,
        "required": [
          "expected_updated_at"
        ],
        "properties": {
          "expected_updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Exact nonzero updated_at from the current operation, with at most microsecond precision; never round a stale token."
          }
        }
      },
      "RevokeApplicationStandardExceptionRequest": {
        "type": "object",
        "description": "Current enrollment revision authorizing revocation of the selected exception.",
        "additionalProperties": false,
        "required": [
          "expected_revision"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740990
          }
        }
      },
      "ApplicationStandardSettings": {
        "type": "object",
        "additionalProperties": false,
        "description": "Logical control values; resource references contain UUIDs, never credentials.",
        "properties": {
          "log_destinations": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "require_signed": {
            "type": "boolean"
          },
          "security_policy": {
            "type": "string",
            "enum": [
              "off",
              "warn",
              "enforce"
            ]
          },
          "trusted_publishers": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "egress_cidrs": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "egress_extra_ports": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 65535
            }
          }
        }
      },
      "ApplicationStandardAdoption": {
        "type": "object",
        "description": "Assignment and immutable version pinned when an application adopts a standard.",
        "required": [
          "assignment_id",
          "version"
        ],
        "properties": {
          "assignment_id": {
            "type": "string",
            "format": "uuid"
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        }
      },
      "ApplicationStandardSource": {
        "type": "object",
        "description": "Inherited assignment, enforcement mode and any applicable exception contributing to one field.",
        "required": [
          "standard_id",
          "version",
          "scope",
          "mode",
          "override"
        ],
        "properties": {
          "assignment_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope_id": {
            "type": "string",
            "format": "uuid"
          },
          "standard_id": {
            "type": "string",
            "format": "uuid"
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "scope": {
            "type": "string",
            "enum": [
              "organization",
              "project",
              "application"
            ]
          },
          "mode": {
            "type": "string",
            "enum": [
              "default",
              "mandatory",
              "restricted"
            ]
          },
          "override": {
            "type": "string",
            "enum": [
              "none",
              "narrow",
              "extend"
            ]
          },
          "exception_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "ApplicationStandardViolation": {
        "type": "object",
        "description": "A field-level constraint violation and the inherited source that imposed it.",
        "required": [
          "field",
          "code",
          "source"
        ],
        "properties": {
          "field": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "source": {
            "$ref": "#/components/schemas/ApplicationStandardSource"
          }
        }
      },
      "ApplicationStandardEffective": {
        "type": "object",
        "description": "Resolved control values with their inheritance sources and any constraint violations.",
        "required": [
          "values",
          "sources",
          "violations"
        ],
        "properties": {
          "values": {
            "$ref": "#/components/schemas/ApplicationStandardSettings"
          },
          "sources": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/ApplicationStandardSource"
              }
            }
          },
          "violations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApplicationStandardViolation"
            }
          }
        }
      },
      "ApplicationStandardAssignment": {
        "type": "object",
        "description": "Retained scope assignment and its current admission version, activity and concurrency revision.",
        "required": [
          "id",
          "org_id",
          "scope",
          "scope_id",
          "standard_id",
          "admission_version",
          "revision",
          "active",
          "created_by",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string",
            "enum": [
              "organization",
              "project",
              "application"
            ]
          },
          "scope_id": {
            "type": "string",
            "format": "uuid"
          },
          "standard_id": {
            "type": "string",
            "format": "uuid"
          },
          "admission_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "active": {
            "type": "boolean"
          },
          "created_by": {
            "type": "string",
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ApplicationStandardAssignmentList": {
        "type": "object",
        "description": "Page of retained assignments with an optional exclusive cursor for the next page.",
        "required": [
          "assignments"
        ],
        "properties": {
          "assignments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApplicationStandardAssignment"
            }
          },
          "next_page_after": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "ApplicationStandardEnrollment": {
        "type": "object",
        "description": "Saved desired intent and the last installed projection, separately from consumer observation.",
        "required": [
          "app_id",
          "org_id",
          "local_settings",
          "additional_log_destinations",
          "adoptions",
          "materialized_fields",
          "desired_revision",
          "persisted_revision",
          "observed_revision",
          "state",
          "updated_at"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "local_settings": {
            "$ref": "#/components/schemas/ApplicationStandardSettings"
          },
          "additional_log_destinations": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "adoptions": {
            "type": "array",
            "description": "Captured adoption pins; publication never moves them automatically.",
            "items": {
              "$ref": "#/components/schemas/ApplicationStandardAdoption"
            }
          },
          "materialized_fields": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "log_destinations",
                "require_signed",
                "security_policy",
                "trusted_publishers",
                "egress_cidrs",
                "egress_extra_ports"
              ]
            }
          },
          "installed_effective": {
            "$ref": "#/components/schemas/ApplicationStandardEffective"
          },
          "installed_effective_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "installed_exception_expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "Deadline of a contributing exception in the last persisted projection; it can already be expired while replacement is pending. Does not establish consumer observation."
          },
          "desired_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "persisted_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "observed_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "state": {
            "type": "string",
            "enum": [
              "unmanaged",
              "pending",
              "applying",
              "blocked",
              "persisted",
              "observed"
            ]
          },
          "error_code": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ApplicationStandardReviewRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "scope",
          "scope_id",
          "standard_id",
          "admission_version",
          "expected_revision",
          "active",
          "batch_size"
        ],
        "properties": {
          "assignment_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string",
            "enum": [
              "organization",
              "project",
              "application"
            ]
          },
          "scope_id": {
            "type": "string",
            "format": "uuid"
          },
          "standard_id": {
            "type": "string",
            "format": "uuid"
          },
          "admission_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "active": {
            "type": "boolean"
          },
          "batch_size": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          }
        },
        "description": "Explicit active and expected_revision are required, including false and zero. New assignments require active=true and revision=0."
      },
      "ApplicationStandardReview": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "org_id",
          "created_by",
          "request",
          "approval_hash",
          "applications",
          "blockers",
          "created_at",
          "expires_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "created_by": {
            "type": "string",
            "format": "uuid"
          },
          "request": {
            "$ref": "#/components/schemas/ApplicationStandardReviewRequest"
          },
          "approval_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "applications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApplicationStandardReviewedApp"
            }
          },
          "blockers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApplicationStandardReviewBlocker"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "description": "Immutable saved preview. Its hash binds private authoritative inputs. Expiry does not prevent historical inspection; approval always requires fresh validation."
      },
      "ApplicationStandardReviewBlocker": {
        "type": "object",
        "description": "A scope or application condition that prevents approval of the saved review.",
        "additionalProperties": false,
        "required": [
          "code"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string",
            "enum": [
              "organization",
              "project",
              "application"
            ]
          },
          "scope_id": {
            "type": "string",
            "format": "uuid"
          },
          "field": {
            "type": "string",
            "enum": [
              "log_destinations",
              "require_signed",
              "security_policy",
              "trusted_publishers",
              "egress_cidrs",
              "egress_extra_ports"
            ]
          },
          "code": {
            "type": "string"
          }
        }
      },
      "ApplicationStandardReviewedApp": {
        "type": "object",
        "description": "Application inputs, adoption pins and resolved changes captured in a saved review.",
        "additionalProperties": false,
        "required": [
          "app_id",
          "slug",
          "desired_revision",
          "before_settings",
          "before_adoptions",
          "after_adoptions",
          "local_settings",
          "additional_log_destinations",
          "effective",
          "changed_fields"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string"
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "desired_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "before_settings": {
            "$ref": "#/components/schemas/ApplicationStandardSettings"
          },
          "before_adoptions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApplicationStandardAdoption"
            }
          },
          "after_adoptions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApplicationStandardAdoption"
            }
          },
          "local_settings": {
            "$ref": "#/components/schemas/ApplicationStandardSettings"
          },
          "additional_log_destinations": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "effective": {
            "$ref": "#/components/schemas/ApplicationStandardEffective"
          },
          "changed_fields": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "log_destinations",
                "require_signed",
                "security_policy",
                "trusted_publishers",
                "egress_cidrs",
                "egress_extra_ports"
              ]
            }
          }
        }
      },
      "ApplicationStandardOperation": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "org_id",
          "plan_id",
          "assignment_id",
          "approval_hash",
          "approved_by",
          "batch_size",
          "state",
          "targets",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "plan_id": {
            "type": "string",
            "format": "uuid"
          },
          "assignment_id": {
            "type": "string",
            "format": "uuid"
          },
          "approval_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "approved_by": {
            "type": "string",
            "format": "uuid"
          },
          "batch_size": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "state": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "waiting",
              "paused",
              "blocked",
              "failed",
              "completed"
            ]
          },
          "error_code": {
            "type": "string"
          },
          "targets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApplicationStandardOperationTarget"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "description": "Saved operation progress. Persisted targets still require consumer observation; this response never advances it."
      },
      "ApplicationStandardOperationTarget": {
        "type": "object",
        "description": "One application target and its installation and observation progress in a controlled rollout.",
        "additionalProperties": false,
        "required": [
          "app_id",
          "position",
          "approved_app",
          "state",
          "desired_revision",
          "updated_at"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "position": {
            "type": "integer",
            "minimum": 0
          },
          "approved_app": {
            "$ref": "#/components/schemas/ApplicationStandardReviewedApp"
          },
          "state": {
            "type": "string",
            "enum": [
              "queued",
              "applying",
              "blocked",
              "persisted",
              "observed",
              "skipped"
            ]
          },
          "desired_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "error_code": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ApplicationStandardException": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "org_id",
          "app_id",
          "standard_id",
          "version",
          "field",
          "value",
          "reason",
          "expires_at",
          "approved_by",
          "created_at",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "standard_id": {
            "type": "string",
            "format": "uuid"
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "field": {
            "type": "string",
            "enum": [
              "log_destinations",
              "require_signed",
              "security_policy",
              "trusted_publishers",
              "egress_cidrs",
              "egress_extra_ports"
            ]
          },
          "value": {
            "oneOf": [
              {
                "type": "boolean"
              },
              {
                "type": "string",
                "enum": [
                  "off",
                  "warn",
                  "enforce"
                ]
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "array",
                "items": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 65535
                }
              }
            ]
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "approved_by": {
            "type": "string",
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "revoked_by": {
            "type": "string",
            "format": "uuid"
          },
          "revoked_at": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "expired",
              "revoked"
            ]
          }
        },
        "description": "Historical approval. Status uses the server as_of timestamp, with revocation taking precedence over expiry; applicability depends on current adoption."
      },
      "ApplicationStandardExceptionList": {
        "type": "object",
        "description": "Page of historical exceptions and their status evaluated at the server as_of timestamp.",
        "additionalProperties": false,
        "required": [
          "exceptions",
          "as_of"
        ],
        "properties": {
          "exceptions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApplicationStandardException"
            }
          },
          "next_page_after": {
            "type": "string",
            "format": "uuid"
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ApplicationStandardList": {
        "type": "object",
        "description": "The latest candidates ordered by standard slug.",
        "required": [
          "standards"
        ],
        "properties": {
          "standards": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApplicationStandardVersion"
            }
          },
          "next_page_after": {
            "type": "string"
          }
        }
      },
      "OrgAppListResponse": {
        "description": "Newest-first safe inventory of apps attributed to an organization.",
        "type": "object",
        "required": [
          "apps"
        ],
        "properties": {
          "apps": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrgAppSummary"
            }
          }
        }
      },
      "ActivityActorResponse": {
        "description": "Captured identity responsible for an activity item.",
        "type": "object",
        "required": [
          "type",
          "label"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "user",
              "api_key",
              "github",
              "system",
              "operator"
            ]
          },
          "label": {
            "type": "string",
            "description": "Actor name captured when the activity occurred."
          },
          "account_id": {
            "type": "string",
            "format": "uuid",
            "description": "Present for a locally-known human actor."
          }
        }
      },
      "ActivityResourceResponse": {
        "description": "Primary infrastructure object affected by an activity item.",
        "type": "object",
        "required": [
          "type",
          "label"
        ],
        "properties": {
          "type": {
            "type": "string",
            "example": "app"
          },
          "id": {
            "type": "string",
            "description": "Stable resource identifier, when one exists."
          },
          "label": {
            "type": "string",
            "description": "Resource name captured when the activity occurred."
          }
        }
      },
      "OrgActivityResponse": {
        "description": "One safe, display-ready organization activity fact.",
        "type": "object",
        "required": [
          "id",
          "occurred_at",
          "kind",
          "summary",
          "actor",
          "resource",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Monotonic bigint row id encoded as a string."
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "kind": {
            "type": "string",
            "example": "app.deployed"
          },
          "summary": {
            "type": "string",
            "example": "Bahadir deployed payments"
          },
          "actor": {
            "$ref": "#/components/schemas/ActivityActorResponse"
          },
          "resource": {
            "$ref": "#/components/schemas/ActivityResourceResponse"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "data": {
            "type": "object",
            "additionalProperties": true,
            "description": "Kind-specific non-secret display metadata."
          }
        }
      },
      "ListOrgActivityResponse": {
        "description": "Newest-first global organization activity page.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrgActivityResponse"
            }
          },
          "next_before": {
            "type": "string",
            "description": "Continue from this value to retrieve older organization activity."
          }
        }
      },
      "OrgWithRole": {
        "description": "OrgResponse + the caller's role on the active org. Used by\nGET /v1/orgs/me (`OrgMeResponse.org`). The role field is\na closed enum: owner|admin|developer|viewer|billing.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/OrgResponse"
          },
          {
            "type": "object",
            "required": [
              "role"
            ],
            "properties": {
              "role": {
                "type": "string",
                "enum": [
                  "owner",
                  "admin",
                  "developer",
                  "viewer",
                  "billing"
                ]
              }
            }
          }
        ]
      },
      "OrgMeResponse": {
        "description": "GET /v1/orgs/me response. Without an X-Active-Org / ?org= hint,\n`org` is the caller's personal organization. It is null only for a\nlegacy account that predates the personal-org backfill.\n",
        "type": "object",
        "required": [
          "org"
        ],
        "properties": {
          "org": {
            "type": [
              "string",
              "null"
            ],
            "allOf": [
              {
                "$ref": "#/components/schemas/OrgWithRole"
              }
            ],
            "description": "The active org + caller's role, or null only for a legacy account without a personal organization."
          }
        }
      },
      "OrgMemberResponse": {
        "description": "Wire shape for a single org membership row. Email is the\njoined account.email; the account_id is also surfaced for\nnon-ambiguous referential purposes (e.g. role-change / remove\npath segments).\n",
        "type": "object",
        "required": [
          "account_id",
          "email",
          "role",
          "joined_at"
        ],
        "properties": {
          "account_id": {
            "type": "string",
            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
          },
          "email": {
            "type": "string",
            "format": "email",
            "example": "bob@acme.com"
          },
          "display_name": {
            "type": "string",
            "maxLength": 80,
            "description": "The member's display name; absent when unset.",
            "example": "bob@acme.com"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "developer",
              "viewer",
              "billing"
            ]
          },
          "joined_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "MemberListResponse": {
        "description": "GET /v1/orgs/{slug}/members response. Only active members (removed rows filtered).",
        "type": "object",
        "required": [
          "members"
        ],
        "properties": {
          "members": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrgMemberResponse"
            }
          }
        }
      },
      "SeatUsageResponse": {
        "description": "GET /v1/orgs/{slug}/seat_usage response. Visibility-only —\nships the per-seat pricing cut-over §\"Out of scope\". `used` counts active members only (the\nstore's `CountActiveOrgMembers` filters `removed_at IS\nNULL`). `limit` comes from `org.Plan.OrgMembersMax` —\nthe `free` plan returns `0` so the dashboard can render\n\"personal org only\" instead of \"0 of 0 used\".\n",
        "type": "object",
        "required": [
          "used",
          "limit",
          "plan"
        ],
        "properties": {
          "used": {
            "type": "integer",
            "minimum": 0,
            "description": "Active member count."
          },
          "limit": {
            "type": "integer",
            "minimum": 0,
            "description": "Plan cap on active members (`Plan.OrgMembersMax()`).\nReturns `0` for the `free` plan — the fail-closed\naccessor shape.\n"
          },
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "hobby",
              "pro",
              "scale"
            ]
          }
        }
      },
      "ChangeMemberRoleRequest": {
        "description": "PATCH /v1/orgs/{slug}/members/{user_id} body. Role cannot\nbe `owner` on this endpoint — transfer-ownership is the\nonly path to owner.\n",
        "type": "object",
        "required": [
          "role"
        ],
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "admin",
              "developer",
              "viewer",
              "billing"
            ]
          }
        }
      },
      "InviteMemberRequest": {
        "description": "POST /v1/orgs/{slug}/members body. Role cannot be `owner`.\nThe handler mints a 32-byte plaintext token (returned ONCE\nin the response) and stores only the SHA-256 hash. The\ntoken expires after 14 days.\n",
        "type": "object",
        "required": [
          "email",
          "role"
        ],
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 320
          },
          "role": {
            "type": "string",
            "enum": [
              "admin",
              "developer",
              "viewer",
              "billing"
            ]
          }
        }
      },
      "OrgInvitationResponse": {
        "description": "Wire shape for a single invitation row. Status is the\nruntime-derived value (pending | consumed | revoked |\nexpired) computed from the (consumed_at, revoked_at,\nexpires_at) tuple. Plaintext token is NEVER re-served —\nit's returned ONCE on the create call via\nInvitationWithTokenResponse.\n",
        "type": "object",
        "required": [
          "id",
          "org_id",
          "org_slug",
          "email",
          "role",
          "status",
          "expires_at",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "description": "32-hex opaque invitation id (NOT canonical UUID)."
          },
          "org_id": {
            "type": "string",
            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
          },
          "org_slug": {
            "type": "string",
            "pattern": "^[a-z0-9]([a-z0-9-]{1,30})[a-z0-9]$"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "role": {
            "type": "string",
            "enum": [
              "admin",
              "developer",
              "viewer",
              "billing"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "consumed",
              "revoked",
              "expired"
            ]
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "InvitationWithTokenResponse": {
        "description": "POST /v1/orgs/{slug}/members response. Carries the\none-time plaintext token in addition to the canonical\ninvitation shape. Never re-served on subsequent reads —\nlosing the token means revoking the invitation and\ninviting again.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/OrgInvitationResponse"
          },
          {
            "type": "object",
            "required": [
              "token"
            ],
            "properties": {
              "token": {
                "type": "string",
                "description": "32-byte plaintext token, base64url-encoded (44 chars).\nReturned ONCE; never re-served. SHA-256 hash is what's\nstored. Treat as a secret — anyone with this token\ncan accept the invitation.\n",
                "example": "Y3J5cHRvX3JhbmRvbV8zMl9ieXRlc19iYXNlNjR1cmw="
              }
            }
          }
        ]
      },
      "InvitationListResponse": {
        "description": "GET /v1/orgs/{slug}/invitations response. Sorted by created_at DESC.",
        "type": "object",
        "required": [
          "invitations"
        ],
        "properties": {
          "invitations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrgInvitationResponse"
            }
          },
          "next_before": {
            "description": "Opaque cursor — set to the **base64-url-of-JSON** of\nthe last row's compound `(created_at, id)` key when\nthere's a next page. Pass back as `?before=` to\nfetch it. The compound key keeps the\n`created_at DESC, id DESC` order exact under random UUIDs. The wire shape is\nopaque; clients MUST pass the value back unchanged.\n",
            "type": "string"
          }
        }
      },
      "TransferOwnershipRequest": {
        "description": "POST /v1/orgs/{slug}/transfer_ownership body. The new owner\nmust already be an active member of the org; the previous\nowner becomes admin on success. The exactly-one-owner\ninvariant is enforced by the partial unique index\n`org_memberships_one_owner_idx`.\n",
        "type": "object",
        "required": [
          "new_owner_account_id"
        ],
        "properties": {
          "new_owner_account_id": {
            "type": "string",
            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
          }
        }
      },
      "Trace": {
        "description": "A single OpenTelemetry trace — the span tree for one\nrequest (one wake). The shape mirrors the SDK's ReadOnlySpan\nflattened to JSON: trace_id + span_id are W3C hex, attributes\nare a string map (the operator's debug session is a grep, not\na query). The same trace_id may host a\n`gateway.handler` → `gateway.route` → `sched.wake` →\n`vmmd.create_*` → `guest.resume` → `guest.readiness` chain\n(acceptance #1).\n",
        "type": "object",
        "required": [
          "trace_id",
          "spans"
        ],
        "properties": {
          "trace_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_seen_at": {
            "type": "string",
            "format": "date-time"
          },
          "spans": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TraceSpan"
            }
          }
        }
      },
      "TraceSpan": {
        "description": "One span in a trace. Mirrors the OTel SDK's ReadOnlySpan\nattributes (kind, name, status, parent linkage, timing) so\nthe customer's debug session can reconstruct the call tree.\n",
        "type": "object",
        "required": [
          "trace_id",
          "span_id",
          "name"
        ],
        "properties": {
          "trace_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          },
          "span_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{16}$"
          },
          "parent_span_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{16}$"
          },
          "name": {
            "type": "string",
            "example": "sched.wake"
          },
          "start_time": {
            "type": "string",
            "format": "date-time"
          },
          "end_time": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": [
              "ok",
              "error"
            ]
          },
          "status_message": {
            "type": "string"
          },
          "attributes": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      },
      "RouteHealthTransitionWebhookPayload": {
        "type": "object",
        "description": "Metadata-only health hold, committed resume, or committed automatic abort event. Produced by actual enforced canary advance evaluations. Unknown evidence never clears a confirmed regression; a fresh context never claims recovery. App-scoped recipients are captured with the decision. Fetch history_path with apps:read and completed MFA for route evidence; snapshots are subject to retention. Repeated worker retries do not emit duplicate holds. Automatic abort events describe a committed recovery from fresh confirmed 5xx evidence under an opt-in policy; receiving a webhook never authorizes a traffic mutation.",
        "required": [
          "version",
          "app_id",
          "deployment_id",
          "stable_deployment_id",
          "decision_id",
          "status",
          "health_status",
          "reason",
          "source",
          "canary_step",
          "revision",
          "checked_at",
          "previous_traffic_percent",
          "requested_traffic_percent",
          "history_path"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "stable_deployment_id": {
            "type": "string",
            "description": "Empty when a unique stable deployment was unavailable."
          },
          "decision_id": {
            "type": "string",
            "format": "uuid"
          },
          "blocked_decision_id": {
            "type": "string",
            "format": "uuid",
            "description": "The prior comparable hold decision for resumed or aborted events when a hold exists; may have been pruned."
          },
          "status": {
            "type": "string",
            "enum": [
              "blocked",
              "resumed",
              "aborted"
            ]
          },
          "health_status": {
            "type": "string",
            "enum": [
              "unknown",
              "regressed",
              "healthy"
            ]
          },
          "reason": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "worker"
            ]
          },
          "canary_step": {
            "type": "integer",
            "minimum": 0
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "observation_anchor": {
            "type": "string",
            "format": "date-time"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "previous_traffic_percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "requested_traffic_percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "history_path": {
            "type": "string",
            "description": "Authenticated single-entry API path for the exact saved decision."
          }
        }
      },
      "DeploymentLiveWebhookPayload": {
        "type": "object",
        "description": "Deployment reached the live state. Delivery IDs are stable across retries.",
        "required": [
          "app_id",
          "deployment_id",
          "status"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "description": "App that owns this live deployment."
          },
          "deployment_id": {
            "type": "string",
            "description": "Deployment that entered the live state."
          },
          "status": {
            "type": "string",
            "enum": [
              "live"
            ]
          }
        },
        "additionalProperties": true
      },
      "DeploymentFailedWebhookPayload": {
        "type": "object",
        "description": "Deployment failure details delivered with deployment.failed. Delivery IDs are stable across retries.",
        "required": [
          "app_id",
          "deployment_id",
          "status"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "description": "App that owns this failed deployment."
          },
          "deployment_id": {
            "type": "string",
            "description": "Deployment that entered the failed state."
          },
          "status": {
            "type": "string",
            "enum": [
              "failed"
            ]
          },
          "error_code": {
            "type": "string"
          },
          "error_hint": {
            "type": "string"
          },
          "error_why": {
            "type": "string"
          },
          "error_fix": {
            "type": "string"
          },
          "relevant_logs": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "additionalProperties": true
      },
      "AgentApprovalWebhookPayload": {
        "type": "object",
        "description": "Delivered with agent.approval.requested, agent.approval.approved and agent.approval.denied: an agent key's request waits for a person, or a person decided it. It never carries the request body.",
        "required": [
          "approval_id",
          "key_id",
          "category",
          "method",
          "path",
          "status",
          "expires_at"
        ],
        "properties": {
          "approval_id": {
            "type": "string",
            "format": "uuid",
            "description": "The approval request this event is about."
          },
          "key_id": {
            "type": "string",
            "format": "uuid",
            "description": "The agent key that made the request."
          },
          "org_id": {
            "type": "string",
            "format": "uuid",
            "description": "The organization the key acts in",
            "when it acts in one.": null
          },
          "category": {
            "type": "string",
            "enum": [
              "delete",
              "production",
              "credentials",
              "billing",
              "budget",
              "undo"
            ],
            "description": "Which kind of risky action the agent asked to take; budget when it would go past its monthly budget, undo when it undoes its own changes."
          },
          "method": {
            "type": "string",
            "description": "HTTP method of the agent's request."
          },
          "path": {
            "type": "string",
            "description": "Path and query of the agent's request."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "approved",
              "denied"
            ],
            "description": "The request's status when the event was recorded."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the request stops being approvable or usable."
          },
          "review_url": {
            "type": "string",
            "format": "uri",
            "description": "On agent.approval.requested: the page where a member who may decide opens it."
          },
          "decided_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the person approved or denied the request."
          },
          "note": {
            "type": "string",
            "maxLength": 280,
            "description": "On agent.approval.denied: the reason the person gave the agent, if any."
          },
          "reason": {
            "type": "string",
            "maxLength": 280,
            "description": "The agent's own account of what the request is for, if it gave one. Untrusted agent text."
          }
        },
        "additionalProperties": true
      },
      "RolloutCompletedWebhookPayload": {
        "type": "object",
        "description": "The configured rollout completed. Explicit traffic splits may complete below 100%; inspect traffic_percent.",
        "required": [
          "app_id",
          "deployment_id",
          "rollout_state",
          "traffic_percent",
          "completed_at"
        ],
        "properties": {
          "app_id": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string"
          },
          "rollout_state": {
            "type": "string",
            "enum": [
              "complete"
            ]
          },
          "traffic_percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          },
          "decision": {
            "$ref": "#/components/schemas/RolloutDecision",
            "description": "The advance evidence that completed the rollout."
          }
        },
        "additionalProperties": true
      },
      "RolloutAbortedWebhookPayload": {
        "type": "object",
        "description": "A live rollout was aborted. Pre-live build failures emit deployment.failed instead.",
        "required": [
          "app_id",
          "deployment_id",
          "rollout_state",
          "traffic_percent",
          "reason",
          "aborted_at"
        ],
        "properties": {
          "app_id": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string"
          },
          "rollout_state": {
            "type": "string",
            "enum": [
              "aborted"
            ]
          },
          "traffic_percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "reason": {
            "type": "string"
          },
          "aborted_at": {
            "type": "string",
            "format": "date-time"
          },
          "decision": {
            "$ref": "#/components/schemas/RolloutDecision",
            "description": "The abort evidence when the circuit breaker, a person, or the worker lease expiry aborted the rollout. Aborts by route monitors, alert rollbacks and profile gates carry only reason."
          }
        },
        "additionalProperties": true
      },
      "ErrorNewWebhookPayload": {
        "type": "object",
        "description": "First-observation details delivered with error.new.",
        "required": [
          "app_id",
          "fingerprint"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          },
          "fingerprint": {
            "type": "string"
          },
          "route": {
            "type": "string"
          },
          "class": {
            "type": "string"
          },
          "sample": {
            "type": "string"
          },
          "first_seen_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": true
      },
      "JobFinishedWebhookPayload": {
        "type": "object",
        "description": "Terminal job details delivered with job.finished.",
        "required": [
          "status",
          "duration_ms"
        ],
        "properties": {
          "job_id": {
            "type": "string"
          },
          "run_id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "finished_at": {
            "type": "string",
            "format": "date-time"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "duration_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        },
        "additionalProperties": true
      },
      "WorkflowFinishedWebhookPayload": {
        "type": "object",
        "description": "Safe workflow run metadata delivered after a run reaches succeeded, failed, or dead. Inputs, outputs, and error text are omitted; fetch the run using its ID when authorized.",
        "required": [
          "app_id",
          "run_id",
          "workflow_name",
          "status",
          "finished_at",
          "resume_count"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "workflow_name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "succeeded",
              "failed",
              "dead"
            ]
          },
          "finished_at": {
            "type": "string",
            "format": "date-time"
          },
          "resume_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 16
          }
        },
        "additionalProperties": false
      },
      "PreviewCreatedWebhookPayload": {
        "type": "object",
        "description": "Preview URL details delivered with preview.created.",
        "required": [
          "url"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "pull_request": {
            "type": "integer",
            "minimum": 1
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": true
      },
      "BudgetThresholdWebhookPayload": {
        "type": "object",
        "description": "Budget observation delivered with budget.threshold.",
        "required": [
          "pct",
          "cap"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          },
          "pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "cap": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "metric": {
            "type": "string"
          },
          "observed_cents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "period": {
            "type": "string"
          }
        },
        "additionalProperties": true
      },
      "APIConsumerUsageAlertResponse": {
        "description": "One plan alert threshold a consumer crossed in one UTC month.",
        "type": "object",
        "required": [
          "id",
          "consumer_id",
          "plan_id",
          "month_start",
          "threshold_percent",
          "limit_units",
          "used_units",
          "crossed_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "plan_id": {
            "type": "string",
            "format": "uuid"
          },
          "month_start": {
            "type": "string",
            "format": "date-time"
          },
          "threshold_percent": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 100
          },
          "limit_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "used_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Weighted units used this month when the threshold was crossed."
          },
          "crossed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "APIConsumerUsageAlertListResponse": {
        "description": "A consumer's usage alerts, newest first.",
        "type": "object",
        "required": [
          "alerts"
        ],
        "properties": {
          "alerts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/APIConsumerUsageAlertResponse"
            }
          }
        }
      },
      "APIConsumerUsageThresholdWebhookPayload": {
        "type": "object",
        "description": "Data delivered with consumer.usage_threshold when a consumer crosses a plan alert threshold. alert_id is stable across retries.",
        "required": [
          "alert_id",
          "app_id",
          "consumer_id",
          "external_ref",
          "plan_id",
          "threshold_percent",
          "limit_units",
          "used_units",
          "month_start",
          "crossed_at"
        ],
        "properties": {
          "alert_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_ref": {
            "type": "string"
          },
          "plan_id": {
            "type": "string",
            "format": "uuid"
          },
          "threshold_percent": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 100
          },
          "limit_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "used_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "month_start": {
            "type": "string",
            "format": "date-time"
          },
          "crossed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OutboundAIBudgetThresholdWebhookPayload": {
        "type": "object",
        "description": "Data delivered with outbound.ai_budget.threshold when an AI budget reaches 80% or 100% in its period. alert_id is stable across retries; integration budgets notify every bound app, app budgets only that app, and an end user's or a tag's budget only the app whose call crossed it.",
        "required": [
          "alert_id",
          "integration_id",
          "integration_name",
          "budget",
          "app_id",
          "end_user",
          "period_start",
          "threshold_percent",
          "limit",
          "used",
          "crossed_at",
          "tag"
        ],
        "properties": {
          "alert_id": {
            "type": "string",
            "format": "uuid"
          },
          "integration_id": {
            "type": "string",
            "format": "uuid"
          },
          "integration_name": {
            "type": "string"
          },
          "budget": {
            "type": "string",
            "enum": [
              "daily_tokens",
              "app_daily_tokens",
              "daily_cost",
              "monthly_cost",
              "user_daily_tokens",
              "user_daily_cost",
              "tag_daily_cost"
            ]
          },
          "app_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "end_user": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The X-Gregale-AI-User value whose daily budget crossed the threshold."
          },
          "period_start": {
            "type": "string",
            "format": "date"
          },
          "threshold_percent": {
            "type": "integer",
            "format": "int32",
            "enum": [
              80,
              100
            ]
          },
          "limit": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "used": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "crossed_at": {
            "type": "string",
            "format": "date-time"
          },
          "tag": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 97,
            "description": "The tag whose daily cost limit crossed the threshold."
          }
        }
      },
      "OutboundAIQualityDriftWebhookPayload": {
        "type": "object",
        "description": "Data delivered with outbound.ai_quality.drift to every app bound to the integration when a model's quality signal moves away from its previous 7 days. alert_id is stable across retries.",
        "required": [
          "alert_id",
          "integration_id",
          "integration_name",
          "usage_date",
          "model",
          "metric",
          "current_value",
          "baseline_value",
          "current_count",
          "baseline_count",
          "detected_at"
        ],
        "properties": {
          "alert_id": {
            "type": "string",
            "format": "uuid"
          },
          "integration_id": {
            "type": "string",
            "format": "uuid"
          },
          "integration_name": {
            "type": "string"
          },
          "usage_date": {
            "type": "string",
            "format": "date"
          },
          "model": {
            "type": "string",
            "maxLength": 200
          },
          "metric": {
            "type": "string",
            "enum": [
              "truncated",
              "refused",
              "empty",
              "invalid_json",
              "tool_error",
              "bad_feedback",
              "evaluation_score"
            ]
          },
          "current_value": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Basis points of answered (or rated) calls; hundredths of a point for evaluation_score."
          },
          "baseline_value": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "current_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Calls the current value was taken over."
          },
          "baseline_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "detected_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ManagedRealtimeBatchMessageRequest": {
        "type": "object",
        "required": [
          "data_base64"
        ],
        "properties": {
          "ttl_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 86400,
            "description": "Override the batch TTL; omitted or null inherits the default and zero disables expiry for this message."
          },
          "data_base64": {
            "type": "string",
            "maxLength": 5464
          },
          "metadata": {
            "type": "object",
            "maxProperties": 8,
            "additionalProperties": {
              "type": "string",
              "maxLength": 128
            }
          },
          "binary": {
            "type": "boolean",
            "default": false
          },
          "expected_sequence": {
            "type": "null",
            "description": "Per-message preconditions are unsupported. Omit this field or set it to null; use the batch-level expected_sequence to require a channel head."
          }
        },
        "description": "One retained publication in a channel batch, with an optional override of the batch message TTL."
      },
      "BillingProvider": {
        "description": "A billing provider statements export to.",
        "type": "string",
        "enum": [
          "stripe",
          "paddle",
          "lago"
        ]
      },
      "PutBillingConnectionRequest": {
        "description": "The account's own key for one billing provider.",
        "type": "object",
        "required": [
          "secret_key"
        ],
        "properties": {
          "secret_key": {
            "type": "string",
            "minLength": 8,
            "maxLength": 512,
            "description": "A Stripe secret or restricted key (sk_… or rk_…), a Paddle API key (pdl_…), or a Lago API key.",
            "writeOnly": true
          },
          "api_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 512,
            "description": "Lago only: the API origin for the EU region or a self-hosted Lago, https:// only; default https://api.getlago.com."
          },
          "collection": {
            "type": "string",
            "enum": [
              "none",
              "send",
              "charge"
            ],
            "default": "none",
            "description": "What the provider does with exported invoices: none leaves drafts (Lago issues them without charging); send has Stripe email the invoice; charge has Stripe charge the customer's default payment method, or Lago charge through its payment provider. Paddle supports none and send: send bills the transaction so Paddle emails the invoice to the customer's most recent address; Paddle cannot charge a saved card for an invoice."
          },
          "days_until_due": {
            "type": "integer",
            "minimum": 1,
            "maximum": 365,
            "default": 30,
            "description": "With collection send, days until a sent invoice is due."
          },
          "automatic_tax": {
            "type": "boolean",
            "default": false,
            "description": "Stripe only: have Stripe Tax calculate tax on exported invoices. Needs Stripe Tax and customer addresses."
          }
        }
      },
      "BillingConnectionResponse": {
        "description": "A stored payment-provider key, identified without revealing it.",
        "type": "object",
        "required": [
          "provider",
          "key_last4",
          "livemode",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "provider": {
            "$ref": "#/components/schemas/BillingProvider"
          },
          "key_last4": {
            "type": "string",
            "minLength": 4,
            "maxLength": 4
          },
          "livemode": {
            "type": "boolean",
            "description": "False for Stripe test and Paddle sandbox keys; Lago has no test mode."
          },
          "api_url": {
            "type": "string",
            "format": "uri",
            "description": "The Lago API origin."
          },
          "collection": {
            "type": "string",
            "enum": [
              "none",
              "send",
              "charge"
            ],
            "description": "What the provider does with exported invoices."
          },
          "days_until_due": {
            "type": "integer",
            "minimum": 1,
            "maximum": 365,
            "description": "Days until a sent invoice is due."
          },
          "automatic_tax": {
            "type": "boolean",
            "description": "Whether Stripe Tax calculates tax on the connection's exports."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreateStatementInvoiceRequest": {
        "description": "Target of a statement invoice export.",
        "type": "object",
        "properties": {
          "provider": {
            "$ref": "#/components/schemas/BillingProvider"
          },
          "customer": {
            "type": "string",
            "maxLength": 255,
            "description": "The provider's customer: a Stripe cus_… ID, a Paddle ctm_… ID, or a Lago external customer ID. Omitted, the consumer's or tenant's external_ref is used when it is one."
          }
        }
      },
      "StatementInvoiceExportResponse": {
        "description": "A finalized statement's invoice in the account's billing provider.",
        "type": "object",
        "required": [
          "statement_id",
          "provider",
          "customer",
          "status",
          "currency",
          "amount_minor",
          "livemode",
          "created_at"
        ],
        "properties": {
          "statement_id": {
            "type": "string",
            "format": "uuid"
          },
          "provider": {
            "$ref": "#/components/schemas/BillingProvider"
          },
          "customer": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "creating",
              "completed"
            ],
            "description": "creating means an earlier attempt stopped part-way; repeat the export to resume it."
          },
          "invoice_id": {
            "type": "string"
          },
          "dashboard_url": {
            "type": "string",
            "format": "uri"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "amount_minor": {
            "type": "integer",
            "format": "int64",
            "description": "Invoice total in the currency's minor unit (cents): the statement total rounded to the cent."
          },
          "livemode": {
            "type": "boolean"
          },
          "collection": {
            "type": "string",
            "enum": [
              "none",
              "send",
              "charge"
            ],
            "description": "What the provider was asked to do with the invoice when the export began."
          },
          "automatic_tax": {
            "type": "boolean",
            "description": "Whether Stripe Tax calculated this invoice's tax."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          },
          "source_kind": {
            "type": "string",
            "enum": [
              "app_consumer",
              "platform_tenant",
              "product_control"
            ]
          },
          "payment_status": {
            "type": "string",
            "enum": [
              "draft",
              "open",
              "paid",
              "void",
              "uncollectible",
              "deleted"
            ],
            "description": "The provider invoice's status as last read by Gregale; deleted means the provider no longer has it. Absent until the first sync."
          },
          "amount_paid_minor": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "amount_remaining_minor": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "due_at": {
            "type": "string",
            "format": "date-time"
          },
          "paid_at": {
            "type": "string",
            "format": "date-time"
          },
          "hosted_invoice_url": {
            "type": "string",
            "format": "uri",
            "description": "The provider's customer-facing invoice or checkout page once there is one."
          },
          "overdue": {
            "type": "boolean",
            "description": "Open, past its due date, with an amount remaining."
          },
          "status_synced_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "StatementInvoiceListResponse": {
        "description": "One page of an account's exported invoices, newest first.",
        "type": "object",
        "required": [
          "invoices"
        ],
        "properties": {
          "invoices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StatementInvoiceExportResponse"
            }
          },
          "next_cursor": {
            "type": "string",
            "description": "Pass as cursor for the next invoice page; absent on the last page."
          }
        }
      },
      "ConsumerBillingPlan": {
        "description": "The consumer's current plan and its monthly unit cap.",
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "max_units_per_month": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        }
      },
      "ConsumerBillingSummaryResponse": {
        "description": "A consumer's own month to date, priced like its next statement.",
        "type": "object",
        "required": [
          "consumer_id",
          "external_ref",
          "name",
          "app",
          "month",
          "billable_units",
          "unpriced_units",
          "amount_millicents",
          "priced",
          "as_of"
        ],
        "properties": {
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_ref": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "app": {
            "type": "string",
            "description": "The app's slug."
          },
          "month": {
            "type": "string",
            "pattern": "^[0-9]{4}-[0-9]{2}$"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "billable_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unpriced_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "amount_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Month-to-date amount; 100000 millicents is 1.00."
          },
          "priced": {
            "type": "boolean",
            "description": "False while some usage has no effective rate card."
          },
          "plan": {
            "$ref": "#/components/schemas/ConsumerBillingPlan"
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "credits": {
            "type": "array",
            "description": "Prepaid credit the consumer can still use, per currency.",
            "items": {
              "$ref": "#/components/schemas/APIConsumerCreditBalance"
            }
          },
          "spend_cap": {
            "$ref": "#/components/schemas/ConsumerBillingSpendCap"
          }
        }
      },
      "ConsumerBillingSpendCap": {
        "description": "The consumer's monthly spend cap; once the amount due passes it, requests are refused until the month ends or credit is added.",
        "type": "object",
        "required": [
          "currency",
          "monthly_cap_millicents",
          "capped"
        ],
        "properties": {
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "monthly_cap_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "capped": {
            "type": "boolean"
          },
          "amount_due_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ConsumerBillingDay": {
        "description": "One UTC day of a consumer's usage.",
        "type": "object",
        "required": [
          "date",
          "requests",
          "billable_units"
        ],
        "properties": {
          "date": {
            "type": "string",
            "format": "date"
          },
          "requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "billable_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ConsumerBillingUsageResponse": {
        "description": "A consumer's daily usage over at most 31 days.",
        "type": "object",
        "required": [
          "since",
          "until",
          "days"
        ],
        "properties": {
          "since": {
            "type": "string",
            "format": "date-time"
          },
          "until": {
            "type": "string",
            "format": "date-time"
          },
          "days": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConsumerBillingDay"
            }
          }
        }
      },
      "ConsumerBillingInvoice": {
        "description": "The customer-facing view of a statement's exported invoice.",
        "type": "object",
        "required": [
          "amount_minor"
        ],
        "properties": {
          "payment_status": {
            "type": "string",
            "enum": [
              "draft",
              "open",
              "paid",
              "void",
              "uncollectible",
              "deleted"
            ]
          },
          "amount_minor": {
            "type": "integer",
            "format": "int64"
          },
          "amount_remaining_minor": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "due_at": {
            "type": "string",
            "format": "date-time"
          },
          "paid_at": {
            "type": "string",
            "format": "date-time"
          },
          "hosted_invoice_url": {
            "type": "string",
            "format": "uri",
            "description": "Stripe's page where the customer views and pays the invoice."
          }
        }
      },
      "ConsumerBillingStatement": {
        "description": "One finalized statement as its consumer sees it.",
        "type": "object",
        "required": [
          "id",
          "period_start",
          "period_end",
          "revision",
          "currency",
          "billable_units",
          "amount_millicents",
          "credit_applied_millicents",
          "amount_due_millicents"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "period_end": {
            "type": "string",
            "format": "date-time"
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "billable_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "amount_millicents": {
            "type": "integer",
            "format": "int64"
          },
          "credit_applied_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Prepaid credit drawn when this billing statement was finalized."
          },
          "amount_due_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "amount_millicents less credit_applied_millicents: what is left to pay."
          },
          "finalized_at": {
            "type": "string",
            "format": "date-time"
          },
          "invoice": {
            "$ref": "#/components/schemas/ConsumerBillingInvoice"
          }
        }
      },
      "ConsumerBillingStatementsResponse": {
        "description": "A consumer's latest finalized statements, newest first.",
        "type": "object",
        "required": [
          "statements"
        ],
        "properties": {
          "statements": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConsumerBillingStatement"
            }
          }
        }
      },
      "PutConsumerSignupRequest": {
        "description": "Self-service sign-up settings. Omitted fields take their defaults.",
        "type": "object",
        "required": [
          "display_name"
        ],
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "Whether customers can start sign-ups (default true)."
          },
          "provider": {
            "type": "string",
            "enum": [
              "stripe"
            ],
            "description": "Where cards are saved (default stripe)."
          },
          "plan_ids": {
            "type": "array",
            "maxItems": 20,
            "description": "Consumer plans customers choose from; none offers the app's default plan.",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "key_scopes": {
            "type": "array",
            "minItems": 1,
            "maxItems": 4,
            "description": "Scopes of the key a customer gets (default write and billing).",
            "items": {
              "type": "string",
              "enum": [
                "read",
                "write",
                "admin",
                "billing"
              ]
            }
          },
          "display_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "terms_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048,
            "description": "https URL customers accept before signing up."
          },
          "return_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048,
            "description": "https URL shown after the key; it never carries the key."
          },
          "trial_days": {
            "type": "integer",
            "minimum": 0,
            "maximum": 365
          },
          "daily_limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000,
            "description": "Sign-ups per UTC day (default 100)."
          },
          "customer_plan_changes": {
            "type": "boolean",
            "description": "Let customers switch between plan_ids with their own key."
          },
          "customer_closing": {
            "type": "boolean",
            "description": "Let customers close their account with their own key."
          }
        }
      },
      "ConsumerSignupSettingsResponse": {
        "description": "An app's sign-up settings.",
        "type": "object",
        "required": [
          "app",
          "enabled",
          "provider",
          "plan_ids",
          "key_scopes",
          "display_name",
          "daily_limit",
          "page_url",
          "customer_plan_changes",
          "customer_closing",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "app": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "provider": {
            "type": "string",
            "enum": [
              "stripe"
            ]
          },
          "plan_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "key_scopes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "display_name": {
            "type": "string"
          },
          "terms_url": {
            "type": "string"
          },
          "return_url": {
            "type": "string"
          },
          "trial_days": {
            "type": "integer"
          },
          "daily_limit": {
            "type": "integer"
          },
          "page_url": {
            "type": "string",
            "format": "uri",
            "description": "The hosted sign-up page to link customers to."
          },
          "customer_plan_changes": {
            "type": "boolean"
          },
          "customer_closing": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ConsumerSignupResponse": {
        "description": "One sign-up as the app owner sees it.",
        "type": "object",
        "required": [
          "id",
          "email",
          "name",
          "status",
          "livemode",
          "created_at",
          "expires_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "email": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "plan_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "completed"
            ]
          },
          "livemode": {
            "type": "boolean"
          },
          "provider_customer_id": {
            "type": "string",
            "description": "The Stripe customer, also the consumer's external_ref."
          },
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ConsumerSignupListResponse": {
        "description": "An app's latest sign-ups, newest first.",
        "type": "object",
        "required": [
          "signups"
        ],
        "properties": {
          "signups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConsumerSignupResponse"
            }
          }
        }
      },
      "ConsumerSignupPrice": {
        "description": "One unit's current price on a plan.",
        "type": "object",
        "required": [
          "unit",
          "currency",
          "price_millicents_per_unit"
        ],
        "properties": {
          "unit": {
            "type": "string"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "price_millicents_per_unit": {
            "type": "integer",
            "format": "int64"
          },
          "included_units_per_month": {
            "type": "integer",
            "format": "int64"
          },
          "tiered": {
            "type": "boolean"
          },
          "base_fee_millicents_per_month": {
            "type": "integer",
            "format": "int64"
          },
          "minimum_millicents_per_month": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "ConsumerSignupPlan": {
        "description": "A plan customers can sign up for; no id is the app's default plan.",
        "type": "object",
        "required": [
          "name",
          "prices"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "max_requests_per_minute": {
            "type": "integer",
            "format": "int64"
          },
          "max_units_per_month": {
            "type": "integer",
            "format": "int64"
          },
          "prices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConsumerSignupPrice"
            }
          }
        }
      },
      "ConsumerSignupFormResponse": {
        "description": "What the sign-up page shows.",
        "type": "object",
        "required": [
          "app",
          "display_name",
          "livemode",
          "plans"
        ],
        "properties": {
          "app": {
            "type": "string"
          },
          "display_name": {
            "type": "string"
          },
          "terms_url": {
            "type": "string"
          },
          "livemode": {
            "type": "boolean",
            "description": "False while the owner's Stripe key is a test key."
          },
          "trial_days": {
            "type": "integer"
          },
          "plans": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConsumerSignupPlan"
            }
          }
        }
      },
      "CreateConsumerSignupRequest": {
        "description": "A customer's sign-up.",
        "type": "object",
        "required": [
          "email",
          "name"
        ],
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 254
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "plan_id": {
            "type": "string",
            "format": "uuid",
            "description": "One of the offered plans; may be omitted when one plan is offered."
          }
        }
      },
      "CreateConsumerSignupResponse": {
        "description": "A started sign-up. Send the customer to checkout_url; keep claim_token to complete it.",
        "type": "object",
        "required": [
          "id",
          "checkout_url",
          "claim_token",
          "expires_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "checkout_url": {
            "type": "string",
            "format": "uri"
          },
          "claim_token": {
            "type": "string"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CompleteConsumerSignupRequest": {
        "description": "Completes a sign-up.",
        "type": "object",
        "required": [
          "claim_token"
        ],
        "properties": {
          "claim_token": {
            "type": "string"
          }
        }
      },
      "CompleteConsumerSignupResponse": {
        "description": "The customer's consumer and new key, shown only here.",
        "type": "object",
        "required": [
          "consumer_id",
          "key",
          "key_prefix",
          "scopes"
        ],
        "properties": {
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "key": {
            "type": "string"
          },
          "key_prefix": {
            "type": "string"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "plan_id": {
            "type": "string",
            "format": "uuid"
          },
          "trial_ends_at": {
            "type": "string",
            "format": "date-time"
          },
          "return_url": {
            "type": "string"
          }
        }
      },
      "ConsumerBillingPlansResponse": {
        "description": "The plans a consumer can switch between.",
        "type": "object",
        "required": [
          "can_change",
          "can_close",
          "plans"
        ],
        "properties": {
          "current_plan_id": {
            "type": "string",
            "format": "uuid",
            "description": "Omitted on the app's default plan."
          },
          "can_change": {
            "type": "boolean"
          },
          "can_close": {
            "type": "boolean"
          },
          "plans": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConsumerSignupPlan"
            }
          }
        }
      },
      "ChangeConsumerBillingPlanRequest": {
        "description": "Switches to one of the offered plans from the next minute.",
        "type": "object",
        "required": [
          "plan_id"
        ],
        "properties": {
          "plan_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "ConsumerBillingPlanChangeResponse": {
        "description": "A scheduled plan change.",
        "type": "object",
        "required": [
          "plan_id",
          "effective_from"
        ],
        "properties": {
          "plan_id": {
            "type": "string",
            "format": "uuid"
          },
          "effective_from": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreateConsumerBillingPortalRequest": {
        "description": "Opens the payment provider's customer portal.",
        "type": "object",
        "properties": {
          "return_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048
          }
        }
      },
      "ConsumerBillingPortalResponse": {
        "description": "A short-lived customer portal URL.",
        "type": "object",
        "required": [
          "url"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "ConsumerBillingCloseResponse": {
        "description": "A closed consumer account.",
        "type": "object",
        "required": [
          "consumer_id",
          "closed_at"
        ],
        "properties": {
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "closed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "APIConsumerSignedUpWebhookPayload": {
        "type": "object",
        "description": "Data delivered with consumer.signed_up once a customer's sign-up created their consumer. signup_id is stable across retries.",
        "required": [
          "signup_id",
          "app_id",
          "consumer_id",
          "external_ref",
          "name",
          "email",
          "livemode",
          "signed_up_at"
        ],
        "properties": {
          "signup_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_ref": {
            "type": "string",
            "description": "The customer's Stripe customer."
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "plan_id": {
            "type": "string",
            "format": "uuid"
          },
          "trial_ends_at": {
            "type": "string",
            "format": "date-time"
          },
          "livemode": {
            "type": "boolean"
          },
          "signed_up_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "APIConsumerPlanChangedWebhookPayload": {
        "type": "object",
        "description": "Data delivered with consumer.plan_changed when a customer switched plans with their own key. assignment_id is stable across retries; an omitted plan is the app's default plan.",
        "required": [
          "assignment_id",
          "app_id",
          "consumer_id",
          "external_ref",
          "effective_from",
          "changed_at"
        ],
        "properties": {
          "assignment_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_ref": {
            "type": "string"
          },
          "from_plan_id": {
            "type": "string",
            "format": "uuid"
          },
          "to_plan_id": {
            "type": "string",
            "format": "uuid"
          },
          "effective_from": {
            "type": "string",
            "format": "date-time"
          },
          "changed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "APIConsumerClosedWebhookPayload": {
        "type": "object",
        "description": "Data delivered with consumer.closed when a customer closed their account with their own key.",
        "required": [
          "app_id",
          "consumer_id",
          "external_ref",
          "closed_at"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_ref": {
            "type": "string"
          },
          "closed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreateBillingRunRequest": {
        "description": "A month-end billing run. Omitted options bill both sources, finalize, do not export, and hold consumers with completeness gaps.",
        "type": "object",
        "required": [
          "month"
        ],
        "properties": {
          "month": {
            "type": "string",
            "pattern": "^[0-9]{4}-(0[1-9]|1[0-2])$",
            "description": "UTC calendar month to bill, YYYY-MM; it must have ended at least an hour ago."
          },
          "sources": {
            "$ref": "#/components/schemas/BillingRunSources"
          },
          "finalize": {
            "type": "boolean",
            "description": "Finalize each drafted statement (default true)."
          },
          "export": {
            "$ref": "#/components/schemas/BillingRunExport"
          },
          "hold_on_gaps": {
            "type": "boolean",
            "description": "Hold an app consumer whose usage ledger misses requests telemetry saw (default true)."
          }
        }
      },
      "BillingRunSources": {
        "description": "Which customers a run bills. With platform_tenants, a consumer's tenant-attributed usage is billed on the tenant statement and its app item is skipped. product_customers bills each Product Control customer's statement for the month and needs Product Control to be enabled.",
        "type": "array",
        "minItems": 1,
        "maxItems": 3,
        "uniqueItems": true,
        "items": {
          "type": "string",
          "enum": [
            "app_consumers",
            "platform_tenants",
            "product_customers"
          ]
        }
      },
      "BillingRunExport": {
        "description": "Where finalized statements go: none, or invoices in the account's Stripe, Paddle or Lago (requires finalize and a connected key).",
        "type": "string",
        "enum": [
          "none",
          "stripe",
          "paddle",
          "lago"
        ]
      },
      "BillingRunCounts": {
        "description": "How many of a run's customers reached each outcome.",
        "type": "object",
        "required": [
          "pending",
          "drafted",
          "finalized",
          "exported",
          "up_to_date",
          "held",
          "skipped",
          "failed"
        ],
        "properties": {
          "pending": {
            "type": "integer",
            "minimum": 0
          },
          "drafted": {
            "type": "integer",
            "minimum": 0
          },
          "finalized": {
            "type": "integer",
            "minimum": 0
          },
          "exported": {
            "type": "integer",
            "minimum": 0
          },
          "up_to_date": {
            "type": "integer",
            "minimum": 0
          },
          "held": {
            "type": "integer",
            "minimum": 0
          },
          "skipped": {
            "type": "integer",
            "minimum": 0
          },
          "failed": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "BillingRunResponse": {
        "description": "A billing run and its progress. A run completes when no customer is pending; held and failed customers do not fail it.",
        "type": "object",
        "required": [
          "id",
          "month",
          "period_start",
          "period_end",
          "sources",
          "finalize",
          "export",
          "hold_on_gaps",
          "trigger",
          "status",
          "counts",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "month": {
            "type": "string",
            "pattern": "^[0-9]{4}-[0-9]{2}$"
          },
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "period_end": {
            "type": "string",
            "format": "date-time"
          },
          "sources": {
            "$ref": "#/components/schemas/BillingRunSources"
          },
          "finalize": {
            "type": "boolean"
          },
          "export": {
            "$ref": "#/components/schemas/BillingRunExport"
          },
          "hold_on_gaps": {
            "type": "boolean"
          },
          "trigger": {
            "type": "string",
            "enum": [
              "api",
              "schedule"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "completed"
            ]
          },
          "counts": {
            "$ref": "#/components/schemas/BillingRunCounts"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "BillingRunListResponse": {
        "description": "An account's billing runs, newest first.",
        "type": "object",
        "required": [
          "runs"
        ],
        "properties": {
          "runs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BillingRunResponse"
            }
          }
        }
      },
      "BillingRunItemResponse": {
        "description": "What a billing run did for one app consumer, platform tenant or Product Control customer. A product_control item names its app in app_id and its customer in platform_tenant_id; its statement_id is the Product Control statement document.",
        "type": "object",
        "required": [
          "source_kind",
          "external_ref",
          "outcome",
          "exported_invoices",
          "attempts",
          "updated_at"
        ],
        "properties": {
          "source_kind": {
            "type": "string",
            "enum": [
              "app_consumer",
              "platform_tenant",
              "product_control"
            ]
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_ref": {
            "type": "string",
            "description": "The consumer's or tenant's external_ref when the run started."
          },
          "outcome": {
            "type": "string",
            "enum": [
              "pending",
              "drafted",
              "finalized",
              "exported",
              "up_to_date",
              "held",
              "skipped",
              "failed"
            ],
            "description": "up_to_date: nothing new to bill or export. held: needs attention, such as unpriced usage, a completeness gap, or Product Control runs with no recorded outcome. skipped: billed through a platform tenant, or already invoiced through the other path or by hand."
          },
          "statement_id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "amount_millicents": {
            "type": "integer",
            "format": "int64",
            "description": "The statement revision's amount in millicents."
          },
          "completeness": {
            "type": "string",
            "enum": [
              "verified",
              "partial",
              "gaps_detected",
              "unverifiable"
            ]
          },
          "invoice_id": {
            "type": "string",
            "description": "The last provider invoice this run created for the customer."
          },
          "exported_invoices": {
            "type": "integer",
            "minimum": 0,
            "description": "Provider invoices this run created for the customer."
          },
          "reason": {
            "type": "string",
            "description": "Why the customer was held, skipped or failed, or why a retry is pending."
          },
          "attempts": {
            "type": "integer",
            "minimum": 0
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "payment_status": {
            "type": "string",
            "enum": [
              "draft",
              "open",
              "paid",
              "void",
              "uncollectible",
              "deleted"
            ],
            "description": "Payment status of the invoice exported for the item's statement."
          }
        }
      },
      "BillingRunItemListResponse": {
        "description": "One page of a billing run's customers, ordered by kind and ID.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BillingRunItemResponse"
            }
          },
          "next_cursor": {
            "type": "string",
            "description": "Pass as cursor to read the next page; absent on the last page."
          }
        }
      },
      "PutBillingRunScheduleRequest": {
        "description": "A monthly billing run schedule. Options default like a run's; delay_hours defaults to 24.",
        "type": "object",
        "properties": {
          "sources": {
            "$ref": "#/components/schemas/BillingRunSources"
          },
          "finalize": {
            "type": "boolean",
            "description": "Finalize each drafted statement in scheduled runs (default true)."
          },
          "export": {
            "$ref": "#/components/schemas/BillingRunExport"
          },
          "hold_on_gaps": {
            "type": "boolean",
            "description": "Hold app consumers with completeness gaps in scheduled runs (default true)."
          },
          "delay_hours": {
            "type": "integer",
            "minimum": 1,
            "maximum": 240,
            "description": "Hours after month end before the run starts (default 24)."
          }
        }
      },
      "BillingRunScheduleResponse": {
        "description": "The account's billing run schedule and the month it bills next.",
        "type": "object",
        "required": [
          "sources",
          "finalize",
          "export",
          "hold_on_gaps",
          "delay_hours",
          "next_month",
          "next_run_at",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "sources": {
            "$ref": "#/components/schemas/BillingRunSources"
          },
          "finalize": {
            "type": "boolean"
          },
          "export": {
            "$ref": "#/components/schemas/BillingRunExport"
          },
          "hold_on_gaps": {
            "type": "boolean"
          },
          "delay_hours": {
            "type": "integer",
            "minimum": 1,
            "maximum": 240
          },
          "next_month": {
            "type": "string",
            "pattern": "^[0-9]{4}-[0-9]{2}$"
          },
          "next_run_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_month": {
            "type": "string",
            "pattern": "^[0-9]{4}-[0-9]{2}$",
            "description": "The last month the schedule started a run for."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "APIConsumerUsageStatementFinalizedWebhookPayload": {
        "type": "object",
        "description": "Complete payable usage statement delivered with usage_statement.finalized.",
        "required": [
          "app_id",
          "consumer_id",
          "statement_id",
          "period_start",
          "period_end",
          "billable_units",
          "unpriced_units",
          "amount_millicents",
          "priced",
          "buckets",
          "as_of",
          "finalized_at"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "statement_id": {
            "type": "string",
            "format": "uuid"
          },
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "period_end": {
            "type": "string",
            "format": "date-time"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "billable_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unpriced_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "amount_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "priced": {
            "type": "boolean"
          },
          "buckets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/APIConsumerUsageStatementBucketResponse"
            }
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "finalized_at": {
            "type": "string",
            "format": "date-time"
          },
          "credit_applied_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Prepaid credit drawn at finalization."
          },
          "amount_due_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "What is left to bill after prepaid credit."
          }
        },
        "additionalProperties": true
      },
      "PlatformTenantStatementFinalizedWebhookPayload": {
        "type": "object",
        "description": "Immutable cross-app statement snapshot delivered once per finalized revision to tenant-scoped receivers.",
        "required": [
          "platform_tenant_id",
          "external_ref",
          "statement_id",
          "revision",
          "status",
          "period_start",
          "period_end",
          "currency",
          "billable_units",
          "unpriced_units",
          "amount_millicents",
          "priced",
          "lines",
          "as_of",
          "finalized_at"
        ],
        "properties": {
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_ref": {
            "type": "string",
            "description": "Platform owner's stable customer reference."
          },
          "statement_id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "finalized"
            ]
          },
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "period_end": {
            "type": "string",
            "format": "date-time"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "billable_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unpriced_units": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "amount_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "priced": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTenantStatementLineResponse"
            }
          },
          "fees": {
            "type": "array",
            "maxItems": 64,
            "description": "The revision's monthly base fees and minimum top-ups, included in amount_millicents.",
            "items": {
              "$ref": "#/components/schemas/APIConsumerStatementFeeResponse"
            }
          },
          "credit_applied_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Tenant prepaid credit this finalized revision drew."
          },
          "amount_due_millicents": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "What remains to invoice after the credit."
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "finalized_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "PlatformTenantHostnameVerifiedWebhookPayload": {
        "type": "object",
        "description": "DNS ownership verification for a hostname on a surface explicitly linked to this tenant. It does not imply certificate issuance or routing, and never contains the DNS challenge token.",
        "required": [
          "platform_tenant_id",
          "external_ref",
          "surface_id",
          "surface_name",
          "app_id",
          "hostname_id",
          "hostname",
          "verified_at"
        ],
        "properties": {
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_ref": {
            "type": "string",
            "description": "Stable customer reference selected by the platform owner."
          },
          "surface_id": {
            "type": "string",
            "format": "uuid"
          },
          "surface_name": {
            "type": "string"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "hostname_id": {
            "type": "string",
            "format": "uuid"
          },
          "hostname": {
            "type": "string",
            "minLength": 1
          },
          "verified_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "PlatformTenantSurfaceCertificateChangedWebhookPayload": {
        "type": "object",
        "description": "Persisted certificate-state transition for a surface explicitly linked to this tenant. Raw provider error text, certificates, and private keys are never included; use the activation snapshot for current diagnostic details.",
        "required": [
          "platform_tenant_id",
          "external_ref",
          "surface_id",
          "surface_name",
          "app_id",
          "cert_state",
          "cert_not_after",
          "changed_at"
        ],
        "properties": {
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_ref": {
            "type": "string",
            "description": "The platform's durable identifier for this customer record."
          },
          "surface_id": {
            "type": "string",
            "format": "uuid"
          },
          "surface_name": {
            "type": "string"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "cert_state": {
            "type": "string",
            "enum": [
              "none",
              "pending",
              "issued",
              "failed"
            ]
          },
          "cert_not_after": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Null unless a certificate expiry is recorded."
          },
          "changed_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "PlatformTenantSurfaceDeploymentChangedWebhookPayload": {
        "type": "object",
        "description": "Terminal deployment outcome for a surface explicitly linked to this tenant. Contains revision and status metadata only; app/deployment IDs, source details, logs, and raw errors are excluded. A failed latest attempt does not mean a previous deployment is not serving.",
        "required": [
          "platform_tenant_id",
          "external_ref",
          "surface_id",
          "surface_name",
          "revision",
          "deployment_status",
          "started_at",
          "changed_at"
        ],
        "properties": {
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_ref": {
            "type": "string"
          },
          "surface_id": {
            "type": "string",
            "format": "uuid"
          },
          "surface_name": {
            "type": "string"
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "deployment_status": {
            "type": "string",
            "enum": [
              "live",
              "failed"
            ]
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "changed_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "PlatformTenantCustomerLifecycleWebhookPayload": {
        "type": "object",
        "description": "Active customer identity created for or linked to a platform tenant, or later revoked. The stable customer_external_ref joins identities across apps; consumer_id and app_id identify the app-local row.",
        "required": [
          "platform_tenant_id",
          "external_ref",
          "consumer_id",
          "app_id",
          "customer_external_ref",
          "customer_name",
          "customer_status",
          "changed_at"
        ],
        "properties": {
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_ref": {
            "type": "string",
            "description": "The platform owner's stable customer reference."
          },
          "consumer_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "customer_external_ref": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "customer_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "customer_status": {
            "type": "string",
            "enum": [
              "active",
              "revoked"
            ]
          },
          "changed_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "PlatformTenantReconciliationAppliedWebhookPayload": {
        "type": "object",
        "description": "Successful apply notification with the platform owner's stable tenant reference. Use receipt_id to fetch full changes; the event omits the submitted desired bundle and hostname challenge tokens.",
        "required": [
          "platform_tenant_id",
          "external_ref",
          "receipt_id",
          "plan_hash",
          "applied_at",
          "change_count"
        ],
        "properties": {
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_ref": {
            "type": "string"
          },
          "receipt_id": {
            "type": "string",
            "format": "uuid"
          },
          "plan_hash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "applied_at": {
            "type": "string",
            "format": "date-time"
          },
          "change_count": {
            "type": "integer",
            "minimum": 0
          }
        },
        "additionalProperties": false
      },
      "CreateInboundWebhookEndpointRequest": {
        "type": "object",
        "description": "Create a provider-verified endpoint for Stripe or a custom sender using Gregale's timestamped HMAC-SHA256 protocol. Accepted events become durable app invocations or stored workflow starts when bound.",
        "required": [
          "name",
          "provider",
          "signing_secret"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$",
            "maxLength": 63
          },
          "provider": {
            "type": "string",
            "enum": [
              "stripe",
              "generic"
            ]
          },
          "signing_secret": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Stripe signing secret or custom sender HMAC secret (at least 32 bytes for generic); sealed at rest and never returned."
          },
          "delivery_path": {
            "type": "string",
            "pattern": "^/[^?#]*$",
            "maxLength": 256,
            "default": "/"
          },
          "enabled": {
            "type": "boolean",
            "default": true
          }
        },
        "example": {
          "name": "stripe-primary",
          "provider": "stripe",
          "signing_secret": "whsec_example",
          "delivery_path": "/internal/stripe"
        }
      },
      "UpdateInboundWebhookEndpointRequest": {
        "type": "object",
        "description": "Omitted fields remain unchanged. A signing_secret value rotates the provider secret in place; generic secrets must contain at least 32 bytes.",
        "properties": {
          "signing_secret": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Generic provider secrets must contain at least 32 bytes."
          },
          "delivery_path": {
            "type": "string",
            "pattern": "^/[^?#]*$",
            "maxLength": 256
          },
          "enabled": {
            "type": "boolean"
          }
        }
      },
      "InboundWebhookEndpointResponse": {
        "type": "object",
        "description": "Safe endpoint metadata. endpoint_url is disclosed only by the create response.",
        "required": [
          "id",
          "app_id",
          "account_id",
          "name",
          "provider",
          "delivery_path",
          "enabled",
          "signing_secret_masked",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "maxLength": 63
          },
          "provider": {
            "type": "string",
            "enum": [
              "stripe",
              "generic"
            ]
          },
          "delivery_path": {
            "type": "string",
            "maxLength": 256
          },
          "enabled": {
            "type": "boolean"
          },
          "signing_secret_masked": {
            "type": "string",
            "enum": [
              "***"
            ]
          },
          "endpoint_url": {
            "type": "string",
            "format": "uri",
            "description": "One-time-disclosed public provider URL, present only on create."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PutWebhookWorkflowBindingRequest": {
        "description": "Bind a verified provider endpoint to a published stored workflow with revision control.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version",
          "workflow_name",
          "event_type",
          "take_over_delivery"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "workflow_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "event_type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "filter": {
            "type": "object",
            "additionalProperties": true
          },
          "take_over_delivery": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        }
      },
      "WebhookWorkflowBindingResponse": {
        "description": "Captured stored workflow name, event selection and current endpoint binding revision.",
        "type": "object",
        "required": [
          "endpoint_id",
          "workflow_name",
          "event_type",
          "filter",
          "version",
          "updated_at"
        ],
        "properties": {
          "endpoint_id": {
            "type": "string",
            "format": "uuid"
          },
          "workflow_name": {
            "type": "string"
          },
          "event_type": {
            "type": "string"
          },
          "filter": {
            "type": "object",
            "additionalProperties": true
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PutOperationWebhookBindingRequest": {
        "description": "Bind a verified provider endpoint to a customer operation with revision control.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version",
          "operation",
          "platform_tenant_id",
          "take_over_delivery"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "scope": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Environment scope; defaults to default."
          },
          "operation": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,63}$",
            "description": "Operation name resolved on the scope's live deployment for each event."
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid",
            "description": "Operation owner fixed by this binding."
          },
          "event_types": {
            "type": "array",
            "maxItems": 32,
            "uniqueItems": true,
            "description": "Exact event types to admit; empty admits every verified event. Must be empty in signal mode.",
            "items": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_.]{0,255}$"
            }
          },
          "take_over_delivery": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "mode": {
            "type": "string",
            "enum": [
              "start",
              "signal"
            ],
            "default": "start",
            "description": "start admits a new operation per event; signal resumes waiting operations."
          },
          "subject": {
            "$ref": "#/components/schemas/OperationSubjectSpec",
            "description": "Signal mode only. The subject type the operation declares and a JSON Pointer into the provider event payload."
          },
          "signals": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "description": "Signal mode only. Provider event types to deliver and the operation event each becomes; other types are acknowledged as ignored.",
            "items": {
              "$ref": "#/components/schemas/OperationWebhookSignal"
            }
          }
        }
      },
      "OperationWebhookSignal": {
        "description": "One provider event type and the operation event a waiting workflow step receives for it.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "provider_event",
          "event"
        ],
        "properties": {
          "provider_event": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_.]{0,255}$"
          },
          "event": {
            "type": "string",
            "maxLength": 63,
            "pattern": "^[a-z][a-z0-9_.-]*$"
          }
        }
      },
      "OperationWebhookBindingResponse": {
        "description": "Bound operation, owner, mode, event selection and current endpoint binding revision.",
        "type": "object",
        "required": [
          "endpoint_id",
          "app_id",
          "scope",
          "operation",
          "platform_tenant_id",
          "event_types",
          "mode",
          "version",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "endpoint_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "operation": {
            "type": "string"
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "event_types": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "mode": {
            "type": "string",
            "enum": [
              "start",
              "signal"
            ]
          },
          "subject": {
            "$ref": "#/components/schemas/OperationSubjectSpec"
          },
          "signals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OperationWebhookSignal"
            }
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WebhookWorkflowReceiptResponse": {
        "description": "Durable provider event routing decision and stored workflow admission progress.",
        "type": "object",
        "required": [
          "receipt_id",
          "endpoint_id",
          "provider_event_id",
          "workflow_name",
          "status",
          "duplicate",
          "accepted_at",
          "event_source",
          "routing_status"
        ],
        "properties": {
          "receipt_id": {
            "type": "string",
            "format": "uuid"
          },
          "endpoint_id": {
            "type": "string",
            "format": "uuid"
          },
          "provider_event_id": {
            "type": "string"
          },
          "workflow_name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "accepted",
              "ignored"
            ]
          },
          "ignored_reason": {
            "type": "string",
            "enum": [
              "stored_workflow_paused",
              "stored_workflow_failure_paused",
              "event_filtered",
              "stored_workflow_unpublished"
            ]
          },
          "duplicate": {
            "type": "boolean"
          },
          "accepted_at": {
            "type": "string",
            "format": "date-time"
          },
          "event_source": {
            "type": "string"
          },
          "routing_status": {
            "type": "string",
            "enum": [
              "pending",
              "filtered",
              "enqueued",
              "failed",
              "ignored"
            ]
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "InboundWebhookReceiptResponse": {
        "type": "object",
        "description": "Returned only after the verified event has a committed durable invocation\nrow or, for an operation-bound endpoint, a committed operation and event\nreceipt; receipt_id is then the operation ID. ignored means a verified\nevent outside the operation binding's event_types created no work.\nFor a signal-mode binding receipt_id identifies the provider\nevent's signal: signaled means at least one active operation received\nit, unmatched means none did, and ignored means the type is unmapped\nor the payload lacks the subject.\n",
        "required": [
          "receipt_id",
          "status",
          "duplicate",
          "accepted_at"
        ],
        "properties": {
          "receipt_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "accepted",
              "ignored",
              "signaled",
              "unmatched"
            ]
          },
          "duplicate": {
            "type": "boolean",
            "description": "True when this endpoint already accepted the same provider event ID."
          },
          "accepted_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AppWebhookResponse": {
        "description": "An outbound webhook subscription. Carries the masked HMAC secret;\nthe sealed ciphertext is server-side only.\n",
        "type": "object",
        "required": [
          "id",
          "app_id",
          "account_id",
          "target_url",
          "webhook_secret_sealed_masked",
          "event_filter",
          "retry_policy",
          "delivery_format",
          "enabled",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          },
          "app_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "target_url": {
            "type": "string",
            "minLength": 8,
            "maxLength": 2048
          },
          "webhook_secret_sealed_masked": {
            "type": "string",
            "enum": [
              "***"
            ]
          },
          "event_filter": {
            "description": "Subscribed events; an empty filter selects standard platform events. app.health.changed requires explicit selection.",
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "operation.effect",
                "app.parked",
                "app.woken",
                "deployment.live",
                "deployment.failed",
                "rollout.completed",
                "rollout.aborted",
                "job.finished",
                "operation.finished",
                "usage_statement.finalized",
                "consumer.usage_threshold",
                "consumer.signed_up",
                "consumer.plan_changed",
                "consumer.closed",
                "outbound.ai_budget.threshold",
                "outbound.ai_quality.drift",
                "issue.created",
                "issue.assigned",
                "issue.resolved",
                "issue.reopened",
                "issue.ignored",
                "issue.regressed",
                "issue.impact_threshold_reached",
                "issue.frequency_threshold_reached",
                "issue.compound_threshold_reached",
                "issue.tracker_sync.attention",
                "issue.tracker_sync.recovered",
                "debug.regression.detected",
                "debug.regression.resolved",
                "routes.requirements.violated",
                "routes.requirements.recovered",
                "routes.requirements.changed",
                "routes.health.blocked",
                "routes.health.resumed",
                "routes.health.aborted",
                "routes.monitor.violated",
                "routes.monitor.escalated",
                "routes.monitor.recovered",
                "routes.insight.detected",
                "routes.insight.resolved",
                "workflow.finished",
                "stored_workflow.paused",
                "realtime.inbox.acknowledged",
                "realtime.inbox.gap",
                "realtime.inbox.fallback_required",
                "realtime.message.read",
                "realtime.notification.sent",
                "realtime.notification.failed",
                "realtime.notification.expired",
                "realtime.notification.cancelled",
                "realtime.notification.superseded",
                "realtime.schedule.published",
                "realtime.schedule.failed",
                "realtime.schedule.skipped",
                "app.health.changed",
                "event_recovery.completed",
                "event_recovery.cancelled",
                "event_recovery.expired",
                "profile.route_regressed",
                "profile.route_recovered",
                "profile.capture_ready",
                "profile.capture_oom_linked",
                "event_recovery.execution_finished",
                "realtime.channel.published",
                "realtime.channel.acknowledged",
                "realtime.consumer_group.dead_lettered",
                "realtime.consumer_group.dead_letter_expiring",
                "realtime.consumer_group.delivery_expired",
                "realtime.consumer_group.worker_lost",
                "realtime.consumer_group.worker_recovered",
                "realtime.consumer_group.circuit_opened",
                "realtime.consumer_group.circuit_half_open",
                "realtime.consumer_group.circuit_closed",
                "realtime.replay_job.completed",
                "realtime.replay_job.cancelled",
                "realtime.replay_job.processing_failed",
                "realtime.consumer_group.lag_exceeded",
                "realtime.consumer_group.lag_recovered",
                "event_recovery.execution_attention",
                "stored_workflow.recovery_review_ready",
                "stored_workflow.recovery_review_finished",
                "stored_workflow.recovery_policy_paused",
                "stored_workflow.recovery_queue_blocked",
                "stored_workflow.recovery_health_alert",
                "stored_workflow.recovery_health_recovered",
                "stored_workflow.recovery_polling_status"
              ]
            },
            "maxItems": 32
          },
          "retry_policy": {
            "type": "string",
            "enum": [
              "default",
              "aggressive",
              "none"
            ]
          },
          "delivery_format": {
            "type": "string",
            "enum": [
              "json",
              "cloudevents",
              "datadog"
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "example": {
          "id": "0123456789abcdef0123456789abcdef",
          "app_id": "fedcba9876543210fedcba9876543210",
          "account_id": "8b1f5e5d-273e-5a18-ae00-58fceba4fe6c",
          "target_url": "https://example.com/hook",
          "webhook_secret_sealed_masked": "***",
          "event_filter": [
            "app.parked",
            "app.woken"
          ],
          "retry_policy": "default",
          "delivery_format": "json",
          "enabled": true,
          "created_at": "2026-08-06T10:00:00Z",
          "updated_at": "2026-08-06T10:00:00Z"
        }
      },
      "AccountReleaseWebhookResponse": {
        "type": "object",
        "description": "Account-owned release receiver; no app_id because it follows all current and future apps.",
        "required": [
          "id",
          "scope",
          "account_id",
          "target_url",
          "webhook_secret_sealed_masked",
          "event_filter",
          "retry_policy",
          "delivery_format",
          "enabled",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          },
          "scope": {
            "type": "string",
            "enum": [
              "account"
            ]
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "target_url": {
            "type": "string",
            "format": "uri",
            "minLength": 8,
            "maxLength": 2048
          },
          "webhook_secret_sealed_masked": {
            "type": "string",
            "enum": [
              "***"
            ]
          },
          "event_filter": {
            "type": "array",
            "minItems": 1,
            "maxItems": 4,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "deployment.live",
                "deployment.failed",
                "rollout.completed",
                "rollout.aborted"
              ]
            }
          },
          "retry_policy": {
            "type": "string",
            "enum": [
              "default",
              "aggressive",
              "none"
            ]
          },
          "delivery_format": {
            "type": "string",
            "enum": [
              "json",
              "cloudevents"
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "RealtimeNotificationPreferences": {
        "description": "Push delivery preferences shared across devices for a verified principal.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "enabled"
        ],
        "properties": {
          "rate_limit": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RealtimeNotificationRateLimit"
              },
              {
                "type": "null"
              }
            ]
          },
          "allow_urgent_bypass": {
            "type": "boolean",
            "default": false,
            "description": "Allow urgent alerts to bypass quiet hours and digest delays; mute settings still apply."
          },
          "digest_interval_seconds": {
            "type": "integer",
            "enum": [
              0,
              300,
              3600
            ],
            "default": 0,
            "description": "Immediate, five-minute or hourly UTC delivery windows."
          },
          "summarize_quiet_hours": {
            "type": [
              "boolean",
              "null"
            ],
            "default": true,
            "description": "Combine eligible alerts released after quiet hours; null inherits true."
          },
          "enabled": {
            "type": "boolean",
            "description": "Master push switch for this principal."
          },
          "categories": {
            "type": [
              "object",
              "null"
            ],
            "maxProperties": 32,
            "propertyNames": {
              "pattern": "^[a-z0-9_.-]{1,64}$"
            },
            "additionalProperties": {
              "type": "boolean"
            },
            "description": "Unlisted categories are enabled. False cancels push for this category."
          },
          "devices": {
            "type": [
              "array",
              "null"
            ],
            "maxItems": 16,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "description": "Null or omitted selects all registered devices; empty array selects none."
          },
          "quiet_hours": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RealtimeQuietHours"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "ManagedRealtimePushProviderRequest": {
        "description": "Provider credentials and enablement settings for realtime push delivery.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "config"
        ],
        "properties": {
          "enabled": {
            "type": "boolean",
            "default": true
          },
          "config": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "provider"
            ],
            "properties": {
              "provider": {
                "type": "string",
                "enum": [
                  "fcm",
                  "apns",
                  "webpush"
                ]
              },
              "project_id": {
                "type": "string",
                "maxLength": 64
              },
              "service_account_json": {
                "type": "object",
                "description": "FCM service-account JSON with Firebase Messaging permission."
              },
              "team_id": {
                "type": "string",
                "pattern": "^[A-Z0-9]{10}$"
              },
              "key_id": {
                "type": "string",
                "pattern": "^[A-Z0-9]{10}$"
              },
              "topic": {
                "type": "string",
                "maxLength": 256
              },
              "private_key": {
                "type": "string",
                "writeOnly": true,
                "description": "APNs PKCS8 PEM key or Web Push unpadded base64url P-256 private scalar."
              },
              "sandbox": {
                "type": "boolean",
                "default": false
              },
              "subject": {
                "type": "string",
                "maxLength": 256,
                "description": "VAPID mailto or https contact URI."
              },
              "title": {
                "type": "string",
                "maxLength": 256
              },
              "body": {
                "type": "string",
                "maxLength": 1024
              }
            }
          }
        }
      },
      "ManagedRealtimePushRegistration": {
        "description": "Device registration used to route push notifications to a principal.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "provider",
          "target"
        ],
        "properties": {
          "provider": {
            "type": "string",
            "enum": [
              "fcm",
              "apns",
              "webpush"
            ]
          },
          "target": {
            "type": "object",
            "additionalProperties": false,
            "description": "FCM/APNs require token; Web Push requires endpoint, p256dh and auth.",
            "properties": {
              "token": {
                "type": "string",
                "maxLength": 4096,
                "writeOnly": true
              },
              "endpoint": {
                "type": "string",
                "format": "uri",
                "maxLength": 2048,
                "writeOnly": true
              },
              "p256dh": {
                "type": "string",
                "writeOnly": true
              },
              "auth": {
                "type": "string",
                "writeOnly": true
              }
            }
          }
        }
      },
      "ManagedRealtimePushProvider": {
        "description": "Configured push provider metadata with credentials omitted.",
        "type": "object",
        "required": [
          "provider",
          "enabled",
          "updated_at"
        ],
        "properties": {
          "provider": {
            "type": "string",
            "enum": [
              "fcm",
              "apns",
              "webpush"
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ManagedRealtimePushDevice": {
        "description": "Registered device metadata with delivery tokens omitted.",
        "type": "object",
        "required": [
          "device",
          "provider",
          "enabled",
          "version",
          "updated_at"
        ],
        "properties": {
          "device": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "enum": [
              "fcm",
              "apns",
              "webpush"
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ManagedRealtimeScheduleHistoryEvent": {
        "description": "Recorded execution or lifecycle event for a channel publish schedule.",
        "type": "object",
        "required": [
          "version",
          "event",
          "status",
          "attempts",
          "cycle_attempts",
          "deliver_at",
          "occurred_at",
          "occurrence",
          "completed_occurrences",
          "skipped_occurrences"
        ],
        "properties": {
          "skipped_occurrences": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "skip_reason": {
            "type": "string"
          },
          "occurrence": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "completed_occurrences": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "event": {
            "type": "string",
            "enum": [
              "baseline",
              "created",
              "rescheduled",
              "canceled",
              "manual_retry",
              "attempt_failed",
              "published",
              "paused",
              "resumed",
              "skipped"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "paused",
              "published",
              "canceled",
              "failed",
              "skipped"
            ]
          },
          "attempts": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cycle_attempts": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10
          },
          "deliver_at": {
            "type": "string",
            "format": "date-time"
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "failure_code": {
            "type": "string"
          },
          "sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ManagedRealtimeScheduleHistoryResponse": {
        "description": "Retained execution history for a channel publish schedule.",
        "type": "object",
        "required": [
          "schedule_id",
          "channel",
          "oldest_version",
          "latest_version",
          "history_truncated",
          "has_more",
          "events"
        ],
        "properties": {
          "schedule_id": {
            "type": "string"
          },
          "channel": {
            "type": "string"
          },
          "oldest_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "latest_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "history_truncated": {
            "type": "boolean"
          },
          "has_more": {
            "type": "boolean"
          },
          "events": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/ManagedRealtimeScheduleHistoryEvent"
            }
          }
        }
      },
      "RealtimeScheduleCompletionWebhookPayload": {
        "type": "object",
        "description": "Committed occurrence outcome delivered through app webhooks. Recurring publications and skips emit independently of the next occurrence's status; failures emit only when the retry budget is exhausted.",
        "required": [
          "event_id",
          "app_id",
          "endpoint_id",
          "channel",
          "schedule_id",
          "version",
          "occurrence",
          "completed_occurrences",
          "skipped_occurrences",
          "outcome",
          "attempts",
          "cycle_attempts",
          "deliver_at",
          "occurred_at"
        ],
        "properties": {
          "event_id": {
            "type": "string"
          },
          "app_id": {
            "type": "string"
          },
          "endpoint_id": {
            "type": "string"
          },
          "channel": {
            "type": "string"
          },
          "schedule_id": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "format": "int64"
          },
          "occurrence": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "completed_occurrences": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "skipped_occurrences": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "outcome": {
            "type": "string",
            "enum": [
              "published",
              "failed",
              "skipped"
            ]
          },
          "attempts": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cycle_attempts": {
            "type": "integer",
            "minimum": 0
          },
          "deliver_at": {
            "type": "string",
            "format": "date-time"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "failure_code": {
            "type": "string"
          },
          "skip_reason": {
            "type": "string"
          }
        }
      },
      "ManagedRealtimeSignalRequest": {
        "description": "Ephemeral backend signal payload with optional name and expiration.",
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "description": "Any JSON value, including null, within 2048 encoded UTF-8 bytes."
          },
          "name": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_.:-]{1,64}$"
          },
          "ttl_ms": {
            "type": "integer",
            "minimum": 0,
            "maximum": 30000,
            "description": "Requires name; defaults to 5000 for named signals. Zero clears."
          }
        }
      },
      "ManagedRealtimeSignalResponse": {
        "description": "Best-effort signal fanout result for currently connected subscribers.",
        "type": "object",
        "required": [
          "accepted",
          "member_id"
        ],
        "properties": {
          "accepted": {
            "type": "boolean"
          },
          "member_id": {
            "type": "string",
            "enum": [
              "backend"
            ]
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ManagedRealtimeScheduleGroupRequest": {
        "description": "Bulk action and version preconditions for a named schedule group.",
        "type": "object",
        "required": [
          "expected_versions"
        ],
        "properties": {
          "expected_versions": {
            "type": "object",
            "maxProperties": 256,
            "description": "Exact schedule ID/version map of all pending or paused group members; terminal members excluded.",
            "additionalProperties": {
              "type": "integer",
              "format": "int64",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          }
        }
      },
      "ManagedRealtimeScheduleTotals": {
        "type": "object",
        "required": [
          "pending",
          "paused",
          "published",
          "failed",
          "skipped",
          "canceled",
          "completed_occurrences",
          "skipped_occurrences"
        ],
        "description": "Totals over returned retained records, not lifetime analytics. Completed occurrences include successful one-time schedules and recurring completion counts.",
        "properties": {
          "pending": {
            "type": "integer",
            "minimum": 0
          },
          "paused": {
            "type": "integer",
            "minimum": 0
          },
          "published": {
            "type": "integer",
            "minimum": 0
          },
          "failed": {
            "type": "integer",
            "minimum": 0
          },
          "skipped": {
            "type": "integer",
            "minimum": 0
          },
          "canceled": {
            "type": "integer",
            "minimum": 0
          },
          "completed_occurrences": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "skipped_occurrences": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ManagedRealtimeScheduleRequest": {
        "description": "Scheduled channel publish payload with recurrence, retry settings, and optional message TTL.",
        "type": "object",
        "required": [
          "data_base64",
          "deliver_at"
        ],
        "properties": {
          "ttl_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400,
            "default": 0,
            "description": "Message lifetime in seconds from publication of each occurrence; zero disables expiry."
          },
          "group": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "description": "Optional immutable channel-scoped group label; at most 128 UTF-8 bytes."
          },
          "conditions": {
            "type": "array",
            "minItems": 1,
            "maxItems": 16,
            "description": "AND predicates over reducer state in this channel; at most 4 KiB encoded. Each predicate has a key and exactly one operator.",
            "items": {
              "type": "object",
              "required": [
                "key"
              ],
              "additionalProperties": false,
              "properties": {
                "key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "field": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "exists": {
                  "type": "boolean",
                  "description": "Entity existence; field must be omitted."
                },
                "equals": {
                  "description": "Any JSON value, compared structurally; requires field."
                },
                "lt": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "lte": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "gt": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "gte": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "oneOf": [
                {
                  "required": [
                    "exists"
                  ]
                },
                {
                  "required": [
                    "field",
                    "equals"
                  ]
                },
                {
                  "required": [
                    "field",
                    "lt"
                  ]
                },
                {
                  "required": [
                    "field",
                    "lte"
                  ]
                },
                {
                  "required": [
                    "field",
                    "gt"
                  ]
                },
                {
                  "required": [
                    "field",
                    "gte"
                  ]
                }
              ]
            }
          },
          "on_condition_failure": {
            "type": "string",
            "enum": [
              "skip",
              "retry"
            ],
            "default": "retry",
            "description": "Requires conditions; retry follows the configured attempt budget."
          },
          "interval_seconds": {
            "type": "integer",
            "minimum": 5,
            "maximum": 2592000,
            "description": "Fixed delay after each successful occurrence; omit for one-time publication."
          },
          "max_occurrences": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1000000,
            "description": "Optional completed-slot limit (published or intentionally skipped); zero is unlimited."
          },
          "end_at": {
            "type": "string",
            "format": "date-time",
            "description": "Last permitted planned occurrence time, within one year of initial delivery."
          },
          "max_attempts": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10,
            "default": 1,
            "description": "Total attempts per retry cycle; one disables automatic retries."
          },
          "backoff_seconds": {
            "type": "integer",
            "minimum": 5,
            "maximum": 3600,
            "default": 5,
            "description": "Initial retry delay, doubled per failure up to one hour."
          },
          "data_base64": {
            "type": "string",
            "maxLength": 5464,
            "description": "At most 4096 decoded bytes."
          },
          "binary": {
            "type": "boolean",
            "default": false
          },
          "metadata": {
            "type": "object",
            "maxProperties": 8,
            "additionalProperties": {
              "type": "string"
            }
          },
          "deliver_at": {
            "type": "string",
            "format": "date-time",
            "description": "Future time within 30 days of creation."
          }
        }
      },
      "ManagedRealtimeScheduleResponse": {
        "description": "Persisted channel publish schedule and current execution state.",
        "allOf": [
          {
            "$ref": "#/components/schemas/ManagedRealtimeScheduleRequest"
          },
          {
            "type": "object",
            "required": [
              "schedule_id",
              "channel",
              "version",
              "status",
              "created_at",
              "updated_at",
              "max_attempts",
              "backoff_seconds",
              "attempts",
              "cycle_attempts",
              "initial_deliver_at",
              "occurrence",
              "completed_occurrences",
              "skipped_occurrences"
            ],
            "properties": {
              "initial_deliver_at": {
                "type": "string",
                "format": "date-time"
              },
              "skipped_occurrences": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "skip_reason": {
                "type": "string"
              },
              "occurrence": {
                "type": "integer",
                "format": "int64",
                "minimum": 1
              },
              "completed_occurrences": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "attempts": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Lifetime recorded delivery attempts."
              },
              "cycle_attempts": {
                "type": "integer",
                "minimum": 0,
                "maximum": 10
              },
              "next_attempt_at": {
                "type": "string",
                "format": "date-time",
                "description": "Next pending retry time; omitted after completion or cancellation."
              },
              "last_attempt_at": {
                "type": "string",
                "format": "date-time"
              },
              "schedule_id": {
                "type": "string"
              },
              "channel": {
                "type": "string"
              },
              "version": {
                "type": "integer",
                "format": "int64",
                "minimum": 1,
                "maximum": 9007199254740991
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending",
                  "paused",
                  "published",
                  "canceled",
                  "failed",
                  "skipped"
                ]
              },
              "sequence": {
                "type": "integer",
                "format": "int64",
                "minimum": 1,
                "description": "Committed history sequence when published."
              },
              "last_error": {
                "type": "string",
                "description": "Most recent recorded delivery failure code; retained after a successful retry."
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "updated_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        ]
      },
      "ManagedRealtimeReducerResponse": {
        "description": "Configured channel state reducer and its current version.",
        "type": "object",
        "required": [
          "channel",
          "sequence",
          "entities",
          "entity_versions",
          "updated_at"
        ],
        "properties": {
          "channel": {
            "type": "string"
          },
          "sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "entities": {
            "type": "object",
            "maxProperties": 128,
            "additionalProperties": {
              "type": "object"
            }
          },
          "entity_expirations": {
            "type": "object",
            "maxProperties": 128,
            "description": "Scheduled entity deadlines; cleanup is asynchronous.",
            "additionalProperties": {
              "type": "string",
              "format": "date-time"
            }
          },
          "entity_versions": {
            "type": "object",
            "maxProperties": 256,
            "description": "Entity versions, including deletion tombstones.",
            "additionalProperties": {
              "type": "integer",
              "format": "int64",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ManagedRealtimeEventSchemaResponse": {
        "description": "Stored JSON Schema used to validate retained channel events.",
        "type": "object",
        "required": [
          "channel",
          "event_type",
          "version",
          "schema",
          "created_at"
        ],
        "properties": {
          "channel": {
            "type": "string"
          },
          "event_type": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000
          },
          "schema": {
            "type": [
              "object",
              "boolean"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ManagedRealtimeChannelSnapshotResponse": {
        "description": "Channel state snapshot with sequence and entity expiration metadata.",
        "type": "object",
        "required": [
          "channel",
          "sequence",
          "resume_after_sequence",
          "data_base64",
          "binary",
          "updated_at",
          "expires_at"
        ],
        "properties": {
          "channel": {
            "type": "string"
          },
          "sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "resume_after_sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "data_base64": {
            "type": "string",
            "maxLength": 87384
          },
          "binary": {
            "type": "boolean"
          },
          "entity_expirations": {
            "type": "object",
            "maxProperties": 128,
            "description": "Entity cleanup deadlines carried by this channel snapshot; cleanup runs asynchronously.",
            "additionalProperties": {
              "type": "string",
              "format": "date-time"
            }
          },
          "entity_versions": {
            "type": "object",
            "maxProperties": 256,
            "description": "Entity versions, including deletion tombstones; reducer snapshots only.",
            "additionalProperties": {
              "type": "integer",
              "format": "int64",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ManagedRealtimeNotificationTimelineEvent": {
        "description": "Recorded notification delivery or lifecycle change for a principal.",
        "type": "object",
        "required": [
          "id",
          "message_id",
          "event",
          "attempts",
          "status_code",
          "occurred_at",
          "not_before",
          "next_attempt"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "message_id": {
            "type": "string"
          },
          "device": {
            "type": "string"
          },
          "delivery_id": {
            "type": "string"
          },
          "event": {
            "type": "string",
            "description": "Delivery status or fallback_scheduled, fallback_rescheduled, fallback_removed."
          },
          "reason": {
            "type": "string"
          },
          "attempts": {
            "type": "integer"
          },
          "status_code": {
            "type": "integer"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "not_before": {
            "type": "string",
            "format": "date-time"
          },
          "next_attempt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ManagedRealtimeNotificationControlResponse": {
        "description": "Notification cancellation or rescheduling result across devices.",
        "type": "object",
        "required": [
          "fallbacks",
          "deliveries"
        ],
        "properties": {
          "fallbacks": {
            "type": "integer",
            "minimum": 0
          },
          "deliveries": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "ManagedRealtimePushDelivery": {
        "description": "Push delivery attempt metadata without provider credentials or device tokens.",
        "type": "object",
        "required": [
          "priority",
          "category",
          "expires_at",
          "id",
          "device",
          "provider",
          "message_id",
          "sequence",
          "status",
          "attempts",
          "status_code",
          "created_at",
          "updated_at",
          "next_attempt"
        ],
        "properties": {
          "not_before": {
            "type": "string",
            "format": "date-time",
            "description": "Earliest scheduled delivery; epoch or zero time means no schedule."
          },
          "collapse_key": {
            "type": "string",
            "maxLength": 128
          },
          "priority": {
            "type": "string",
            "enum": [
              "low",
              "normal",
              "urgent"
            ]
          },
          "group_key": {
            "type": "string"
          },
          "group_label": {
            "type": "string"
          },
          "digest_id": {
            "type": "string",
            "format": "uuid"
          },
          "digest_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 128,
            "description": "Distinct message count at the most recent prepared digest attempt."
          },
          "category": {
            "type": "string",
            "pattern": "^[a-z0-9_.-]{1,64}$"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "device": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "enum": [
              "fcm",
              "apns",
              "webpush"
            ]
          },
          "message_id": {
            "type": "string"
          },
          "sequence": {
            "type": "integer",
            "format": "int64"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "sending",
              "sent",
              "failed",
              "cancelled"
            ]
          },
          "attempts": {
            "type": "integer",
            "minimum": 0
          },
          "status_code": {
            "type": "integer",
            "minimum": 0,
            "description": "Provider HTTP status; zero means no response."
          },
          "code": {
            "type": "string",
            "description": "Sanitized outcome code; provider bodies are omitted."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "next_attempt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ManagedRealtimeConnectionResponse": {
        "type": "object",
        "description": "Safe control-plane projection of one live managed realtime connection.",
        "required": [
          "id",
          "endpoint_id",
          "app_id",
          "account_id",
          "connected_at",
          "last_seen_at",
          "expires_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "endpoint_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "principal": {
            "type": "string",
            "maxLength": 256
          },
          "connected_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_seen_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "channels": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 256
            },
            "maxItems": 256
          }
        }
      },
      "ManagedRealtimeConnectionListResponse": {
        "type": "object",
        "description": "Bounded point-in-time live connection inventory.",
        "required": [
          "connections",
          "limit",
          "truncated",
          "partial",
          "nodes_queried",
          "nodes_unavailable"
        ],
        "properties": {
          "connections": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ManagedRealtimeConnectionResponse"
            }
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000
          },
          "truncated": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": "string",
            "maxLength": 2048,
            "description": "Opaque cursor for the next page when truncated is true."
          },
          "partial": {
            "type": "boolean",
            "description": "True when one or more active realtime nodes did not answer."
          },
          "nodes_queried": {
            "type": "integer",
            "minimum": 0
          },
          "nodes_unavailable": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "ManagedRealtimeChannelOccupancy": {
        "type": "object",
        "description": "Fleet-wide subscription and presence counts for one channel.",
        "required": [
          "channel",
          "subscribers",
          "presence_members"
        ],
        "properties": {
          "channel": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "subscribers": {
            "type": "integer",
            "minimum": 0,
            "description": "Open subscriptions on every transport (WebSocket",
            "read-only ticket": null,
            "SSE).": null
          },
          "presence_members": {
            "type": "integer",
            "minimum": 0,
            "description": "Distinct presence members; a principal-scoped member counts once."
          }
        }
      },
      "ManagedRealtimeOccupancyResponse": {
        "type": "object",
        "description": "Point-in-time channel occupancy across the realtime fleet.",
        "required": [
          "channels",
          "partial",
          "nodes_queried",
          "nodes_unavailable"
        ],
        "properties": {
          "channels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ManagedRealtimeChannelOccupancy"
            }
          },
          "partial": {
            "type": "boolean",
            "description": "True when some active realtime nodes did not answer and counts may be low."
          },
          "nodes_queried": {
            "type": "integer",
            "minimum": 0
          },
          "nodes_unavailable": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "ManagedRealtimeDrainRequest": {
        "type": "object",
        "description": "Bounded or explicitly all-matching auditable selection for closing live connections.",
        "required": [
          "reason"
        ],
        "properties": {
          "channel": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "^[^/?#\\\\r\\\\n ]+$",
            "description": "Only select connections subscribed to this channel."
          },
          "principal": {
            "type": "string",
            "maxLength": 256,
            "description": "Only select connections for this authenticated principal."
          },
          "connection_ids": {
            "type": "array",
            "maxItems": 100,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "description": "Explicit connection IDs to select in addition to the filters."
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000,
            "default": 100,
            "description": "Maximum number of connections to select."
          },
          "all": {
            "type": "boolean",
            "default": false,
            "description": "Select every matching connection up to the server safety cap of 10,000; cannot be combined with connection_ids. Any supplied limit is ignored."
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Required reason recorded in the audit event and close request."
          },
          "dry_run": {
            "type": "boolean",
            "default": false,
            "description": "Return the selection without closing any connection."
          },
          "allow_partial": {
            "type": "boolean",
            "default": false,
            "description": "Permit closing the reachable subset when some nodes are unavailable."
          }
        }
      },
      "ManagedRealtimeDrainResult": {
        "type": "object",
        "description": "Outcome for one connection in a drain request.",
        "required": [
          "id",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "would_close",
              "closed",
              "gone",
              "failed"
            ]
          }
        }
      },
      "ManagedRealtimeDrainResponse": {
        "type": "object",
        "description": "Bounded or all-matching, auditable result of a realtime connection drain.",
        "required": [
          "operation_id",
          "status",
          "created_at",
          "results",
          "matched",
          "closed",
          "gone",
          "failed",
          "limit",
          "all",
          "truncated",
          "dry_run",
          "partial",
          "nodes_queried",
          "nodes_unavailable"
        ],
        "properties": {
          "operation_id": {
            "type": "string",
            "format": "uuid",
            "description": "Durable identifier for this drain operation."
          },
          "status": {
            "type": "string",
            "enum": [
              "running",
              "completed",
              "partial"
            ],
            "description": "Durable operation state. A partial operation had at least one gone or failed connection."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ManagedRealtimeDrainResult"
            },
            "maxItems": 10000
          },
          "matched": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000,
            "description": "Number selected after applying the limit or all-mode safety cap."
          },
          "closed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          },
          "gone": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000,
            "description": "Selected connections that disappeared before close."
          },
          "failed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000
          },
          "all": {
            "type": "boolean",
            "description": "True when the operation explicitly selected all matching connections."
          },
          "truncated": {
            "type": "boolean",
            "description": "True when more eligible connections existed than the limit."
          },
          "dry_run": {
            "type": "boolean"
          },
          "partial": {
            "type": "boolean",
            "description": "Indicates that the inventory did not cover every active realtime node."
          },
          "nodes_queried": {
            "type": "integer",
            "minimum": 0
          },
          "nodes_unavailable": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "ManagedRealtimeEndpointResponse": {
        "type": "object",
        "description": "Durable managed realtime endpoint configuration. Credentials are\nwrite-only and represented by a constant mask on every response.\n",
        "required": [
          "id",
          "app_id",
          "account_id",
          "callback_url",
          "connect_path",
          "message_path",
          "disconnect_path",
          "callback_auth_token_masked",
          "auth_token_masked",
          "auth_mode",
          "allowed_origins",
          "max_connections",
          "max_message_bytes",
          "max_connection_age_seconds",
          "enabled",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "callback_url": {
            "type": "string",
            "format": "uri",
            "minLength": 8,
            "maxLength": 2048
          },
          "connect_path": {
            "type": "string",
            "pattern": "^/",
            "maxLength": 256
          },
          "message_path": {
            "type": "string",
            "pattern": "^/",
            "maxLength": 256
          },
          "disconnect_path": {
            "type": "string",
            "pattern": "^/",
            "maxLength": 256
          },
          "callback_auth_token_masked": {
            "type": "string",
            "enum": [
              "***"
            ]
          },
          "auth_token_masked": {
            "type": "string",
            "enum": [
              "***"
            ]
          },
          "auth_token_previous_expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the previous static bearer credential stops being accepted during rotation."
          },
          "auth_mode": {
            "type": "string",
            "enum": [
              "none",
              "static_bearer",
              "oidc_jwt"
            ]
          },
          "auth_issuer": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048
          },
          "auth_jwks_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048
          },
          "auth_audience": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "type": "string",
              "maxLength": 256
            }
          },
          "auth_algorithms": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "type": "string",
              "enum": [
                "RS256",
                "RS384",
                "RS512",
                "ES256",
                "ES384",
                "ES512"
              ]
            }
          },
          "auth_required_claims": {
            "type": "object",
            "maxProperties": 16,
            "additionalProperties": {
              "type": "string",
              "maxLength": 256
            }
          },
          "allowed_origins": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "type": "string",
              "format": "uri"
            }
          },
          "max_connections": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          },
          "max_message_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1048576
          },
          "max_connection_age_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 604800
          },
          "enabled": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "slug": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,47}$",
            "description": "Name of the endpoint within its app, used by gregale.yaml. Absent for endpoints created without one."
          },
          "channel_rules": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/RealtimeChannelRule"
            }
          }
        }
      },
      "RealtimeChannelRule": {
        "type": "object",
        "description": "Grants a channel to a verified token without the authorize callback. The pattern is literal text with {claim} placeholders that must equal the token's claims and an optional trailing * matching any suffix.",
        "required": [
          "pattern",
          "read"
        ],
        "properties": {
          "pattern": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "example": "org:{org_id}:room:*"
          },
          "read": {
            "type": "boolean",
            "description": "Must be true: a rule grants read access."
          },
          "presence": {
            "type": "boolean",
            "description": "Also grants setting presence state and sending signals on the channel. Without it those go to the authorize callback with permission presence."
          }
        }
      },
      "CreateManagedRealtimeEndpointRequest": {
        "type": "object",
        "description": "Create a durable managed realtime endpoint and its callback contract.",
        "required": [
          "callback_url",
          "callback_auth_token"
        ],
        "properties": {
          "callback_url": {
            "type": "string",
            "format": "uri",
            "minLength": 8,
            "maxLength": 2048
          },
          "connect_path": {
            "type": "string",
            "pattern": "^/",
            "maxLength": 256,
            "default": "/realtime/connect"
          },
          "message_path": {
            "type": "string",
            "pattern": "^/",
            "maxLength": 256,
            "default": "/realtime/message"
          },
          "disconnect_path": {
            "type": "string",
            "pattern": "^/",
            "maxLength": 256,
            "default": "/realtime/disconnect"
          },
          "callback_auth_token": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "writeOnly": true
          },
          "auth_token": {
            "type": "string",
            "maxLength": 256,
            "writeOnly": true
          },
          "auth_mode": {
            "type": "string",
            "enum": [
              "none",
              "static_bearer",
              "oidc_jwt"
            ]
          },
          "auth_issuer": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048
          },
          "auth_jwks_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048
          },
          "auth_audience": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "type": "string",
              "maxLength": 256
            }
          },
          "auth_algorithms": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "type": "string",
              "enum": [
                "RS256",
                "RS384",
                "RS512",
                "ES256",
                "ES384",
                "ES512"
              ]
            }
          },
          "auth_required_claims": {
            "type": "object",
            "maxProperties": 16,
            "additionalProperties": {
              "type": "string",
              "maxLength": 256
            }
          },
          "allowed_origins": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "type": "string",
              "format": "uri"
            }
          },
          "max_connections": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000,
            "default": 0
          },
          "max_message_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1048576,
            "default": 0
          },
          "max_connection_age_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 604800,
            "default": 0
          },
          "enabled": {
            "type": "boolean",
            "default": true
          },
          "slug": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,47}$",
            "description": "Optional name of the endpoint within its app, unique per app. gregale.yaml declares endpoints by slug."
          },
          "channel_rules": {
            "type": "array",
            "maxItems": 32,
            "description": "Channels granted from verified token claims without the authorize callback. A matching channel trusts the token until it expires.",
            "items": {
              "$ref": "#/components/schemas/RealtimeChannelRule"
            }
          }
        }
      },
      "UpdateManagedRealtimeEndpointRequest": {
        "type": "object",
        "description": "Partially update a managed realtime endpoint; omitted fields remain unchanged.",
        "properties": {
          "callback_url": {
            "type": "string",
            "format": "uri",
            "minLength": 8,
            "maxLength": 2048
          },
          "connect_path": {
            "type": "string",
            "pattern": "^/",
            "maxLength": 256
          },
          "message_path": {
            "type": "string",
            "pattern": "^/",
            "maxLength": 256
          },
          "disconnect_path": {
            "type": "string",
            "pattern": "^/",
            "maxLength": 256
          },
          "callback_auth_token": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "writeOnly": true
          },
          "auth_token": {
            "type": "string",
            "maxLength": 256,
            "writeOnly": true
          },
          "auth_mode": {
            "type": "string",
            "enum": [
              "none",
              "static_bearer",
              "oidc_jwt"
            ]
          },
          "auth_issuer": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048
          },
          "auth_jwks_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048
          },
          "auth_audience": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "type": "string",
              "maxLength": 256
            }
          },
          "auth_algorithms": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "type": "string",
              "enum": [
                "RS256",
                "RS384",
                "RS512",
                "ES256",
                "ES384",
                "ES512"
              ]
            }
          },
          "auth_required_claims": {
            "type": "object",
            "maxProperties": 16,
            "additionalProperties": {
              "type": "string",
              "maxLength": 256
            }
          },
          "allowed_origins": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "type": "string",
              "format": "uri"
            }
          },
          "max_connections": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          },
          "max_message_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 1048576
          },
          "max_connection_age_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 604800
          },
          "enabled": {
            "type": "boolean"
          },
          "slug": {
            "type": "string",
            "pattern": "^$|^[a-z0-9][a-z0-9-]{0,47}$",
            "description": "Replace the endpoint's slug. An empty string removes it."
          },
          "channel_rules": {
            "type": "array",
            "maxItems": 32,
            "description": "Replace the endpoint's channel rules. An empty list removes them.",
            "items": {
              "$ref": "#/components/schemas/RealtimeChannelRule"
            }
          }
        }
      },
      "RotateManagedRealtimeAuthRequest": {
        "type": "object",
        "description": "Start a bounded overlap window for a replacement static bearer credential.",
        "required": [
          "new_auth_token"
        ],
        "properties": {
          "new_auth_token": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "writeOnly": true
          },
          "grace_period_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400,
            "default": 300
          }
        }
      },
      "RotateManagedRealtimeAuthResponse": {
        "type": "object",
        "description": "Metadata for an in-progress static bearer credential rotation.",
        "required": [
          "endpoint_id",
          "auth_mode",
          "previous_token_expires_at"
        ],
        "properties": {
          "endpoint_id": {
            "type": "string",
            "format": "uuid"
          },
          "auth_mode": {
            "type": "string",
            "enum": [
              "static_bearer"
            ]
          },
          "previous_token_expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "FinalizeManagedRealtimeAuthResponse": {
        "type": "object",
        "description": "Metadata after the predecessor static bearer credential is revoked.",
        "required": [
          "endpoint_id",
          "auth_mode",
          "previous_token_expires_at"
        ],
        "properties": {
          "endpoint_id": {
            "type": "string",
            "format": "uuid"
          },
          "auth_mode": {
            "type": "string",
            "enum": [
              "static_bearer"
            ]
          },
          "previous_token_expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "ManagedRealtimeMessageRequest": {
        "type": "object",
        "description": "Binary-safe message payload encoded as standard base64.",
        "required": [
          "data_base64"
        ],
        "properties": {
          "ttl_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400,
            "default": 0,
            "description": "Optional retained channel delivery lifetime from first commit. Zero disables expiry; retries preserve the original deadline."
          },
          "expected_sequence": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0,
            "description": "Optional current channel sequence precondition; zero requires an empty channel. Retained channel writes only."
          },
          "metadata": {
            "type": "object",
            "maxProperties": 8,
            "propertyNames": {
              "pattern": "^[a-z0-9_.-]{1,64}$"
            },
            "additionalProperties": {
              "type": "string",
              "maxLength": 128
            },
            "description": "Exact-match routing metadata; at most 4096 encoded JSON bytes. Retained channel publishing only."
          },
          "data_base64": {
            "type": "string",
            "format": "byte",
            "maxLength": 1398104,
            "description": "Decoded payload is limited to 1 MiB."
          },
          "binary": {
            "type": "boolean",
            "default": false
          }
        }
      },
      "ManagedRealtimeCloseRequest": {
        "type": "object",
        "description": "Optional close reason for a live managed realtime connection.",
        "properties": {
          "reason": {
            "type": "string",
            "maxLength": 256
          }
        }
      },
      "ManagedRealtimePublishResponse": {
        "type": "object",
        "description": "Per-recipient queue outcome for publishing to an endpoint-scoped channel. Queue admission does not imply client receipt; retained publishes include their durable channel sequence.",
        "required": [
          "queued"
        ],
        "properties": {
          "queued": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of live subscriber output queues or retained-resume wake-ups that accepted delivery work."
          },
          "subscribers": {
            "type": "integer",
            "minimum": 0,
            "description": "Live and resumable subscribers targeted across reachable nodes."
          },
          "queue_full": {
            "type": "integer",
            "minimum": 0,
            "description": "Subscribers whose bounded output queues were full."
          },
          "failed": {
            "type": "integer",
            "minimum": 0,
            "description": "Target subscribers that could not be queued for another per-connection reason."
          },
          "partial": {
            "type": "boolean",
            "description": "Whether a node or any target subscriber did not accept the publish."
          },
          "nodes_queried": {
            "type": "integer",
            "minimum": 0,
            "description": "Active realtime nodes that accepted the publish request."
          },
          "nodes_unavailable": {
            "type": "integer",
            "minimum": 0,
            "description": "Active realtime nodes that did not accept the publish request."
          },
          "sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Committed channel sequence; present when durable is true."
          },
          "durable": {
            "type": "boolean",
            "description": "Whether this publish was committed to retained channel history before fan-out."
          }
        }
      },
      "ManagedRealtimeRetainedMessageRequest": {
        "type": "object",
        "description": "Binary-safe payload to append to retained channel history.",
        "required": [
          "data_base64"
        ],
        "properties": {
          "ttl_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400,
            "default": 0,
            "description": "Managed realtime retained message request properties ttl seconds. Optional retained channel delivery lifetime from first commit. Zero disables expiry; retries preserve the original deadline."
          },
          "expected_sequence": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0,
            "description": "Optional channel head sequence required before this retained publish; zero requires an empty channel."
          },
          "metadata": {
            "type": "object",
            "maxProperties": 8,
            "propertyNames": {
              "pattern": "^[a-z0-9_.-]{1,64}$"
            },
            "additionalProperties": {
              "type": "string",
              "maxLength": 128
            },
            "description": "Routing metadata attached to this retained publish; at most 4096 encoded JSON bytes."
          },
          "data_base64": {
            "type": "string",
            "format": "byte",
            "maxLength": 5464,
            "description": "Standard base64 for at most 4096 decoded bytes."
          },
          "binary": {
            "type": "boolean",
            "default": false
          },
          "idempotency_key": {
            "type": "string",
            "maxLength": 128,
            "description": "Deduplicates identical writes while retained."
          }
        }
      },
      "ManagedRealtimeRetainedMessageResponse": {
        "type": "object",
        "description": "A committed message and its channel-scoped sequence.",
        "required": [
          "sequence",
          "data_base64",
          "binary",
          "created_at"
        ],
        "properties": {
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "Original server-assigned delivery deadline when TTL is set."
          },
          "expired": {
            "type": "boolean",
            "default": false,
            "description": "Expired checkpoint entry; payload and metadata are suppressed."
          },
          "metadata": {
            "type": "object",
            "maxProperties": 8,
            "propertyNames": {
              "pattern": "^[a-z0-9_.-]{1,64}$"
            },
            "additionalProperties": {
              "type": "string",
              "maxLength": 128
            },
            "description": "Exact-match routing metadata persisted with this channel message."
          },
          "sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "data_base64": {
            "type": "string",
            "format": "byte"
          },
          "binary": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "target_message_id": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "event": {
            "type": "string"
          },
          "deleted": {
            "type": "boolean"
          }
        }
      },
      "ManagedRealtimeRetainedHistoryResponse": {
        "type": "object",
        "description": "A consistent page of retained channel messages and retention bounds.",
        "required": [
          "messages",
          "oldest_sequence",
          "latest_sequence",
          "has_more"
        ],
        "properties": {
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ManagedRealtimeRetainedMessageResponse"
            }
          },
          "oldest_sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "latest_sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "has_more": {
            "type": "boolean"
          }
        }
      },
      "ManagedRealtimeHistoryUsageResponse": {
        "type": "object",
        "description": "Account-scoped point-in-time retained history payload counts; not billing meters.",
        "required": [
          "observed_at",
          "endpoint_count",
          "channel_count",
          "stored_message_count",
          "stored_payload_bytes",
          "replayable_message_count",
          "replayable_payload_bytes"
        ],
        "properties": {
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "endpoint_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Endpoints with a retained channel head."
          },
          "channel_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Retained channel heads, including empty heads."
          },
          "stored_message_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Message rows still physically present, including expired rows awaiting cleanup."
          },
          "stored_payload_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Decoded payload bytes in physically present rows; excludes database overhead."
          },
          "replayable_message_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Rows at or above each channel's current contiguous retention floor."
          },
          "replayable_payload_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Decoded payload bytes eligible for replay."
          }
        }
      },
      "AppLogDrainResponse": {
        "type": "object",
        "description": "Runtime log destination with sealed credentials represented by a mask.",
        "required": [
          "id",
          "app_id",
          "account_id",
          "kind",
          "target_url",
          "auth_header_masked",
          "enabled",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          },
          "app_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "http_json",
              "otlp",
              "datadog"
            ]
          },
          "target_url": {
            "type": "string",
            "format": "uri",
            "minLength": 8,
            "maxLength": 2048
          },
          "auth_header_masked": {
            "type": "string",
            "enum": [
              "",
              "***"
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AppLogDrainHealthResponse": {
        "type": "object",
        "description": "Durable, customer-safe delivery health for one runtime log destination.",
        "required": [
          "log_drain_id",
          "status",
          "active",
          "queue_depth",
          "queue_capacity",
          "pending_records",
          "pending_bytes",
          "pending_bytes_capacity",
          "dead_letter_total",
          "delivered_total",
          "failed_total",
          "dropped_total",
          "retries_total",
          "stream_reconnects_total",
          "gaps_total",
          "updated_at"
        ],
        "properties": {
          "log_drain_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "unknown",
              "healthy",
              "degraded",
              "inactive"
            ]
          },
          "active": {
            "type": "boolean"
          },
          "queue_depth": {
            "type": "integer",
            "minimum": 0
          },
          "queue_capacity": {
            "type": "integer",
            "minimum": 0
          },
          "pending_records": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of records waiting in the durable local outbox."
          },
          "pending_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Bytes waiting in the durable local outbox."
          },
          "pending_bytes_capacity": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Durable local outbox byte capacity."
          },
          "dead_letter_total": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Number of records retained in the bounded dead-letter file."
          },
          "oldest_pending_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of the oldest record still awaiting delivery."
          },
          "delivered_total": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "failed_total": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "dropped_total": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "retries_total": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "stream_reconnects_total": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "gaps_total": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "last_success_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_failure_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_error": {
            "type": "string",
            "description": "Sanitized delivery summary; never raw transport output."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AppLogDrainAnalyticsResponse": {
        "type": "object",
        "description": "Bounded hourly, customer-safe delivery analytics for one runtime log destination.",
        "required": [
          "log_drain_id",
          "window",
          "bucket_interval",
          "from",
          "to",
          "buckets",
          "summary"
        ],
        "properties": {
          "requested_from": {
            "type": "string",
            "format": "date-time",
            "description": "Original requested lower bound before expanding to the recorded hourly observations."
          },
          "window_aligned": {
            "type": "boolean",
            "description": "True when hourly observations changed the effective bounds; from/to match the counter observation times."
          },
          "complete": {
            "type": "boolean",
            "description": "Whether every reported counter delta has a valid baseline without missing hourly samples."
          },
          "coverage_gaps": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Missing baseline or hourly sample evidence; unknown deltas are omitted from totals."
          },
          "log_drain_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          },
          "window": {
            "type": "string",
            "enum": [
              "1h",
              "24h",
              "7d",
              "30d"
            ]
          },
          "bucket_interval": {
            "type": "string",
            "enum": [
              "1h"
            ]
          },
          "from": {
            "type": "string",
            "format": "date-time"
          },
          "to": {
            "type": "string",
            "format": "date-time"
          },
          "buckets": {
            "type": "array",
            "maxItems": 720,
            "items": {
              "$ref": "#/components/schemas/AppLogDrainAnalyticsBucket"
            }
          },
          "summary": {
            "$ref": "#/components/schemas/AppLogDrainAnalyticsSummary"
          }
        }
      },
      "AppLogDrainAnalyticsBucket": {
        "type": "object",
        "description": "One hourly customer-safe delivery analytics bucket.",
        "required": [
          "start",
          "delivered",
          "failed",
          "dropped",
          "retries",
          "dead_letters",
          "pending_records",
          "pending_bytes",
          "success_rate",
          "average_latency_ms"
        ],
        "properties": {
          "start": {
            "type": "string",
            "format": "date-time"
          },
          "delivered": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "failed": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "dropped": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "retries": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "dead_letters": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "pending_records": {
            "type": "integer",
            "minimum": 0
          },
          "pending_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "success_rate": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 1
          },
          "average_latency_ms": {
            "type": "number",
            "format": "double",
            "minimum": 0
          }
        }
      },
      "AppLogDrainAnalyticsSummary": {
        "type": "object",
        "description": "Aggregate customer-safe delivery analytics over the requested window.",
        "required": [
          "delivered",
          "failed",
          "dropped",
          "retries",
          "dead_letters",
          "success_rate",
          "average_latency_ms"
        ],
        "properties": {
          "delivered": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "failed": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "dropped": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "retries": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "dead_letters": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "success_rate": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 1
          },
          "average_latency_ms": {
            "type": "number",
            "format": "double",
            "minimum": 0
          }
        }
      },
      "CreateAppLogDrainRequest": {
        "type": "object",
        "description": "Create a provider-neutral runtime log destination.",
        "required": [
          "kind",
          "target_url"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "http_json",
              "otlp",
              "datadog"
            ]
          },
          "target_url": {
            "type": "string",
            "format": "uri",
            "minLength": 8,
            "maxLength": 2048
          },
          "auth_header": {
            "type": "string",
            "maxLength": 4096,
            "description": "One Name: value pair; sealed at rest and never returned."
          },
          "enabled": {
            "type": "boolean",
            "default": true
          }
        }
      },
      "UpdateAppLogDrainRequest": {
        "type": "object",
        "description": "Partially update a runtime log destination; omitted fields remain unchanged.",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "http_json",
              "otlp",
              "datadog"
            ]
          },
          "target_url": {
            "type": "string",
            "format": "uri",
            "minLength": 8,
            "maxLength": 2048
          },
          "auth_header": {
            "type": "string",
            "maxLength": 4096,
            "description": "One Name: value pair; an empty value clears credentials."
          },
          "enabled": {
            "type": "boolean"
          }
        }
      },
      "CreateAppWebhookRequest": {
        "type": "object",
        "description": "Subscribe a target URL to events emitted by the app. The\nwebhook_secret is HMAC-SHA256 sealed at rest with the host\nX25519 recipient (namespace `APP_WEBHOOK`).\n",
        "required": [
          "target_url",
          "webhook_secret"
        ],
        "properties": {
          "target_url": {
            "type": "string",
            "minLength": 8,
            "maxLength": 2048
          },
          "webhook_secret": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "event_filter": {
            "description": "Events to subscribe to; omit or leave empty for standard platform events. Select app.health.changed explicitly to enable health notifications.",
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "operation.effect",
                "app.parked",
                "app.woken",
                "deployment.live",
                "deployment.failed",
                "rollout.completed",
                "rollout.aborted",
                "job.finished",
                "operation.finished",
                "usage_statement.finalized",
                "consumer.usage_threshold",
                "consumer.signed_up",
                "consumer.plan_changed",
                "consumer.closed",
                "outbound.ai_budget.threshold",
                "outbound.ai_quality.drift",
                "issue.created",
                "issue.assigned",
                "issue.resolved",
                "issue.reopened",
                "issue.ignored",
                "issue.regressed",
                "issue.impact_threshold_reached",
                "issue.frequency_threshold_reached",
                "issue.compound_threshold_reached",
                "issue.tracker_sync.attention",
                "issue.tracker_sync.recovered",
                "debug.regression.detected",
                "debug.regression.resolved",
                "routes.requirements.violated",
                "routes.requirements.recovered",
                "routes.requirements.changed",
                "routes.health.blocked",
                "routes.health.resumed",
                "routes.health.aborted",
                "routes.monitor.violated",
                "routes.monitor.escalated",
                "routes.monitor.recovered",
                "routes.insight.detected",
                "routes.insight.resolved",
                "workflow.finished",
                "stored_workflow.paused",
                "realtime.inbox.acknowledged",
                "realtime.inbox.gap",
                "realtime.inbox.fallback_required",
                "realtime.message.read",
                "realtime.notification.sent",
                "realtime.notification.failed",
                "realtime.notification.expired",
                "realtime.notification.cancelled",
                "realtime.notification.superseded",
                "realtime.schedule.published",
                "realtime.schedule.failed",
                "realtime.schedule.skipped",
                "app.health.changed",
                "event_recovery.completed",
                "event_recovery.cancelled",
                "event_recovery.expired",
                "profile.route_regressed",
                "profile.route_recovered",
                "profile.capture_ready",
                "profile.capture_oom_linked",
                "event_recovery.execution_finished",
                "realtime.channel.published",
                "realtime.channel.acknowledged",
                "realtime.consumer_group.dead_lettered",
                "realtime.consumer_group.dead_letter_expiring",
                "realtime.consumer_group.delivery_expired",
                "realtime.consumer_group.worker_lost",
                "realtime.consumer_group.worker_recovered",
                "realtime.consumer_group.circuit_opened",
                "realtime.consumer_group.circuit_half_open",
                "realtime.consumer_group.circuit_closed",
                "realtime.replay_job.completed",
                "realtime.replay_job.cancelled",
                "realtime.replay_job.processing_failed",
                "realtime.consumer_group.lag_exceeded",
                "realtime.consumer_group.lag_recovered",
                "event_recovery.execution_attention",
                "stored_workflow.recovery_review_ready",
                "stored_workflow.recovery_review_finished",
                "stored_workflow.recovery_policy_paused",
                "stored_workflow.recovery_queue_blocked",
                "stored_workflow.recovery_health_alert",
                "stored_workflow.recovery_health_recovered",
                "stored_workflow.recovery_polling_status"
              ]
            },
            "maxItems": 32
          },
          "retry_policy": {
            "type": "string",
            "enum": [
              "default",
              "aggressive",
              "none"
            ],
            "default": "default"
          },
          "delivery_format": {
            "type": "string",
            "enum": [
              "json",
              "cloudevents",
              "datadog"
            ],
            "default": "json",
            "description": "Wire envelope. json preserves the legacy Gregale body; cloudevents opts into CloudEvents 1.0 structured mode; datadog posts Datadog Events API bodies to a Datadog Events endpoint and sends webhook_secret as DD-API-KEY, for deployment and rollout events only."
          },
          "enabled": {
            "type": "boolean",
            "default": true
          }
        },
        "example": {
          "target_url": "https://example.com/hook",
          "webhook_secret": "shh",
          "event_filter": [
            "app.parked",
            "app.woken"
          ],
          "retry_policy": "default",
          "delivery_format": "json",
          "enabled": true
        }
      },
      "CreateAccountReleaseWebhookRequest": {
        "type": "object",
        "description": "Subscribe to account release outcomes, environment GitOps status transitions, and agent approval requests and decisions.",
        "required": [
          "target_url",
          "webhook_secret",
          "event_filter"
        ],
        "properties": {
          "target_url": {
            "type": "string",
            "format": "uri",
            "minLength": 8,
            "maxLength": 2048
          },
          "webhook_secret": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "event_filter": {
            "type": "array",
            "minItems": 1,
            "maxItems": 8,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "deployment.live",
                "deployment.failed",
                "rollout.completed",
                "rollout.aborted",
                "environment.gitops.changed",
                "agent.approval.requested",
                "agent.approval.approved",
                "agent.approval.denied"
              ]
            }
          },
          "retry_policy": {
            "type": "string",
            "enum": [
              "default",
              "aggressive",
              "none"
            ],
            "default": "default"
          },
          "delivery_format": {
            "type": "string",
            "enum": [
              "json",
              "cloudevents"
            ],
            "default": "json"
          },
          "enabled": {
            "type": "boolean",
            "default": true
          }
        },
        "example": {
          "target_url": "https://example.com/releases",
          "webhook_secret": "replace-with-random-secret",
          "event_filter": [
            "deployment.live",
            "deployment.failed"
          ],
          "retry_policy": "default",
          "delivery_format": "cloudevents",
          "enabled": true
        }
      },
      "DeliverAppEventRequest": {
        "description": "Request to enqueue a signed webhook delivery owned by the source app.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "destination",
          "type",
          "data"
        ],
        "properties": {
          "destination": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048,
            "description": "A webhook id or exact registered target URL owned by the source app."
          },
          "type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "data": {
            "description": "Any valid JSON value placed in the signed webhook envelope."
          }
        }
      },
      "DeliverAppEventResponse": {
        "description": "Durable receipt for an accepted outbound webhook delivery.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "webhook_id",
          "destination",
          "event",
          "status",
          "status_url"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "webhook_id": {
            "type": "string"
          },
          "destination": {
            "type": "string",
            "format": "uri"
          },
          "event": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "status": {
            "type": "string",
            "enum": [
              "pending"
            ]
          },
          "status_url": {
            "type": "string"
          }
        }
      },
      "UpdateAppWebhookRequest": {
        "type": "object",
        "description": "Partial update of an existing webhook subscription. Every\nfield is optional — the handler merges the supplied fields\nonto the current row. omit a field to leave it unchanged.\n",
        "properties": {
          "target_url": {
            "type": "string",
            "minLength": 8,
            "maxLength": 2048
          },
          "webhook_secret": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "event_filter": {
            "description": "Replacement event selection; an empty array restores standard platform events. Include app.health.changed to opt into health notifications.",
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "operation.effect",
                "app.parked",
                "app.woken",
                "deployment.live",
                "deployment.failed",
                "rollout.completed",
                "rollout.aborted",
                "job.finished",
                "operation.finished",
                "usage_statement.finalized",
                "consumer.usage_threshold",
                "consumer.signed_up",
                "consumer.plan_changed",
                "consumer.closed",
                "outbound.ai_budget.threshold",
                "outbound.ai_quality.drift",
                "issue.created",
                "issue.assigned",
                "issue.resolved",
                "issue.reopened",
                "issue.ignored",
                "issue.regressed",
                "issue.impact_threshold_reached",
                "issue.frequency_threshold_reached",
                "issue.compound_threshold_reached",
                "issue.tracker_sync.attention",
                "issue.tracker_sync.recovered",
                "debug.regression.detected",
                "debug.regression.resolved",
                "routes.requirements.violated",
                "routes.requirements.recovered",
                "routes.requirements.changed",
                "routes.health.blocked",
                "routes.health.resumed",
                "routes.health.aborted",
                "routes.monitor.violated",
                "routes.monitor.escalated",
                "routes.monitor.recovered",
                "routes.insight.detected",
                "routes.insight.resolved",
                "workflow.finished",
                "stored_workflow.paused",
                "realtime.inbox.acknowledged",
                "realtime.inbox.gap",
                "realtime.inbox.fallback_required",
                "realtime.message.read",
                "realtime.notification.sent",
                "realtime.notification.failed",
                "realtime.notification.expired",
                "realtime.notification.cancelled",
                "realtime.notification.superseded",
                "realtime.schedule.published",
                "realtime.schedule.failed",
                "realtime.schedule.skipped",
                "app.health.changed",
                "event_recovery.completed",
                "event_recovery.cancelled",
                "event_recovery.expired",
                "profile.route_regressed",
                "profile.route_recovered",
                "profile.capture_ready",
                "profile.capture_oom_linked",
                "event_recovery.execution_finished",
                "realtime.channel.published",
                "realtime.channel.acknowledged",
                "realtime.consumer_group.dead_lettered",
                "realtime.consumer_group.dead_letter_expiring",
                "realtime.consumer_group.delivery_expired",
                "realtime.consumer_group.worker_lost",
                "realtime.consumer_group.worker_recovered",
                "realtime.consumer_group.circuit_opened",
                "realtime.consumer_group.circuit_half_open",
                "realtime.consumer_group.circuit_closed",
                "realtime.replay_job.completed",
                "realtime.replay_job.cancelled",
                "realtime.replay_job.processing_failed",
                "realtime.consumer_group.lag_exceeded",
                "realtime.consumer_group.lag_recovered",
                "event_recovery.execution_attention",
                "stored_workflow.recovery_review_ready",
                "stored_workflow.recovery_review_finished",
                "stored_workflow.recovery_policy_paused",
                "stored_workflow.recovery_queue_blocked",
                "stored_workflow.recovery_health_alert",
                "stored_workflow.recovery_health_recovered",
                "stored_workflow.recovery_polling_status"
              ]
            },
            "maxItems": 32
          },
          "retry_policy": {
            "type": "string",
            "enum": [
              "default",
              "aggressive",
              "none"
            ]
          },
          "delivery_format": {
            "type": "string",
            "enum": [
              "json",
              "cloudevents",
              "datadog"
            ],
            "description": "Wire envelope for future deliveries; existing delivery rows are unchanged. Switching to datadog requires a new webhook_secret holding the Datadog API key."
          },
          "enabled": {
            "type": "boolean"
          }
        },
        "example": {
          "target_url": "https://example.com/hook2",
          "delivery_format": "cloudevents",
          "enabled": true
        }
      },
      "UpdateAccountReleaseWebhookRequest": {
        "type": "object",
        "description": "Partial update; omitted fields retain their current value.",
        "properties": {
          "target_url": {
            "type": "string",
            "format": "uri",
            "minLength": 8,
            "maxLength": 2048
          },
          "webhook_secret": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "event_filter": {
            "type": "array",
            "minItems": 1,
            "maxItems": 8,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "deployment.live",
                "deployment.failed",
                "rollout.completed",
                "rollout.aborted",
                "environment.gitops.changed",
                "agent.approval.requested",
                "agent.approval.approved",
                "agent.approval.denied"
              ]
            }
          },
          "retry_policy": {
            "type": "string",
            "enum": [
              "default",
              "aggressive",
              "none"
            ]
          },
          "delivery_format": {
            "type": "string",
            "enum": [
              "json",
              "cloudevents"
            ]
          },
          "enabled": {
            "type": "boolean"
          }
        }
      },
      "RotateAppWebhookSecretResponse": {
        "type": "object",
        "description": "Response from POST /v1/apps/{slug}/webhooks/{id}/rotate-secret.\nThe plaintext secret is NEVER returned; the masked field is\na constant sentinel so the dashboard renders the same shape\nacross all secret-bearing rows (mirrors AlertRule rotate).\n",
        "required": [
          "rotated_at",
          "webhook_secret_sealed_masked"
        ],
        "properties": {
          "rotated_at": {
            "type": "string",
            "format": "date-time"
          },
          "webhook_secret_sealed_masked": {
            "type": "string",
            "enum": [
              "***"
            ]
          }
        },
        "example": {
          "rotated_at": "2026-08-06T12:00:00Z",
          "webhook_secret_sealed_masked": "***"
        }
      },
      "RotateAppWebhookSecretRequest": {
        "type": "object",
        "description": "Caller-supplied replacement signing secret. The value is sealed at\nrest and never returned in a response.\n",
        "required": [
          "webhook_secret"
        ],
        "properties": {
          "webhook_secret": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "example": {
          "webhook_secret": "replacement-secret-from-manager"
        }
      },
      "AppWebhookDeliveryResponse": {
        "type": "object",
        "description": "One row per (event × target) emission. The dispatcher mutates\nthis row in place as attempts progress; the GET /deliveries\nendpoint returns this shape per row. attempt=7 + status='dead'\nis the DLQ state; the customer-facing retry endpoint flips a\ndead row back to status='pending' for one more shot.\n",
        "required": [
          "id",
          "webhook_id",
          "account_id",
          "event",
          "attempt",
          "status",
          "next_attempt_at",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          },
          "webhook_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          },
          "app_id": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$",
            "description": "Omitted for events sourced from a platform tenant rather than one app."
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "event": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Platform event name or explicitly delivered custom outbox event type."
          },
          "payload": {
            "type": "object",
            "additionalProperties": true,
            "description": "The original event payload (omitted on rows past the first attempt; the customer has already seen it)."
          },
          "attempt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 8
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "in_flight",
              "succeeded",
              "failed",
              "dead"
            ]
          },
          "last_error": {
            "type": "string"
          },
          "last_response_code": {
            "type": "integer",
            "minimum": 0,
            "maximum": 599
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "delivered_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "example": {
          "id": "0123456789abcdef0123456789abcdef",
          "webhook_id": "fedcba9876543210fedcba9876543210",
          "app_id": "8b1f5e5d273e5a18ae0058fceba4fe6c",
          "account_id": "8b1f5e5d-273e-5a18-ae00-58fceba4fe6c",
          "event": "app.parked",
          "payload": {
            "reason": "idle_timeout_300s",
            "cron_name": "nightly-rollup"
          },
          "attempt": 0,
          "status": "pending",
          "next_attempt_at": "2026-08-06T10:00:00Z",
          "created_at": "2026-08-06T10:00:00Z",
          "updated_at": "2026-08-06T10:00:00Z"
        }
      },
      "AppWebhookDeliveryListResponse": {
        "type": "object",
        "description": "Paged deliveries surface for the dashboard's \"recent\ndeliveries\" pane. page_token is opaque + base64-encoded —\ntreat it as a cursor; do not parse it.\n",
        "required": [
          "deliveries"
        ],
        "properties": {
          "deliveries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppWebhookDeliveryResponse"
            }
          },
          "next_token": {
            "type": "string",
            "description": "Cursor for the next page; empty/absent when the page is the last."
          }
        }
      },
      "AppWebhookDeliveryAttemptResponse": {
        "type": "object",
        "description": "One completed outbound dispatch, including its replay round and receiver outcome.",
        "required": [
          "id",
          "delivery_id",
          "replay_generation",
          "attempt_number",
          "outcome",
          "response_code",
          "started_at",
          "finished_at",
          "duration_ms"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "delivery_id": {
            "type": "string",
            "format": "uuid"
          },
          "replay_generation": {
            "type": "integer",
            "minimum": 0
          },
          "attempt_number": {
            "type": "integer",
            "minimum": 1,
            "maximum": 8
          },
          "outcome": {
            "type": "string",
            "enum": [
              "succeeded",
              "retrying",
              "dead"
            ]
          },
          "response_code": {
            "type": "integer",
            "minimum": 0,
            "maximum": 999
          },
          "error": {
            "type": "string"
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": "string",
            "format": "date-time"
          },
          "duration_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AppWebhookDeliveryHealthResponse": {
        "type": "object",
        "description": "Receiver recovery state, claimable queue age, and terminal outcomes over the 24 hours ending at snapshot_at.",
        "required": [
          "webhook_id",
          "snapshot_at",
          "pending_count",
          "in_flight_count",
          "dead_count",
          "receiver_state",
          "recent_succeeded_count",
          "recent_dead_count"
        ],
        "properties": {
          "webhook_id": {
            "type": "string",
            "format": "uuid"
          },
          "snapshot_at": {
            "type": "string",
            "format": "date-time"
          },
          "pending_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "in_flight_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "dead_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "receiver_state": {
            "type": "string",
            "enum": [
              "ready",
              "cooling_down",
              "awaiting_probe",
              "probing"
            ],
            "description": "Claim gate at snapshot_at; probing requires a live recovery delivery lease."
          },
          "receiver_cooldown_until": {
            "type": "string",
            "format": "date-time",
            "description": "Active receiver pause deadline; after it expires, one recovery delivery probes before normal capacity resumes."
          },
          "oldest_overdue_at": {
            "type": "string",
            "format": "date-time",
            "description": "Earliest due time among claimable pending or expired in-flight deliveries; omitted while the subscription has no claim capacity."
          },
          "oldest_overdue_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Age of the oldest overdue delivery at snapshot_at."
          },
          "recent_succeeded_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "recent_dead_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "recent_success_rate": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 1,
            "description": "Recent succeeded divided by recent succeeded plus dead; omitted when there are no terminal deliveries."
          }
        }
      },
      "AppWebhookDeliveryAttemptListResponse": {
        "type": "object",
        "description": "A newest-first page of attempts for one account-owned delivery.",
        "required": [
          "attempts"
        ],
        "properties": {
          "attempts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppWebhookDeliveryAttemptResponse"
            }
          },
          "next_token": {
            "type": "string",
            "description": "Cursor for the next page."
          }
        }
      },
      "AppWebhookRetryDeliveryResponse": {
        "type": "object",
        "description": "Response from POST /v1/apps/{slug}/webhooks/{id}/deliveries/{did}/retry.\nMirrors AppWebhookDeliveryResponse; the row in `delivery` is\nre-emitted with status='pending' and next_attempt_at=now().\n",
        "required": [
          "delivery"
        ],
        "properties": {
          "delivery": {
            "$ref": "#/components/schemas/AppWebhookDeliveryResponse"
          }
        }
      },
      "DebugCoverageSignal": {
        "type": "object",
        "description": "Observed coverage for one debugger signal. Requests are weighted by collapsed-row count.",
        "required": [
          "rows",
          "requests",
          "rate_pct"
        ],
        "properties": {
          "rows": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "rate_pct": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 100
          }
        }
      },
      "ProfileRouteAlertPayload": {
        "type": "object",
        "description": "Advisory app webhook evidence. Application frames are aggregate hotspots and do not establish route-level code causality. Paths are relative to Gregale; raw profile samples are excluded.",
        "required": [
          "version",
          "app_id",
          "deployment_id",
          "baseline_deployment_id",
          "policy_revision",
          "incident_id",
          "status",
          "source",
          "checked_at",
          "baseline",
          "candidate",
          "route_check",
          "evidence_path"
        ],
        "properties": {
          "comparison_url": {
            "type": "string",
            "description": "Dashboard link with the exact route, baseline and candidate windows and selected route call path."
          },
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "baseline_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "policy_revision": {
            "type": "integer",
            "format": "int64"
          },
          "incident_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "regressed",
              "recovered"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "deployment",
              "canary",
              "periodic"
            ]
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "baseline": {
            "$ref": "#/components/schemas/ProfileQuery"
          },
          "candidate": {
            "$ref": "#/components/schemas/ProfileQuery"
          },
          "route_check": {
            "$ref": "#/components/schemas/ProfileRouteRegression"
          },
          "application_frames": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/ProfileCallPathFrame"
            }
          },
          "evidence_path": {
            "type": "string"
          },
          "investigation_path": {
            "type": "string"
          }
        }
      },
      "PeriodicProfilePolicy": {
        "type": "object",
        "description": "Opt-in monitoring of live completed deployments and explicit routes. Interval must be a whole number of minutes and at least window_seconds. Each route pins its first evidence-qualified window on this deployment and policy revision. Both regression and recovery need this many consecutive supported, distinct-window results; missing evidence interrupts confirmation. Expired baselines start a new context without recovering the old incident.",
        "required": [
          "interval_seconds",
          "confirmations"
        ],
        "properties": {
          "interval_seconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 86400,
            "multipleOf": 60
          },
          "confirmations": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5
          }
        }
      },
      "ProfilePeriodicObservation": {
        "description": "One retained route CPU/request comparison from a periodic monitor.",
        "type": "object",
        "required": [
          "id",
          "status",
          "reason",
          "checked_at",
          "baseline",
          "candidate"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "baseline_pinned",
              "baseline_expired",
              "regressed",
              "no_regression_detected",
              "inconclusive"
            ]
          },
          "reason": {
            "type": "string",
            "maxLength": 256
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "baseline": {
            "$ref": "#/components/schemas/ProfileQuery"
          },
          "candidate": {
            "$ref": "#/components/schemas/ProfileQuery"
          },
          "route_check": {
            "$ref": "#/components/schemas/ProfileRouteRegression"
          },
          "incident_id": {
            "type": "string",
            "format": "uuid"
          },
          "transition": {
            "type": "string",
            "enum": [
              "profile.route_regressed",
              "profile.route_recovered"
            ]
          },
          "investigation_id": {
            "type": "string",
            "format": "uuid"
          },
          "comparison_url": {
            "type": "string"
          }
        }
      },
      "ProfilePeriodicMonitor": {
        "description": "Bounded periodic route evidence and consecutive observations for one deployment and policy revision.",
        "type": "object",
        "required": [
          "active",
          "id",
          "app_id",
          "deployment_id",
          "scope",
          "route",
          "policy_revision",
          "config",
          "candidate",
          "attempts",
          "next_attempt_at",
          "history"
        ],
        "properties": {
          "active": {
            "type": "boolean",
            "description": "Whether this monitor still matches the running deployment, current policy and eligible account."
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "route": {
            "type": "string"
          },
          "policy_revision": {
            "type": "integer",
            "format": "int64"
          },
          "config": {
            "$ref": "#/components/schemas/ProfileDeploymentPolicyConfig"
          },
          "baseline": {
            "$ref": "#/components/schemas/ProfileQuery"
          },
          "candidate": {
            "$ref": "#/components/schemas/ProfileQuery"
          },
          "attempts": {
            "type": "integer",
            "minimum": 0,
            "maximum": 6
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "history": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/ProfilePeriodicObservation"
            }
          }
        }
      },
      "ListProfilePeriodicMonitorsResponse": {
        "description": "Current periodic profiling monitors for the authenticated application.",
        "type": "object",
        "required": [
          "monitors"
        ],
        "properties": {
          "monitors": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/ProfilePeriodicMonitor"
            }
          }
        }
      },
      "ProfileDeploymentPolicyConfig": {
        "type": "object",
        "description": "Opt-in background comparison policy. Collection must already be enabled on applications. Runtime filters apply to both deployments; capture coverage is not instrumentation completeness.",
        "required": [
          "enabled",
          "runtime",
          "window_seconds",
          "warmup_seconds",
          "options"
        ],
        "properties": {
          "canary_gate": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ProfileCanaryGatePolicy"
              },
              {
                "type": "null"
              }
            ],
            "description": "Omitted or null keeps canary checks advisory. Requires enabled checks and explicit routes."
          },
          "periodic": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PeriodicProfilePolicy"
              },
              {
                "type": "null"
              }
            ],
            "description": "Omitted or null disables periodic monitoring. Enabled automatic checks and explicit advisory routes are required."
          },
          "enabled": {
            "type": "boolean",
            "default": false
          },
          "notify_route_regressions": {
            "type": "boolean",
            "default": false,
            "description": "Advisory app webhook notifications on evidence-qualified route regression and recovery transitions. Requires enabled checks and explicit options.routes. Applies to deployment and canary checks; does not affect rollout decisions."
          },
          "runtime": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "window_seconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 1800,
            "default": 300
          },
          "warmup_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 3600,
            "default": 120
          },
          "options": {
            "$ref": "#/components/schemas/ProfileRegressionOptions"
          }
        }
      },
      "ProfileDeploymentPolicy": {
        "type": "object",
        "description": "App-owned CPU-check configuration. Revision zero represents an unsaved disabled policy; updated_at appears after saving.",
        "required": [
          "app_id",
          "revision",
          "config"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "config": {
            "$ref": "#/components/schemas/ProfileDeploymentPolicyConfig"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SaveProfileDeploymentPolicyRequest": {
        "type": "object",
        "description": "Full replacement of the CPU rollout-check settings. Changing or disabling settings cancels queued and leased work for earlier policy revisions.",
        "required": [
          "expected_revision",
          "config"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740990
          },
          "config": {
            "$ref": "#/components/schemas/ProfileDeploymentPolicyConfig"
          }
        }
      },
      "ProfileDeploymentCheck": {
        "type": "object",
        "description": "Durable automatic CPU-check receipt. Only bounded metadata is retained; raw samples remain under backend retention. Retry and lease recovery keep the original deployment pair and windows. Missing predecessors yield an inconclusive receipt without an investigation. If the saved-investigation quota is full, the result remains recorded with its original comparison link and an explicit explanation.",
        "required": [
          "deployment_id",
          "app_id",
          "scope",
          "policy_revision",
          "config",
          "candidate",
          "status",
          "reason",
          "attempts",
          "created_at"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "policy_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "config": {
            "$ref": "#/components/schemas/ProfileDeploymentPolicyConfig"
          },
          "baseline": {
            "$ref": "#/components/schemas/ProfileQuery"
          },
          "candidate": {
            "$ref": "#/components/schemas/ProfileQuery"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "regressed",
              "no_regression_detected",
              "inconclusive",
              "cancelled"
            ]
          },
          "reason": {
            "type": "string"
          },
          "attempts": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          },
          "investigation_id": {
            "type": "string",
            "format": "uuid"
          },
          "comparison_url": {
            "type": "string",
            "description": "Relative authenticated dashboard link to saved metadata or the original exact comparison windows."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ListProfileDeploymentChecksResponse": {
        "type": "object",
        "description": "Bounded automatic CPU-check history sorted by creation time and deployment UUID.",
        "required": [
          "checks"
        ],
        "properties": {
          "checks": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/ProfileDeploymentCheck"
            }
          }
        }
      },
      "ProfileRegressionOptions": {
        "type": "object",
        "description": "Threshold policy for sampled CPU per wall-clock second or per weighted observed request. Both relative and selected-metric absolute increase thresholds must be met. CPU-per-request mode also requires retained request telemetry and its configured minimum request count in both deployment windows; absent or sparse counts are inconclusive. Request telemetry rows use minute-bucket timestamps, so counts near window boundaries can be approximate and may be incomplete. Capture requirements apply separately to each profile window.",
        "required": [
          "relative_increase_percent",
          "absolute_increase_cpu_per_second",
          "minimum_profiles",
          "minimum_coverage_ratio"
        ],
        "properties": {
          "routes": {
            "type": "array",
            "maxItems": 10,
            "uniqueItems": true,
            "description": "Optional advisory route CPU/request checks using the relative and CPU/request thresholds and minimum requests, regardless of the aggregate metric. Never gates rollout.",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          "metric": {
            "type": "string",
            "enum": [
              "cpu_per_second",
              "cpu_per_request"
            ],
            "default": "cpu_per_second"
          },
          "relative_increase_percent": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 10000,
            "default": 20
          },
          "absolute_increase_cpu_per_second": {
            "type": "number",
            "format": "double",
            "exclusiveMinimum": 0,
            "maximum": 1000000,
            "default": 0.01,
            "description": "Absolute increase threshold for cpu_per_second mode."
          },
          "absolute_increase_cpu_seconds_per_request": {
            "type": "number",
            "format": "double",
            "exclusiveMinimum": 0,
            "maximum": 3600,
            "default": 0.0001,
            "description": "Required when metric is cpu_per_request."
          },
          "minimum_profiles": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 5000,
            "default": 3
          },
          "minimum_coverage_ratio": {
            "type": "number",
            "format": "double",
            "minimum": 0.1,
            "maximum": 1,
            "default": 0.8
          },
          "minimum_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 100000000,
            "default": 20,
            "description": "Required when metric is cpu_per_request; applied to each deployment window."
          }
        }
      },
      "CheckProfileRegressionRequest": {
        "type": "object",
        "description": "Revision-protected on-demand assessment request. Omitted options use CPU/s, 20 percent, 0.01 CPU/s, three profiles and 0.8 capture ratio. CPU/request mode requires both request-specific options.",
        "required": [
          "expected_revision"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740990
          },
          "options": {
            "$ref": "#/components/schemas/ProfileRegressionOptions"
          }
        }
      },
      "ProfileRegressionMetric": {
        "type": "object",
        "description": "Observed sampled CPU/s comparison, optionally with CPU seconds per weighted observed request. exceeds_threshold and relative_increase_percent use the metric selected by options. The relative percentage is absent when that metric's baseline is zero.",
        "required": [
          "baseline_cpu_per_second",
          "candidate_cpu_per_second",
          "delta_cpu_per_second",
          "exceeds_threshold"
        ],
        "properties": {
          "baseline_cpu_per_second": {
            "type": "number",
            "format": "double",
            "minimum": 0
          },
          "candidate_cpu_per_second": {
            "type": "number",
            "format": "double",
            "minimum": 0
          },
          "delta_cpu_per_second": {
            "type": "number",
            "format": "double"
          },
          "relative_increase_percent": {
            "type": "number",
            "format": "double"
          },
          "cpu_per_request": {
            "type": "object",
            "description": "Present when retained request telemetry has observations for both deployment windows. Counts are weighted collapsed rows with minute-bucket timestamps; boundary counts can be approximate and telemetry can be incomplete.",
            "required": [
              "baseline_cpu_seconds_per_request",
              "candidate_cpu_seconds_per_request",
              "delta_cpu_seconds_per_request",
              "exceeds_threshold"
            ],
            "properties": {
              "baseline_cpu_seconds_per_request": {
                "type": "number",
                "format": "double",
                "minimum": 0
              },
              "candidate_cpu_seconds_per_request": {
                "type": "number",
                "format": "double",
                "minimum": 0
              },
              "delta_cpu_seconds_per_request": {
                "type": "number",
                "format": "double"
              },
              "relative_increase_percent": {
                "type": "number",
                "format": "double"
              },
              "exceeds_threshold": {
                "type": "boolean"
              }
            }
          },
          "exceeds_threshold": {
            "type": "boolean"
          }
        }
      },
      "ProfileRegressionEvidence": {
        "type": "object",
        "description": "Comparable function self CPU or complete caller-path inclusive CPU meeting both thresholds. Inclusive path entries overlap and must not be summed. Frame names and source paths are observed profile symbols; use an authorized profile comparison to inspect source when available.",
        "required": [
          "kind",
          "frames",
          "metric"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "function",
              "call_path"
            ]
          },
          "frames": {
            "type": "array",
            "minItems": 1,
            "maxItems": 257,
            "items": {
              "$ref": "#/components/schemas/ProfileCallPathFrame"
            }
          },
          "metric": {
            "$ref": "#/components/schemas/ProfileRegressionMetric"
          }
        }
      },
      "ProfileRequestMixGroup": {
        "description": "Bounded request-count aggregate for one route or response-status group.",
        "type": "object",
        "required": [
          "label",
          "method",
          "requests"
        ],
        "properties": {
          "label": {
            "type": "string",
            "maxLength": 1024
          },
          "method": {
            "type": "string",
            "maxLength": 16
          },
          "requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ProfileRequestMixWindow": {
        "description": "Frozen request-count summary for one profile query window.",
        "type": "object",
        "required": [
          "query",
          "total",
          "routes",
          "statuses",
          "truncated"
        ],
        "properties": {
          "query": {
            "$ref": "#/components/schemas/ProfileQuery"
          },
          "total": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "routes": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/ProfileRequestMixGroup"
            }
          },
          "statuses": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/ProfileRequestMixGroup"
            }
          },
          "truncated": {
            "type": "boolean"
          }
        }
      },
      "ProfileRequestMixSnapshot": {
        "type": "object",
        "description": "Frozen observed telemetry summary, at most 16 KiB JSON. Completeness describes route/status aggregation, not telemetry delivery. Readable with the assessment after raw request telemetry expires.",
        "required": [
          "captured_at",
          "status",
          "complete",
          "reason",
          "warnings"
        ],
        "properties": {
          "captured_at": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": [
              "captured",
              "partial",
              "unavailable"
            ]
          },
          "complete": {
            "type": "boolean"
          },
          "reason": {
            "type": "string",
            "maxLength": 1024
          },
          "baseline": {
            "$ref": "#/components/schemas/ProfileRequestMixWindow"
          },
          "candidate": {
            "$ref": "#/components/schemas/ProfileRequestMixWindow"
          },
          "warnings": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "type": "string",
              "maxLength": 1024
            }
          },
          "route_difference": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "Frozen total variation distance in percentage points; omitted for truncated or unavailable route distributions."
          },
          "status_difference": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          }
        }
      },
      "ProfileRegressionAssessment": {
        "type": "object",
        "description": "Latest bounded historical CPU assessment, at most 64 KiB JSON, including at most 32 KiB evidence. Original samples are not retained. A different current saved revision marks this assessment stale. Profile expiry leaves this historical summary readable, without extending backend retention.",
        "required": [
          "investigation_revision",
          "checked_at",
          "status",
          "reason",
          "options",
          "baseline",
          "candidate",
          "evidence",
          "uncomparable_entries"
        ],
        "properties": {
          "attribution": {
            "$ref": "#/components/schemas/ProfileAttributionComparison",
            "readOnly": true
          },
          "route_checks": {
            "type": "array",
            "maxItems": 10,
            "readOnly": true,
            "items": {
              "$ref": "#/components/schemas/ProfileRouteRegression"
            }
          },
          "request_mix": {
            "$ref": "#/components/schemas/ProfileRequestMixSnapshot",
            "readOnly": true
          },
          "investigation_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": [
              "regressed",
              "no_regression_detected",
              "inconclusive"
            ]
          },
          "reason": {
            "type": "string"
          },
          "options": {
            "$ref": "#/components/schemas/ProfileRegressionOptions"
          },
          "baseline": {
            "$ref": "#/components/schemas/ProfileQuery"
          },
          "candidate": {
            "$ref": "#/components/schemas/ProfileQuery"
          },
          "baseline_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Weighted observed request telemetry count for the baseline window."
          },
          "candidate_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Weighted observed request telemetry count for the candidate window."
          },
          "baseline_coverage": {
            "$ref": "#/components/schemas/ProfileCoverage"
          },
          "candidate_coverage": {
            "$ref": "#/components/schemas/ProfileCoverage"
          },
          "total": {
            "$ref": "#/components/schemas/ProfileRegressionMetric"
          },
          "evidence": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/ProfileRegressionEvidence"
            }
          },
          "uncomparable_entries": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "ProfileCallPathFrame": {
        "type": "object",
        "description": "One sampled frame in a complete saved caller path. Automatic canary evidence retains only safe repository-relative paths and line numbers; source URLs are derived at read time from each deployment's recorded commit.",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 4096
          },
          "file": {
            "type": "string",
            "maxLength": 4096
          },
          "line": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "baseline_path": {
            "type": "string",
            "maxLength": 4096,
            "readOnly": true,
            "description": "Safe repository-relative baseline path retained for automatic canary evidence."
          },
          "baseline_line": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "readOnly": true
          },
          "candidate_path": {
            "type": "string",
            "maxLength": 4096,
            "readOnly": true,
            "description": "Safe repository-relative candidate path retained for automatic canary evidence."
          },
          "candidate_line": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "readOnly": true
          },
          "baseline_source": {
            "$ref": "#/components/schemas/ProfileSourceLocation",
            "readOnly": true,
            "description": "Request-time source link for the stable deployment; omitted when source is unavailable."
          },
          "candidate_source": {
            "$ref": "#/components/schemas/ProfileSourceLocation",
            "readOnly": true,
            "description": "Request-time source link for the canary deployment; omitted when source is unavailable."
          }
        }
      },
      "ProfileCallPath": {
        "type": "object",
        "description": "Root-to-frame selection. Named comparison frames ignore sampled line changes; candidate and anonymous frames match their sampled line. Total name and file text is limited to 16384 UTF-8 bytes.",
        "required": [
          "view",
          "frames"
        ],
        "properties": {
          "view": {
            "type": "string",
            "enum": [
              "candidate",
              "comparison"
            ]
          },
          "frames": {
            "type": "array",
            "minItems": 1,
            "maxItems": 257,
            "items": {
              "$ref": "#/components/schemas/ProfileCallPathFrame"
            }
          }
        }
      },
      "ProfileInvestigationInput": {
        "type": "object",
        "description": "Saved comparison metadata. Title allows 160 UTF-8 bytes and findings and notes 8192 bytes each. Selections share a runtime. Changed windows must belong to retained deployments; unchanged expired windows permit commentary edits.",
        "required": [
          "title",
          "findings",
          "notes",
          "baseline",
          "candidate"
        ],
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "findings": {
            "type": "string",
            "maxLength": 8192
          },
          "notes": {
            "type": "string",
            "maxLength": 8192
          },
          "baseline": {
            "$ref": "#/components/schemas/ProfileQuery"
          },
          "candidate": {
            "$ref": "#/components/schemas/ProfileQuery"
          },
          "selected_path": {
            "$ref": "#/components/schemas/ProfileCallPath"
          }
        }
      },
      "SaveProfileInvestigationRequest": {
        "type": "object",
        "description": "Complete replacement. Supply expected_revision 0 for creation or the current revision for updates. Concurrent changes return conflict. Body limited to 65536 bytes.",
        "required": [
          "expected_revision",
          "investigation"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740990
          },
          "investigation": {
            "$ref": "#/components/schemas/ProfileInvestigationInput"
          }
        }
      },
      "ProfileInvestigation": {
        "type": "object",
        "description": "Persistent app-owned selections and notes; no profile samples are stored. Up to 50 investigations per app.",
        "required": [
          "id",
          "app_id",
          "revision",
          "investigation",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "investigation": {
            "$ref": "#/components/schemas/ProfileInvestigationInput"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "assessment": {
            "$ref": "#/components/schemas/ProfileRegressionAssessment"
          }
        }
      },
      "ProfileInvestigationWindowStatus": {
        "type": "object",
        "description": "Query eligibility under the current plan and installation. Retained does not guarantee that samples exist; expiry never implies zero CPU usage.",
        "required": [
          "status",
          "detail"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "retained",
              "expired",
              "deployment_unavailable",
              "plan_unavailable",
              "backend_unavailable"
            ]
          },
          "detail": {
            "type": "string"
          }
        }
      },
      "ProfileInvestigationResponse": {
        "type": "object",
        "description": "Saved metadata and authenticated dashboard link, with explicit per-window eligibility.",
        "required": [
          "saved",
          "url",
          "baseline_status",
          "candidate_status"
        ],
        "properties": {
          "saved": {
            "$ref": "#/components/schemas/ProfileInvestigation"
          },
          "url": {
            "type": "string",
            "description": "Relative dashboard link that requires an authenticated account with access to this app."
          },
          "baseline_status": {
            "$ref": "#/components/schemas/ProfileInvestigationWindowStatus"
          },
          "candidate_status": {
            "$ref": "#/components/schemas/ProfileInvestigationWindowStatus"
          }
        }
      },
      "ListProfileInvestigationsResponse": {
        "type": "object",
        "description": "Saved investigations ordered by most recent update, then UUID.",
        "required": [
          "investigations"
        ],
        "properties": {
          "investigations": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/ProfileInvestigationResponse"
            }
          }
        }
      },
      "ProfilingConfig": {
        "description": "Opt-in sampled CPU profiling baked into each deployment.",
        "type": "object",
        "required": [
          "enabled"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "window_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 60,
            "default": 10
          },
          "kinds": {
            "description": "Continuous profile kinds; defaults to cpu.",
            "type": "array",
            "maxItems": 2,
            "items": {
              "type": "string",
              "enum": [
                "cpu",
                "heap"
              ]
            }
          },
          "pprof_port": {
            "description": "Guest-local port where a Go application serves net/http/pprof. The platform then collects CPU, heap and goroutine profiles from it, so the application needs no Gregale SDK. 9191 and 4318 are reserved.",
            "type": "integer",
            "minimum": 1,
            "maximum": 65535
          },
          "automatic_captures": {
            "description": "Whether the platform may start automatic on-demand captures of the app when memory runs low, a request is in flight for too long, or an instance uses its whole CPU limit. Unset means on. Automatic captures count against their own hourly limit and at most half of the account's capture storage.",
            "type": "boolean"
          }
        }
      },
      "CreateProfileCaptureRequest": {
        "description": "On-demand capture request. Kinds defaults to [cpu]; duration_seconds to 10. Stacks is an instant snapshot of where every goroutine or thread is waiting, taken when the capture starts. Block and mutex are Go contention profiles (time goroutines spent blocked on channels or locks, or waiting for a mutex, during the window).",
        "type": "object",
        "properties": {
          "kinds": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "type": "string",
              "enum": [
                "cpu",
                "heap",
                "stacks",
                "block",
                "mutex"
              ]
            }
          },
          "duration_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 60,
            "default": 10
          },
          "instance_id": {
            "type": "string",
            "format": "uuid",
            "description": "Running instance to profile; empty selects the earliest-started RUNNING instance."
          }
        }
      },
      "ProfileCaptureProfile": {
        "description": "One collector's stored profile.",
        "type": "object",
        "required": [
          "kind",
          "bytes"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "cpu",
              "heap",
              "stacks",
              "block",
              "mutex"
            ]
          },
          "process_id": {
            "type": "string"
          },
          "bytes": {
            "type": "integer"
          }
        }
      },
      "ProfileCapture": {
        "description": "An on-demand capture. processes counts instrumented processes that saw the capture; zero means the instance has no collector.",
        "type": "object",
        "required": [
          "id",
          "app_id",
          "status",
          "kinds",
          "duration_seconds",
          "processes",
          "profiles",
          "created_at",
          "expires_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "capturing",
              "ready",
              "failed"
            ]
          },
          "kinds": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "cpu",
                "heap",
                "stacks",
                "block",
                "mutex"
              ]
            }
          },
          "duration_seconds": {
            "type": "integer"
          },
          "requested_instance_id": {
            "type": "string",
            "format": "uuid"
          },
          "trigger": {
            "type": "string",
            "enum": [
              "manual",
              "memory_pressure",
              "slow_request",
              "cpu_saturation"
            ],
            "description": "Who started the capture; memory_pressure captures are queued automatically when an instance runs low on memory, slow_request captures (stacks and CPU) when a request stays in flight for 10 seconds, cpu_saturation captures (CPU) when an instance uses 90% of its CPU limit for 30 seconds."
          },
          "request_id": {
            "type": "string",
            "maxLength": 128,
            "description": "The x-faas-request-id of the in-flight request that started a slow_request capture."
          },
          "request_trace_id": {
            "type": "string",
            "maxLength": 128,
            "description": "The trace id that request's telemetry is stored under."
          },
          "trigger_detail": {
            "type": "string"
          },
          "instance_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "processes": {
            "type": "integer"
          },
          "dropped": {
            "type": "integer",
            "description": "Profiles discarded by the reply bounds."
          },
          "reason": {
            "type": "string"
          },
          "profiles": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/ProfileCaptureProfile"
            }
          },
          "partial": {
            "type": "boolean",
            "description": "The capture ended early, normally because the workload was OOM-killed; heap profiles are the last checkpoints before the kill."
          },
          "oom_killed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Set when the captured instance was OOM-killed within 15 minutes of the capture."
          },
          "oom_peak_mb": {
            "type": "integer",
            "description": "Memory in use when the instance was OOM-killed."
          },
          "oom_plan_mb": {
            "type": "integer",
            "description": "The instance's plan memory limit."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ProfileCaptureList": {
        "description": "An app's profile captures, newest first.",
        "type": "object",
        "required": [
          "captures"
        ],
        "properties": {
          "captures": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/ProfileCapture"
            }
          }
        }
      },
      "ProfileCaptureWebhookPayload": {
        "description": "Payload of the profile.capture_ready and profile.capture_oom_linked app webhook events. Carries the capture record and its paths, never profile samples.",
        "type": "object",
        "required": [
          "version",
          "capture",
          "capture_path",
          "api_path"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1
          },
          "capture": {
            "$ref": "#/components/schemas/ProfileCapture"
          },
          "capture_path": {
            "type": "string",
            "description": "Dashboard page of the capture."
          },
          "api_path": {
            "type": "string",
            "description": "API resource of the capture."
          }
        }
      },
      "ProfileCaptureFunction": {
        "description": "Self and inclusive cost of one function in the view's unit.",
        "type": "object",
        "required": [
          "name",
          "self",
          "total"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "file": {
            "type": "string"
          },
          "line": {
            "type": "integer",
            "format": "int64"
          },
          "source": {
            "$ref": "#/components/schemas/ProfileSourceLocation"
          },
          "self": {
            "type": "integer",
            "format": "int64"
          },
          "total": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "ProfileCaptureStack": {
        "description": "One frame in a bounded call-path tree.",
        "type": "object",
        "required": [
          "name",
          "value"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "file": {
            "type": "string"
          },
          "line": {
            "type": "integer",
            "format": "int64"
          },
          "source": {
            "$ref": "#/components/schemas/ProfileSourceLocation"
          },
          "value": {
            "type": "integer",
            "format": "int64"
          },
          "children": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProfileCaptureStack"
            }
          }
        }
      },
      "ProfileCaptureView": {
        "description": "One profile kind merged across processes. unit is nanoseconds for cpu, bytes for heap and count (goroutines or threads) for stacks. Node and Python heap captures report memory allocated during the window and still live at its end; Go reports the sampled live heap.",
        "type": "object",
        "required": [
          "capture",
          "kind",
          "unit",
          "total",
          "functions",
          "flamegraph",
          "empty"
        ],
        "properties": {
          "capture": {
            "$ref": "#/components/schemas/ProfileCapture"
          },
          "kind": {
            "type": "string",
            "enum": [
              "cpu",
              "heap",
              "stacks",
              "block",
              "mutex"
            ]
          },
          "unit": {
            "type": "string",
            "enum": [
              "nanoseconds",
              "bytes",
              "count"
            ]
          },
          "total": {
            "type": "integer",
            "format": "int64"
          },
          "functions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProfileCaptureFunction"
            }
          },
          "flamegraph": {
            "$ref": "#/components/schemas/ProfileCaptureStack"
          },
          "empty": {
            "type": "boolean"
          },
          "source": {
            "$ref": "#/components/schemas/ProfileSource"
          }
        }
      },
      "ProfileCaptureDiff": {
        "description": "One kind compared between two ready captures of an app. Values keep the kind's unit and are not rescaled.",
        "type": "object",
        "required": [
          "baseline",
          "candidate",
          "kind",
          "unit",
          "baseline_total",
          "candidate_total",
          "delta",
          "functions",
          "flamegraph",
          "warnings"
        ],
        "properties": {
          "baseline": {
            "$ref": "#/components/schemas/ProfileCapture"
          },
          "candidate": {
            "$ref": "#/components/schemas/ProfileCapture"
          },
          "kind": {
            "type": "string",
            "enum": [
              "cpu",
              "heap",
              "stacks",
              "block",
              "mutex"
            ]
          },
          "unit": {
            "type": "string",
            "enum": [
              "nanoseconds",
              "bytes",
              "count"
            ]
          },
          "baseline_total": {
            "type": "integer",
            "format": "int64"
          },
          "candidate_total": {
            "type": "integer",
            "format": "int64"
          },
          "delta": {
            "type": "integer",
            "format": "int64"
          },
          "functions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProfileCaptureFunctionDelta"
            }
          },
          "flamegraph": {
            "$ref": "#/components/schemas/ProfileCaptureStackDelta"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "ProfileCaptureFunctionDelta": {
        "description": "One function's self cost in both captures; named functions aggregate across lines.",
        "type": "object",
        "required": [
          "name",
          "baseline",
          "candidate",
          "delta"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "file": {
            "type": "string"
          },
          "line": {
            "type": "integer",
            "format": "int64"
          },
          "source": {
            "$ref": "#/components/schemas/ProfileSourceLocation"
          },
          "baseline": {
            "type": "integer",
            "format": "int64"
          },
          "candidate": {
            "type": "integer",
            "format": "int64"
          },
          "delta": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "ProfileCaptureStackDelta": {
        "description": "One call path in both captures.",
        "type": "object",
        "required": [
          "name",
          "baseline",
          "candidate",
          "delta"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "file": {
            "type": "string"
          },
          "line": {
            "type": "integer",
            "format": "int64"
          },
          "source": {
            "$ref": "#/components/schemas/ProfileSourceLocation"
          },
          "baseline": {
            "type": "integer",
            "format": "int64"
          },
          "candidate": {
            "type": "integer",
            "format": "int64"
          },
          "delta": {
            "type": "integer",
            "format": "int64"
          },
          "children": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProfileCaptureStackDelta"
            }
          }
        }
      },
      "ProfileHeapResponse": {
        "description": "Continuous live heap near query.end.",
        "type": "object",
        "required": [
          "query",
          "kind",
          "unit",
          "total",
          "functions",
          "flamegraph",
          "empty"
        ],
        "properties": {
          "query": {
            "$ref": "#/components/schemas/ProfileQuery"
          },
          "capture": {
            "$ref": "#/components/schemas/ProfileCapture"
          },
          "kind": {
            "type": "string",
            "enum": [
              "heap"
            ]
          },
          "unit": {
            "type": "string",
            "enum": [
              "bytes"
            ]
          },
          "total": {
            "type": "integer",
            "format": "int64"
          },
          "functions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProfileCaptureFunction"
            }
          },
          "flamegraph": {
            "$ref": "#/components/schemas/ProfileCaptureStack"
          },
          "empty": {
            "type": "boolean"
          },
          "source": {
            "$ref": "#/components/schemas/ProfileSource"
          }
        }
      },
      "TracingConfig": {
        "description": "Opt-in zero-config request tracing baked into each deployment. Managed runtimes export database, cache and HTTP client spans to the debugger without an API key or code changes; apps that configure their own OTel exporter are left untouched.",
        "type": "object",
        "required": [
          "enabled"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "sample_ratio": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 1,
            "default": 1,
            "description": "Fraction of requests whose spans the app exports."
          },
          "forward": {
            "$ref": "#/components/schemas/TracingForward"
          },
          "metrics": {
            "type": "boolean",
            "default": false,
            "description": "Sends the app's OpenTelemetry metrics to Gregale from inside its instance, stored as its custom metrics (no API key needed). Requires tracing to be enabled and a plan with custom metrics. The managed auto-instrumentation's own metrics count toward the app's metric limit."
          }
        }
      },
      "TracingForward": {
        "description": "Sends a copy of every OpenTelemetry trace and log export the app makes to your own OTLP/HTTP endpoint, from inside the app's instance. Requires tracing to be enabled.",
        "type": "object",
        "properties": {
          "endpoint": {
            "type": "string",
            "maxLength": 2048,
            "description": "Base OTLP/HTTP URL (http or https, no credentials, query or fragment); /v1/traces and /v1/logs are appended."
          },
          "headers_secret": {
            "type": "string",
            "maxLength": 128,
            "description": "Name of an app secret holding request headers as comma-separated key=value pairs, in the OTEL_EXPORTER_OTLP_HEADERS format."
          }
        }
      },
      "ProfileQuery": {
        "description": "Authorized deployment CPU capture window.",
        "type": "object",
        "required": [
          "deployment_id",
          "runtime",
          "start",
          "end"
        ],
        "properties": {
          "route": {
            "type": "string",
            "maxLength": 256,
            "description": "Optional static METHOD /pattern or [unattributed]; empty selects all sampled CPU."
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "runtime": {
            "type": "string"
          },
          "start": {
            "type": "string",
            "format": "date-time"
          },
          "end": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ProfileFunction": {
        "description": "Sampled self and inclusive CPU seconds for one source function.",
        "type": "object",
        "required": [
          "name",
          "self_cpu_seconds",
          "total_cpu_seconds"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "file": {
            "type": "string"
          },
          "line": {
            "type": "integer",
            "format": "int64"
          },
          "source": {
            "$ref": "#/components/schemas/ProfileSourceLocation"
          },
          "self_cpu_seconds": {
            "type": "number",
            "format": "double"
          },
          "total_cpu_seconds": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "ProfileStack": {
        "description": "One frame in a bounded CPU call-path tree.",
        "type": "object",
        "required": [
          "name",
          "cpu_seconds"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "file": {
            "type": "string"
          },
          "line": {
            "type": "integer",
            "format": "int64"
          },
          "source": {
            "$ref": "#/components/schemas/ProfileSourceLocation"
          },
          "cpu_seconds": {
            "type": "number",
            "format": "double"
          },
          "children": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProfileStack"
            }
          }
        }
      },
      "ProfileRouteCPU": {
        "description": "Sampled CPU attributed to one validated static application route.",
        "type": "object",
        "required": [
          "route",
          "cpu_seconds"
        ],
        "properties": {
          "label_coverage": {
            "$ref": "#/components/schemas/ProfileRouteLabelCoverage",
            "readOnly": true
          },
          "route": {
            "type": "string",
            "maxLength": 256
          },
          "cpu_seconds": {
            "type": "number",
            "minimum": 0
          },
          "requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cpu_seconds_per_request": {
            "type": "number",
            "minimum": 0
          }
        }
      },
      "ProfileRouteWeight": {
        "description": "Request share used to adjust aggregate CPU comparisons for route mix.",
        "type": "object",
        "required": [
          "route",
          "weight"
        ],
        "properties": {
          "route": {
            "type": "string",
            "maxLength": 256
          },
          "weight": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          }
        }
      },
      "ProfileRouteAdjustment": {
        "type": "object",
        "description": "Common request mix uses the mean of stable/canary route shares. Requires matching route sets, no unattributed CPU, sufficient collection coverage and at least 20 requests per route on each side. This does not alter canary outcomes.",
        "required": [
          "available",
          "reason",
          "weights"
        ],
        "properties": {
          "available": {
            "type": "boolean"
          },
          "reason": {
            "type": "string"
          },
          "baseline_cpu_seconds_per_request": {
            "type": "number"
          },
          "candidate_cpu_seconds_per_request": {
            "type": "number"
          },
          "delta_cpu_seconds_per_request": {
            "type": "number"
          },
          "weights": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/ProfileRouteWeight"
            }
          }
        }
      },
      "ProfileResponse": {
        "description": "CPU profile with an explicit absence-of-samples flag.",
        "type": "object",
        "required": [
          "query",
          "cpu_seconds",
          "stack_count",
          "functions",
          "flamegraph",
          "empty"
        ],
        "properties": {
          "attribution": {
            "$ref": "#/components/schemas/ProfileAttributionQuality",
            "readOnly": true
          },
          "routes": {
            "type": "array",
            "maxItems": 51,
            "items": {
              "$ref": "#/components/schemas/ProfileRouteCPU"
            }
          },
          "route_requests_complete": {
            "type": "boolean",
            "description": "All observed request-route labels have CPU attribution and a complete bounded request summary. This does not establish telemetry delivery or instrumentation completeness."
          },
          "query": {
            "$ref": "#/components/schemas/ProfileQuery"
          },
          "cpu_seconds": {
            "type": "number",
            "format": "double"
          },
          "stack_count": {
            "type": "integer",
            "format": "int64",
            "description": "Number of nonzero aggregated stack records, not raw sampling ticks."
          },
          "functions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProfileFunction"
            }
          },
          "flamegraph": {
            "$ref": "#/components/schemas/ProfileStack"
          },
          "empty": {
            "type": "boolean"
          },
          "coverage": {
            "$ref": "#/components/schemas/ProfileCoverage"
          },
          "source": {
            "$ref": "#/components/schemas/ProfileSource"
          }
        }
      },
      "ProfileSource": {
        "description": "Deployment-recorded GitHub provenance. Links use a full immutable commit SHA; uploaded or generated source is not verified against that commit. Unavailable provenance is explicit.",
        "type": "object",
        "required": [
          "available"
        ],
        "properties": {
          "available": {
            "type": "boolean"
          },
          "repository": {
            "type": "string"
          },
          "commit_sha": {
            "type": "string"
          },
          "commit_url": {
            "type": "string",
            "format": "uri"
          },
          "reason": {
            "type": "string"
          }
        }
      },
      "ProfileSourceLocation": {
        "description": "Safely mapped sampled source line at the deployment's recorded commit. Omitted for missing symbols, unknown paths, generated adapters, or exhausted link bounds. Private repository access is enforced by GitHub.",
        "type": "object",
        "required": [
          "url",
          "path",
          "line"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "path": {
            "type": "string"
          },
          "line": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        }
      },
      "ProfileCoverage": {
        "description": "Recorded collection evidence. Overlapping intervals count once; gaps can include idle time or loss. Failure counts are a lower bound; losses before ingestion are unknown. Unavailable coverage must not be interpreted as zero collection.",
        "type": "object",
        "required": [
          "available",
          "received_profiles",
          "contributing_collectors",
          "window_seconds",
          "covered_seconds",
          "gap_seconds",
          "recorded_failed_uploads",
          "failures_complete"
        ],
        "properties": {
          "attribution_reasons": {
            "type": "array",
            "maxItems": 6,
            "description": "Optional host-generated whole-capture CPU diagnostics. Legacy captures have no counters; public attribution quality reconciles counters against merged CPU before declaring completeness.",
            "items": {
              "$ref": "#/components/schemas/ProfileAttributionReason"
            }
          },
          "available": {
            "type": "boolean"
          },
          "received_profiles": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "contributing_collectors": {
            "type": "integer",
            "minimum": 0
          },
          "last_received_at": {
            "type": "string",
            "format": "date-time",
            "description": "Latest recorded receipt among profiles in the selected capture window."
          },
          "window_seconds": {
            "type": "number",
            "format": "double",
            "minimum": 0
          },
          "covered_seconds": {
            "type": "number",
            "format": "double",
            "minimum": 0
          },
          "gap_seconds": {
            "type": "number",
            "format": "double",
            "minimum": 0
          },
          "recorded_failed_uploads": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Rate limited recorded failures; a lower bound on failed attempts rather than exact lost profiles."
          },
          "failures_complete": {
            "type": "boolean",
            "description": "False because failures before ingestion and omitted failure records are unknown."
          }
        }
      },
      "ProfileCompareRequest": {
        "description": "Baseline and candidate deployment CPU selections.",
        "type": "object",
        "required": [
          "baseline",
          "candidate"
        ],
        "properties": {
          "baseline": {
            "$ref": "#/components/schemas/ProfileQuery"
          },
          "candidate": {
            "$ref": "#/components/schemas/ProfileQuery"
          }
        }
      },
      "ProfileFunctionDelta": {
        "description": "Function self CPU rates normalized by each selected capture window. Numeric rates are meaningful only when the corresponding observed flag is true; delta_cpu_per_second is meaningful only when delta_known is true. Unobserved functions are not measured zero.",
        "type": "object",
        "required": [
          "name",
          "baseline_cpu_per_second",
          "candidate_cpu_per_second",
          "delta_cpu_per_second",
          "baseline_observed",
          "candidate_observed",
          "delta_known"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "file": {
            "type": "string"
          },
          "line": {
            "type": "integer",
            "format": "int64"
          },
          "baseline_source": {
            "$ref": "#/components/schemas/ProfileSourceLocation"
          },
          "candidate_source": {
            "$ref": "#/components/schemas/ProfileSourceLocation"
          },
          "baseline_cpu_per_second": {
            "type": "number",
            "format": "double"
          },
          "candidate_cpu_per_second": {
            "type": "number",
            "format": "double"
          },
          "delta_cpu_per_second": {
            "type": "number",
            "format": "double"
          },
          "baseline_observed": {
            "type": "boolean"
          },
          "candidate_observed": {
            "type": "boolean"
          },
          "delta_known": {
            "type": "boolean"
          }
        }
      },
      "ProfileStackDelta": {
        "description": "Inclusive CPU rates for one complete caller path. Rates are normalized by each selected window; omitted rates mean the path was not observed, not measured zero. Delta is omitted unless both sides were observed. Width is the sum of observed rates for an additive union layout. Named frames match by symbol and file within their parent path; unknown and anonymous frames also retain their line identity.",
        "type": "object",
        "required": [
          "name",
          "width_cpu_per_second"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "file": {
            "type": "string"
          },
          "baseline_line": {
            "type": "integer",
            "format": "int64"
          },
          "candidate_line": {
            "type": "integer",
            "format": "int64"
          },
          "baseline_source": {
            "$ref": "#/components/schemas/ProfileSourceLocation"
          },
          "candidate_source": {
            "$ref": "#/components/schemas/ProfileSourceLocation"
          },
          "baseline_cpu_per_second": {
            "type": "number",
            "format": "double",
            "minimum": 0
          },
          "candidate_cpu_per_second": {
            "type": "number",
            "format": "double",
            "minimum": 0
          },
          "delta_cpu_per_second": {
            "type": "number",
            "format": "double"
          },
          "width_cpu_per_second": {
            "type": "number",
            "format": "double",
            "minimum": 0
          },
          "children": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProfileStackDelta"
            }
          }
        }
      },
      "ProfileCompareResponse": {
        "description": "Deployment CPU rate differences with a compatibility decision.",
        "type": "object",
        "required": [
          "baseline",
          "candidate",
          "functions",
          "comparable"
        ],
        "properties": {
          "attribution": {
            "$ref": "#/components/schemas/ProfileAttributionComparison",
            "readOnly": true
          },
          "route_adjustment": {
            "$ref": "#/components/schemas/ProfileRouteAdjustment"
          },
          "baseline": {
            "$ref": "#/components/schemas/ProfileResponse"
          },
          "candidate": {
            "$ref": "#/components/schemas/ProfileResponse"
          },
          "functions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProfileFunctionDelta"
            }
          },
          "comparable": {
            "type": "boolean"
          },
          "reason": {
            "type": "string"
          },
          "flamegraph": {
            "$ref": "#/components/schemas/ProfileStackDelta"
          },
          "flamegraph_reason": {
            "type": "string",
            "description": "Explains unavailable differential data while preserving a valid function comparison."
          }
        }
      },
      "DebugCoverageResponse": {
        "type": "object",
        "description": "Customer-safe debugger coverage summary. This is observed coverage\nof retained telemetry, not a claim that every gateway request was\npersisted.\n",
        "required": [
          "app_id",
          "since",
          "window_start",
          "window_end",
          "plan_retention_days",
          "telemetry_rows",
          "represented_requests",
          "error_requests",
          "trace_linked",
          "span_evidence",
          "wake_evidence",
          "guest_evidence"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "since": {
            "type": "string"
          },
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "window_end": {
            "type": "string",
            "format": "date-time"
          },
          "plan_retention_days": {
            "type": "integer",
            "minimum": 0
          },
          "telemetry_rows": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "represented_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "trace_linked": {
            "$ref": "#/components/schemas/DebugCoverageSignal"
          },
          "span_evidence": {
            "$ref": "#/components/schemas/DebugCoverageSignal"
          },
          "wake_evidence": {
            "$ref": "#/components/schemas/DebugCoverageSignal"
          },
          "guest_evidence": {
            "$ref": "#/components/schemas/DebugCoverageSignal"
          },
          "oldest_telemetry_at": {
            "type": "string",
            "format": "date-time"
          },
          "latest_telemetry_at": {
            "type": "string",
            "format": "date-time"
          },
          "requests_not_retained": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Requests the app's request analytics counted in the window's whole\nminutes that the debugger did not keep, because the plan's\nper-minute debugger row limit turned them away. A lower bound;\nabsent when request analytics do not cover the window.\n"
          }
        }
      },
      "DebugRunningRequestAttribution": {
        "type": "object",
        "description": "The nearest retained request-telemetry representative linked to a\nrequest-activity cause. A representative may contain several\ncollapsed requests; match_delta_ms and count make that limitation\nexplicit.\n",
        "required": [
          "telemetry_id",
          "deployment_id",
          "route",
          "method",
          "received_at",
          "count",
          "match_delta_ms"
        ],
        "properties": {
          "telemetry_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "route": {
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "trace_id": {
            "type": "string"
          },
          "received_at": {
            "type": "string",
            "format": "date-time"
          },
          "count": {
            "type": "integer",
            "minimum": 1
          },
          "wake_id": {
            "type": "string"
          },
          "instance_id": {
            "type": "string"
          },
          "match_delta_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "DebugRunningFlowSummary": {
        "type": "object",
        "description": "A bounded endpoint-level flow summary observed for a running\ninstance. The platform omits payloads, headers, and unbounded\nconnection data.\n",
        "properties": {
          "instance_id": {
            "type": "string"
          },
          "protocol": {
            "type": "string"
          },
          "remote_ip": {
            "type": "string"
          },
          "remote_port": {
            "type": "integer",
            "minimum": 0,
            "maximum": 65535
          },
          "state": {
            "type": "string"
          },
          "direction": {
            "type": "string"
          },
          "count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "DebugRunningCause": {
        "type": "object",
        "description": "One observed scheduler reason an application remained resident. The\nplatform reports evidence available at the scheduler boundary; it\ndoes not infer a protocol or predict a cost saving.\n",
        "required": [
          "code",
          "summary",
          "instance_count"
        ],
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "request_activity",
              "open_connection",
              "tail_tasks",
              "min_instances",
              "prewarm_floor",
              "scale_in_cooldown",
              "workload_mode",
              "startup_grace",
              "activity_unknown",
              "no_blocker_observed"
            ]
          },
          "summary": {
            "type": "string"
          },
          "instance_count": {
            "type": "integer",
            "minimum": 0
          },
          "open_connections": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "tail_tasks": {
            "type": "integer",
            "minimum": 0
          },
          "mode": {
            "type": "string"
          },
          "workload_class": {
            "type": "string"
          },
          "last_activity_at": {
            "type": "string",
            "format": "date-time"
          },
          "idle_deadline": {
            "type": "string",
            "format": "date-time"
          },
          "request": {
            "$ref": "#/components/schemas/DebugRunningRequestAttribution"
          },
          "flow_topology": {
            "type": "array",
            "description": "Bounded endpoint-level flow summaries observed for the cause.",
            "items": {
              "$ref": "#/components/schemas/DebugRunningFlowSummary"
            }
          },
          "flow_topology_degraded": {
            "type": "boolean",
            "description": "True when optional flow detail was unavailable or stale."
          }
        }
      },
      "DebugRunningObservation": {
        "type": "object",
        "description": "Bounded point-in-time scheduler observation for the running debugger.",
        "required": [
          "observed_at",
          "running_instances",
          "configured_min_instances",
          "effective_min_instances",
          "idle_timeout_seconds",
          "causes"
        ],
        "properties": {
          "event_id": {
            "type": "string"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "running_instances": {
            "type": "integer",
            "minimum": 0
          },
          "configured_min_instances": {
            "type": "integer",
            "minimum": 0
          },
          "effective_min_instances": {
            "type": "integer",
            "minimum": 0
          },
          "prewarm_min_instances": {
            "type": "integer",
            "minimum": 0
          },
          "idle_timeout_seconds": {
            "type": "integer",
            "minimum": 0
          },
          "degraded": {
            "type": "boolean",
            "description": "True when one or more scheduler signals were unavailable."
          },
          "causes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DebugRunningCause"
            }
          }
        }
      },
      "DebugRunningConfig": {
        "type": "object",
        "description": "Configuration context shown with the observed running causes.",
        "required": [
          "configured_min_instances",
          "effective_min_instances",
          "idle_timeout_seconds"
        ],
        "properties": {
          "configured_min_instances": {
            "type": "integer",
            "minimum": 0
          },
          "effective_min_instances": {
            "type": "integer",
            "minimum": 0
          },
          "prewarm_min_instances": {
            "type": "integer",
            "minimum": 0
          },
          "idle_timeout_seconds": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "DebugRunningResponse": {
        "type": "object",
        "description": "Customer-safe explanation of why an app remained resident. `current`\nis the newest observation and `history` contains the bounded recent\nobservations in the requested window.\n",
        "required": [
          "app_id",
          "since",
          "window_start",
          "window_end",
          "retention_clamped",
          "current",
          "config",
          "history",
          "history_truncated"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "since": {
            "type": "string"
          },
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "window_end": {
            "type": "string",
            "format": "date-time"
          },
          "retention_clamped": {
            "type": "boolean"
          },
          "current": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DebugRunningCause"
            }
          },
          "current_observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "config": {
            "$ref": "#/components/schemas/DebugRunningConfig"
          },
          "history": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DebugRunningObservation"
            }
          },
          "history_truncated": {
            "type": "boolean"
          }
        }
      },
      "DebugRolloutExplanation": {
        "type": "object",
        "description": "Why a release was rolled back or is held, with the request evidence\nbehind the safe-release decision.\n",
        "required": [
          "state",
          "traffic_percent",
          "headline",
          "routes",
          "examples",
          "regressions",
          "generated_at"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "stable_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "aborted",
              "held",
              "rolling_out",
              "complete",
              "none"
            ]
          },
          "traffic_percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "decision": {
            "$ref": "#/components/schemas/RolloutDecision"
          },
          "aborted_reason": {
            "type": "string",
            "description": "Reason recorded by an abort that has no safe-release decision (route monitor, alert rollback, profile gate)."
          },
          "headline": {
            "type": "string",
            "description": "Deterministic one-line explanation."
          },
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "window_end": {
            "type": "string",
            "format": "date-time"
          },
          "retention_clamped": {
            "type": "boolean"
          },
          "routes": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/DebugRolloutRoute"
            }
          },
          "examples": {
            "type": "array",
            "maxItems": 3,
            "items": {
              "$ref": "#/components/schemas/DebugTelemetryRequestItem"
            }
          },
          "regressions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DebugRegressionItem"
            }
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DebugRolloutRoute": {
        "type": "object",
        "description": "One route's candidate-vs-stable comparison over the rollout window; counts are represented requests.",
        "required": [
          "route",
          "candidate_requests",
          "candidate_server_errors",
          "candidate_p95_ms",
          "stable_requests",
          "stable_server_errors",
          "stable_p95_ms"
        ],
        "properties": {
          "route": {
            "type": "string"
          },
          "candidate_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "candidate_server_errors": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "candidate_p95_ms": {
            "type": "integer",
            "minimum": 0
          },
          "stable_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "stable_server_errors": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "stable_p95_ms": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "DebugStatusResponse": {
        "type": "object",
        "description": "One summary of an app's health, release, regressions, and recent failures over `since`.",
        "required": [
          "verdict",
          "headline",
          "since",
          "window_start",
          "window_end",
          "health",
          "deployments",
          "regressions",
          "regressions_total",
          "recent_failures",
          "tracing_enabled",
          "generated_at"
        ],
        "properties": {
          "verdict": {
            "type": "string",
            "enum": [
              "failing",
              "rolled_back",
              "degraded",
              "releasing",
              "healthy",
              "idle"
            ]
          },
          "headline": {
            "type": "string"
          },
          "since": {
            "type": "string"
          },
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "window_end": {
            "type": "string",
            "format": "date-time"
          },
          "health": {
            "$ref": "#/components/schemas/DebugStatusHealth"
          },
          "deployments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DebugStatusDeployment"
            }
          },
          "rollout": {
            "$ref": "#/components/schemas/DebugRolloutExplanation"
          },
          "regressions": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/DebugRegressionItem"
            }
          },
          "regressions_total": {
            "type": "integer",
            "minimum": 0
          },
          "recent_failures": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/DebugTelemetryRequestItem"
            }
          },
          "oom_kills": {
            "type": "array",
            "maxItems": 5,
            "description": "Out-of-memory kills of the app's instances in the window, newest first.",
            "items": {
              "$ref": "#/components/schemas/DebugStatusOOMKill"
            }
          },
          "oom_kills_total": {
            "type": "integer",
            "minimum": 0
          },
          "oom_fix": {
            "type": "string",
            "description": "The remedy for the newest out-of-memory kill, one suggestion per line."
          },
          "memory_pressure": {
            "$ref": "#/components/schemas/DebugStatusMemory"
          },
          "tracing_enabled": {
            "type": "boolean"
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DebugStatusMemory": {
        "type": "object",
        "description": "Present when the app's guests ran short of memory in the last day: the low point and the RAM that would have kept 30% of the guest's memory free. Shown where Gregale has released memory warnings to the account.",
        "required": [
          "episodes",
          "lowest_available_mb",
          "total_mb",
          "peak_anon_mb",
          "last_at",
          "current_mb",
          "suggested_mb",
          "plan",
          "plan_mb",
          "fits_plan",
          "advice"
        ],
        "properties": {
          "episodes": {
            "type": "integer",
            "minimum": 0
          },
          "lowest_available_mb": {
            "type": "integer",
            "minimum": 0
          },
          "total_mb": {
            "type": "integer",
            "minimum": 0
          },
          "peak_anon_mb": {
            "type": "integer",
            "minimum": 0
          },
          "last_at": {
            "type": "string",
            "format": "date-time"
          },
          "current_mb": {
            "type": "integer",
            "minimum": 0,
            "description": "The app's ram_mb."
          },
          "suggested_mb": {
            "type": "integer",
            "minimum": 0,
            "description": "RAM that would have kept 30% free, in 64 MB steps; always above current_mb."
          },
          "plan": {
            "type": "string"
          },
          "plan_mb": {
            "type": "integer",
            "minimum": 0,
            "description": "The most RAM the account's plan allows."
          },
          "fits_plan": {
            "type": "boolean"
          },
          "upgrade_plan": {
            "type": "string",
            "description": "The smallest plan that allows suggested_mb, when fits_plan is false; absent when no plan does."
          },
          "upgrade_mb": {
            "type": "integer",
            "minimum": 0
          },
          "advice": {
            "type": "string",
            "description": "The same suggestion the app health memory check gives."
          }
        }
      },
      "DebugStatusOOMKill": {
        "type": "object",
        "description": "One out-of-memory kill of an app instance. A deployment that was not yet live fails; a live release keeps serving on a new instance.",
        "required": [
          "at",
          "deployment_id",
          "peak_mb",
          "plan_mb",
          "deployment_failed"
        ],
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "peak_mb": {
            "type": "integer",
            "minimum": 0
          },
          "plan_mb": {
            "type": "integer",
            "minimum": 0
          },
          "deployment_failed": {
            "type": "boolean"
          }
        }
      },
      "DebugStatusHealth": {
        "type": "object",
        "description": "The serving deployments' traffic over the window.",
        "required": [
          "requests",
          "server_errors",
          "p95_ms"
        ],
        "properties": {
          "requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "server_errors": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "p95_ms": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "DebugStatusDeployment": {
        "type": "object",
        "description": "One deployment currently serving traffic.",
        "required": [
          "id",
          "traffic_percent",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "traffic_percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "rollout_state": {
            "type": "string"
          },
          "commit_sha": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DebugTelemetryListResponse": {
        "type": "object",
        "description": "Response from GET /v1/apps/{slug}/debug/requests.\n`since` echoes the effective window used (after the plan's\n`DebugTelemetryRetentionDays` clamp) so the dashboard can\nsurface a \"you widened past the cap\" tile.\n",
        "required": [
          "requests",
          "since",
          "window_start",
          "window_end",
          "retention_clamped",
          "complete",
          "filters"
        ],
        "properties": {
          "since": {
            "type": "string",
            "description": "Effective window applied (e.g. '24h', '72h')."
          },
          "window_start": {
            "type": "string",
            "format": "date-time",
            "description": "Inclusive start of the pinned retention window."
          },
          "window_end": {
            "type": "string",
            "format": "date-time",
            "description": "Exclusive end of the pinned retention window."
          },
          "retention_clamped": {
            "type": "boolean",
            "description": "True when the requested lookback exceeded the plan retention cap."
          },
          "complete": {
            "type": "boolean",
            "description": "True when this page contains every retained row in the pinned window."
          },
          "next_cursor": {
            "type": "string",
            "description": "Opaque cursor for the next page; omitted when complete is true."
          },
          "filters": {
            "$ref": "#/components/schemas/DebugTelemetryListFilters"
          },
          "requests": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DebugTelemetryRequestItem"
            }
          }
        }
      },
      "DebugTelemetryListFilters": {
        "type": "object",
        "description": "Normalized server-side filters echoed by a request telemetry page.",
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599
          },
          "cold_boot": {
            "type": "boolean"
          },
          "consumer_id": {
            "type": "string",
            "description": "Consumer UUID, or __anonymous__ for anonymous traffic."
          },
          "min_latency_ms": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400000
          }
        }
      },
      "DebugTelemetryRequestItem": {
        "type": "object",
        "description": "A retained request-ID mapping, optionally enriched with a bounded telemetry row when detailed evidence is available.",
        "required": [
          "received_at",
          "cold_boot"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Internal telemetry row UUID when detailed telemetry is available."
          },
          "request_id": {
            "type": "string",
            "maxLength": 128,
            "description": "Exact public x-faas-request-id supplied by the caller or generated by the gateway."
          },
          "evidence_status": {
            "type": "string",
            "enum": [
              "request_id_only"
            ],
            "description": "Set when the durable request-ID mapping exists but no detailed telemetry row was retained."
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "route": {
            "type": "string",
            "description": "Route template (NOT expanded URL)."
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE",
              "HEAD",
              "OPTIONS"
            ]
          },
          "status": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599
          },
          "latency_ms": {
            "type": "integer",
            "minimum": 0,
            "description": "Inclusive upper bound of the bounded latency bucket represented by this row."
          },
          "count": {
            "type": "integer",
            "minimum": 1,
            "description": "Number of original requests represented by this collapsed telemetry row."
          },
          "cold_boot": {
            "type": "boolean"
          },
          "trace_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "W3C distributed-tracing identifier (32 hex chars), separate from request_id."
          },
          "trace_inferred": {
            "type": "boolean",
            "description": "True when Gregale linked this service call to its caller's trace because the caller sent no traceparent and was serving exactly one request: the trace id is inferred, not propagated."
          },
          "received_at": {
            "type": "string",
            "format": "date-time"
          },
          "wake_id": {
            "type": "string",
            "description": "Opaque wake identifier when this request admitted a wake; omitted for warm requests."
          },
          "instance_id": {
            "type": "string",
            "description": "Opaque instance identifier that served the request; omitted when no target was reached."
          },
          "consumer_id": {
            "type": "string",
            "format": "uuid",
            "description": "Stable API consumer identity; omitted for anonymous or legacy traffic."
          },
          "node_id": {
            "type": "string",
            "description": "Compute node that served the request."
          },
          "region": {
            "type": "string",
            "description": "Region associated with the deployment target."
          },
          "commit_sha": {
            "type": "string",
            "description": "Source revision associated with the deployment."
          },
          "deployment_tag": {
            "type": "string",
            "description": "Deployment tag associated with the request."
          },
          "deployment_created_at": {
            "type": "string",
            "description": "Deployment creation timestamp supplied by the platform."
          },
          "image_digest": {
            "type": "string",
            "description": "Immutable image/artifact digest associated with the deployment."
          },
          "guest": {
            "$ref": "#/components/schemas/DebugGuestExecutionEvidence"
          },
          "profile_capture_id": {
            "type": "string",
            "format": "uuid",
            "description": "Stack snapshot taken while this request was in flight (slow_request capture), when one exists."
          }
        }
      },
      "DebugGuestExecutionEvidence": {
        "type": "object",
        "description": "Bounded, platform-owned runtime execution evidence. Omitted when the runner signal was unavailable.",
        "required": [
          "runtime",
          "duration_ms",
          "outcome"
        ],
        "properties": {
          "runtime": {
            "type": "string",
            "enum": [
              "node22",
              "node24",
              "python312",
              "python313",
              "go124"
            ]
          },
          "duration_ms": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400000
          },
          "outcome": {
            "type": "string",
            "enum": [
              "ok",
              "http_error",
              "handler_error",
              "timeout",
              "canceled"
            ]
          },
          "error_class": {
            "type": "string",
            "enum": [
              "http_5xx",
              "handler_exec",
              "handler_protocol",
              "timeout",
              "canceled"
            ]
          }
        }
      },
      "DebugTelemetrySpan": {
        "type": "object",
        "description": "Bounded, redacted span evidence. DB statements are sanitized fingerprints.",
        "required": [
          "trace_id",
          "span_id",
          "name",
          "kind",
          "duration_nanos"
        ],
        "properties": {
          "trace_id": {
            "type": "string",
            "maxLength": 256
          },
          "span_id": {
            "type": "string",
            "maxLength": 256
          },
          "parent_span_id": {
            "type": "string",
            "maxLength": 256
          },
          "name": {
            "type": "string",
            "maxLength": 256
          },
          "kind": {
            "type": "string",
            "maxLength": 256
          },
          "start_time": {
            "type": "string",
            "format": "date-time",
            "description": "Redacted span start time used for the request waterfall."
          },
          "end_time": {
            "type": "string",
            "format": "date-time",
            "description": "Redacted span end time used for the request waterfall."
          },
          "duration_nanos": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "status": {
            "type": "string",
            "maxLength": 256
          },
          "db_statement": {
            "type": "string",
            "maxLength": 512,
            "description": "SQL fingerprint with literals redacted."
          },
          "dependency_type": {
            "type": "string",
            "enum": [
              "managed_binding",
              "outbound_integration",
              "guest_transport",
              "platform_internal",
              "app_dependency"
            ],
            "description": "Allowlisted platform-owned dependency classification."
          },
          "dependency_kind": {
            "type": "string",
            "maxLength": 64,
            "pattern": "^[a-z0-9_.-]+$",
            "description": "Allowlisted platform-owned dependency kind; raw span attributes are never returned."
          },
          "dependency_name": {
            "type": "string",
            "maxLength": 96,
            "description": "Grouping identity of an app_dependency span: database operation and table, HTTP host, RPC method or messaging destination. Never contains literals, paths, query strings or credentials."
          },
          "error_type": {
            "type": "string",
            "maxLength": 96,
            "pattern": "^[A-Za-z0-9._:$/-]+$",
            "description": "Failure class of an error span, from the error.type attribute or the first recorded exception.type (for example QueryTimeout or 503). Exception messages and stack traces are never retained."
          }
        }
      },
      "DebugCriticalPathSpan": {
        "type": "object",
        "description": "One redacted span on the selected causal path. Exclusive time excludes overlapping direct children.",
        "required": [
          "span_id",
          "name",
          "kind",
          "start_time",
          "end_time",
          "duration_ms",
          "exclusive_ms"
        ],
        "properties": {
          "span_id": {
            "type": "string",
            "maxLength": 256
          },
          "parent_span_id": {
            "type": "string",
            "maxLength": 256
          },
          "name": {
            "type": "string",
            "maxLength": 256
          },
          "kind": {
            "type": "string",
            "maxLength": 256
          },
          "dependency_type": {
            "type": "string",
            "enum": [
              "managed_binding",
              "outbound_integration",
              "guest_transport",
              "platform_internal",
              "app_dependency"
            ]
          },
          "dependency_kind": {
            "type": "string",
            "maxLength": 64,
            "pattern": "^[a-z0-9_.-]+$"
          },
          "dependency_name": {
            "type": "string",
            "maxLength": 96
          },
          "status": {
            "type": "string",
            "maxLength": 256
          },
          "start_time": {
            "type": "string",
            "format": "date-time"
          },
          "end_time": {
            "type": "string",
            "format": "date-time"
          },
          "duration_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "exclusive_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Wall time not covered by overlapping direct child spans."
          }
        }
      },
      "DebugRequestCriticalPath": {
        "type": "object",
        "description": "Bounded causal path reconstructed from retained span timing and parent links.",
        "required": [
          "duration_ms",
          "complete",
          "span_count",
          "spans"
        ],
        "properties": {
          "duration_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "complete": {
            "type": "boolean",
            "description": "True only when all retained spans have valid timing and parent links within the sample."
          },
          "span_count": {
            "type": "integer",
            "minimum": 1,
            "maximum": 32
          },
          "slowest_span_id": {
            "type": "string",
            "maxLength": 256
          },
          "slowest_span_name": {
            "type": "string",
            "maxLength": 256
          },
          "slowest_exclusive_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "spans": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/DebugCriticalPathSpan"
            }
          }
        }
      },
      "DebugDependencyLatencyItem": {
        "type": "object",
        "description": "Bounded historical dependency aggregate. Percentiles are weighted by collapsed request-row counts and derived from sampled redacted spans.",
        "required": [
          "type",
          "name",
          "calls",
          "error_calls",
          "error_rate_pct",
          "p50_ms",
          "p95_ms",
          "p99_ms",
          "regression",
          "failure_regression"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "application",
              "managed_binding",
              "outbound_integration",
              "guest_transport",
              "platform_internal",
              "app_dependency"
            ]
          },
          "kind": {
            "type": "string",
            "maxLength": 64,
            "pattern": "^[a-z0-9_.-]+$"
          },
          "name": {
            "type": "string",
            "maxLength": 256
          },
          "calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "error_calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_rate_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "p50_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "p95_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "p99_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "exclusive_p50_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Median (p50) wall time not covered by overlapping direct child spans."
          },
          "exclusive_p95_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "p95 wall time not covered by overlapping direct child spans."
          },
          "exclusive_p99_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "p99 wall time not covered by overlapping direct child spans."
          },
          "baseline_p95_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "current_p95_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "p95_delta_ms": {
            "type": "integer",
            "format": "int64"
          },
          "baseline_exclusive_p95_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "current_exclusive_p95_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "exclusive_p95_delta_ms": {
            "type": "integer",
            "format": "int64"
          },
          "regression_factor": {
            "type": "number",
            "minimum": 0
          },
          "regression": {
            "type": "boolean",
            "description": "True when both split-window samples meet the minimum call threshold and current p95 is at least 1.5x and 25ms above baseline."
          },
          "baseline_error_rate_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "current_error_rate_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "error_rate_delta_pct": {
            "type": "number"
          },
          "failure_regression": {
            "type": "boolean",
            "description": "True when both split-window samples meet the minimum call threshold, the current side has at least 3 failed calls, and the current error rate is at least 5 percentage points and 2x above baseline."
          },
          "top_error_type": {
            "type": "string",
            "maxLength": 96,
            "description": "Most frequent span failure class, from the current side when it has failures."
          },
          "queries": {
            "type": "array",
            "maxItems": 5,
            "description": "Database dependencies only: the dependency broken down by normalized query pattern (literals, placeholders, IN lists and VALUES rows folded), regressions first.",
            "items": {
              "$ref": "#/components/schemas/DebugDependencyQueryItem"
            }
          },
          "queries_truncated": {
            "type": "boolean",
            "description": "True when more query patterns were seen than are returned."
          }
        }
      },
      "DebugDependencyQueryItem": {
        "type": "object",
        "description": "One normalized query pattern within a database dependency, with the same latency and failure comparison as its dependency.",
        "required": [
          "pattern",
          "calls",
          "error_calls",
          "p95_ms",
          "regression",
          "failure_regression"
        ],
        "properties": {
          "pattern": {
            "type": "string",
            "maxLength": 256,
            "description": "Redacted, normalized statement; never contains literal values."
          },
          "calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "error_calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "p95_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "baseline_p95_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "current_p95_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "regression_factor": {
            "type": "number",
            "minimum": 0
          },
          "regression": {
            "type": "boolean"
          },
          "baseline_error_rate_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "current_error_rate_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "failure_regression": {
            "type": "boolean"
          },
          "top_error_type": {
            "type": "string",
            "maxLength": 96
          }
        }
      },
      "DebugDependencyImpactEdge": {
        "type": "object",
        "description": "Bounded normalized parent-to-child dependency edge reconstructed from retained redacted span links.",
        "required": [
          "from",
          "to",
          "exemplars",
          "calls",
          "error_calls",
          "error_rate_pct",
          "p50_ms",
          "p95_ms",
          "p99_ms",
          "exclusive_p50_ms",
          "exclusive_p95_ms",
          "exclusive_p99_ms",
          "regression"
        ],
        "properties": {
          "from": {
            "$ref": "#/components/schemas/DebugCriticalPathSegment"
          },
          "to": {
            "$ref": "#/components/schemas/DebugCriticalPathSegment"
          },
          "exemplars": {
            "type": "array",
            "maxItems": 3,
            "description": "Bounded current, baseline, and error representatives. Each request_id resolves only to redacted debugger evidence.",
            "items": {
              "$ref": "#/components/schemas/DebugDependencyImpactExemplar"
            }
          },
          "calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "error_calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_rate_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "p50_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "p95_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "p99_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "exclusive_p50_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "exclusive_p95_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "exclusive_p99_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "baseline_p95_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "current_p95_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "p95_delta_ms": {
            "type": "integer",
            "format": "int64"
          },
          "baseline_exclusive_p95_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "current_exclusive_p95_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "exclusive_p95_delta_ms": {
            "type": "integer",
            "format": "int64"
          },
          "regression_factor": {
            "type": "number",
            "minimum": 0
          },
          "regression": {
            "type": "boolean"
          },
          "baseline_error_rate_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "current_error_rate_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "error_rate_delta_pct": {
            "type": "number"
          }
        }
      },
      "DebugDependencyImpactExemplar": {
        "type": "object",
        "description": "Bounded representative request for a historical dependency edge. Request identifiers resolve only to retained redacted debugger evidence.",
        "required": [
          "request_id",
          "window",
          "received_at",
          "duration_ms",
          "http_status",
          "error",
          "count"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "maxLength": 128
          },
          "trace_id": {
            "type": "string",
            "maxLength": 128
          },
          "window": {
            "type": "string",
            "enum": [
              "baseline",
              "current"
            ]
          },
          "received_at": {
            "type": "string",
            "format": "date-time"
          },
          "duration_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "http_status": {
            "type": "integer",
            "minimum": 0,
            "maximum": 999
          },
          "error": {
            "type": "boolean"
          },
          "count": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        }
      },
      "DebugDependencyLatencyResponse": {
        "type": "object",
        "description": "Historical dependency latency for one app. Raw span attributes and destinations are never exposed.",
        "required": [
          "app_id",
          "since",
          "window_start",
          "window_end",
          "retention_clamped",
          "complete",
          "truncated",
          "telemetry_rows",
          "represented_requests",
          "span_samples",
          "dependencies",
          "edges"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "since": {
            "type": "string"
          },
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "window_end": {
            "type": "string",
            "format": "date-time"
          },
          "retention_clamped": {
            "type": "boolean"
          },
          "complete": {
            "type": "boolean",
            "description": "True only when the row, span, and dependency-cardinality caps were not reached."
          },
          "truncated": {
            "type": "boolean"
          },
          "telemetry_rows": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "represented_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "span_samples": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "dependencies": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/DebugDependencyLatencyItem"
            }
          },
          "edges": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/DebugDependencyImpactEdge"
            }
          },
          "deployment_comparison": {
            "$ref": "#/components/schemas/DebugDependencyDeploymentComparison"
          }
        }
      },
      "DebugDependencyDeploymentComparison": {
        "type": "object",
        "description": "Dependency latency split by deployment: baseline_* fields describe the previous deployment, current_* the compared one. Regressions first, then by current p95.",
        "required": [
          "current_deployment_id",
          "previous_deployment_id",
          "dependencies",
          "truncated"
        ],
        "properties": {
          "current_deployment_id": {
            "type": "string"
          },
          "current_deployment_tag": {
            "type": "string"
          },
          "current_commit_sha": {
            "type": "string"
          },
          "previous_deployment_id": {
            "type": "string"
          },
          "previous_deployment_tag": {
            "type": "string"
          },
          "previous_commit_sha": {
            "type": "string"
          },
          "route": {
            "type": "string"
          },
          "dependencies": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/DebugDependencyLatencyItem"
            }
          },
          "truncated": {
            "type": "boolean"
          }
        }
      },
      "DebugCriticalPathSegment": {
        "type": "object",
        "description": "One redacted span identity in a canonical historical critical-path signature.",
        "required": [
          "type",
          "name"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "application",
              "managed_binding",
              "outbound_integration",
              "guest_transport",
              "platform_internal",
              "app_dependency"
            ]
          },
          "kind": {
            "type": "string",
            "maxLength": 64,
            "pattern": "^[a-z0-9_.-]+$"
          },
          "name": {
            "type": "string",
            "maxLength": 256
          }
        }
      },
      "DebugCriticalPathHistoryItem": {
        "type": "object",
        "description": "Bounded historical critical-path aggregate. Percentiles are weighted by collapsed request-row counts and derived from sampled redacted spans.",
        "required": [
          "signature",
          "segments",
          "exemplars",
          "calls",
          "error_calls",
          "error_rate_pct",
          "p50_ms",
          "p95_ms",
          "p99_ms",
          "baseline_calls",
          "current_calls",
          "baseline_p95_ms",
          "current_p95_ms",
          "p95_delta_ms",
          "regression_factor",
          "regression",
          "baseline_error_rate_pct",
          "current_error_rate_pct",
          "error_rate_delta_pct"
        ],
        "properties": {
          "signature": {
            "type": "string",
            "maxLength": 8192
          },
          "segments": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/DebugCriticalPathSegment"
            }
          },
          "dominant_segment": {
            "$ref": "#/components/schemas/DebugCriticalPathSegment"
          },
          "dominant_segment_exclusive_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "exemplars": {
            "type": "array",
            "maxItems": 3,
            "items": {
              "$ref": "#/components/schemas/DebugCriticalPathExemplar"
            }
          },
          "calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "error_calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "error_rate_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "p50_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "p95_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "p99_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "baseline_calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "current_calls": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "baseline_p95_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "current_p95_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "p95_delta_ms": {
            "type": "integer",
            "format": "int64"
          },
          "regression_factor": {
            "type": "number",
            "minimum": 0
          },
          "regression": {
            "type": "boolean",
            "description": "True when both path samples meet the minimum threshold and the newer p95 exceeds the older p95 by the configured factor and delta."
          },
          "baseline_error_rate_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "current_error_rate_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "error_rate_delta_pct": {
            "type": "number"
          }
        }
      },
      "DebugCriticalPathExemplar": {
        "type": "object",
        "description": "Bounded representative request for a historical critical path. Request identifiers resolve only to retained redacted debugger evidence.",
        "required": [
          "request_id",
          "window",
          "received_at",
          "duration_ms",
          "http_status",
          "error",
          "count"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "maxLength": 128
          },
          "trace_id": {
            "type": "string",
            "maxLength": 128
          },
          "window": {
            "type": "string",
            "enum": [
              "baseline",
              "current"
            ]
          },
          "received_at": {
            "type": "string",
            "format": "date-time"
          },
          "duration_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "http_status": {
            "type": "integer",
            "minimum": 0,
            "maximum": 999
          },
          "error": {
            "type": "boolean"
          },
          "count": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "dominant_segment": {
            "$ref": "#/components/schemas/DebugCriticalPathSegment"
          },
          "dominant_segment_exclusive_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "DebugCriticalPathHistoryResponse": {
        "type": "object",
        "description": "Historical critical-path aggregates for one app. Raw span attributes and destinations are never exposed.",
        "required": [
          "app_id",
          "since",
          "window_start",
          "window_end",
          "retention_clamped",
          "complete",
          "truncated",
          "telemetry_rows",
          "represented_requests",
          "path_samples",
          "critical_paths"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "since": {
            "type": "string"
          },
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "window_end": {
            "type": "string",
            "format": "date-time"
          },
          "retention_clamped": {
            "type": "boolean"
          },
          "complete": {
            "type": "boolean",
            "description": "True only when the row, path-cardinality, span-timing, and parent-link caps were not reached."
          },
          "truncated": {
            "type": "boolean"
          },
          "telemetry_rows": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "represented_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "path_samples": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "critical_paths": {
            "type": "array",
            "maxItems": 25,
            "items": {
              "$ref": "#/components/schemas/DebugCriticalPathHistoryItem"
            }
          }
        }
      },
      "DebugRequestDependencyLatency": {
        "type": "object",
        "description": "Bounded latency aggregate for one retained dependency span group. Total duration may include overlapping child spans and is not a critical-path sum.",
        "required": [
          "type",
          "name",
          "calls",
          "total_duration_ms",
          "max_duration_ms"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "application",
              "managed_binding",
              "outbound_integration",
              "guest_transport",
              "platform_internal",
              "app_dependency"
            ]
          },
          "kind": {
            "type": "string",
            "maxLength": 64,
            "pattern": "^[a-z0-9_.-]+$"
          },
          "name": {
            "type": "string",
            "maxLength": 256
          },
          "calls": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "errors": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "total_duration_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "max_duration_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "DebugEvidenceExplanation": {
        "type": "object",
        "description": "Bounded root-cause synthesis generated from the safe evidence payload.",
        "required": [
          "status",
          "headline"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "regression_detected",
              "unobserved",
              "regression_unavailable"
            ]
          },
          "headline": {
            "type": "string"
          },
          "diagnosis": {
            "type": "string",
            "enum": [
              "dependency_failure",
              "request_failure",
              "dependency_regression",
              "error_regression",
              "performance_regression",
              "cold_start",
              "slow_path",
              "insufficient_evidence",
              "no_issue_observed"
            ]
          },
          "confidence": {
            "type": "string",
            "enum": [
              "high",
              "medium",
              "low"
            ]
          },
          "primary_span": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DebugTelemetrySpan"
              },
              {
                "type": "null"
              }
            ]
          },
          "findings": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/DebugEvidenceFinding"
            }
          },
          "recommendations": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/DebugEvidenceRecommendation"
            }
          },
          "evidence_refs": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/DebugEvidenceRef"
            }
          },
          "generated_by": {
            "type": "string",
            "enum": [
              "rules-v1"
            ]
          }
        }
      },
      "DebugEvidenceFinding": {
        "type": "object",
        "description": "One bounded, evidence-backed debugger finding.",
        "required": [
          "code",
          "title",
          "detail",
          "confidence"
        ],
        "properties": {
          "code": {
            "type": "string",
            "maxLength": 64
          },
          "title": {
            "type": "string",
            "maxLength": 128
          },
          "detail": {
            "type": "string",
            "maxLength": 512
          },
          "confidence": {
            "type": "string",
            "enum": [
              "high",
              "medium",
              "low"
            ]
          },
          "evidence_refs": {
            "type": "array",
            "maxItems": 4,
            "items": {
              "type": "string",
              "maxLength": 64
            }
          }
        }
      },
      "DebugEvidenceRecommendation": {
        "type": "object",
        "description": "One safe next action suggested by the debugger.",
        "required": [
          "action",
          "detail"
        ],
        "properties": {
          "action": {
            "type": "string",
            "maxLength": 64
          },
          "detail": {
            "type": "string",
            "maxLength": 512
          }
        }
      },
      "DebugEvidenceRef": {
        "type": "object",
        "description": "A stable label for the bounded signal supporting a finding.",
        "required": [
          "kind",
          "label",
          "value"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "maxLength": 64
          },
          "label": {
            "type": "string",
            "maxLength": 128
          },
          "value": {
            "type": "string",
            "maxLength": 64
          }
        }
      },
      "DebugTimelineEvent": {
        "type": "object",
        "description": "Deterministic, bounded request and wake lifecycle marker. Raw event payloads are not returned.",
        "required": [
          "at",
          "phase",
          "kind",
          "summary"
        ],
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "phase": {
            "type": "string",
            "enum": [
              "request",
              "wake",
              "guest",
              "error",
              "regression"
            ]
          },
          "kind": {
            "type": "string",
            "maxLength": 128
          },
          "actor": {
            "type": "string",
            "maxLength": 128
          },
          "summary": {
            "type": "string",
            "maxLength": 256
          },
          "duration_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "status": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599
          },
          "approximate": {
            "type": "boolean",
            "description": "True when the marker is derived from a collapsed minute bucket rather than an exact request timestamp."
          }
        }
      },
      "DebugRequestCorrelationStage": {
        "type": "object",
        "description": "One bounded edge-to-billing request stage. Missing and partial signals are explicit and are never rendered as zero latency.",
        "required": [
          "phase",
          "status"
        ],
        "properties": {
          "phase": {
            "type": "string",
            "enum": [
              "edge",
              "queue",
              "wake",
              "guest",
              "downstream",
              "billing"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "observed",
              "partial",
              "missing",
              "not_applicable"
            ]
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          },
          "duration_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "evidence_count": {
            "type": "integer",
            "minimum": 0
          },
          "reason": {
            "type": "string",
            "maxLength": 256
          },
          "approximate": {
            "type": "boolean",
            "description": "True when the stage is derived from a collapsed request bucket rather than an exact request timestamp."
          }
        }
      },
      "DebugRequestCorrelation": {
        "type": "object",
        "description": "Fixed-shape edge-to-billing correlation for a retained request. Every stage is present so unavailable telemetry is visible.",
        "required": [
          "stages",
          "complete"
        ],
        "properties": {
          "stages": {
            "type": "array",
            "minItems": 6,
            "maxItems": 6,
            "items": {
              "$ref": "#/components/schemas/DebugRequestCorrelationStage"
            }
          },
          "complete": {
            "type": "boolean",
            "description": "True only when every applicable stage has complete retained evidence."
          }
        }
      },
      "DebugRequestEvidenceResponse": {
        "type": "object",
        "description": "Request metadata, deterministic wake/request timeline, bounded span evidence, the request's own log lines, matching regression, and explanation.",
        "required": [
          "request",
          "timeline",
          "correlation",
          "dependency_latency",
          "dependency_latency_truncated",
          "spans",
          "spans_truncated",
          "logs",
          "logs_truncated",
          "explanation",
          "generated_at"
        ],
        "properties": {
          "request": {
            "$ref": "#/components/schemas/DebugTelemetryRequestItem"
          },
          "regression": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DebugRegressionItem"
              },
              {
                "type": "null"
              }
            ]
          },
          "timeline": {
            "type": "array",
            "maxItems": 200,
            "items": {
              "$ref": "#/components/schemas/DebugTimelineEvent"
            }
          },
          "correlation": {
            "$ref": "#/components/schemas/DebugRequestCorrelation"
          },
          "critical_path": {
            "$ref": "#/components/schemas/DebugRequestCriticalPath"
          },
          "dependency_latency": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/DebugRequestDependencyLatency"
            }
          },
          "dependency_latency_truncated": {
            "type": "boolean",
            "description": "True when more than 16 dependency groups were retained."
          },
          "dependency_comparison": {
            "$ref": "#/components/schemas/DebugDependencyDeploymentComparison"
          },
          "spans": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/DebugTelemetrySpan"
            }
          },
          "spans_truncated": {
            "type": "boolean"
          },
          "logs": {
            "type": "array",
            "maxItems": 20,
            "description": "Log lines the app emitted for this request: OTel log records carrying its trace ID, forwarded by the in-guest bridge when tracing is enabled (runtime source; HTTP access lines are not repeated). Chronological; redacted and bounded. Empty without a trace ID or when the app exports no OTel logs.",
            "items": {
              "$ref": "#/components/schemas/DebugEvidenceLogLine"
            }
          },
          "logs_truncated": {
            "type": "boolean",
            "description": "True when the request logged more than 20 lines; logs then holds its last 20."
          },
          "explanation": {
            "$ref": "#/components/schemas/DebugEvidenceExplanation"
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DebugEvidenceLogLine": {
        "type": "object",
        "description": "One log line attached to request evidence. The message is bounded to 512 bytes; structured log fields are not included.",
        "required": [
          "occurred_at",
          "source",
          "message"
        ],
        "properties": {
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "source": {
            "type": "string",
            "maxLength": 32
          },
          "level": {
            "type": "string",
            "maxLength": 16
          },
          "stream": {
            "type": "string",
            "maxLength": 16
          },
          "message": {
            "type": "string",
            "maxLength": 512
          }
        }
      },
      "DebugRegressionsResponse": {
        "type": "object",
        "description": "Response from GET /v1/apps/{slug}/debug/regressions.\n`since` echoes the effective window applied.\n",
        "required": [
          "regressions",
          "since"
        ],
        "properties": {
          "since": {
            "type": "string"
          },
          "regressions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DebugRegressionItem"
            }
          }
        }
      },
      "DebugRegressionItem": {
        "type": "object",
        "description": "One regression observation row.",
        "required": [
          "deployment_id",
          "route",
          "p95_ms",
          "p95_base_ms",
          "affected_count",
          "regression_factor",
          "first_detected_at",
          "last_detected_at",
          "state"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "route": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "latency",
              "errors",
              "latency_and_errors"
            ],
            "description": "Which signal regressed (absent from servers before error-rate detection, meaning latency): latency (p95 at least 1.2x baseline across at least 100 slower requests), errors (the share of HTTP 5xx responses rose at least 5 percentage points and 2x, with at least 10 failed and 50 total requests on each side), or both."
          },
          "p95_ms": {
            "type": "integer",
            "minimum": 0
          },
          "p95_base_ms": {
            "type": "integer",
            "minimum": 0
          },
          "affected_count": {
            "type": "integer",
            "minimum": 0,
            "description": "Requests slower than the latency threshold; for an errors-only observation, the failed requests."
          },
          "regression_factor": {
            "type": "string",
            "description": "Decimal string with up to 2 places, NUMERIC(5,2). Latency inflation; 1.00 for an errors-only observation whose p95 did not rise."
          },
          "error_rate_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "Share of HTTP 5xx responses on the regressed deployment's route."
          },
          "error_rate_base_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "Share of HTTP 5xx responses on the previous deployment's route."
          },
          "error_count": {
            "type": "integer",
            "minimum": 0,
            "description": "HTTP 5xx responses on the regressed deployment's route in the detection window."
          },
          "first_detected_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_detected_at": {
            "type": "string",
            "format": "date-time"
          },
          "state": {
            "type": "string",
            "enum": [
              "active",
              "acknowledged",
              "dismissed",
              "resolved"
            ]
          },
          "acknowledged_at": {
            "type": "string",
            "format": "date-time"
          },
          "dismissed_until": {
            "type": "string",
            "format": "date-time"
          },
          "resolved_at": {
            "type": "string",
            "format": "date-time"
          },
          "suspected_dependency": {
            "$ref": "#/components/schemas/DebugSuspectedDependency"
          }
        }
      },
      "DebugSuspectedDependency": {
        "type": "object",
        "description": "The classified dependency most likely behind this route regression: for a latency regression the one whose p95 regressed most between the previous and the regressed deployment, else one that started failing more often; an errors-only regression checks failing dependencies first. Bounded and redacted; also sent in debug.regression.* webhooks.",
        "required": [
          "type",
          "name",
          "p95_base_ms",
          "p95_ms",
          "regression_factor"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "managed_binding",
              "outbound_integration",
              "guest_transport",
              "platform_internal",
              "app_dependency"
            ]
          },
          "kind": {
            "type": "string",
            "maxLength": 64
          },
          "name": {
            "type": "string",
            "maxLength": 96
          },
          "p95_base_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "p95_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "regression_factor": {
            "type": "number",
            "minimum": 0
          },
          "reason": {
            "type": "string",
            "enum": [
              "latency",
              "failures"
            ],
            "description": "latency when the dependency's p95 regressed; failures when its error rate rose. Absent on suspects recorded before failure attribution, which are latency suspects."
          },
          "baseline_error_rate_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "error_rate_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "error_type": {
            "type": "string",
            "maxLength": 96
          },
          "query": {
            "type": "string",
            "maxLength": 256,
            "description": "Normalized pattern of the database query that regressed within the dependency, when one did."
          }
        }
      },
      "DebugRegressionReview": {
        "type": "object",
        "description": "Exact workflow-only observation. Opaque version invalidates on every update; state is stored triage metadata, not health or effective inbox visibility.",
        "required": [
          "app_id",
          "deployment_id",
          "route",
          "version",
          "state",
          "first_detected_at",
          "last_detected_at"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "route": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "version": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "active",
              "acknowledged",
              "dismissed",
              "resolved"
            ]
          },
          "first_detected_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_detected_at": {
            "type": "string",
            "format": "date-time"
          },
          "acknowledged_at": {
            "type": "string",
            "format": "date-time"
          },
          "dismissed_until": {
            "type": "string",
            "format": "date-time"
          },
          "resolved_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DebugRegressionActionRequest": {
        "type": "object",
        "description": "Legacy debugger-only workflow action for one deployment/route observation.",
        "required": [
          "deployment_id",
          "route",
          "action"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "route": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "action": {
            "type": "string",
            "enum": [
              "acknowledge",
              "dismiss",
              "resolve",
              "reopen"
            ]
          },
          "dismissed_until": {
            "type": "string",
            "format": "date-time",
            "description": "Dismissal expiry; defaults to 24h and is capped at 30d."
          }
        }
      },
      "GuardedDebugRegressionActionRequest": {
        "type": "object",
        "description": "Mandatory immutable app/observation-version guarded triage action. Use the dedicated checked endpoint; older API nodes reject it.",
        "required": [
          "deployment_id",
          "route",
          "action",
          "expected_app_id",
          "expected_version",
          "reason"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "route": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "action": {
            "type": "string",
            "enum": [
              "acknowledge",
              "dismiss",
              "resolve",
              "reopen"
            ]
          },
          "dismissed_until": {
            "type": "string",
            "format": "date-time",
            "description": "Absolute checked-action dismissal expiry, frozen by MCP review and capped at 30 days."
          },
          "expected_app_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_version": {
            "type": "string",
            "format": "uuid"
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 280
          }
        }
      },
      "DebugRegressionActionResponse": {
        "type": "object",
        "description": "Updated regression plus the exact workflow receipt. Older servers may omit review.",
        "required": [
          "regression"
        ],
        "properties": {
          "regression": {
            "$ref": "#/components/schemas/DebugRegressionItem"
          },
          "review": {
            "$ref": "#/components/schemas/DebugRegressionReview"
          }
        }
      },
      "DebugCompareRequest": {
        "type": "object",
        "description": "POST body for /v1/apps/{slug}/debug/compare.",
        "required": [
          "source",
          "mirror"
        ],
        "properties": {
          "source": {
            "type": "string",
            "format": "uuid",
            "description": "Source deployment id."
          },
          "mirror": {
            "type": "string",
            "format": "uuid",
            "description": "Mirror deployment id."
          },
          "route": {
            "type": [
              "string",
              "null"
            ],
            "description": "Optional exact-match route filter."
          },
          "since": {
            "type": [
              "string",
              "null"
            ],
            "description": "Lookback duration (e.g. '24h')."
          },
          "until": {
            "type": [
              "string",
              "null"
            ],
            "description": "Window end (RFC3339). Empty = now."
          }
        }
      },
      "DebugCompareResponse": {
        "type": "object",
        "description": "POST response from /v1/apps/{slug}/debug/compare.",
        "required": [
          "source",
          "mirror",
          "routes"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid",
            "description": "App identity; present on servers supporting comparison-window metadata."
          },
          "since": {
            "type": "string",
            "description": "Effective lookback after the current retention cutoff; native default is 1h."
          },
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "window_end": {
            "type": "string",
            "format": "date-time"
          },
          "retention_clamped": {
            "type": "boolean",
            "description": "Whether the requested start was moved to the current plan-retention cutoff."
          },
          "route_filter": {
            "type": "string",
            "description": "Applied exact route filter; omitted for all routes."
          },
          "source": {
            "type": "string",
            "format": "uuid"
          },
          "mirror": {
            "type": "string",
            "format": "uuid"
          },
          "routes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DebugCompareRouteStats"
            }
          }
        }
      },
      "DebugCompareRouteStats": {
        "type": "object",
        "description": "Per-route latency stats for one side of the compare.",
        "required": [
          "route"
        ],
        "properties": {
          "route": {
            "type": "string"
          },
          "source_p50_ms": {
            "type": [
              "integer",
              "null"
            ]
          },
          "source_p95_ms": {
            "type": [
              "integer",
              "null"
            ]
          },
          "source_p99_ms": {
            "type": [
              "integer",
              "null"
            ]
          },
          "source_count": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "mirror_p50_ms": {
            "type": [
              "integer",
              "null"
            ]
          },
          "mirror_p95_ms": {
            "type": [
              "integer",
              "null"
            ]
          },
          "mirror_p99_ms": {
            "type": [
              "integer",
              "null"
            ]
          },
          "mirror_count": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          }
        }
      },
      "DebugReplayResponse": {
        "type": "object",
        "description": "POST response from /v1/apps/{slug}/debug/requests/{req_id}/replay.",
        "required": [
          "status"
        ],
        "properties": {
          "mirror_invocation_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Durable invocation ID for polling replay status and comparison results."
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "completed",
              "failed"
            ]
          },
          "source_deployment_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Deployment that served the retained request."
          },
          "mirror_deployment_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Enabled mirror target selected for this replay."
          }
        }
      },
      "DebugReplayRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Optional target selection for a metadata-only debugger replay. Empty body preserves the default mirror rule selected for the retained request's serving deployment.",
        "properties": {
          "mirror_deployment_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Enabled mirror target deployment for the retained request's serving deployment."
          }
        }
      },
      "DebugReplayComparison": {
        "type": "object",
        "description": "Safe metadata-only comparison written to a completed debugger replay invocation.",
        "properties": {
          "source_deployment_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "mirror_deployment_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "source_status_code": {
            "type": "integer"
          },
          "mirror_status_code": {
            "type": "integer"
          },
          "source_latency_ms": {
            "type": "integer"
          },
          "mirror_latency_ms": {
            "type": "integer"
          },
          "status_diff": {
            "type": "boolean"
          },
          "body_diff": {
            "type": "boolean"
          },
          "crashed": {
            "type": "boolean"
          },
          "comparison_incomplete": {
            "type": "boolean",
            "description": "True when neither source status nor source body hash was supplied, or the mirror produced no response."
          }
        }
      },
      "ExclusiveOperationPolicy": {
        "type": "object",
        "additionalProperties": false,
        "description": "Account-owned policy for managed exclusive operations. Apps and selected Jobs share the account policy namespace; Jobs require account scope and cannot use an app project environment.",
        "required": [
          "scope",
          "contention",
          "lease_seconds",
          "max_attempt_seconds"
        ],
        "anyOf": [
          {
            "required": [
              "member_app_ids"
            ]
          },
          {
            "required": [
              "member_job_ids"
            ]
          }
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "scope": {
            "type": "string",
            "enum": [
              "account",
              "platform_tenant"
            ]
          },
          "environment_id": {
            "type": "string",
            "format": "uuid"
          },
          "member_app_ids": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "member_job_ids": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "contention": {
            "type": "string",
            "enum": [
              "queue",
              "reject",
              "join_existing"
            ]
          },
          "lease_seconds": {
            "type": "integer",
            "minimum": 5,
            "maximum": 300
          },
          "max_attempt_seconds": {
            "type": "integer",
            "minimum": 5,
            "maximum": 86400
          },
          "max_attempts": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "retry_after_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3600
          }
        }
      },
      "ExclusiveWorkPolicyRecord": {
        "type": "object",
        "description": "Persisted policy revision and lifecycle metadata.",
        "required": [
          "id",
          "revision",
          "policy",
          "retired",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "policy": {
            "$ref": "#/components/schemas/ExclusiveOperationPolicy"
          },
          "retired": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ExclusiveWorkPolicyList": {
        "type": "object",
        "description": "Account-owned exclusive-operation policies.",
        "required": [
          "policies"
        ],
        "properties": {
          "policies": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExclusiveWorkPolicyRecord"
            }
          }
        }
      },
      "ExclusiveOperationRequest": {
        "type": "object",
        "description": "Work request admitted under a named exclusive-operation policy.",
        "additionalProperties": false,
        "required": [
          "policy",
          "key",
          "invocation"
        ],
        "properties": {
          "policy": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "key": {
            "description": "JSON scalar used only as a business coordination key; account and tenant scope come from authenticated platform context.",
            "oneOf": [
              {
                "type": "string",
                "maxLength": 128
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              }
            ]
          },
          "equivalence_key": {
            "type": "string",
            "maxLength": 128,
            "description": "Optional identity for joining accepted app invocations only when their invocation intents are equivalent."
          },
          "invocation": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "payload": {
                "type": "object",
                "additionalProperties": true
              },
              "headers": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "method": {
                "type": "string",
                "default": "POST"
              },
              "path": {
                "type": "string",
                "default": "/"
              }
            }
          }
        }
      },
      "ExclusiveJobOperationRequest": {
        "type": "object",
        "description": "Job run intent admitted under a named exclusive-operation policy. The account and Job identity are derived from the authenticated route.",
        "additionalProperties": false,
        "required": [
          "policy",
          "key",
          "run"
        ],
        "properties": {
          "policy": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "key": {
            "description": "Business identifier for this Job run lane; account authorization scope is derived from the authenticated route.",
            "oneOf": [
              {
                "type": "string",
                "maxLength": 128
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              }
            ]
          },
          "equivalence_key": {
            "type": "string",
            "maxLength": 128,
            "description": "Optional identity for joining accepted Job runs only when their run intents are equivalent."
          },
          "run": {
            "$ref": "#/components/schemas/CreateJobRunRequest"
          }
        }
      },
      "ExclusiveAppTaskOperationRequest": {
        "type": "object",
        "description": "Deployment-attached app task intent admitted under a named exclusive-operation policy.",
        "additionalProperties": false,
        "required": [
          "policy",
          "key",
          "task"
        ],
        "properties": {
          "policy": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "key": {
            "description": "Business identifier for this deployment-attached task lane; account and customer authorization scope comes from trusted platform context.",
            "oneOf": [
              {
                "type": "string",
                "maxLength": 128
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              }
            ]
          },
          "equivalence_key": {
            "type": "string",
            "maxLength": 128,
            "description": "Optional identity for joining accepted app tasks only when their task intents are equivalent."
          },
          "task": {
            "$ref": "#/components/schemas/CreateAppTaskRequest"
          }
        }
      },
      "ExclusiveTriggerBindingRequest": {
        "type": "object",
        "description": "Configuration that routes one trusted trigger through an exclusive-operation policy.",
        "additionalProperties": false,
        "required": [
          "policy",
          "key"
        ],
        "properties": {
          "policy": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "key": {
            "description": "Business coordination key; it never sets account or customer security scope.",
            "oneOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              }
            ]
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid",
            "description": "Account-owner configured trusted tenant identity for tenant-scoped triggers."
          },
          "equivalence_key": {
            "type": "string",
            "maxLength": 128,
            "description": "Required by join_existing policies; used to distinguish equivalent requests."
          }
        }
      },
      "ExclusiveTriggerBindingRecord": {
        "type": "object",
        "description": "Persisted binding between an account-owned trigger or recurring Job schedule and its exclusive-operation policy. Exactly one of app_id or job_id is present.",
        "required": [
          "source",
          "trigger_id",
          "policy",
          "key",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "source": {
            "type": "string",
            "enum": [
              "cron",
              "inbound_webhook",
              "broker",
              "job_schedule"
            ]
          },
          "trigger_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid",
            "description": "Present for app-owned triggers."
          },
          "job_id": {
            "type": "string",
            "format": "uuid",
            "description": "Present for a recurring Job schedule."
          },
          "policy": {
            "type": "string"
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "key": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              }
            ]
          },
          "equivalence_key": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ExclusiveOperationAccepted": {
        "type": "object",
        "description": "Receipt returned when an operation is durably accepted or joined.",
        "required": [
          "id",
          "joined",
          "status_url"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "joined": {
            "type": "boolean",
            "description": "True only when an equivalent active operation was linked under join_existing."
          },
          "status_url": {
            "type": "string",
            "description": "Scoped status endpoint for the submitting credential."
          }
        }
      },
      "ExclusiveOperationRecord": {
        "type": "object",
        "description": "Public receipt. Accepted request contents, claim tokens, and renewal credentials are never returned.",
        "required": [
          "id",
          "sequence",
          "state",
          "policy_revision",
          "generation",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "job_id": {
            "type": "string",
            "format": "uuid"
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "sequence": {
            "type": "integer",
            "format": "int64"
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "running",
              "completed",
              "failed",
              "cancelled"
            ]
          },
          "policy_revision": {
            "type": "integer",
            "format": "int64"
          },
          "generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Monotonically increasing fencing generation for this coordination key."
          },
          "lease_expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "attempt_deadline": {
            "type": "string",
            "format": "date-time"
          },
          "result": {
            "description": "Platform-committed invocation result; arbitrary JSON value."
          },
          "effects": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/OperationEffectRecord"
            }
          },
          "last_error": {
            "type": "string",
            "maxLength": 1024
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ManagedOperationResult": {
        "type": "object",
        "additionalProperties": false,
        "description": "Opt-in managed HTTP operation handler response; encode as JSON and return from the handler after requiring X-Gregale-Operation-Result-Version header value 1. The entire response is bounded to 1 MiB. Ordinary invocation responses are unchanged. Only supported on managed request operations, including Commit operations.",
        "required": [
          "gregale_operation_result",
          "result",
          "effects"
        ],
        "properties": {
          "gregale_operation_result": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "result": {
            "description": "Business result persisted atomically with effect enqueue; any JSON value, including null."
          },
          "effects": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/ManagedOperationEffect"
            }
          }
        }
      },
      "ManagedOperationEffect": {
        "description": "Named business webhook delivery proposed by a managed HTTP operation handler.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "webhook_id",
          "type",
          "payload"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$",
            "description": "Unique within this operation completion."
          },
          "webhook_id": {
            "type": "string",
            "format": "uuid",
            "description": "Explicit operation.effect subscriber owned by the authenticated operation scope."
          },
          "type": {
            "type": "string",
            "maxLength": 256,
            "pattern": "^[a-z][a-z0-9_.-]*$",
            "description": "Business event type carried inside the operation.effect payload."
          },
          "payload": {
            "description": "JSON business data bounded to 64 KiB."
          }
        }
      },
      "OperationEffectRecord": {
        "description": "Immutable effect identity and current delivery status, or platform-captured intent for a rehearsal. Captured effects have no outbound delivery.",
        "type": "object",
        "required": [
          "id",
          "name",
          "generation",
          "status",
          "attempt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "generation": {
            "type": "integer",
            "format": "int64"
          },
          "webhook_id": {
            "type": "string",
            "format": "uuid"
          },
          "delivery_id": {
            "type": "string",
            "format": "uuid",
            "description": "Stable across webhook retries; equals the effect ID."
          },
          "rehearsal_run_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$",
            "description": "Present only for platform-captured rehearsal effects; no outbound delivery was queued."
          },
          "type": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "recorded",
              "captured",
              "pending",
              "in_flight",
              "succeeded",
              "failed",
              "dead",
              "unavailable"
            ],
            "description": "recorded is an opaque effect with no adapter; captured is retained rehearsal intent with no outbound delivery; unavailable indicates deleted or pruned delivery history. Completion of the operation does not imply delivery succeeded."
          },
          "attempt": {
            "type": "integer",
            "minimum": 0
          },
          "last_error": {
            "type": "string"
          }
        }
      },
      "OperationEffectPayload": {
        "type": "object",
        "description": "Data of the operation.effect webhook. Identity comes from the platform-owned operation.",
        "required": [
          "operation_id",
          "app_id",
          "generation",
          "name",
          "type",
          "data"
        ],
        "properties": {
          "operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "generation": {
            "type": "integer",
            "format": "int64"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "data": {
            "description": "Handler-supplied business event data."
          }
        }
      },
      "IssueFrame": {
        "description": "A sanitized stack frame. Grouping excludes line numbers; in_app selects application evidence.",
        "type": "object",
        "required": [
          "file",
          "function",
          "in_app"
        ],
        "properties": {
          "file": {
            "type": "string"
          },
          "function": {
            "type": "string"
          },
          "line": {
            "type": "integer"
          },
          "column": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647,
            "description": "One-based generated or original column; omitted when unknown. Excluded from grouping identity."
          },
          "in_app": {
            "type": "boolean"
          }
        }
      },
      "IssueCause": {
        "description": "One sanitized linear cause, ordered immediate to deepest; bounds are UTF-8 bytes.",
        "type": "object",
        "required": [
          "exception_type",
          "message"
        ],
        "properties": {
          "exception_type": {
            "type": "string",
            "maxLength": 256
          },
          "message": {
            "type": "string",
            "maxLength": 2048
          },
          "error_code": {
            "type": "string",
            "maxLength": 256
          },
          "frames": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/IssueFrame"
            }
          },
          "frame_order": {
            "type": "string",
            "enum": [
              "newest-first",
              "oldest-first"
            ]
          }
        }
      },
      "IssueSourceMapArtifact": {
        "description": "One generated bundle and its bounded source-map metadata, without embedded source contents.",
        "type": "object",
        "required": [
          "generatedFile",
          "sha256",
          "payload"
        ],
        "properties": {
          "generatedFile": {
            "type": "string",
            "maxLength": 512,
            "description": "Portable relative bundle path from the Node build manifest."
          },
          "sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Producer-supplied bundle digest; the server does not retrieve bundle bytes to independently verify it."
          },
          "payload": {
            "type": "string",
            "maxLength": 524288,
            "description": "Flat Source Map v3 JSON; byte and decoded limits are enforced before persistence."
          }
        }
      },
      "IssueSourceMapManifest": {
        "description": "Portable source-map manifest with exact generated-bundle digests and original source locations.",
        "type": "object",
        "required": [
          "version",
          "artifacts"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "artifacts": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/IssueSourceMapArtifact"
            }
          }
        }
      },
      "PublishIssueSourceMapsRequest": {
        "description": "Deployment source-map publication request containing the deployed directory and portable manifest.",
        "type": "object",
        "required": [
          "directory",
          "manifest"
        ],
        "properties": {
          "directory": {
            "type": "string",
            "maxLength": 512,
            "description": "Absolute deployed directory corresponding to the manifest scan root."
          },
          "manifest": {
            "$ref": "#/components/schemas/IssueSourceMapManifest"
          }
        }
      },
      "IssueSourceMapsMetadata": {
        "description": "Read-only publication status, manifest digest and retained map count for one deployment.",
        "type": "object",
        "required": [
          "deployment_id",
          "manifest_sha256",
          "map_count",
          "ready",
          "created_at"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "manifest_sha256": {
            "type": "string"
          },
          "map_count": {
            "type": "integer"
          },
          "ready": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "retired_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "IssueSymbolicationResult": {
        "description": "Symbolication outcome and mapped frames for one reported exception in its deployment.",
        "type": "object",
        "readOnly": true,
        "required": [
          "manifest_sha256",
          "mapped_frames",
          "unmapped_frames"
        ],
        "properties": {
          "manifest_sha256": {
            "type": "string"
          },
          "mapped_frames": {
            "type": "integer"
          },
          "unmapped_frames": {
            "type": "integer"
          }
        }
      },
      "IssueBreadcrumb": {
        "description": "Bounded sanitized event context recorded before an issue occurrence.",
        "type": "object",
        "required": [
          "occurred_at",
          "category",
          "level",
          "message"
        ],
        "properties": {
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "category": {
            "type": "string",
            "enum": [
              "http",
              "db",
              "cache",
              "workflow",
              "log",
              "custom"
            ]
          },
          "level": {
            "type": "string",
            "enum": [
              "debug",
              "info",
              "warning",
              "error"
            ]
          },
          "message": {
            "type": "string",
            "description": "Sanitized and bounded to 256 UTF-8 bytes."
          }
        }
      },
      "IssueEvent": {
        "description": "Structured exception evidence; credential-derived account and deployment identity cannot be overridden.",
        "type": "object",
        "required": [
          "event_id",
          "occurred_at",
          "exception_type",
          "message"
        ],
        "properties": {
          "breadcrumbs": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/IssueBreadcrumb"
            }
          },
          "breadcrumbs_dropped": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "tags": {
            "type": "object",
            "maxProperties": 16,
            "additionalProperties": {
              "type": "string"
            },
            "description": "Sanitized operational dimensions; unknown keys are discarded. Allowed keys are component, operation, feature_flag, feature_variant, dependency, region, job_type, workflow, state, error_class, release_channel, runtime."
          },
          "symbolication_strategy": {
            "type": "string",
            "enum": [
              "deployment-source-maps-v1"
            ],
            "description": "Opt-in server mapping against this credential's deployment artifacts; requires failure-site-v1 or cause-chain-v1."
          },
          "symbolication": {
            "$ref": "#/components/schemas/IssueSymbolicationResult"
          },
          "causes": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/IssueCause"
            }
          },
          "causes_incomplete": {
            "type": "boolean",
            "description": "Incomplete or ambiguous chain; version 3 uses outer evidence instead of a partial cause."
          },
          "event_id": {
            "type": "string",
            "format": "uuid"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "exception_type": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "stack_trace": {
            "type": "string"
          },
          "frames": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IssueFrame"
            }
          },
          "fingerprint_override": {
            "type": "string"
          },
          "grouping_strategy": {
            "type": "string",
            "enum": [
              "legacy",
              "failure-site-v1",
              "cause-chain-v1"
            ],
            "description": "Defaults to unchanged version 1. failure-site-v1 selects version 2 and creates separate groups without migrating existing history. cause-chain-v1 selects version 3 using the deepest complete reported cause."
          },
          "frame_order": {
            "type": "string",
            "enum": [
              "newest-first",
              "oldest-first"
            ],
            "description": "For failure-site-v1, structured frames default to newest-first. Parsed Node/Python stacks infer order when omitted."
          },
          "error_code": {
            "type": "string",
            "maxLength": 256,
            "description": "Stable application error code, bounded to 256 UTF-8 bytes and sanitized. In failure-site-v1 it replaces the normalized message discriminator; ignored by legacy grouping."
          },
          "trace_id": {
            "type": "string"
          },
          "span_id": {
            "type": "string"
          },
          "request_id": {
            "type": "string",
            "description": "Bounded opaque gateway request ID, sanitized before persistence."
          },
          "invocation_id": {
            "type": "string",
            "format": "uuid"
          },
          "route": {
            "type": "string"
          },
          "http_status": {
            "type": "integer"
          },
          "source_kind": {
            "type": "string"
          },
          "redactions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Issue": {
        "description": "Durable failure group across releases in one app and environment.",
        "type": "object",
        "required": [
          "id",
          "app_id",
          "environment",
          "fingerprint",
          "grouping_version",
          "title",
          "state",
          "first_seen_at",
          "last_seen_at",
          "event_count",
          "regression_count"
        ],
        "properties": {
          "split_source_issue_id": {
            "type": "string",
            "format": "uuid",
            "readOnly": true,
            "description": "Original fingerprint source for a branch created by an occurrence split rule."
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "environment": {
            "type": "string"
          },
          "fingerprint": {
            "type": "string"
          },
          "grouping_version": {
            "type": "integer"
          },
          "title": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "open",
              "resolved",
              "ignored"
            ]
          },
          "assignee_account_id": {
            "type": "string",
            "format": "uuid"
          },
          "first_seen_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_seen_at": {
            "type": "string",
            "format": "date-time"
          },
          "event_count": {
            "type": "integer"
          },
          "regression_count": {
            "type": "integer"
          },
          "impact_24h": {
            "$ref": "#/components/schemas/IssueImpactSummary"
          },
          "resolved_at": {
            "type": "string",
            "format": "date-time"
          },
          "fixed_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "fixed_deployment_created_at": {
            "type": "string",
            "format": "date-time"
          },
          "ignored_until": {
            "type": "string",
            "format": "date-time"
          },
          "assignee_team_id": {
            "type": "string",
            "format": "uuid",
            "description": "Current team assignment within this app, mutually exclusive with the account assignee."
          }
        }
      },
      "IssueImpactSummary": {
        "description": "Observed retained occurrences, verified distinct customers, and unattributed events from the previous 24 hours.",
        "type": "object",
        "required": [
          "identified_customers",
          "observed_events",
          "unattributed_events"
        ],
        "properties": {
          "identified_customers": {
            "type": "integer"
          },
          "observed_events": {
            "type": "integer"
          },
          "unattributed_events": {
            "type": "integer"
          },
          "unknown_http_batches": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Legacy HTTP records with unknown folded weights; observed event counts are lower bounds."
          }
        }
      },
      "IssueGroupingFrame": {
        "description": "Canonical file and function used in identity, with a zero-based index into selected cause frames when cause_index is present, otherwise occurrence frames. Line numbers are excluded.",
        "type": "object",
        "required": [
          "frame_index",
          "file",
          "function"
        ],
        "properties": {
          "frame_index": {
            "type": "integer",
            "minimum": 0
          },
          "file": {
            "type": "string"
          },
          "function": {
            "type": "string"
          }
        }
      },
      "IssueGroupingExplanation": {
        "description": "Read-only evidence reconstructed from a retained sanitized occurrence using the saved group version. Present only when its identity reproduces the saved fingerprint. Unsupported versions or mismatches omit the explanation.",
        "type": "object",
        "required": [
          "grouping_version",
          "strategy",
          "basis",
          "source_kind",
          "exception_type",
          "discriminator_kind"
        ],
        "properties": {
          "cause_index": {
            "type": "integer",
            "minimum": 0,
            "maximum": 7,
            "description": "Zero-based selected cause index; absent when grouping uses the outer exception."
          },
          "grouping_version": {
            "type": "integer"
          },
          "strategy": {
            "type": "string",
            "enum": [
              "legacy",
              "failure-site-v1",
              "cause-chain-v1"
            ]
          },
          "basis": {
            "type": "string",
            "enum": [
              "override",
              "application-frames",
              "failure-site",
              "fallback"
            ]
          },
          "source_kind": {
            "type": "string"
          },
          "exception_type": {
            "type": "string"
          },
          "frames": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IssueGroupingFrame"
            }
          },
          "route": {
            "type": "string"
          },
          "http_status": {
            "type": "integer"
          },
          "discriminator_kind": {
            "type": "string",
            "enum": [
              "none",
              "override",
              "error-code",
              "message"
            ]
          },
          "discriminator_value": {
            "type": "string",
            "description": "Selected sanitized override, stable error code, or normalized message. May be empty for an empty message."
          }
        }
      },
      "IssueOccurrence": {
        "description": "Retained sanitized occurrence with verified platform attribution and optional debugger correlation.",
        "allOf": [
          {
            "$ref": "#/components/schemas/IssueEvent"
          },
          {
            "type": "object",
            "required": [
              "deployment_id",
              "received_at",
              "attribution"
            ],
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "original_issue_id": {
                "type": "string",
                "format": "uuid",
                "readOnly": true,
                "description": "Original fingerprint provenance retained through occurrence-level splits and manual merges."
              },
              "occurrence_count": {
                "type": "integer",
                "format": "int64",
                "minimum": 1,
                "readOnly": true,
                "description": "Number of failures represented by this record; customer identity applies to the sampled request only."
              },
              "occurrence_count_exact": {
                "type": "boolean",
                "readOnly": true,
                "description": "False when an older writer did not preserve the folded HTTP weight."
              },
              "deployment_id": {
                "type": "string",
                "format": "uuid"
              },
              "received_at": {
                "type": "string",
                "format": "date-time"
              },
              "verified_consumer_id": {
                "type": "string",
                "format": "uuid"
              },
              "verified_platform_tenant_id": {
                "type": "string",
                "format": "uuid"
              },
              "debug_request_id": {
                "type": "string",
                "format": "uuid"
              },
              "attribution": {
                "type": "string"
              },
              "grouping_explanation": {
                "$ref": "#/components/schemas/IssueGroupingExplanation"
              }
            }
          }
        ]
      },
      "IssueRelease": {
        "description": "Immutable deployment metadata and aggregate observations for one issue.",
        "type": "object",
        "required": [
          "deployment_id",
          "event_count",
          "first_seen_at",
          "last_seen_at"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "commit_sha": {
            "type": "string"
          },
          "image_digest": {
            "type": "string"
          },
          "event_count": {
            "type": "integer"
          },
          "first_seen_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_seen_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "IssueActivity": {
        "description": "An audited issue lifecycle, ownership, or manual regrouping transition.",
        "type": "object",
        "required": [
          "id",
          "action",
          "created_at",
          "details"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "action": {
            "type": "string"
          },
          "original_issue_id": {
            "type": "string",
            "format": "uuid",
            "readOnly": true
          },
          "actor_account_id": {
            "type": "string",
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "details": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      },
      "IssueImpact": {
        "description": "Observed retained customer impact within an explicit time window; unknown identity remains unattributed.",
        "type": "object",
        "required": [
          "window_start",
          "window_end",
          "identified_customers",
          "observed_events",
          "unattributed_events",
          "coverage"
        ],
        "properties": {
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "window_end": {
            "type": "string",
            "format": "date-time"
          },
          "identified_customers": {
            "type": "integer"
          },
          "observed_events": {
            "type": "integer"
          },
          "unattributed_events": {
            "type": "integer"
          },
          "unknown_http_batches": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Legacy HTTP batches in this impact window have unknown folded weights; observed events are a lower bound."
          },
          "coverage": {
            "type": "string"
          }
        }
      },
      "IssueLifecycleAlertPolicy": {
        "description": "Native new-issue/regression environment filter and shared per-group cooldown.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "revision",
          "environments",
          "cooldown_seconds"
        ],
        "properties": {
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "environments": {
            "type": "array",
            "maxItems": 20,
            "uniqueItems": true,
            "description": "Environments permitted by the saved policy; an empty array means all.",
            "items": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9-]{0,62}$",
              "maxLength": 63
            }
          },
          "cooldown_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 604800
          }
        }
      },
      "UpdateIssueLifecycleAlertPolicyRequest": {
        "description": "Revision-guarded replacement lifecycle alert policy.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_revision",
          "environments",
          "cooldown_seconds"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "environments": {
            "type": "array",
            "maxItems": 20,
            "uniqueItems": true,
            "description": "Replacement allowlist of exact names; an empty array removes the environment filter.",
            "items": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9-]{0,62}$",
              "maxLength": 63
            }
          },
          "cooldown_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 604800
          }
        }
      },
      "PreviewIssueLifecycleAlertRequest": {
        "description": "Draft policy and hypothetical lifecycle event for an existing issue.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "issue_id",
          "event",
          "environments",
          "cooldown_seconds"
        ],
        "properties": {
          "issue_id": {
            "type": "string",
            "format": "uuid"
          },
          "event": {
            "type": "string",
            "enum": [
              "created",
              "regressed"
            ]
          },
          "environments": {
            "type": "array",
            "maxItems": 20,
            "uniqueItems": true,
            "description": "Draft environment allowlist used only for this preview; an empty array matches all.",
            "items": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9-]{0,62}$",
              "maxLength": 63
            }
          },
          "cooldown_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 604800
          }
        }
      },
      "IssueLifecycleAlertPreview": {
        "description": "Policy-only eligibility; actual Slack delivery has additional subscription, routing and sender gates.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "issue_id",
          "event",
          "environment",
          "policy_revision",
          "allowed",
          "reason"
        ],
        "properties": {
          "issue_id": {
            "type": "string",
            "format": "uuid"
          },
          "event": {
            "type": "string",
            "enum": [
              "created",
              "regressed"
            ]
          },
          "environment": {
            "type": "string"
          },
          "policy_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "allowed": {
            "type": "boolean"
          },
          "reason": {
            "type": "string",
            "enum": [
              "eligible",
              "environment_excluded",
              "cooldown"
            ]
          },
          "next_eligible_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "IssueCompoundAlertRule": {
        "description": "Named AND rule requiring event frequency and verified customer impact in one shared window.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "key",
          "enabled",
          "environment",
          "minimum_events",
          "minimum_customers",
          "window_seconds",
          "cooldown_seconds"
        ],
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,47}$",
            "maxLength": 48
          },
          "enabled": {
            "type": "boolean"
          },
          "environment": {
            "type": "string",
            "maxLength": 63,
            "description": "Compound-rule environment selector; leave empty to evaluate every issue environment."
          },
          "minimum_events": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 100000
          },
          "minimum_customers": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 10000
          },
          "window_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 60,
            "maximum": 86400
          },
          "cooldown_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 60,
            "maximum": 604800
          }
        }
      },
      "IssueCompoundAlertPolicy": {
        "description": "Current revision and complete ordered set of application compound-alert rules.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "revision",
          "rules"
        ],
        "properties": {
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "rules": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/IssueCompoundAlertRule"
            }
          }
        }
      },
      "UpdateIssueCompoundAlertPolicyRequest": {
        "description": "Replacement compound-alert rules guarded by the expected policy revision.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_revision",
          "rules"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "rules": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/IssueCompoundAlertRule"
            }
          }
        }
      },
      "PreviewIssueCompoundAlertRequest": {
        "description": "An unsaved compound rule and an existing issue to evaluate without notification side effects.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "issue_id",
          "rule"
        ],
        "properties": {
          "issue_id": {
            "type": "string",
            "format": "uuid"
          },
          "rule": {
            "$ref": "#/components/schemas/IssueCompoundAlertRule"
          }
        }
      },
      "IssueCompoundAlertPreview": {
        "description": "Predicate results and retained shared-window counts from a read-only compound-rule evaluation.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "issue_id",
          "rule_key",
          "environment",
          "policy_revision",
          "window_start",
          "window_end",
          "observed_events",
          "identified_customers",
          "enabled",
          "environment_matches",
          "events_matched",
          "customers_matched",
          "suppressed",
          "cooldown_ready",
          "allowed",
          "reason"
        ],
        "properties": {
          "issue_id": {
            "type": "string",
            "format": "uuid"
          },
          "rule_key": {
            "type": "string"
          },
          "environment": {
            "type": "string"
          },
          "policy_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "window_end": {
            "type": "string",
            "format": "date-time"
          },
          "observed_events": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "identified_customers": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "enabled": {
            "type": "boolean"
          },
          "environment_matches": {
            "type": "boolean"
          },
          "events_matched": {
            "type": "boolean"
          },
          "customers_matched": {
            "type": "boolean"
          },
          "suppressed": {
            "type": "boolean"
          },
          "cooldown_ready": {
            "type": "boolean"
          },
          "allowed": {
            "type": "boolean"
          },
          "reason": {
            "type": "string",
            "enum": [
              "disabled",
              "environment_excluded",
              "suppressed",
              "event_threshold",
              "customer_threshold",
              "cooldown",
              "eligible"
            ]
          },
          "next_eligible_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "IssueFrequencyAlertRule": {
        "description": "Named event-frequency threshold with a bounded observation window, cooldown and optional filters.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "key",
          "enabled",
          "environment",
          "minimum_events",
          "window_seconds",
          "cooldown_seconds"
        ],
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,47}$",
            "maxLength": 48
          },
          "enabled": {
            "type": "boolean"
          },
          "environment": {
            "type": "string",
            "maxLength": 63,
            "description": "Exact issue environment. Empty string matches all environments."
          },
          "minimum_events": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 100000
          },
          "window_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 60,
            "maximum": 86400
          },
          "cooldown_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 60,
            "maximum": 604800
          }
        }
      },
      "IssueFrequencyAlertPolicy": {
        "description": "Current revision and complete ordered set of application frequency-alert rules.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "revision",
          "rules"
        ],
        "properties": {
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "rules": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/IssueFrequencyAlertRule"
            }
          }
        }
      },
      "UpdateIssueFrequencyAlertPolicyRequest": {
        "description": "Replacement frequency-alert rules guarded by the expected policy revision.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_revision",
          "rules"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "rules": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/IssueFrequencyAlertRule"
            }
          }
        }
      },
      "IssueImpactAlertPolicy": {
        "description": "App-level customer-impact threshold measured using verified distinct customers in a rolling 24-hour window.",
        "type": "object",
        "required": [
          "enabled",
          "minimum_customers",
          "window_seconds"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "minimum_customers": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          },
          "window_seconds": {
            "type": "integer",
            "const": 86400
          }
        }
      },
      "UpdateIssueImpactAlertPolicyRequest": {
        "description": "Set the minimum verified distinct customer count; zero disables the policy.",
        "type": "object",
        "required": [
          "minimum_customers"
        ],
        "additionalProperties": false,
        "properties": {
          "minimum_customers": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          }
        }
      },
      "PutIssueTrackerLinkRequest": {
        "description": "Explicit provider ticket URL and optional title to attach to an issue group.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "url"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "maxLength": 512,
            "description": "Public GitHub issue or Linear issue HTTPS URL; maximum 512 UTF-8 bytes."
          },
          "title": {
            "type": "string",
            "maxLength": 256,
            "description": "Optional display title; maximum 256 UTF-8 bytes without control characters."
          }
        }
      },
      "CreateNativeIssueTicketRequest": {
        "type": "object",
        "description": "Explicit content and stable operation identity for native GitHub ticket creation or recovery.",
        "additionalProperties": false,
        "required": [
          "request_id",
          "repository",
          "title"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "repository": {
            "type": "string",
            "maxLength": 256
          },
          "title": {
            "type": "string",
            "maxLength": 256
          },
          "description": {
            "type": "string",
            "maxLength": 16384
          },
          "recovery_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 512
          },
          "original_app_slug": {
            "type": "string",
            "maxLength": 512,
            "description": "Original slug for recovering a legacy receipt after an app rename."
          }
        }
      },
      "NativeIssueTicketResult": {
        "type": "object",
        "description": "Durable GitHub ticket evidence and Gregale attachment state for a native creation operation.",
        "required": [
          "request_id",
          "state",
          "ticket_url"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "created",
              "linked"
            ]
          },
          "ticket_url": {
            "type": "string",
            "format": "uri"
          },
          "link_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "NativeLinearIssueTrackerStatus": {
        "type": "object",
        "description": "Credential-free Linear lifecycle preview pinned to the current issue group and owner connection.",
        "required": [
          "issue_id",
          "link_id",
          "connection_revision",
          "group_fingerprint",
          "workspace_id",
          "team_id",
          "viewer_id",
          "status"
        ],
        "properties": {
          "issue_id": {
            "type": "string",
            "format": "uuid",
            "description": "Current canonical Gregale issue identity."
          },
          "link_id": {
            "type": "string",
            "format": "uuid",
            "description": "Stored Linear reference identity."
          },
          "connection_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Verified connection revision used to fence later pushes."
          },
          "group_fingerprint": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Opaque scope fingerprint tracking canonical membership and grouping rules."
          },
          "workspace_id": {
            "type": "string",
            "format": "uuid",
            "description": "Verified Linear workspace identity."
          },
          "team_id": {
            "type": "string",
            "format": "uuid",
            "description": "Verified connected team matching the linked ticket."
          },
          "viewer_id": {
            "type": "string",
            "format": "uuid",
            "description": "Verified identity owning the stored API key."
          },
          "status": {
            "$ref": "#/components/schemas/IssueTrackerProviderStatus",
            "description": "Supported linked Linear status including ticket and team and workflow UUIDs."
          }
        }
      },
      "UpdateNativeLinearIssueTrackerStatusRequest": {
        "type": "object",
        "description": "Explicit push against an observed provider snapshot and connection/group scope.",
        "required": [
          "desired_state",
          "expected",
          "expected_connection_revision",
          "expected_group_fingerprint"
        ],
        "properties": {
          "desired_state": {
            "type": "string",
            "enum": [
              "open",
              "resolved"
            ],
            "description": "Lifecycle matching the current Gregale issue state."
          },
          "expected": {
            "$ref": "#/components/schemas/IssueTrackerProviderStatus",
            "description": "Exact Linear status from the native preview."
          },
          "expected_connection_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Connection revision from the native preview."
          },
          "expected_group_fingerprint": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Group fingerprint from the native preview."
          },
          "linear_state_id": {
            "type": "string",
            "format": "uuid",
            "description": "Explicit active same-team workflow state UUID required when the lifecycle changes."
          }
        }
      },
      "CreateNativeLinearIssueTicketRequest": {
        "type": "object",
        "description": "Explicit creation or UUID recovery through the app owner's connected Linear team.",
        "required": [
          "request_id",
          "team_id",
          "title"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid",
            "description": "Stable UUID v4 used as the Linear issue ID and reused across retries."
          },
          "team_id": {
            "type": "string",
            "format": "uuid",
            "description": "Verified team UUID matching the stored app connection."
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Explicit ticket title bounded to 256 UTF-8 bytes."
          },
          "description": {
            "type": "string",
            "maxLength": 16384,
            "description": "Optional description bounded to 16 KiB; no telemetry is copied automatically."
          },
          "recover": {
            "type": "boolean",
            "default": false,
            "description": "Explicitly recover an unconfirmed dispatch by its stable request UUID after the dispatch lease expires."
          },
          "recovery_url": {
            "type": "string",
            "maxLength": 512,
            "description": "Optional known Linear issue URL that also requests recovery and must match the UUID lookup."
          },
          "original_app_slug": {
            "type": "string",
            "maxLength": 512,
            "description": "Slug used when recovering a legacy Linear receipt created before the app was renamed."
          }
        }
      },
      "IssueTrackerLinearConnection": {
        "type": "object",
        "description": "Non-secret owner-scoped Linear connection metadata; disconnected records omit provider identity.",
        "required": [
          "connected",
          "revision"
        ],
        "properties": {
          "auth_method": {
            "type": "string",
            "description": "Stored credential kind (api_key or oauth)."
          },
          "oauth_status": {
            "type": "string",
            "description": "OAuth health (ready, refreshing, reconnect_required or revoking); absent for API keys."
          },
          "access_token_expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "OAuth access token expiry; never includes credentials."
          },
          "webhook_enabled": {
            "type": "boolean",
            "description": "True when a scoped signing secret is stored for Linear issue callbacks."
          },
          "callback_path": {
            "type": "string",
            "description": "Provider callback path to append to the Gregale API origin when callbacks are enabled."
          },
          "connected": {
            "type": "boolean",
            "description": "Whether a verified API key or OAuth grant is stored."
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Configuration revision used to fence concurrent changes."
          },
          "workspace_id": {
            "type": "string",
            "format": "uuid",
            "description": "Verified Linear organization identity."
          },
          "team_id": {
            "type": "string",
            "format": "uuid",
            "description": "Verified active Linear team identity."
          },
          "viewer_id": {
            "type": "string",
            "format": "uuid",
            "description": "Verified Linear user identity owning the credential."
          }
        }
      },
      "UpdateIssueTrackerLinearConnectionRequest": {
        "type": "object",
        "description": "Explicit connection or disconnection against a known revision.",
        "required": [
          "connected",
          "expected_revision"
        ],
        "properties": {
          "connected": {
            "type": "boolean",
            "description": "True connects a verified personal API key; false erases it."
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Revision from the latest connection metadata read."
          },
          "team_id": {
            "type": "string",
            "format": "uuid",
            "description": "Active team UUID required only when connecting."
          },
          "api_key": {
            "type": "string",
            "maxLength": 4096,
            "writeOnly": true,
            "description": "Personal API key required only when connecting; never returned or logged."
          },
          "webhook_secret": {
            "type": "string",
            "minLength": 32,
            "maxLength": 4096,
            "writeOnly": true,
            "description": "Optional Linear webhook signing secret stored with the connection. Omission on replacement disables callbacks. Never returned or logged."
          }
        }
      },
      "IssueTrackerAutoSync": {
        "type": "object",
        "description": "Opt-in tracker direction and latest durable worker outcome. Inbound resolutions require explicit fixing-deployment evidence.",
        "required": [
          "link_id",
          "enabled",
          "revision",
          "source_issue_id",
          "outcome"
        ],
        "properties": {
          "direction": {
            "type": "string",
            "enum": [
              "outbound",
              "inbound",
              "both"
            ],
            "description": "Outbound pushes Gregale lifecycle; inbound applies verified reopenings; both enables both behaviors."
          },
          "observed_state": {
            "type": "string",
            "enum": [
              "open",
              "resolved"
            ],
            "description": "Last provider lifecycle observed by the worker including changes held for review."
          },
          "link_id": {
            "type": "string",
            "format": "uuid"
          },
          "enabled": {
            "type": "boolean"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "source_issue_id": {
            "type": "string",
            "format": "uuid"
          },
          "source_state": {
            "type": "string",
            "enum": [
              "open",
              "resolved"
            ]
          },
          "provider_state": {
            "type": "string",
            "enum": [
              "open",
              "resolved"
            ]
          },
          "pending_state": {
            "type": "string",
            "enum": [
              "open",
              "resolved"
            ]
          },
          "outcome": {
            "type": "string",
            "enum": [
              "disabled",
              "matched",
              "pending",
              "applied",
              "error",
              "conflict",
              "blocked"
            ]
          },
          "reason": {
            "type": "string"
          },
          "last_checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "next_check_at": {
            "type": "string",
            "format": "date-time"
          },
          "linear_open_state_id": {
            "type": "string",
            "format": "uuid",
            "description": "Selected open workflow destination for Linear policies."
          },
          "linear_resolved_state_id": {
            "type": "string",
            "format": "uuid",
            "description": "Selected resolved workflow destination for Linear policies."
          }
        }
      },
      "UpdateIssueTrackerAutoSyncRequest": {
        "type": "object",
        "description": "Explicit direction delegation against a known policy revision and aligned native/source lifecycle snapshot. Inbound closures are held for fixing-deployment review.",
        "additionalProperties": false,
        "required": [
          "enabled",
          "expected_revision"
        ],
        "properties": {
          "direction": {
            "type": "string",
            "enum": [
              "outbound",
              "inbound",
              "both"
            ],
            "description": "Defaults to outbound when omitted. Inbound and both require a fresh source intent baseline."
          },
          "enabled": {
            "type": "boolean"
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "expected_status": {
            "$ref": "#/components/schemas/NativeIssueTrackerStatus"
          },
          "expected_issue_state": {
            "type": "string",
            "enum": [
              "open",
              "resolved"
            ]
          },
          "expected_linear_status": {
            "$ref": "#/components/schemas/NativeLinearIssueTrackerStatus"
          },
          "linear_open_state_id": {
            "type": "string",
            "format": "uuid",
            "description": "Active same-team open workflow required to enable Linear automatic sync."
          },
          "linear_resolved_state_id": {
            "type": "string",
            "format": "uuid",
            "description": "Active same-team completed workflow required to enable Linear automatic sync."
          }
        }
      },
      "IssueTrackerProviderStatus": {
        "description": "Observed lifecycle and identity of an external tracker issue.",
        "type": "object",
        "required": [
          "provider",
          "url",
          "id",
          "state"
        ],
        "properties": {
          "provider": {
            "type": "string",
            "enum": [
              "github",
              "linear"
            ]
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "id": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "open",
              "resolved"
            ]
          },
          "team_id": {
            "type": "string",
            "format": "uuid"
          },
          "state_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "NativeIssueTrackerStatus": {
        "description": "Verified native connection and observed status of a linked tracker issue.",
        "type": "object",
        "required": [
          "issue_id",
          "link_id",
          "installation_id",
          "repository",
          "repository_id",
          "status"
        ],
        "properties": {
          "issue_id": {
            "type": "string",
            "format": "uuid"
          },
          "link_id": {
            "type": "string",
            "format": "uuid"
          },
          "installation_id": {
            "type": "integer",
            "format": "int64"
          },
          "repository": {
            "type": "string"
          },
          "repository_id": {
            "type": "integer",
            "format": "int64"
          },
          "status": {
            "$ref": "#/components/schemas/IssueTrackerProviderStatus"
          }
        }
      },
      "UpdateNativeIssueTrackerStatusRequest": {
        "description": "Expected provider snapshot and current Gregale lifecycle to push through a native connection.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "desired_state",
          "expected"
        ],
        "properties": {
          "desired_state": {
            "type": "string",
            "enum": [
              "open",
              "resolved"
            ]
          },
          "expected": {
            "$ref": "#/components/schemas/IssueTrackerProviderStatus"
          }
        }
      },
      "IssueTrackerLink": {
        "description": "Stored external ticket reference with provider identity and editor metadata.",
        "type": "object",
        "required": [
          "id",
          "original_issue_id",
          "provider",
          "external_key",
          "url",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "original_issue_id": {
            "type": "string",
            "format": "uuid",
            "description": "Original identity owning this reference; retained through merge and split."
          },
          "provider": {
            "type": "string",
            "enum": [
              "github",
              "linear"
            ]
          },
          "external_key": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "title": {
            "type": "string"
          },
          "created_by_account_id": {
            "type": "string",
            "format": "uuid"
          },
          "updated_by_account_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "ListIssueTrackerLinksResponse": {
        "description": "Cursor-paginated tracker references attached to the selected issue group.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/IssueTrackerLink"
            }
          },
          "next_cursor": {
            "type": "string"
          }
        }
      },
      "IssueTeam": {
        "description": "Application-scoped team identity, display name, complete member roster and editor metadata.",
        "type": "object",
        "required": [
          "id",
          "key",
          "name",
          "member_account_ids",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "key": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,47}$"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "member_account_ids": {
            "type": "array",
            "maxItems": 50,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_by_account_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "PutIssueTeamRequest": {
        "description": "Replacement team display name and eligible account membership roster.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "member_account_ids"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Maximum 64 UTF-8 bytes without control characters."
          },
          "member_account_ids": {
            "type": "array",
            "minItems": 1,
            "maxItems": 50,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      },
      "ListIssueTeamsResponse": {
        "description": "Teams available for issue assignment and response routing within an application.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IssueTeam"
            }
          }
        }
      },
      "IssueSavedViewFilters": {
        "description": "Supported query filters retained by a shared application issue view.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "open",
              "resolved",
              "ignored"
            ],
            "description": "Omit to include every state."
          },
          "environment": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$",
            "description": "Omit to include every issue environment."
          },
          "assignee": {
            "type": "string",
            "description": "me, unassigned, or an eligible account UUID. Omit for all owners. me resolves for each authenticated viewer."
          },
          "sort": {
            "type": "string",
            "enum": [
              "recent",
              "impact"
            ],
            "default": "recent"
          },
          "min_customers": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "default": 0
          },
          "tag": {
            "type": "string",
            "maxLength": 193,
            "description": "Exact allowlisted operational key=value in retained occurrences over 24h; value is limited to 128 UTF-8 bytes."
          },
          "team": {
            "type": "string",
            "format": "uuid",
            "description": "App-scoped team inbox; mutually exclusive with assignee."
          }
        }
      },
      "PutIssueSavedViewRequest": {
        "description": "Shared issue-view display name and validated replacement filter set.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "filters"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Trimmed display name",
            "limited to 64 UTF-8 bytes without control characters.": null
          },
          "filters": {
            "$ref": "#/components/schemas/IssueSavedViewFilters"
          }
        }
      },
      "IssueSavedView": {
        "description": "Named shared issue query with its stable key and creation and editor metadata.",
        "type": "object",
        "required": [
          "key",
          "name",
          "filters",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "key": {
            "type": "string",
            "maxLength": 48,
            "pattern": "^[a-z0-9][a-z0-9-]{0,47}$"
          },
          "name": {
            "type": "string",
            "maxLength": 64
          },
          "filters": {
            "$ref": "#/components/schemas/IssueSavedViewFilters"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_by_account_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "ListIssueSavedViewsResponse": {
        "description": "Shared saved issue queries available within the selected application.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/IssueSavedView"
            }
          }
        }
      },
      "IssueOwnershipRule": {
        "description": "Provide at least one matcher. All populated matchers are ANDed; the first matching rule assigns a new issue to one eligible account or team. Exactly one assignment target is required.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "assignee_account_id": {
            "type": "string",
            "format": "uuid"
          },
          "exception_type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Exact exception type match."
          },
          "source_kind": {
            "type": "string",
            "enum": [
              "exception",
              "http",
              "runtime",
              "worker"
            ]
          },
          "route_prefix": {
            "type": "string",
            "pattern": "^/",
            "maxLength": 256,
            "description": "Path prefix; matches only at a path-segment boundary."
          },
          "source_path_prefix": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Local source path prefix (256 UTF-8 bytes); matches any application frame in the exception or its causes at a path-segment boundary. Backslashes and dot segments normalize; parent traversal, URLs, queries, and fragments are rejected. No glob or filesystem access."
          },
          "tag": {
            "type": "string",
            "maxLength": 193,
            "description": "Exact allowlisted operational key=value matcher against sanitized reported tags; value <=128 UTF-8 bytes. Missing keys do not match an empty value."
          },
          "assignee_team_id": {
            "type": "string",
            "format": "uuid",
            "description": "Team selected by this ownership rule; cannot be combined with an account assignment."
          }
        }
      },
      "IssueOwnershipRules": {
        "description": "Complete ordered app-level ownership policy. An empty rules list disables automatic assignment.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "rules"
        ],
        "properties": {
          "rules": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/IssueOwnershipRule"
            }
          }
        }
      },
      "IssueDetail": {
        "description": "Canonical issue metadata and independently paginated combined history. Linked IDs resolve to their current canonical issue; original identities and counters appear in group_members.",
        "type": "object",
        "required": [
          "issue",
          "events",
          "releases",
          "activity",
          "impact"
        ],
        "properties": {
          "split_rules": {
            "type": "array",
            "maxItems": 256,
            "description": "Routing rules associated with the displayed original identities or derived branches; lower priority wins per source.",
            "items": {
              "$ref": "#/components/schemas/IssueSplitRule"
            }
          },
          "issue": {
            "$ref": "#/components/schemas/Issue"
          },
          "group_members": {
            "type": "array",
            "minItems": 2,
            "maxItems": 32,
            "description": "Original fingerprint identities with their own lifetime counters.",
            "items": {
              "$ref": "#/components/schemas/Issue"
            }
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IssueOccurrence"
            }
          },
          "releases": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IssueRelease"
            }
          },
          "activity": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IssueActivity"
            }
          },
          "impact": {
            "$ref": "#/components/schemas/IssueImpact"
          },
          "next_event_cursor": {
            "type": "string"
          },
          "next_release_cursor": {
            "type": "string"
          },
          "next_activity_cursor": {
            "type": "string"
          }
        }
      },
      "ListIssuesResponse": {
        "description": "A bounded page of grouped issues with an opaque continuation cursor.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Issue"
            }
          },
          "next_cursor": {
            "type": "string"
          }
        }
      },
      "IssueEventResponse": {
        "description": "Receipt acknowledging an accepted or exact duplicate occurrence.",
        "type": "object",
        "required": [
          "issue_id",
          "event_id",
          "duplicate",
          "regressed"
        ],
        "properties": {
          "issue_id": {
            "type": "string",
            "format": "uuid"
          },
          "event_id": {
            "type": "string",
            "format": "uuid"
          },
          "duplicate": {
            "type": "boolean"
          },
          "regressed": {
            "type": "boolean"
          }
        }
      },
      "IssueSplitMatcher": {
        "description": "Exact equality against sanitized stored evidence; every populated field must match. At least one nonempty selector is required. Empty fields are wildcards.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "exception_type": {
            "type": "string",
            "maxLength": 256
          },
          "error_code": {
            "type": "string",
            "maxLength": 256
          },
          "route": {
            "type": "string",
            "maxLength": 256
          },
          "source_kind": {
            "type": "string",
            "enum": [
              "",
              "exception",
              "http",
              "runtime",
              "worker"
            ]
          }
        }
      },
      "IssueSplitPreview": {
        "description": "Read-only counts for one original fingerprint, across all retained evidence. Unavailable lifetime history cannot be classified; no split or routing change is performed.",
        "type": "object",
        "required": [
          "original_issue_id",
          "canonical_issue_id",
          "matcher",
          "lifetime_event_count",
          "retained_event_count",
          "matching_event_count",
          "nonmatching_event_count",
          "unavailable_history_event_count",
          "matching_event_ids"
        ],
        "properties": {
          "eligible_event_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "readOnly": true,
            "description": "Current retained matches a new rule would move; zero when application_status is not new-rule."
          },
          "shadowed_event_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "readOnly": true,
            "description": "Retained selector matches claimed by already enabled rules."
          },
          "eligible_event_ids": {
            "type": "array",
            "maxItems": 10,
            "readOnly": true,
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Newest eligible occurrence IDs after rule priority exclusions."
          },
          "application_status": {
            "type": "string",
            "enum": [
              "new-rule",
              "existing-rule",
              "derived-branch",
              "rule-limit"
            ],
            "readOnly": true,
            "description": "Whether this matcher can create a new rule in the current snapshot; plan capacity is checked during application."
          },
          "existing_rule_id": {
            "type": "string",
            "format": "uuid",
            "readOnly": true,
            "description": "Existing exact matcher returned by repeat creation without replay or re-enable."
          },
          "existing_target_issue_id": {
            "type": "string",
            "format": "uuid",
            "readOnly": true,
            "description": "Stable branch of the existing exact matcher."
          },
          "original_issue_id": {
            "type": "string",
            "format": "uuid"
          },
          "canonical_issue_id": {
            "type": "string",
            "format": "uuid"
          },
          "matcher": {
            "$ref": "#/components/schemas/IssueSplitMatcher"
          },
          "lifetime_event_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "retained_event_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "matching_event_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "nonmatching_event_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unavailable_history_event_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "matching_event_ids": {
            "type": "array",
            "maxItems": 10,
            "description": "Newest matching occurrence IDs",
            "bounded independently of total matches.": null,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      },
      "IssueSplitRule": {
        "description": "Immutable exact-match routing rule. Creating it moves eligible retained matches still assigned to the original source into an open branch. Earlier enabled rules take priority. Expired history remains on the source. Toggling affects future captures only; retries retain their existing routing identity.",
        "type": "object",
        "required": [
          "id",
          "source_issue_id",
          "target_issue_id",
          "priority",
          "matcher",
          "enabled",
          "initial_moved_event_count",
          "unavailable_history_event_count",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "source_issue_id": {
            "type": "string",
            "format": "uuid"
          },
          "target_issue_id": {
            "type": "string",
            "format": "uuid"
          },
          "priority": {
            "type": "integer",
            "minimum": 1,
            "maximum": 8
          },
          "matcher": {
            "$ref": "#/components/schemas/IssueSplitMatcher"
          },
          "enabled": {
            "type": "boolean"
          },
          "initial_moved_event_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unavailable_history_event_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "IssueSplitRuleUndoRequest": {
        "description": "Reviewed canonical destination required for atomic split-rule undo; a changed destination rejects the operation without disabling the rule.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "canonical_source_issue_id"
        ],
        "properties": {
          "canonical_source_issue_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "IssueSplitRuleUpdate": {
        "description": "Enable or disable routing for future captures without moving existing occurrences or changing the immutable rule definition.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "enabled"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          }
        }
      },
      "IssueReleaseHealth": {
        "description": "Observed issue and occurrence counts for one deployment within the requested environment.",
        "type": "object",
        "required": [
          "deployment_id",
          "commit_sha",
          "created_at",
          "observed_requests",
          "http_5xx_requests",
          "http_5xx_rate",
          "request_coverage",
          "observed_issue_events",
          "observed_issue_groups",
          "new_issue_groups",
          "regressed_issue_groups",
          "identified_customers",
          "unattributed_events"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "commit_sha": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "observed_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "http_5xx_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "http_5xx_rate": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "minimum": 0,
            "maximum": 1
          },
          "request_coverage": {
            "type": "string",
            "enum": [
              "observed",
              "unknown"
            ]
          },
          "observed_issue_events": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "observed_issue_groups": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "new_issue_groups": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "regressed_issue_groups": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "identified_customers": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unattributed_events": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unknown_http_batches": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Legacy HTTP batches in this release have unknown folded weights; release event counts are lower bounds."
          }
        }
      },
      "IssueReleaseComparison": {
        "description": "Baseline and candidate deployment health with newly observed, recurring and resolved issue groups.",
        "type": "object",
        "required": [
          "window_start",
          "window_end",
          "environment",
          "baseline",
          "candidate",
          "http_5xx_rate_delta"
        ],
        "properties": {
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "window_end": {
            "type": "string",
            "format": "date-time"
          },
          "environment": {
            "type": "string"
          },
          "baseline": {
            "$ref": "#/components/schemas/IssueReleaseHealth"
          },
          "candidate": {
            "$ref": "#/components/schemas/IssueReleaseHealth"
          },
          "http_5xx_rate_delta": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "minimum": -1,
            "maximum": 1,
            "description": "Candidate minus baseline observed HTTP 5xx rate, expressed as a fraction. Null if either has no observed requests."
          }
        }
      },
      "BulkIssueLifecycleAction": {
        "description": "Lifecycle or assignment action applied atomically to the selected canonical issue groups.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "action"
        ],
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "assign",
              "resolve",
              "ignore",
              "reopen"
            ]
          },
          "assignee_account_id": {
            "type": "string",
            "format": "uuid",
            "description": "Only for assign; omit both assignment targets to unassign."
          },
          "fixed_deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Required only for resolve."
          },
          "ignored_until": {
            "type": "string",
            "format": "date-time",
            "description": "Required only for ignore; future and within 90 days."
          },
          "assignee_team_id": {
            "type": "string",
            "format": "uuid",
            "description": "Only for assign; mutually exclusive with assignee_account_id."
          }
        }
      },
      "BulkIssueActionRequest": {
        "description": "Bounded issue selection and one lifecycle or assignment operation to apply atomically.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "issue_ids",
          "action"
        ],
        "properties": {
          "issue_ids": {
            "type": "array",
            "minItems": 1,
            "maxItems": 50,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "action": {
            "$ref": "#/components/schemas/BulkIssueLifecycleAction"
          }
        }
      },
      "BulkIssueActionResponse": {
        "description": "Canonical issue groups updated by the completed atomic bulk action.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/Issue"
            }
          }
        }
      },
      "IssueActionRequest": {
        "description": "Desired ownership, lifecycle, or reversible regrouping action within the app. Merge adopts the destination owner/state; split opens one linked original group. Merge/split responses identify the remaining canonical issue.",
        "type": "object",
        "required": [
          "action"
        ],
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "assign",
              "resolve",
              "reopen",
              "ignore",
              "merge",
              "split"
            ]
          },
          "target_issue_id": {
            "type": "string",
            "format": "uuid",
            "description": "Required only for merge; destination in the same app and environment."
          },
          "member_issue_id": {
            "type": "string",
            "format": "uuid",
            "description": "Required only for split; linked original identity to detach."
          },
          "assignee_account_id": {
            "type": "string",
            "format": "uuid"
          },
          "fixed_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "ignored_until": {
            "type": "string",
            "format": "date-time"
          },
          "assignee_team_id": {
            "type": "string",
            "format": "uuid",
            "description": "Target team for this assignment action; clear the account assignee when selecting a team."
          }
        }
      },
      "CreateIssueIngestTokenRequest": {
        "description": "Create a short-lived reporting credential for one existing deployment and environment.",
        "type": "object",
        "required": [
          "deployment_id",
          "name",
          "expires_at"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "environment": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "IssueIngestToken": {
        "description": "Reporting credential metadata; the bearer secret appears only on initial creation.",
        "type": "object",
        "required": [
          "id",
          "name",
          "app_id",
          "deployment_id",
          "environment",
          "expires_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "environment": {
            "type": "string"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "revoked_at": {
            "type": "string",
            "format": "date-time"
          },
          "token": {
            "type": "string"
          }
        }
      },
      "ListIssueIngestTokensResponse": {
        "description": "A collection of scoped reporting credentials; secret values are never included.",
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IssueIngestToken"
            }
          }
        }
      },
      "ProfileRouteRegression": {
        "type": "object",
        "description": "Retained advisory route-associated sampled CPU/request observation. Missing attribution, sparse requests or inadequate capture coverage produces insufficient_data. No rollout decision is changed.",
        "required": [
          "route",
          "status",
          "reason"
        ],
        "properties": {
          "code_reason": {
            "type": "string",
            "maxLength": 1024,
            "description": "Availability and limitations of route-filtered code attribution."
          },
          "code_evidence": {
            "type": "array",
            "maxItems": 10,
            "description": "Bounded route-filtered function self CPU and inclusive call-path increases ranked by CPU/request delta. Source URLs are derived at read time.",
            "items": {
              "$ref": "#/components/schemas/ProfileRegressionEvidence"
            }
          },
          "label_coverage": {
            "$ref": "#/components/schemas/ProfileRouteLabelComparison",
            "readOnly": true
          },
          "route": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "status": {
            "type": "string",
            "enum": [
              "regressed",
              "no_regression_detected",
              "insufficient_data"
            ]
          },
          "reason": {
            "type": "string",
            "maxLength": 1024
          },
          "baseline_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "candidate_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "metric": {
            "$ref": "#/components/schemas/ProfileRegressionCPUPerRequestMetric"
          },
          "comparison_url": {
            "type": "string",
            "readOnly": true,
            "description": "Request-time dashboard link to the route differential flamegraph for the frozen comparison windows."
          }
        }
      },
      "ProfileRegressionCPUPerRequestMetric": {
        "description": "Qualified route CPU/request measurements and regression threshold results.",
        "type": "object",
        "required": [
          "baseline_cpu_seconds_per_request",
          "candidate_cpu_seconds_per_request",
          "delta_cpu_seconds_per_request",
          "exceeds_threshold"
        ],
        "properties": {
          "baseline_cpu_seconds_per_request": {
            "type": "number",
            "format": "double",
            "minimum": 0
          },
          "candidate_cpu_seconds_per_request": {
            "type": "number",
            "format": "double",
            "minimum": 0
          },
          "delta_cpu_seconds_per_request": {
            "type": "number",
            "format": "double"
          },
          "relative_increase_percent": {
            "type": "number",
            "format": "double"
          },
          "exceeds_threshold": {
            "type": "boolean"
          }
        }
      },
      "ProfileAttributionQuality": {
        "type": "object",
        "description": "Labeled and unattributed shares of all sampled CPU in the deployment window, even when a route filter is selected. Not VM CPU or request instrumentation completeness. Percentages are absent when no CPU was sampled.",
        "required": [
          "available",
          "total_cpu_seconds",
          "attributed_cpu_seconds",
          "unattributed_cpu_seconds",
          "diagnostics_complete",
          "reasons"
        ],
        "properties": {
          "available": {
            "type": "boolean"
          },
          "total_cpu_seconds": {
            "type": "number",
            "format": "double",
            "minimum": 0
          },
          "attributed_cpu_seconds": {
            "type": "number",
            "format": "double",
            "minimum": 0
          },
          "unattributed_cpu_seconds": {
            "type": "number",
            "format": "double",
            "minimum": 0
          },
          "attributed_percent": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 100
          },
          "unattributed_percent": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 100
          },
          "diagnostics_complete": {
            "type": "boolean",
            "description": "Host discard counters reconciled against the whole merged CPU capture. False for missing or inconsistent counters."
          },
          "reasons": {
            "type": "array",
            "maxItems": 6,
            "items": {
              "$ref": "#/components/schemas/ProfileAttributionReason"
            }
          }
        }
      },
      "ProfileAttributionReason": {
        "description": "Bounded evidence explaining why profile attribution is incomplete or inconsistent.",
        "type": "object",
        "required": [
          "reason",
          "cpu_seconds"
        ],
        "properties": {
          "reason": {
            "type": "string",
            "enum": [
              "attributed",
              "unlabeled",
              "invalid_label",
              "route_not_admitted",
              "encoding_limit",
              "unknown"
            ]
          },
          "cpu_seconds": {
            "type": "number",
            "format": "double",
            "minimum": 0
          }
        }
      },
      "ProfileAttributionComparison": {
        "type": "object",
        "description": "Captured route attribution quality comparison. An absolute labeled-share change of at least 20 percentage points suppresses advisory route regression conclusions without changing aggregate results or rollout behavior. Background work and traffic changes can also change labeled CPU share.",
        "required": [
          "available",
          "substantial_change",
          "maximum_change_percentage_points",
          "warnings"
        ],
        "properties": {
          "baseline": {
            "$ref": "#/components/schemas/ProfileAttributionQuality"
          },
          "candidate": {
            "$ref": "#/components/schemas/ProfileAttributionQuality"
          },
          "available": {
            "type": "boolean"
          },
          "delta_percentage_points": {
            "type": "number",
            "format": "double",
            "minimum": -100,
            "maximum": 100
          },
          "substantial_change": {
            "type": "boolean"
          },
          "maximum_change_percentage_points": {
            "type": "number",
            "format": "double",
            "exclusiveMinimum": 0,
            "maximum": 100,
            "default": 20
          },
          "warnings": {
            "type": "array",
            "maxItems": 3,
            "items": {
              "type": "string",
              "maxLength": 1024
            }
          }
        }
      },
      "ProfileRouteLabelCoverage": {
        "type": "object",
        "description": "Application-reported labeled request entries in retained whole captures divided by weighted observed requests in the deployment window. Boundary captures are excluded without extrapolation. This is not proof of full request instrumentation. Counts above observed traffic cannot be reconciled.",
        "required": [
          "available",
          "reason",
          "captured_profiles",
          "boundary_profiles"
        ],
        "properties": {
          "available": {
            "type": "boolean"
          },
          "reason": {
            "type": "string",
            "maxLength": 1024
          },
          "labeled_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "observed_requests": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "percent": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 100
          },
          "captured_profiles": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "boundary_profiles": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ProfileRouteLabelComparison": {
        "type": "object",
        "description": "Advisory route CPU/request requires reconciled labeling shares of at least 80 percent in both windows and a change below 20 percentage points in either direction. Missing reports or failed reconciliation produces insufficient data.",
        "required": [
          "available",
          "consistent",
          "reason",
          "minimum_percent",
          "maximum_change_percentage_points"
        ],
        "properties": {
          "baseline": {
            "$ref": "#/components/schemas/ProfileRouteLabelCoverage"
          },
          "candidate": {
            "$ref": "#/components/schemas/ProfileRouteLabelCoverage"
          },
          "available": {
            "type": "boolean"
          },
          "consistent": {
            "type": "boolean"
          },
          "reason": {
            "type": "string",
            "maxLength": 1024
          },
          "delta_percentage_points": {
            "type": "number",
            "format": "double",
            "minimum": -100,
            "maximum": 100
          },
          "minimum_percent": {
            "type": "number",
            "format": "double",
            "exclusiveMinimum": 0,
            "maximum": 100,
            "default": 80
          },
          "maximum_change_percentage_points": {
            "type": "number",
            "format": "double",
            "exclusiveMinimum": 0,
            "maximum": 100,
            "default": 20
          }
        }
      },
      "OperationWorkflowConditionCoverage": {
        "type": "object",
        "additionalProperties": false,
        "description": "Reporting coverage for current states in the bounded ongoing sample. Expectations come only from the latest reporting Operation's immutable definition, not a global registry or every Operation in the workflow. Missing means no matching evidence in latest explicit contexts, not a failed check or proof it was never reported historically. Full continuous retained history is required. Conflicting results and over-limit evidence are excluded. Reported includes overdue, so expected equals reported plus missing and overdue is a subset of reported. Counts precede the per-workflow preview cap. No expectations is unconfigured coverage, not completeness.",
        "required": [
          "missing_groups",
          "missing_groups_truncated",
          "matching_workflow_count",
          "sampled_workflow_count",
          "compared_workflow_count",
          "no_expectations_workflow_count",
          "excluded_incomplete_workflow_count",
          "excluded_ambiguous_workflow_count",
          "excluded_condition_evidence_workflow_count",
          "expected_condition_count",
          "reported_condition_count",
          "missing_condition_count",
          "overdue_condition_count",
          "cohort_truncated",
          "items"
        ],
        "properties": {
          "missing_groups": {
            "type": "array",
            "maxItems": 64,
            "description": "Missing reports grouped by current contract and state and pinned refresh owner. Workflow counts are unique per group; one workflow may appear for several owners. Canonical contract/state/owner ordering includes unassigned. Counts precede condition previews; group display caps do not change total missing conditions.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowMissingConditionGroup"
            }
          },
          "missing_groups_truncated": {
            "type": "boolean"
          },
          "matching_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "sampled_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "compared_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "no_expectations_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "excluded_incomplete_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "excluded_ambiguous_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "excluded_condition_evidence_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "expected_condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "reported_condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "missing_condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "overdue_condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "cohort_truncated": {
            "type": "boolean"
          },
          "items": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowConditionCoverageInstance"
            }
          }
        }
      },
      "OperationWorkflowConditionCoverageInstance": {
        "type": "object",
        "additionalProperties": false,
        "description": "Coverage for one ongoing workflow. Conditions are ordered by declaring step then condition ID. Exact totals include preview omissions; workflows are ordered by stable identity.",
        "required": [
          "subject",
          "state",
          "expected_condition_count",
          "reported_condition_count",
          "missing_condition_count",
          "overdue_condition_count",
          "conditions_truncated",
          "conditions"
        ],
        "properties": {
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid",
            "description": "Operator only; omitted in customer projections."
          },
          "subject": {
            "$ref": "#/components/schemas/OperationSubject"
          },
          "state": {
            "$ref": "#/components/schemas/OperationWorkflowState"
          },
          "expected_condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "reported_condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "missing_condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "overdue_condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "conditions_truncated": {
            "type": "boolean"
          },
          "conditions": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowConditionCoverageEntry"
            }
          }
        }
      },
      "OperationWorkflowConditionCoverageEntry": {
        "type": "object",
        "additionalProperties": false,
        "description": "One condition expected in the current state. Match the declaring workflow step and exact condition ID and description within the current contract and latest explicit contexts. Evidence keeps the source report pinned age budget and decision identity. Reported includes any application result and may have no freshness budget; overdue is evidence past its budget. Missing has no evidence. This grants no authorization or verification.",
        "required": [
          "step",
          "milestone",
          "definition",
          "status"
        ],
        "properties": {
          "step": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63
          },
          "milestone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63
          },
          "definition": {
            "$ref": "#/components/schemas/OperationBusinessConditionDefinition"
          },
          "status": {
            "type": "string",
            "enum": [
              "reported",
              "missing",
              "overdue"
            ]
          },
          "evidence": {
            "$ref": "#/components/schemas/OperationWorkflowDecisionOutcomeEvidence"
          }
        }
      },
      "OperationWorkflowMissingConditionGroup": {
        "type": "object",
        "additionalProperties": false,
        "description": "Missing reporting coverage for one current contract and state and pinned refresh owner. Unassigned means owner is absent. blocked_time counts each workflow once and measures full observed workflow blocked duration, not duration caused by the missing condition or owner. Groups overlap across owners and do not assign business severity.",
        "required": [
          "contract_version",
          "state",
          "unassigned",
          "missing_condition_count",
          "blocked_time"
        ],
        "properties": {
          "contract_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000
          },
          "state": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "owner": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "description": "Public refresh owner from the expected condition declaration in the latest reporting Operation pinned definition."
          },
          "unassigned": {
            "type": "boolean"
          },
          "missing_condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "blocked_time": {
            "$ref": "#/components/schemas/OperationWorkflowDurationDistribution"
          }
        }
      },
      "OperationWorkflowMissingConditionProgress": {
        "type": "object",
        "additionalProperties": false,
        "description": "Optional baseline_token comparison of missing expectations reconstructed from retained reports and the baseline reporting Operation's immutable definition in today's completed and ongoing samples. Publication timestamps determine baseline visibility. This does not store original cohort membership or prove backlog resolution. Missing historical definitions, incomplete report history, conflicts and evidence limits are explicitly excluded. Baseline histories must be continuous within one contract; current contract boundaries permit contract_changed classification. Prior terminal reports do not create baseline gaps. Counts precede change preview limits. Conditions leaving the current state's expectation set, changed declarations and terminal workflows do not imply successful verification.",
        "required": [
          "baseline_at",
          "evaluated_at",
          "sampled_workflow_count",
          "compared_workflow_count",
          "no_baseline_workflow_count",
          "no_missing_baseline_workflow_count",
          "excluded_incomplete_workflow_count",
          "excluded_ambiguous_workflow_count",
          "excluded_condition_evidence_workflow_count",
          "excluded_definition_workflow_count",
          "statuses",
          "items"
        ],
        "properties": {
          "baseline_at": {
            "type": "string",
            "format": "date-time"
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time"
          },
          "sampled_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "compared_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "no_baseline_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "no_missing_baseline_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "excluded_incomplete_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "excluded_ambiguous_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "excluded_condition_evidence_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "excluded_definition_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "statuses": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowMissingConditionProgressCount"
            }
          },
          "items": {
            "type": "array",
            "maxItems": 200,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowMissingConditionProgressInstance"
            }
          }
        }
      },
      "OperationWorkflowMissingConditionProgressCount": {
        "type": "object",
        "additionalProperties": false,
        "description": "Exact baseline missing condition count for one progress status before preview limits. Received reports may report fail or unknown or already be overdue; status does not mean verification passed.",
        "required": [
          "status",
          "condition_count"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "received_report",
              "still_missing",
              "expectation_changed",
              "not_expected",
              "contract_changed"
            ]
          },
          "condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "OperationWorkflowMissingConditionProgressInstance": {
        "type": "object",
        "additionalProperties": false,
        "description": "One workflow with baseline missing expectations, ordered by stable workflow identity. Baseline_report anchors the reporting Operation and publication time whose pinned definition declares the before expectations. State is current; state_changed is observational. Customer projections omit tenant identifiers. Changes use canonical baseline step and condition ID order.",
        "required": [
          "subject",
          "baseline_report",
          "state",
          "state_changed",
          "baseline_missing_condition_count",
          "statuses",
          "changes_truncated",
          "changes"
        ],
        "properties": {
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "subject": {
            "$ref": "#/components/schemas/OperationSubject"
          },
          "baseline_report": {
            "$ref": "#/components/schemas/OperationWorkflowStateHistoryEntry"
          },
          "state": {
            "$ref": "#/components/schemas/OperationWorkflowState"
          },
          "state_changed": {
            "type": "boolean"
          },
          "baseline_missing_condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "statuses": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowMissingConditionProgressCount"
            }
          },
          "changes_truncated": {
            "type": "boolean"
          },
          "changes": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowMissingConditionProgressChange"
            }
          }
        }
      },
      "OperationWorkflowMissingConditionProgressChange": {
        "type": "object",
        "additionalProperties": false,
        "description": "Before is a baseline missing declaration without evidence. After is an optional current expectation and its selected result/freshness. Match step and condition ID to locate replacements, but receiving a report requires identical pinned declaration and milestone. Changed vocabulary, expected states, budgets or guidance are expectation_changed. Absent current expectations are not_expected; no cross-contract after comparison is emitted. Missing reports and no-longer-expected conditions are not failed or passed business verification.",
        "required": [
          "status",
          "before",
          "explanation"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "received_report",
              "still_missing",
              "expectation_changed",
              "not_expected",
              "contract_changed"
            ]
          },
          "before": {
            "$ref": "#/components/schemas/OperationWorkflowConditionCoverageEntry"
          },
          "after": {
            "$ref": "#/components/schemas/OperationWorkflowConditionCoverageEntry"
          },
          "explanation": {
            "type": "string"
          }
        }
      },
      "OperationWorkflowNewMissingConditionProgress": {
        "type": "object",
        "additionalProperties": false,
        "description": "Optional baseline_token comparison explaining current missing reports relative to retained baseline expectations in today's completed and ongoing sample. Current terminal workflows produce no active gaps. Publication visibility, retained immutable baseline definitions, continuous baseline report history, conflict and evidence limits match missing_progress. Workflows with no retained baseline are not invented as new gaps, and unavailable definitions are excluded. This is not original cohort membership or total historical backlog. All current missing status counts precede preview caps; missing evidence is not failed verification.",
        "required": [
          "groups",
          "groups_truncated",
          "baseline_at",
          "evaluated_at",
          "sampled_workflow_count",
          "compared_workflow_count",
          "no_baseline_workflow_count",
          "no_current_missing_workflow_count",
          "excluded_incomplete_workflow_count",
          "excluded_ambiguous_workflow_count",
          "excluded_condition_evidence_workflow_count",
          "excluded_definition_workflow_count",
          "statuses",
          "items"
        ],
        "properties": {
          "groups": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowGapProgressGroup"
            }
          },
          "groups_truncated": {
            "type": "boolean"
          },
          "baseline_at": {
            "type": "string",
            "format": "date-time"
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time"
          },
          "sampled_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "compared_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "no_baseline_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "no_current_missing_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "excluded_incomplete_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "excluded_ambiguous_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "excluded_condition_evidence_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "excluded_definition_workflow_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "statuses": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowNewMissingConditionProgressCount"
            }
          },
          "items": {
            "type": "array",
            "maxItems": 200,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowNewMissingConditionProgressInstance"
            }
          }
        }
      },
      "OperationWorkflowNewMissingConditionProgressCount": {
        "type": "object",
        "additionalProperties": false,
        "description": "Exact count of current missing conditions by comparison category before previews. Still_missing is an existing gap, while report_lost requires the identical baseline expectation and prior evidence. New or changed expectations and contract changes are distinct.",
        "required": [
          "status",
          "condition_count"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "report_lost",
              "new_expectation",
              "still_missing",
              "expectation_changed",
              "contract_changed"
            ]
          },
          "condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "OperationWorkflowNewMissingConditionProgressInstance": {
        "type": "object",
        "additionalProperties": false,
        "description": "One current ongoing workflow with missing reports and a comparable retained baseline, ordered by stable workflow identity. Baseline_report identifies the pinned baseline definition source. A terminal baseline has no active expectations; newly active current gaps are new_expectation rather than reporting loss. Conditions use canonical current step and condition ID order. Customer projections omit tenant identifiers.",
        "required": [
          "subject",
          "baseline_report",
          "baseline_terminal",
          "state",
          "state_changed",
          "current_missing_condition_count",
          "statuses",
          "changes_truncated",
          "changes"
        ],
        "properties": {
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "subject": {
            "$ref": "#/components/schemas/OperationSubject"
          },
          "baseline_report": {
            "$ref": "#/components/schemas/OperationWorkflowStateHistoryEntry"
          },
          "baseline_terminal": {
            "type": "boolean"
          },
          "state": {
            "$ref": "#/components/schemas/OperationWorkflowState"
          },
          "state_changed": {
            "type": "boolean"
          },
          "current_missing_condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "statuses": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowNewMissingConditionProgressCount"
            }
          },
          "changes_truncated": {
            "type": "boolean"
          },
          "changes": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowNewMissingConditionProgressChange"
            }
          }
        }
      },
      "OperationWorkflowNewMissingConditionProgressChange": {
        "type": "object",
        "additionalProperties": false,
        "description": "After is a current missing expectation without evidence. Before optionally includes prior pinned declaration and evidence with result and baseline freshness. Same step and condition ID locate candidates; report_lost requires identical milestone and full declaration including expected states, budget and guidance plus prior evidence. Age expiry never removes reports. Changed declarations are expectation_changed; absent or previously inactive terminal expectations are new_expectation. Contract changes omit Before and never compare facts across contracts.",
        "required": [
          "status",
          "after",
          "explanation"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "report_lost",
              "new_expectation",
              "still_missing",
              "expectation_changed",
              "contract_changed"
            ]
          },
          "before": {
            "$ref": "#/components/schemas/OperationWorkflowConditionCoverageEntry"
          },
          "after": {
            "$ref": "#/components/schemas/OperationWorkflowConditionCoverageEntry"
          },
          "explanation": {
            "type": "string"
          }
        }
      },
      "OperationWorkflowGapProgressGroup": {
        "type": "object",
        "additionalProperties": false,
        "description": "Current gap group ordered by contract, state, owner and category, before condition previews. Each workflow contributes once per group. Blocked duration includes observed report intervals across permitted contract boundaries and does not measure gap age or business severity.",
        "required": [
          "contract_version",
          "state",
          "unassigned",
          "gap_status",
          "missing_condition_count",
          "blocked_time"
        ],
        "properties": {
          "contract_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000
          },
          "state": {
            "type": "string",
            "maxLength": 64
          },
          "owner": {
            "type": "string",
            "maxLength": 128
          },
          "unassigned": {
            "type": "boolean"
          },
          "gap_status": {
            "type": "string",
            "enum": [
              "report_lost",
              "new_expectation",
              "still_missing",
              "expectation_changed",
              "contract_changed"
            ]
          },
          "missing_condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "blocked_time": {
            "$ref": "#/components/schemas/OperationWorkflowDurationDistribution"
          }
        }
      },
      "OperationWorkflowGapQueuePriority": {
        "type": "object",
        "additionalProperties": false,
        "description": "All current reporting gaps before queue filters and evidence previews. Guidance contains every eligible pinned missing expectation, including owners beyond the evidence preview; it carries no prior report facts. Blocked intervals spanning contracts are omitted.",
        "required": [
          "missing_condition_count",
          "statuses",
          "refresh_owners",
          "unassigned_condition_count",
          "guidance",
          "blocked_seconds",
          "explanation"
        ],
        "properties": {
          "missing_condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "statuses": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowNewMissingConditionProgressCount"
            }
          },
          "refresh_owners": {
            "type": "array",
            "maxItems": 256,
            "items": {
              "type": "string",
              "maxLength": 128
            }
          },
          "unassigned_condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "guidance": {
            "type": "array",
            "maxItems": 256,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowGapQueueGuidance"
            }
          },
          "blocked_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "explanation": {
            "type": "string"
          }
        }
      },
      "OperationWorkflowGapQueueGuidance": {
        "description": "Pinned public expectation and comparison category for one current reporting gap, without prior evidence facts.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "status",
          "expectation"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "report_lost",
              "new_expectation",
              "still_missing",
              "expectation_changed",
              "contract_changed"
            ]
          },
          "expectation": {
            "$ref": "#/components/schemas/OperationWorkflowConditionCoverageEntry"
          }
        }
      },
      "OperationWorkflowTransitionReporting": {
        "type": "object",
        "additionalProperties": false,
        "description": "Workflow-wide current-state expected condition coverage evaluated from the latest reporting Operation pinned definition and retained explicit decision contexts. It does not add transition guards. Counts precede previews. Unknown coverage is never inferred as satisfied; source evidence uses its own pinned freshness budget. Conditions apply to current state rather than proposed destination state.",
        "required": [
          "evaluated_at",
          "state",
          "reporting_operation_id",
          "status",
          "expected_condition_count",
          "reported_condition_count",
          "missing_condition_count",
          "overdue_condition_count",
          "conditions",
          "conditions_truncated"
        ],
        "properties": {
          "evaluated_at": {
            "type": "string",
            "format": "date-time"
          },
          "state": {
            "type": "string",
            "maxLength": 64
          },
          "reporting_operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "compared",
              "unconfigured",
              "terminal",
              "definition_unavailable",
              "incomplete",
              "limit",
              "ambiguous"
            ]
          },
          "expected_condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "reported_condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "missing_condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "overdue_condition_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "conditions": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowConditionCoverageEntry"
            }
          },
          "conditions_truncated": {
            "type": "boolean"
          }
        }
      },
      "OperationWorkflowReadinessQueueEntry": {
        "type": "object",
        "description": "One declared current-state transition evaluated without planned evidence; reporting is advisory.",
        "required": [
          "subject",
          "workflow",
          "instance_id",
          "operation_id",
          "state_revision",
          "contract_version",
          "transition",
          "evaluated_at",
          "ready",
          "reasons",
          "advisories",
          "owners",
          "unassigned",
          "blockers",
          "missing_milestones",
          "missing_dependency_workflows",
          "pending_verifications_truncated",
          "pending_verification_count",
          "reporting_status",
          "missing_report_count",
          "overdue_report_count"
        ],
        "properties": {
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid",
            "description": "Customer identity present only on the account surface."
          },
          "subject": {
            "$ref": "#/components/schemas/OperationSubject"
          },
          "workflow": {
            "type": "string",
            "description": "Declared workflow name."
          },
          "instance_id": {
            "type": "string",
            "description": "Application workflow instance identifier."
          },
          "operation_id": {
            "type": "string",
            "format": "uuid",
            "description": "Current reporting Operation identifier."
          },
          "state_revision": {
            "type": "integer",
            "format": "int64",
            "description": "Evaluated current state revision."
          },
          "contract_version": {
            "type": "integer",
            "description": "Evaluated pinned workflow contract version."
          },
          "transition": {
            "$ref": "#/components/schemas/OperationWorkflowInstanceTransition"
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Shared reporting and retained-evidence evaluation time for this workflow."
          },
          "ready": {
            "type": "boolean",
            "description": "Whether declared requirements are met without planned evidence."
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Unmet declared requirement codes."
          },
          "advisories": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Reporting or verification context that does not change readiness."
          },
          "owners": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Sorted unique blocker and pending verification owners for the target Operation."
          },
          "unassigned": {
            "type": "boolean",
            "description": "Whether a matching blocker or pending verification has no owner."
          },
          "blockers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowBlocker"
            },
            "description": "Application-reported blockers for this transition Operation."
          },
          "missing_milestones": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Required planned milestone names absent from the empty plan."
          },
          "missing_dependency_workflows": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Declared prerequisite workflows without a reported dependency reference."
          },
          "pending_verifications": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowResolutionVerification"
            },
            "description": "Canonical preview of pending evidence obligations for this transition Operation."
          },
          "pending_verifications_truncated": {
            "type": "boolean",
            "description": "More pending evidence obligations exist than the queue preview contains."
          },
          "pending_verification_count": {
            "type": "integer",
            "format": "int64",
            "description": "Exact pending obligation count before previews."
          },
          "reporting_status": {
            "type": "string",
            "description": "Current-state reporting coverage status; unknown coverage does not invent missing evidence."
          },
          "missing_report_count": {
            "type": "integer",
            "format": "int64",
            "description": "Known missing condition reports when reporting coverage is comparable."
          },
          "overdue_report_count": {
            "type": "integer",
            "format": "int64",
            "description": "Known overdue condition reports when reporting coverage is comparable."
          }
        }
      },
      "OperationWorkflowReadinessQueueResponse": {
        "type": "object",
        "description": "Bounded live readiness queue; counts describe the evaluated sample and filters.",
        "required": [
          "snapshot",
          "items",
          "sampled_at",
          "evaluated_at",
          "matching_workflow_count",
          "sampled_workflow_count",
          "excluded_changed_workflow_count",
          "no_transition_workflow_count",
          "declared_transition_count",
          "evaluated_transition_count",
          "matching_transition_count",
          "ready_transition_count",
          "unmet_transition_count",
          "workflow_sample_truncated",
          "transition_sample_truncated",
          "has_more"
        ],
        "properties": {
          "snapshot": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessSnapshot"
          },
          "items": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowReadinessQueueEntry"
            },
            "description": "Matching transitions with unmet rows first."
          },
          "sampled_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time used to select recently updated ongoing workflows."
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time evaluation completed; reads are live rather than atomic."
          },
          "matching_workflow_count": {
            "type": "integer",
            "format": "int64",
            "description": "Retained ongoing workflows matching app customer and workflow selectors before sampling."
          },
          "sampled_workflow_count": {
            "type": "integer",
            "format": "int64",
            "description": "Ongoing workflows selected up to the workflow cap."
          },
          "excluded_changed_workflow_count": {
            "type": "integer",
            "format": "int64",
            "description": "Sampled workflows excluded after their current report or contract changed."
          },
          "no_transition_workflow_count": {
            "type": "integer",
            "format": "int64",
            "description": "Unchanged sampled workflows without a matching current-state edge."
          },
          "declared_transition_count": {
            "type": "integer",
            "format": "int64",
            "description": "Matching current-state edges before per-workflow edge sampling."
          },
          "evaluated_transition_count": {
            "type": "integer",
            "format": "int64",
            "description": "Current-state edges evaluated before owner and requirement filtering."
          },
          "matching_transition_count": {
            "type": "integer",
            "format": "int64",
            "description": "Evaluated transitions matching filters before the row limit."
          },
          "ready_transition_count": {
            "type": "integer",
            "format": "int64",
            "description": "Matching evaluated transitions with all declared requirements met."
          },
          "unmet_transition_count": {
            "type": "integer",
            "format": "int64",
            "description": "Matching evaluated transitions with unmet declared requirements."
          },
          "workflow_sample_truncated": {
            "type": "boolean",
            "description": "More matching ongoing workflows exist than were sampled."
          },
          "transition_sample_truncated": {
            "type": "boolean",
            "description": "At least one workflow has more matching edges than the per-workflow cap."
          },
          "has_more": {
            "type": "boolean",
            "description": "More matching evaluated rows exist than the response row limit."
          }
        }
      },
      "OperationWorkflowReadinessSnapshot": {
        "description": "Caller-held compact readiness observations for at most 100 returned transitions. No historical authentication or execution authority is implied.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "query",
          "captured_at",
          "items"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "description": "ReadinessSnapshot. Snapshot format version; currently 1.",
            "enum": [
              1
            ]
          },
          "query": {
            "type": "string",
            "description": "ReadinessSnapshot. Account app environment customer-selector and role fingerprint; preserve unchanged when saving.",
            "minLength": 64,
            "maxLength": 64,
            "pattern": "^[a-f0-9]{64}$"
          },
          "captured_at": {
            "type": "string",
            "format": "date-time",
            "description": "ReadinessSnapshot. Time the live snapshot capture completed."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowReadinessSnapshotEntry"
            },
            "description": "ReadinessSnapshot. Saved transition observations.",
            "maxItems": 100
          }
        }
      },
      "OperationWorkflowReadinessSnapshotEntry": {
        "description": "One saved transition identity and stable evidence summaries for comparison within the same ownership scope.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "subject",
          "workflow",
          "instance_id",
          "operation_id",
          "state_revision",
          "contract_version",
          "operation",
          "from_state",
          "to_state",
          "evaluated_at",
          "ready",
          "reasons",
          "advisories",
          "blocker_codes",
          "missing_milestones",
          "missing_dependency_workflows",
          "pending_verification_count",
          "requirements_fingerprint",
          "blockers_fingerprint",
          "prerequisites_fingerprint",
          "verifications_fingerprint",
          "reporting_fingerprint"
        ],
        "properties": {
          "platform_tenant_id": {
            "type": "string",
            "description": "ReadinessSnapshotEntry. Customer UUID present only in account snapshots.",
            "format": "uuid"
          },
          "subject": {
            "$ref": "#/components/schemas/OperationSubject"
          },
          "workflow": {
            "type": "string",
            "description": "ReadinessSnapshotEntry. Declared workflow name.",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "instance_id": {
            "type": "string",
            "description": "ReadinessSnapshotEntry. Application workflow instance identifier.",
            "minLength": 1,
            "maxLength": 256
          },
          "operation_id": {
            "type": "string",
            "description": "ReadinessSnapshotEntry. Operation that reported the saved workflow state.",
            "format": "uuid"
          },
          "state_revision": {
            "type": "integer",
            "format": "int64",
            "description": "ReadinessSnapshotEntry. Application state revision observed at capture.",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "contract_version": {
            "type": "integer",
            "description": "ReadinessSnapshotEntry. Pinned workflow contract version at capture.",
            "minimum": 1,
            "maximum": 1000000
          },
          "operation": {
            "type": "string",
            "description": "ReadinessSnapshotEntry. Target Operation of the saved transition.",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "from_state": {
            "type": "string",
            "description": "ReadinessSnapshotEntry. Declared source state of the saved transition.",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "to_state": {
            "type": "string",
            "description": "ReadinessSnapshotEntry. Declared destination state of the saved transition.",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time",
            "description": "ReadinessSnapshotEntry. Time of the shared per-workflow evidence evaluation or comparison completion."
          },
          "ready": {
            "type": "boolean",
            "description": "ReadinessSnapshotEntry. Declared requirements were met without planned evidence at capture."
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "state_unknown",
                "terminal",
                "transition_undeclared",
                "from_state_mismatch",
                "revision_mismatch",
                "contract_version_mismatch",
                "application_blocked",
                "dependency_unmet",
                "milestone_required",
                "policy_evidence_required",
                "dependency_required",
                "invariant_evidence_required",
                "effect_evidence_required",
                "retained_milestone_required",
                "retained_milestone_invalidated",
                "retained_milestone_expired",
                "retained_milestone_group_unmet",
                "path_selection_invalid"
              ]
            },
            "description": "ReadinessSnapshotEntry. Saved unmet declared requirement codes.",
            "maxItems": 18,
            "uniqueItems": true
          },
          "advisories": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "state_stale",
                "deadline_overdue",
                "condition_reports_missing",
                "condition_reports_overdue",
                "condition_reporting_unknown",
                "verification_pending"
              ]
            },
            "description": "ReadinessSnapshotEntry. Saved reporting and verification context; advisories never determine readiness.",
            "maxItems": 6,
            "uniqueItems": true
          },
          "blocker_codes": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            },
            "description": "ReadinessSnapshotEntry. Sorted unique saved blocker codes for this target Operation.",
            "maxItems": 16,
            "uniqueItems": true
          },
          "missing_milestones": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            },
            "description": "ReadinessSnapshotEntry. Saved missing planned milestone names.",
            "maxItems": 16,
            "uniqueItems": true
          },
          "missing_dependency_workflows": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]*$"
            },
            "description": "ReadinessSnapshotEntry. Saved prerequisite workflows without reported references.",
            "maxItems": 16,
            "uniqueItems": true
          },
          "pending_verification_count": {
            "type": "integer",
            "format": "int64",
            "description": "ReadinessSnapshotEntry. Exact saved pending verification obligation count before previews.",
            "minimum": 0
          },
          "requirements_fingerprint": {
            "type": "string",
            "description": "ReadinessSnapshotEntry. Digest of pinned contract version and declared edge requirements.",
            "minLength": 64,
            "maxLength": 64,
            "pattern": "^[a-f0-9]{64}$"
          },
          "blockers_fingerprint": {
            "type": "string",
            "description": "ReadinessSnapshotEntry. Order-independent digest of all target blocker details.",
            "minLength": 64,
            "maxLength": 64,
            "pattern": "^[a-f0-9]{64}$"
          },
          "prerequisites_fingerprint": {
            "type": "string",
            "description": "ReadinessSnapshotEntry. Digest of prerequisite statuses and evidence identities excluding moving ages and evaluation clocks.",
            "minLength": 64,
            "maxLength": 64,
            "pattern": "^[a-f0-9]{64}$"
          },
          "verifications_fingerprint": {
            "type": "string",
            "description": "ReadinessSnapshotEntry. Order-independent digest of all retained pending target obligations before previews.",
            "minLength": 64,
            "maxLength": 64,
            "pattern": "^[a-f0-9]{64}$"
          },
          "reporting_fingerprint": {
            "type": "string",
            "description": "ReadinessSnapshotEntry. Digest of reporting coverage counts and timing advisories excluding pending verification.",
            "minLength": 64,
            "maxLength": 64,
            "pattern": "^[a-f0-9]{64}$"
          },
          "evidence": {
            "type": "array",
            "description": "Bounded saved evidence inventory; older snapshots may omit it.",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowReadinessEvidence"
            }
          },
          "evidence_complete": {
            "type": "boolean",
            "description": "True only when the saved evidence inventory covers every applicable observation."
          }
        }
      },
      "OperationWorkflowReadinessComparisonRequest": {
        "description": "Scoped request to reread and compare saved transitions. The baseline is caller-supplied advisory data.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "scope",
          "baseline"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "description": "ReadinessComparisonRequest. Required explicit app UUID for customer-self requests; reject on account routes.",
            "format": "uuid"
          },
          "tenant_id": {
            "type": "string",
            "description": "ReadinessComparisonRequest. Optional account-owned customer selector; reject on customer-self routes.",
            "format": "uuid"
          },
          "scope": {
            "type": "string",
            "description": "ReadinessComparisonRequest. Explicit application environment for this comparison."
          },
          "baseline": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessSnapshot"
          },
          "change": {
            "type": "string",
            "description": "ReadinessComparisonRequest. Filter after all baseline transitions have been classified; unavailable includes contract and state boundaries.",
            "enum": [
              "newly_ready",
              "newly_blocked",
              "changed",
              "unchanged",
              "unavailable"
            ]
          },
          "limit": {
            "type": "integer",
            "description": "ReadinessComparisonRequest. Maximum matching rows returned after comparison; defaults to 20 and is capped at 100.",
            "minimum": 1,
            "maximum": 100,
            "default": 20
          }
        }
      },
      "OperationWorkflowReadinessChange": {
        "description": "Readiness comparison of the saved edge with fresh retained evidence. Contract and state boundaries are explicit.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "baseline",
          "status",
          "added_reasons",
          "resolved_reasons",
          "changed_categories",
          "explanation",
          "evidence_changes",
          "evidence_comparison_complete"
        ],
        "properties": {
          "current_operation_id": {
            "type": "string",
            "description": "ReadinessChange. Latest retained reporting Operation when current state is available.",
            "format": "uuid"
          },
          "current_state": {
            "type": "string",
            "description": "ReadinessChange. Current retained workflow state even when the saved edge is no longer applicable."
          },
          "baseline": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessSnapshotEntry"
          },
          "current": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessQueueEntry"
          },
          "status": {
            "type": "string",
            "description": "ReadinessChange. Classification; only comparable unchanged requirements can become newly ready or newly blocked.",
            "enum": [
              "newly_ready",
              "newly_blocked",
              "changed",
              "unchanged",
              "state_unknown",
              "terminal",
              "transition_unavailable",
              "contract_changed",
              "baseline_ahead"
            ]
          },
          "added_reasons": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "state_unknown",
                "terminal",
                "transition_undeclared",
                "from_state_mismatch",
                "revision_mismatch",
                "contract_version_mismatch",
                "application_blocked",
                "dependency_unmet",
                "milestone_required",
                "policy_evidence_required",
                "dependency_required",
                "invariant_evidence_required",
                "effect_evidence_required",
                "retained_milestone_required",
                "retained_milestone_invalidated",
                "retained_milestone_expired",
                "retained_milestone_group_unmet",
                "path_selection_invalid"
              ]
            },
            "description": "ReadinessChange. Declared requirement codes now unmet that were absent from the saved reasons.",
            "maxItems": 18,
            "uniqueItems": true
          },
          "resolved_reasons": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "state_unknown",
                "terminal",
                "transition_undeclared",
                "from_state_mismatch",
                "revision_mismatch",
                "contract_version_mismatch",
                "application_blocked",
                "dependency_unmet",
                "milestone_required",
                "policy_evidence_required",
                "dependency_required",
                "invariant_evidence_required",
                "effect_evidence_required",
                "retained_milestone_required",
                "retained_milestone_invalidated",
                "retained_milestone_expired",
                "retained_milestone_group_unmet",
                "path_selection_invalid"
              ]
            },
            "description": "ReadinessChange. Saved requirement codes that are no longer unmet; this does not prove application authorization.",
            "maxItems": 18,
            "uniqueItems": true
          },
          "changed_categories": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "blockers",
                "prerequisites",
                "verification",
                "reporting"
              ]
            },
            "description": "ReadinessChange. Evidence categories whose complete stable summaries changed."
          },
          "explanation": {
            "type": "string",
            "description": "ReadinessChange. Human-readable meaning and comparison boundary."
          },
          "evidence_changes": {
            "type": "array",
            "description": "Individual retained evidence changes; missing verification is never inferred fulfilled.",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowReadinessEvidenceChange"
            }
          },
          "evidence_comparison_complete": {
            "type": "boolean",
            "description": "True only when both evidence inventories are complete and requirements remain comparable."
          }
        }
      },
      "OperationWorkflowReadinessComparisonResponse": {
        "description": "Live comparison counts before filtering with bounded matching changes and the next available-edge snapshot.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "baseline_at",
          "evaluated_at",
          "baseline_transition_count",
          "compared_transition_count",
          "newly_ready_count",
          "newly_blocked_count",
          "changed_count",
          "unchanged_count",
          "unavailable_count",
          "matching_change_count",
          "items",
          "snapshot",
          "has_more"
        ],
        "properties": {
          "baseline_at": {
            "type": "string",
            "format": "date-time",
            "description": "ReadinessComparisonResponse. Saved snapshot capture time."
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time",
            "description": "ReadinessComparisonResponse. Time of the shared per-workflow evidence evaluation or comparison completion."
          },
          "baseline_transition_count": {
            "type": "integer",
            "format": "int64",
            "description": "ReadinessComparisonResponse. All transitions in the supplied snapshot before filters."
          },
          "compared_transition_count": {
            "type": "integer",
            "format": "int64",
            "description": "ReadinessComparisonResponse. Transitions with comparable current edges and declared requirements."
          },
          "newly_ready_count": {
            "type": "integer",
            "format": "int64",
            "description": "ReadinessComparisonResponse. Comparable transitions that changed from unmet to ready."
          },
          "newly_blocked_count": {
            "type": "integer",
            "format": "int64",
            "description": "ReadinessComparisonResponse. Comparable transitions that changed from ready to unmet."
          },
          "changed_count": {
            "type": "integer",
            "format": "int64",
            "description": "ReadinessComparisonResponse. Comparable transitions with evidence or reason changes and unchanged readiness result."
          },
          "unchanged_count": {
            "type": "integer",
            "format": "int64",
            "description": "ReadinessComparisonResponse. Comparable transitions with unchanged result and evidence summaries."
          },
          "unavailable_count": {
            "type": "integer",
            "format": "int64",
            "description": "ReadinessComparisonResponse. Transitions excluded from readiness comparison due to contract state edge or retained-revision boundaries."
          },
          "matching_change_count": {
            "type": "integer",
            "format": "int64",
            "description": "ReadinessComparisonResponse. Changes matching the selected filter before row limit."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowReadinessChange"
            },
            "description": "ReadinessComparisonResponse. Matching transition comparison rows.",
            "maxItems": 100
          },
          "snapshot": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessSnapshot"
          },
          "has_more": {
            "type": "boolean",
            "description": "ReadinessComparisonResponse. More matching changes exist than the returned row limit."
          }
        }
      },
      "OperationWorkflowReadinessEvidence": {
        "description": "Compact app-reported evidence observation preserving prerequisite group/path or verification obligation identity.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "category",
          "key",
          "name",
          "status",
          "fingerprint"
        ],
        "properties": {
          "category": {
            "type": "string",
            "description": "Evidence category.",
            "enum": [
              "blockers",
              "prerequisites",
              "verification"
            ]
          },
          "key": {
            "type": "string",
            "description": "Stable scoped evidence identity digest.",
            "pattern": "^[0-9a-f]{64}$"
          },
          "name": {
            "type": "string",
            "description": "Human-readable requirement or blocker identity.",
            "maxLength": 256,
            "minLength": 1
          },
          "status": {
            "type": "string",
            "description": "Retained observation status.",
            "enum": [
              "active",
              "required",
              "verified",
              "invalidated",
              "expired",
              "awaiting_verification",
              "unknown",
              "waiting",
              "terminal",
              "satisfied",
              "outcome_mismatch"
            ]
          },
          "owner": {
            "type": "string",
            "description": "Reported evidence owner.",
            "maxLength": 256
          },
          "operation_id": {
            "type": "string",
            "description": "Operation containing the reported evidence or expected verification.",
            "format": "uuid"
          },
          "invalidation_operation_id": {
            "type": "string",
            "description": "Operation containing the invalidating milestone.",
            "format": "uuid"
          },
          "fingerprint": {
            "type": "string",
            "description": "Stable evidence content digest excluding moving age counters.",
            "pattern": "^[0-9a-f]{64}$"
          }
        }
      },
      "OperationWorkflowReadinessEvidenceChange": {
        "description": "Individual comparison; absence is unavailable unless complete inventories establish blocker clearance.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "kind"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "description": "Evidence change classification.",
            "enum": [
              "observed",
              "added",
              "changed",
              "reassigned",
              "required",
              "verified",
              "invalidated",
              "expired",
              "awaiting_verification",
              "fulfilled",
              "unavailable",
              "cleared",
              "unknown",
              "waiting",
              "terminal",
              "satisfied",
              "outcome_mismatch"
            ]
          },
          "before": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessEvidence"
          },
          "after": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessEvidence"
          }
        }
      },
      "OperationWorkflowReadinessSubscriptionRequest": {
        "type": "object",
        "description": "Create a durable readiness inbox subscription; initial observations establish a baseline without inventing readiness changes.",
        "additionalProperties": false,
        "properties": {
          "next_action_digest": {
            "$ref": "#/components/schemas/OperationWorkflowNextActionDigestPolicy",
            "description": "Optional team digest policy using this subscription customer/environment; filters are independent of transition discovery. Policy is fixed until subscription deletion."
          },
          "business_impact_watches": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowReadinessImpactWatchRequest"
            },
            "description": "OperationWorkflowReadinessSubscriptionRequest.business_impact_watches. Optional unique workflow/result watches in the subscription application, customer and environment scope. Initial successful observation is silent; configuration remains fixed until deletion. These targets are independent of transition discovery owner/operation filters."
          },
          "app_id": {
            "type": "string",
            "description": "OperationWorkflowReadinessSubscriptionRequest.app_id. Application UUID; required in customer requests and omitted in account requests.",
            "format": "uuid"
          },
          "tenant_id": {
            "type": "string",
            "description": "OperationWorkflowReadinessSubscriptionRequest.tenant_id. Optional account-only customer selector; customer identity derives from authentication.",
            "format": "uuid"
          },
          "scope": {
            "type": "string",
            "description": "OperationWorkflowReadinessSubscriptionRequest.scope. Application environment scope.",
            "minLength": 1,
            "maxLength": 40,
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
          },
          "name": {
            "type": "string",
            "description": "OperationWorkflowReadinessSubscriptionRequest.name. Subscription name.",
            "pattern": "^[a-z][a-z0-9-]*$",
            "minLength": 1,
            "maxLength": 63
          },
          "workflow": {
            "type": "string",
            "description": "OperationWorkflowReadinessSubscriptionRequest.workflow. Optional declared workflow selector.",
            "maxLength": 63
          },
          "target_operation": {
            "type": "string",
            "description": "OperationWorkflowReadinessSubscriptionRequest.target_operation. Optional transition operation selector.",
            "maxLength": 63
          },
          "owner": {
            "type": "string",
            "description": "OperationWorkflowReadinessSubscriptionRequest.owner. Optional blocker or pending verification owner selector.",
            "maxLength": 128
          },
          "unassigned": {
            "type": "boolean",
            "description": "OperationWorkflowReadinessSubscriptionRequest.unassigned. Select ownerless blockers or verification obligations."
          },
          "events": {
            "type": "array",
            "description": "OperationWorkflowReadinessSubscriptionRequest.events. Readiness inbox event selectors; defaults to all four when omitted.",
            "minItems": 1,
            "maxItems": 4,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "description": "OperationWorkflowReadinessSubscriptionRequest.events.items. Subscription event kind.",
              "enum": [
                "newly_ready",
                "newly_blocked",
                "reassigned",
                "unavailable"
              ]
            }
          }
        },
        "required": [
          "scope",
          "name"
        ]
      },
      "OperationWorkflowReadinessSubscription": {
        "type": "object",
        "description": "Durable subscription configuration and most recent successful bounded evaluation; deletion cancels future evaluations and removes its inbox.",
        "additionalProperties": false,
        "properties": {
          "digest_next_at": {
            "type": "string",
            "format": "date-time",
            "description": "Next digest evaluation time. Evaluation occurs on a worker pass at or after this time; failures retry without consuming the cadence."
          },
          "digest_evaluated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Most recent successful digest evaluation, including silent evaluations with no changed items."
          },
          "digest_delivered_at": {
            "type": "string",
            "format": "date-time",
            "description": "Most recent changed-item digest delivery. This does not acknowledge or fulfill source work."
          },
          "next_action_digest": {
            "$ref": "#/components/schemas/OperationWorkflowNextActionDigestPolicy",
            "description": "Configured team digest filters and cadence for this subscription scope; delete and recreate the subscription to change this policy."
          },
          "business_impact_watches": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowReadinessImpactWatch"
            },
            "description": "OperationWorkflowReadinessSubscription.business_impact_watches. Retained impact observations and coverage status for configured protected results."
          },
          "playbook_evidence_watches": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPlaybookEvidenceWatch"
            },
            "description": "OperationWorkflowReadinessSubscription.playbook_evidence_watches. Durable opt-in checklist evidence monitoring, independent of readiness discovery filters."
          },
          "app_id": {
            "type": "string",
            "description": "OperationWorkflowReadinessSubscription.app_id. Application UUID; required in customer requests and omitted in account requests.",
            "format": "uuid"
          },
          "tenant_id": {
            "type": "string",
            "description": "OperationWorkflowReadinessSubscription.tenant_id. Optional account-only customer selector; customer identity derives from authentication.",
            "format": "uuid"
          },
          "scope": {
            "type": "string",
            "description": "OperationWorkflowReadinessSubscription.scope. Application environment scope.",
            "minLength": 1,
            "maxLength": 40,
            "pattern": "^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$"
          },
          "name": {
            "type": "string",
            "description": "OperationWorkflowReadinessSubscription.name. Subscription name.",
            "pattern": "^[a-z][a-z0-9-]*$",
            "minLength": 1,
            "maxLength": 63
          },
          "workflow": {
            "type": "string",
            "description": "OperationWorkflowReadinessSubscription.workflow. Optional declared workflow selector.",
            "maxLength": 63
          },
          "target_operation": {
            "type": "string",
            "description": "OperationWorkflowReadinessSubscription.target_operation. Optional transition operation selector.",
            "maxLength": 63
          },
          "owner": {
            "type": "string",
            "description": "OperationWorkflowReadinessSubscription.owner. Optional blocker or pending verification owner selector.",
            "maxLength": 128
          },
          "unassigned": {
            "type": "boolean",
            "description": "OperationWorkflowReadinessSubscription.unassigned. Select ownerless blockers or verification obligations."
          },
          "events": {
            "type": "array",
            "description": "OperationWorkflowReadinessSubscription.events. Readiness inbox event selectors; defaults to all four when omitted.",
            "minItems": 1,
            "maxItems": 4,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "description": "OperationWorkflowReadinessSubscription.events.items. Subscription event kind.",
              "enum": [
                "newly_ready",
                "newly_blocked",
                "reassigned",
                "unavailable"
              ]
            }
          },
          "id": {
            "type": "string",
            "description": "OperationWorkflowReadinessSubscription.id. Subscription UUID.",
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "description": "OperationWorkflowReadinessSubscription.created_at. Subscription creation time.",
            "format": "date-time"
          },
          "evaluated_at": {
            "type": "string",
            "description": "OperationWorkflowReadinessSubscription.evaluated_at. Most recent successful evaluation time.",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "description": "OperationWorkflowReadinessSubscription.status. Evaluation health; retrying preserves the last successful baseline.",
            "enum": [
              "active",
              "retrying"
            ]
          },
          "watched_transition_count": {
            "type": "integer",
            "description": "OperationWorkflowReadinessSubscription.watched_transition_count. Current saved edges within the 100-edge watch budget.",
            "minimum": 0,
            "maximum": 100
          },
          "coverage_incomplete": {
            "type": "boolean",
            "description": "OperationWorkflowReadinessSubscription.coverage_incomplete. Discovery, evidence previews or saved-edge capacity are incomplete; no exhaustive delivery guarantee is inferred."
          },
          "latest_sequence": {
            "type": "integer",
            "description": "OperationWorkflowReadinessSubscription.latest_sequence. Latest committed inbox sequence.",
            "format": "int64",
            "minimum": 0
          }
        },
        "required": [
          "id",
          "app_id",
          "scope",
          "name",
          "events",
          "created_at",
          "evaluated_at",
          "status",
          "watched_transition_count",
          "coverage_incomplete",
          "latest_sequence"
        ]
      },
      "OperationWorkflowReadinessSubscriptionsResponse": {
        "type": "object",
        "description": "Subscriptions in this ownership, application and environment scope.",
        "additionalProperties": false,
        "properties": {
          "items": {
            "type": "array",
            "description": "OperationWorkflowReadinessSubscriptionsResponse.items. Subscriptions ordered by creation time and identity.",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowReadinessSubscription"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "OperationWorkflowReadinessNotification": {
        "type": "object",
        "description": "Durable advisory readiness notification containing a bounded comparison and reporting Operation identities.",
        "additionalProperties": false,
        "properties": {
          "fulfillment_review_escalation": {
            "$ref": "#/components/schemas/OperationWorkflowFulfillmentReviewEscalation"
          },
          "fulfillment_review_reminder": {
            "$ref": "#/components/schemas/OperationWorkflowFulfillmentReviewReminder"
          },
          "fulfillment_review": {
            "$ref": "#/components/schemas/OperationWorkflowObligationFulfillmentReview"
          },
          "obligation_reopening": {
            "$ref": "#/components/schemas/OperationWorkflowObligationReopening"
          },
          "target_assessment": {
            "$ref": "#/components/schemas/OperationWorkflowObligationAssessment",
            "description": "Bound target prerequisite change observed by the worker; fulfillment and execution remain explicit."
          },
          "obligation_receipts": {
            "type": "array",
            "maxItems": 128,
            "description": "Server-written obligation-linked lifecycle receipts saved atomically with this source mutation; bounded history is not a complete audit log.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowObligationEvent"
            }
          },
          "obligation_receipts_truncated": {
            "type": "boolean",
            "description": "Older obligation receipts have been pruned from this source record."
          },
          "next_action_digest": {
            "$ref": "#/components/schemas/OperationWorkflowNextActionDigest",
            "description": "Immutable retained snapshots of newly qualifying or changed team actions, with links to current controls. Source records are read independently of publication."
          },
          "handoff_reassignment": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseHandoffReassignmentEvent",
            "description": "OperationWorkflowReadinessNotification.handoff_reassignment. Explicit reassignment after decline with accountable actor, reason and new acceptance requirement."
          },
          "handoff_decline": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseHandoffDeclineEvent",
            "description": "OperationWorkflowReadinessNotification.handoff_decline. Explicit immutable decline of the current handoff with accountable actor and reason."
          },
          "decision_review": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseDecisionReviewEvent",
            "description": "OperationWorkflowReadinessNotification.decision_review. Latched review requirement after the condition captured by an explicit decision changed."
          },
          "review_blockage": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseBlockageEvent",
            "description": "OperationWorkflowReadinessNotification.review_blockage. Newly observed blockers or positively verified recoveries for an active response plan."
          },
          "review_check_in": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseCheckInEvent",
            "description": "OperationWorkflowReadinessNotification.review_check_in. One-time missed response check-in with immutable plan/link/ownership context; source resolution and rescheduling fence stale publication."
          },
          "review_response": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponse",
            "description": "OperationWorkflowReadinessNotification.review_response. Explicit human response ownership, plan and check-in linked to protected-result reviews; separate from alert acknowledgment and application execution."
          },
          "business_impact": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessImpactEvent",
            "description": "OperationWorkflowReadinessNotification.business_impact. Sampled critical/overdue review transitions or source-confirmed clearance of tracked obligations; never an application business outcome assertion."
          },
          "dependency_recovery": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookDependencyRecovery"
          },
          "dependency_regression": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookDependencyRegression"
          },
          "playbook_step": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookStepAssignment"
          },
          "playbook_review": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookCompletionReview"
          },
          "playbook_review_event": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookCompletionReviewEvent"
          },
          "playbook_escalation": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookOutcomeEscalation",
            "description": "OperationWorkflowReadinessNotification.playbook_escalation. Live evidence of an assigned playbook deadline follow-up, separate from human coordination and immutable delivery evidence."
          },
          "playbook_evidence": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookEvidenceEvent",
            "description": "OperationWorkflowReadinessNotification.playbook_evidence. Durable opt-in checklist evidence monitoring, independent of readiness discovery filters."
          },
          "escalation_response": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessEscalationResponseEvent"
          },
          "outcome_escalation": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessOutcomeEscalation"
          },
          "business_outcome_watch": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessBusinessOutcomeWatch"
          },
          "business_outcome": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessBusinessOutcomeEvent"
          },
          "verification_watch": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessVerificationWatch"
          },
          "verification": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessVerificationEvent"
          },
          "coordination": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessCoordination"
          },
          "id": {
            "type": "string",
            "description": "OperationWorkflowReadinessNotification.id. Stable notification UUID.",
            "format": "uuid"
          },
          "sequence": {
            "type": "integer",
            "description": "OperationWorkflowReadinessNotification.sequence. Monotonic subscription-local delivery cursor.",
            "format": "int64",
            "minimum": 1
          },
          "kind": {
            "type": "string",
            "description": "OperationWorkflowReadinessNotification.kind. Matched subscription notification kind.",
            "enum": [
              "review_response_handoff_reassigned",
              "review_response_handoff_declined",
              "fulfillment_review_required",
              "fulfillment_review_overdue",
              "fulfillment_review_escalated",
              "obligation_reopened",
              "obligation_target_changed",
              "next_action_digest",
              "review_response_escalation_action_checked",
              "review_response_escalation_commitment_overdue",
              "review_response_handoff_acceptance_escalated",
              "review_response_handoff_acceptance_overdue",
              "review_response_decision_review_overdue",
              "review_response_decision_review_required",
              "review_response_recovered",
              "review_response_blocked",
              "review_response_check_in_overdue",
              "business_impact_changed",
              "newly_ready",
              "newly_blocked",
              "reassigned",
              "unavailable",
              "verification_verified",
              "verification_invalidated",
              "verification_unavailable",
              "outcome_achieved",
              "outcome_different_outcome",
              "outcome_unavailable",
              "outcome_deadline_reached",
              "escalation_response_overdue",
              "playbook_evidence_changed",
              "playbook_outcome_changed",
              "playbook_outcome_deadline_reached",
              "playbook_outcome_step_assigned",
              "playbook_dependency_regressed",
              "playbook_dependency_recovered"
            ]
          },
          "created_at": {
            "type": "string",
            "description": "OperationWorkflowReadinessNotification.created_at. Time the observation was converted into a notification.",
            "format": "date-time"
          },
          "explanation": {
            "type": "string",
            "description": "OperationWorkflowReadinessNotification.explanation. Human-readable change or unavailable-evaluation explanation."
          },
          "change": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessChange"
          },
          "reminder": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessDueReminder"
          }
        },
        "required": [
          "id",
          "sequence",
          "kind",
          "created_at",
          "explanation"
        ]
      },
      "OperationWorkflowReadinessInboxResponse": {
        "type": "object",
        "description": "Retained notification page with explicit cursor gaps; unchanged evaluations do not create entries.",
        "additionalProperties": false,
        "properties": {
          "subscription": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessSubscription"
          },
          "items": {
            "type": "array",
            "description": "OperationWorkflowReadinessInboxResponse.items. Notifications after the supplied sequence in ascending order.",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowReadinessNotification"
            }
          },
          "latest_sequence": {
            "type": "integer",
            "description": "OperationWorkflowReadinessInboxResponse.latest_sequence. Most recent committed subscription sequence.",
            "format": "int64",
            "minimum": 0
          },
          "next_sequence": {
            "type": "integer",
            "description": "OperationWorkflowReadinessInboxResponse.next_sequence. Cursor for the next page.",
            "format": "int64",
            "minimum": 0
          },
          "resync_required": {
            "type": "boolean",
            "description": "OperationWorkflowReadinessInboxResponse.resync_required. The supplied cursor is outside retained history; the page starts at retained entries without claiming completeness."
          },
          "has_more": {
            "type": "boolean",
            "description": "OperationWorkflowReadinessInboxResponse.has_more. More committed entries follow this page."
          }
        },
        "required": [
          "subscription",
          "items",
          "latest_sequence",
          "next_sequence",
          "resync_required",
          "has_more"
        ]
      },
      "OperationWorkflowReadinessCoordinationRequest": {
        "type": "object",
        "description": "OperationWorkflowReadinessCoordinationRequest. Shared inbox coordination with optimistic revision checks; omission of a follow-up time clears it.",
        "additionalProperties": false,
        "properties": {
          "review_coordination": {
            "$ref": "#/components/schemas/OperationWorkflowFulfillmentReviewCoordinationRequest"
          },
          "reaffirmation": {
            "$ref": "#/components/schemas/OperationWorkflowObligationReaffirmationRequest"
          },
          "reopening": {
            "$ref": "#/components/schemas/OperationWorkflowObligationReopeningRequest"
          },
          "fulfillment": {
            "$ref": "#/components/schemas/OperationWorkflowObligationFulfillmentRequest"
          },
          "target_binding": {
            "$ref": "#/components/schemas/OperationWorkflowObligationTargetRequest"
          },
          "review_response": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseRequest",
            "description": "OperationWorkflowReadinessCoordinationRequest.review_response. Explicit human response ownership, plan and check-in linked to protected-result reviews; separate from alert acknowledgment and application execution."
          },
          "completion": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessCompletionRequest"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "OperationWorkflowReadinessCoordinationRequest.revision. Shared coordination value; does not alter application evidence."
          },
          "status": {
            "type": "string",
            "enum": [
              "unread",
              "read",
              "acknowledged"
            ],
            "description": "OperationWorkflowReadinessCoordinationRequest.status. Shared coordination value; does not alter application evidence."
          },
          "owner": {
            "type": "string",
            "maxLength": 256,
            "description": "OperationWorkflowReadinessCoordinationRequest.owner. Shared coordination value; does not alter application evidence."
          },
          "note": {
            "type": "string",
            "maxLength": 1024,
            "description": "OperationWorkflowReadinessCoordinationRequest.note. Shared coordination value; does not alter application evidence."
          },
          "follow_up_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReadinessCoordinationRequest.follow_up_at. Shared coordination value; does not alter application evidence."
          }
        },
        "required": [
          "revision",
          "status",
          "owner",
          "note"
        ]
      },
      "OperationWorkflowReadinessCoordination": {
        "type": "object",
        "description": "OperationWorkflowReadinessCoordination. Shared inbox coordination with optimistic revision checks; omission of a follow-up time clears it.",
        "additionalProperties": false,
        "properties": {
          "fulfillment_review_escalations": {
            "type": "array",
            "maxItems": 128,
            "description": "Immutable escalation delivery receipts. One delivery per review ID/deadline across destination/policy edits and restoring deadlines; capacity exhaustion stops further escalation delivery for this retained source.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowFulfillmentReviewEscalation"
            }
          },
          "fulfillment_review_reminders": {
            "type": "array",
            "maxItems": 128,
            "description": "Immutable delivery receipts; each review deadline is notified once, even if restored later. At capacity no further reminders are published for this retained source.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowFulfillmentReviewReminder"
            }
          },
          "review_coordination_changes": {
            "type": "array",
            "maxItems": 128,
            "description": "Immutable review-cycle ownership/deadline changes. Capacity exhaustion rejects further writes without pruning decisions.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowFulfillmentReviewCoordinationChange"
            }
          },
          "fulfillment_reviews": {
            "type": "array",
            "maxItems": 128,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowObligationFulfillmentReview"
            }
          },
          "reaffirmations": {
            "type": "array",
            "maxItems": 128,
            "description": "Immutable human reaffirmations with fresh application evidence; capacity exhaustion rejects further writes.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowObligationReaffirmation"
            }
          },
          "reopenings": {
            "type": "array",
            "maxItems": 128,
            "description": "Retained immutable human reopening receipts. Capacity exhaustion rejects further reopening without pruning prior decisions.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowObligationReopening"
            }
          },
          "fulfillments": {
            "type": "array",
            "maxItems": 128,
            "description": "Immutable exact-case cycle fulfillment receipts. Capacity exhaustion rejects further fulfillment; receipts are never pruned into reopened work.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowObligationFulfillment"
            }
          },
          "target_bindings": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowObligationTargetBinding"
            }
          },
          "completion": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessCompletion"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "OperationWorkflowReadinessCoordination.revision. Shared coordination value; does not alter application evidence."
          },
          "status": {
            "type": "string",
            "enum": [
              "unread",
              "read",
              "acknowledged"
            ],
            "description": "OperationWorkflowReadinessCoordination.status. Shared coordination value; does not alter application evidence."
          },
          "owner": {
            "type": "string",
            "maxLength": 256,
            "description": "OperationWorkflowReadinessCoordination.owner. Shared coordination value; does not alter application evidence."
          },
          "note": {
            "type": "string",
            "maxLength": 1024,
            "description": "OperationWorkflowReadinessCoordination.note. Shared coordination value; does not alter application evidence."
          },
          "follow_up_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReadinessCoordination.follow_up_at. Shared coordination value; does not alter application evidence."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReadinessCoordination.updated_at. Shared coordination value; does not alter application evidence."
          },
          "acknowledged_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReadinessCoordination.acknowledged_at. Shared coordination value; does not alter application evidence."
          },
          "updated_by": {
            "type": "string",
            "description": "OperationWorkflowReadinessCoordination.updated_by. Shared coordination value; does not alter application evidence."
          },
          "acknowledged_by": {
            "type": "string",
            "description": "OperationWorkflowReadinessCoordination.acknowledged_by. Shared coordination value; does not alter application evidence."
          }
        },
        "required": [
          "revision",
          "status",
          "owner",
          "note",
          "updated_at",
          "updated_by"
        ]
      },
      "OperationWorkflowReadinessCompletionRequest": {
        "type": "object",
        "description": "An asserted coordination outcome. Generic completion requires a note and resolved requires retained evidence; playbook business completion captures its own current evidence. Closing does not prove business resolution.",
        "additionalProperties": false,
        "properties": {
          "playbook_review_after_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 604800,
            "description": "OperationWorkflowReadinessCompletionRequest.playbook_review_after_seconds. Optional review window after business-aware playbook completion; zero disables. Monitoring also ends with source inbox retention."
          },
          "playbook_resolution": {
            "type": "string",
            "enum": [
              "expected_outcome_achieved",
              "alternative_accepted",
              "follow_up_canceled"
            ],
            "description": "OperationWorkflowReadinessCompletionRequest.playbook_resolution. Optional business disposition for assigned playbook escalations. Expected or alternative resolutions require outcome resolved; canceled requires no_longer_applicable. Uses the frozen expectation, permits empty note and evidence IDs, and excludes extra outcome or verification watches."
          },
          "escalation_policy": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessOutcomeEscalationPolicy"
          },
          "watch_outcome": {
            "type": "boolean",
            "description": "OperationWorkflowReadinessCompletionRequest.watch_outcome. Opt in at completion to observe a pending or unknown business result; requires expected_outcome_code and a source workflow. The watch expires with source inbox retention."
          },
          "outcome_deadline_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReadinessCompletionRequest.outcome_deadline_at. Optional future UTC deadline requiring watch_outcome. The first successful due check without an observed achieved outcome emits one notice; this is not business failure or a historical deadline verdict."
          },
          "expected_outcome_code": {
            "type": "string",
            "description": "OperationWorkflowReadinessCompletionRequest.expected_outcome_code. Optional caller-selected terminal outcome slug compared with application reports for the source workflow; never defines or modifies application success rules.",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "watch_verification": {
            "type": "boolean",
            "description": "OperationWorkflowReadinessCompletionRequest.watch_verification. Opt in at completion to watch up to 16 currently pending saved resolutions; requires comparable current pending evidence."
          },
          "outcome": {
            "type": "string",
            "description": "OperationWorkflowReadinessCompletionRequest.outcome. Retained follow-up completion value; never changes application evidence.",
            "enum": [
              "resolved",
              "no_longer_applicable",
              "handed_off"
            ]
          },
          "note": {
            "type": "string",
            "description": "OperationWorkflowReadinessCompletionRequest.note. Retained follow-up completion value; never changes application evidence.",
            "minLength": 0,
            "maxLength": 1024
          },
          "evidence_operation_ids": {
            "type": "array",
            "description": "OperationWorkflowReadinessCompletionRequest.evidence_operation_ids. Retained follow-up completion value; never changes application evidence.",
            "maxItems": 8,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        },
        "required": [
          "outcome",
          "note",
          "evidence_operation_ids"
        ]
      },
      "OperationWorkflowReadinessCompletion": {
        "type": "object",
        "description": "Immutable recorded follow-up completion with server-derived actor, write time and advisory pre-write evidence check. Retained with the original notification.",
        "additionalProperties": false,
        "properties": {
          "playbook_review_after_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 604800,
            "description": "OperationWorkflowReadinessCompletion.playbook_review_after_seconds. Optional review window after business-aware playbook completion; zero disables. Monitoring also ends with source inbox retention."
          },
          "playbook_outcome": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookCompletionOutcome"
          },
          "escalation_policy": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessOutcomeEscalationPolicy"
          },
          "watch_outcome": {
            "type": "boolean",
            "description": "OperationWorkflowReadinessCompletion.watch_outcome. Opt in at completion to observe a pending or unknown business result; requires expected_outcome_code and a source workflow. The watch expires with source inbox retention."
          },
          "outcome_deadline_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReadinessCompletion.outcome_deadline_at. Optional future UTC deadline requiring watch_outcome. The first successful due check without an observed achieved outcome emits one notice; this is not business failure or a historical deadline verdict."
          },
          "expected_outcome_code": {
            "type": "string",
            "description": "OperationWorkflowReadinessCompletion.expected_outcome_code. Optional caller-selected terminal outcome slug compared with application reports for the source workflow; never defines or modifies application success rules.",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$"
          },
          "business_outcome": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessBusinessOutcome"
          },
          "watch_verification": {
            "type": "boolean",
            "description": "OperationWorkflowReadinessCompletion.watch_verification. Opt in at completion to watch up to 16 currently pending saved resolutions; requires comparable current pending evidence."
          },
          "outcome": {
            "type": "string",
            "description": "OperationWorkflowReadinessCompletion.outcome. Retained follow-up completion value; never changes application evidence.",
            "enum": [
              "resolved",
              "no_longer_applicable",
              "handed_off"
            ]
          },
          "note": {
            "type": "string",
            "description": "OperationWorkflowReadinessCompletion.note. Retained follow-up completion value; never changes application evidence.",
            "maxLength": 1024
          },
          "evidence_operation_ids": {
            "type": "array",
            "description": "OperationWorkflowReadinessCompletion.evidence_operation_ids. Retained follow-up completion value; never changes application evidence.",
            "maxItems": 8,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "completed_at": {
            "type": "string",
            "description": "OperationWorkflowReadinessCompletion.completed_at. Retained follow-up completion value; never changes application evidence.",
            "format": "date-time"
          },
          "completed_by": {
            "type": "string",
            "description": "OperationWorkflowReadinessCompletion.completed_by. Retained follow-up completion value; never changes application evidence."
          },
          "evidence": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessCompletionEvidence"
          }
        },
        "required": [
          "outcome",
          "note",
          "evidence_operation_ids",
          "completed_at",
          "completed_by",
          "evidence"
        ]
      },
      "OperationWorkflowReadinessCompletionEvidence": {
        "type": "object",
        "description": "Server-observed advisory evidence before the revision-checked completion write. Workflow reports may change after this observation. Explicit boundaries never imply readiness.",
        "additionalProperties": false,
        "properties": {
          "checked_at": {
            "type": "string",
            "description": "OperationWorkflowReadinessCompletionEvidence.checked_at. Retained follow-up completion value; never changes application evidence.",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "description": "OperationWorkflowReadinessCompletionEvidence.status. Retained follow-up completion value; never changes application evidence."
          },
          "explanation": {
            "type": "string",
            "description": "OperationWorkflowReadinessCompletionEvidence.explanation. Retained follow-up completion value; never changes application evidence."
          },
          "reporting_operation_id": {
            "type": "string",
            "description": "OperationWorkflowReadinessCompletionEvidence.reporting_operation_id. Retained follow-up completion value; never changes application evidence.",
            "format": "uuid"
          },
          "state_revision": {
            "type": "integer",
            "description": "OperationWorkflowReadinessCompletionEvidence.state_revision. Retained follow-up completion value; never changes application evidence.",
            "format": "int64"
          },
          "evidence_complete": {
            "type": "boolean",
            "description": "OperationWorkflowReadinessCompletionEvidence.evidence_complete. Retained follow-up completion value; never changes application evidence."
          },
          "remaining_reasons": {
            "type": "array",
            "description": "OperationWorkflowReadinessCompletionEvidence.remaining_reasons. Retained follow-up completion value; never changes application evidence.",
            "items": {
              "type": "string"
            }
          },
          "pending_verification_count": {
            "type": "integer",
            "description": "OperationWorkflowReadinessCompletionEvidence.pending_verification_count. Retained follow-up completion value; never changes application evidence.",
            "format": "int64"
          },
          "warnings": {
            "type": "array",
            "description": "OperationWorkflowReadinessCompletionEvidence.warnings. Retained follow-up completion value; never changes application evidence.",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "checked_at",
          "status",
          "explanation",
          "evidence_complete",
          "remaining_reasons",
          "pending_verification_count",
          "warnings"
        ]
      },
      "OperationWorkflowReadinessBusinessOutcome": {
        "type": "object",
        "description": "Advisory comparison of the expected terminal outcome with a scoped retained application report. Missing state, stale reports, contract changes, older revisions and terminal reports without outcome codes remain unknown. Explicit outcome codes do not imply causation or authorize execution. Completion snapshots are immutable; current checks are live reads.",
        "additionalProperties": false,
        "properties": {
          "expected_outcome_code": {
            "type": "string",
            "description": "OperationWorkflowReadinessBusinessOutcome.expected_outcome_code. Scoped application-reported business result relative to the caller-selected expected terminal outcome; independent of coordination completion and readiness."
          },
          "checked_at": {
            "type": "string",
            "description": "OperationWorkflowReadinessBusinessOutcome.checked_at. Scoped application-reported business result relative to the caller-selected expected terminal outcome; independent of coordination completion and readiness.",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "description": "OperationWorkflowReadinessBusinessOutcome.status. Scoped application-reported business result relative to the caller-selected expected terminal outcome; independent of coordination completion and readiness.",
            "enum": [
              "achieved",
              "pending",
              "different_outcome",
              "unknown"
            ]
          },
          "explanation": {
            "type": "string",
            "description": "OperationWorkflowReadinessBusinessOutcome.explanation. Scoped application-reported business result relative to the caller-selected expected terminal outcome; independent of coordination completion and readiness."
          },
          "reporting_operation_id": {
            "type": "string",
            "description": "OperationWorkflowReadinessBusinessOutcome.reporting_operation_id. Scoped application-reported business result relative to the caller-selected expected terminal outcome; independent of coordination completion and readiness.",
            "format": "uuid"
          },
          "report_id": {
            "type": "string",
            "description": "OperationWorkflowReadinessBusinessOutcome.report_id. Scoped application-reported business result relative to the caller-selected expected terminal outcome; independent of coordination completion and readiness.",
            "format": "uuid"
          },
          "state_revision": {
            "type": "integer",
            "description": "OperationWorkflowReadinessBusinessOutcome.state_revision. Scoped application-reported business result relative to the caller-selected expected terminal outcome; independent of coordination completion and readiness.",
            "format": "int64"
          },
          "contract_version": {
            "type": "integer",
            "description": "OperationWorkflowReadinessBusinessOutcome.contract_version. Scoped application-reported business result relative to the caller-selected expected terminal outcome; independent of coordination completion and readiness."
          },
          "state": {
            "type": "string",
            "description": "OperationWorkflowReadinessBusinessOutcome.state. Scoped application-reported business result relative to the caller-selected expected terminal outcome; independent of coordination completion and readiness."
          },
          "reported_outcome_code": {
            "type": "string",
            "description": "OperationWorkflowReadinessBusinessOutcome.reported_outcome_code. Scoped application-reported business result relative to the caller-selected expected terminal outcome; independent of coordination completion and readiness."
          },
          "reported_outcome_description": {
            "type": "string",
            "description": "OperationWorkflowReadinessBusinessOutcome.reported_outcome_description. Scoped application-reported business result relative to the caller-selected expected terminal outcome; independent of coordination completion and readiness."
          },
          "occurred_at": {
            "type": "string",
            "description": "OperationWorkflowReadinessBusinessOutcome.occurred_at. Scoped application-reported business result relative to the caller-selected expected terminal outcome; independent of coordination completion and readiness.",
            "format": "date-time"
          }
        },
        "required": [
          "expected_outcome_code",
          "checked_at",
          "status",
          "explanation"
        ]
      },
      "OperationWorkflowReadinessEscalationResponse": {
        "type": "object",
        "description": "Optional acknowledgment response target on a retained assigned escalation. Human acknowledgment fulfills it; completion or follow-up clearing stops it. A missed target emits one notice and optional guarded fallback. Assignment history retains the latest 16 changes.",
        "additionalProperties": false,
        "properties": {
          "deadline_at": {
            "type": "string",
            "description": "OperationWorkflowReadinessEscalationResponse.deadline_at. Retained acknowledgment target or assignment observation; never modifies application business reports.",
            "format": "date-time"
          },
          "initial_owner": {
            "type": "string",
            "description": "OperationWorkflowReadinessEscalationResponse.initial_owner. Retained acknowledgment target or assignment observation; never modifies application business reports."
          },
          "fallback_owner": {
            "type": "string",
            "description": "OperationWorkflowReadinessEscalationResponse.fallback_owner. Retained acknowledgment target or assignment observation; never modifies application business reports."
          },
          "status": {
            "type": "string",
            "description": "OperationWorkflowReadinessEscalationResponse.status. Retained acknowledgment target or assignment observation; never modifies application business reports.",
            "enum": [
              "awaiting",
              "acknowledged",
              "closed",
              "deadline_missed"
            ]
          },
          "first_acknowledged_at": {
            "type": "string",
            "description": "OperationWorkflowReadinessEscalationResponse.first_acknowledged_at. Retained acknowledgment target or assignment observation; never modifies application business reports.",
            "format": "date-time"
          },
          "deadline_notified_at": {
            "type": "string",
            "description": "OperationWorkflowReadinessEscalationResponse.deadline_notified_at. Retained acknowledgment target or assignment observation; never modifies application business reports.",
            "format": "date-time"
          },
          "history": {
            "type": "array",
            "description": "OperationWorkflowReadinessEscalationResponse.history. Latest retained manual or automatic assignment changes.",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowReadinessAssignmentChange"
            }
          },
          "history_truncated": {
            "type": "boolean",
            "description": "OperationWorkflowReadinessEscalationResponse.history_truncated. Retained acknowledgment target or assignment observation; never modifies application business reports."
          }
        },
        "required": [
          "deadline_at",
          "initial_owner",
          "status",
          "history",
          "history_truncated"
        ]
      },
      "OperationWorkflowReadinessAssignmentChange": {
        "type": "object",
        "description": "Retained server-recorded ownership change for an escalation response target. History is bounded and may be truncated; no business authority is granted.",
        "additionalProperties": false,
        "properties": {
          "from_owner": {
            "type": "string",
            "description": "OperationWorkflowReadinessAssignmentChange.from_owner. Retained acknowledgment target or assignment observation; never modifies application business reports."
          },
          "to_owner": {
            "type": "string",
            "description": "OperationWorkflowReadinessAssignmentChange.to_owner. Retained acknowledgment target or assignment observation; never modifies application business reports."
          },
          "at": {
            "type": "string",
            "description": "OperationWorkflowReadinessAssignmentChange.at. Retained acknowledgment target or assignment observation; never modifies application business reports.",
            "format": "date-time"
          },
          "actor": {
            "type": "string",
            "description": "OperationWorkflowReadinessAssignmentChange.actor. Retained acknowledgment target or assignment observation; never modifies application business reports."
          },
          "reason": {
            "type": "string",
            "description": "OperationWorkflowReadinessAssignmentChange.reason. Retained acknowledgment target or assignment observation; never modifies application business reports.",
            "enum": [
              "manual_assignment",
              "response_deadline_fallback",
              "step_assignment"
            ]
          }
        },
        "required": [
          "from_owner",
          "to_owner",
          "at",
          "actor",
          "reason"
        ]
      },
      "OperationWorkflowReadinessEscalationResponseEvent": {
        "type": "object",
        "description": "Single durable acknowledgment-deadline notice for an assigned escalation, with exact scoped source identity. Does not automatically schedule a second follow-up or indicate business failure.",
        "additionalProperties": false,
        "properties": {
          "business_impact": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessImpactEvent",
            "description": "OperationWorkflowReadinessEscalationResponseEvent.business_impact. Original protected-result alert context, without a new response target or fabricated transition baseline."
          },
          "escalation_notification_id": {
            "type": "string",
            "description": "OperationWorkflowReadinessEscalationResponseEvent.escalation_notification_id. Retained acknowledgment target or assignment observation; never modifies application business reports.",
            "format": "uuid"
          },
          "escalation_sequence": {
            "type": "integer",
            "description": "OperationWorkflowReadinessEscalationResponseEvent.escalation_sequence. Retained acknowledgment target or assignment observation; never modifies application business reports.",
            "format": "int64",
            "minimum": 1
          },
          "source": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessSnapshotEntry"
          },
          "playbook": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookEvidenceEvent"
          },
          "checked_at": {
            "type": "string",
            "description": "OperationWorkflowReadinessEscalationResponseEvent.checked_at. Retained acknowledgment target or assignment observation; never modifies application business reports.",
            "format": "date-time"
          },
          "deadline_at": {
            "type": "string",
            "description": "OperationWorkflowReadinessEscalationResponseEvent.deadline_at. Retained acknowledgment target or assignment observation; never modifies application business reports.",
            "format": "date-time"
          },
          "owner": {
            "type": "string",
            "description": "OperationWorkflowReadinessEscalationResponseEvent.owner. Retained acknowledgment target or assignment observation; never modifies application business reports."
          },
          "reassigned": {
            "type": "boolean",
            "description": "OperationWorkflowReadinessEscalationResponseEvent.reassigned. Retained acknowledgment target or assignment observation; never modifies application business reports."
          }
        },
        "required": [
          "escalation_notification_id",
          "escalation_sequence",
          "checked_at",
          "deadline_at",
          "owner",
          "reassigned"
        ]
      },
      "OperationWorkflowReadinessOutcomeEscalationPolicy": {
        "type": "object",
        "description": "Opt-in deadline escalation policy frozen at completion. Requires an outcome watch and future outcome deadline. Schedules one assigned follow-up on the deadline notification; never executes business actions.",
        "additionalProperties": false,
        "properties": {
          "acknowledge_after_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 604800,
            "description": "OperationWorkflowReadinessOutcomeEscalationPolicy.acknowledge_after_seconds. Optional positive response target from escalation delivery; zero or omission disables it. Bounded to one week."
          },
          "fallback_owner": {
            "type": "string",
            "maxLength": 256,
            "description": "OperationWorkflowReadinessOutcomeEscalationPolicy.fallback_owner. Optional different owner label requiring a response target. Applied once only to open unacknowledged escalation with unchanged original ownership and no assignment history."
          },
          "owner": {
            "type": "string",
            "description": "OperationWorkflowReadinessOutcomeEscalationPolicy.owner. Retained coordination escalation policy or evidence; business interpretation and execution remain application-owned.",
            "minLength": 1,
            "maxLength": 256
          },
          "note": {
            "type": "string",
            "description": "OperationWorkflowReadinessOutcomeEscalationPolicy.note. Retained coordination escalation policy or evidence; business interpretation and execution remain application-owned.",
            "maxLength": 1024
          },
          "follow_up_after_seconds": {
            "type": "integer",
            "description": "OperationWorkflowReadinessOutcomeEscalationPolicy.follow_up_after_seconds. Retained coordination escalation policy or evidence; business interpretation and execution remain application-owned.",
            "format": "int64",
            "minimum": 1,
            "maximum": 604800
          }
        },
        "required": [
          "owner",
          "follow_up_after_seconds"
        ]
      },
      "OperationWorkflowReadinessOutcomeEscalationReference": {
        "type": "object",
        "description": "Reference to the single retained escalation notification in the same subscription. Pruning does not recreate escalations; links may expire.",
        "additionalProperties": false,
        "properties": {
          "notification_id": {
            "type": "string",
            "description": "OperationWorkflowReadinessOutcomeEscalationReference.notification_id. Retained coordination escalation policy or evidence; business interpretation and execution remain application-owned.",
            "format": "uuid"
          },
          "sequence": {
            "type": "integer",
            "description": "OperationWorkflowReadinessOutcomeEscalationReference.sequence. Retained coordination escalation policy or evidence; business interpretation and execution remain application-owned.",
            "format": "int64",
            "minimum": 1
          },
          "created_at": {
            "type": "string",
            "description": "OperationWorkflowReadinessOutcomeEscalationReference.created_at. Retained coordination escalation policy or evidence; business interpretation and execution remain application-owned.",
            "format": "date-time"
          }
        },
        "required": [
          "notification_id",
          "sequence",
          "created_at"
        ]
      },
      "OperationWorkflowReadinessOutcomeEscalation": {
        "type": "object",
        "description": "Live evidence for an assigned outcome escalation, separate from immutable deadline delivery evidence and human coordination. First observed application success is retained as a flag; it never automatically acknowledges or completes work. Monitoring ends with source retention.",
        "additionalProperties": false,
        "properties": {
          "response": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessEscalationResponse"
          },
          "watch_id": {
            "type": "string",
            "description": "OperationWorkflowReadinessOutcomeEscalation.watch_id. Retained coordination escalation policy or evidence; business interpretation and execution remain application-owned.",
            "format": "uuid"
          },
          "source_notification_id": {
            "type": "string",
            "description": "OperationWorkflowReadinessOutcomeEscalation.source_notification_id. Retained coordination escalation policy or evidence; business interpretation and execution remain application-owned.",
            "format": "uuid"
          },
          "source_sequence": {
            "type": "integer",
            "description": "OperationWorkflowReadinessOutcomeEscalation.source_sequence. Retained coordination escalation policy or evidence; business interpretation and execution remain application-owned.",
            "format": "int64",
            "minimum": 1
          },
          "current": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessBusinessOutcome"
          },
          "success_observed_at": {
            "type": "string",
            "description": "OperationWorkflowReadinessOutcomeEscalation.success_observed_at. Retained coordination escalation policy or evidence; business interpretation and execution remain application-owned.",
            "format": "date-time"
          }
        },
        "required": [
          "watch_id",
          "source_notification_id",
          "source_sequence",
          "current"
        ]
      },
      "OperationWorkflowReadinessBusinessOutcomeWatch": {
        "type": "object",
        "description": "Retained opt-in watch for one source completion business criterion. Current observations remain advisory; deadlines are notified once and unchanged status is suppressed. Source inbox retention and subscription deletion end monitoring.",
        "additionalProperties": false,
        "properties": {
          "escalation": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessOutcomeEscalationReference"
          },
          "escalation_policy": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessOutcomeEscalationPolicy"
          },
          "id": {
            "type": "string",
            "description": "OperationWorkflowReadinessBusinessOutcomeWatch.id. Retained advisory business outcome watch metadata; does not modify application reports or coordination revisions.",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "description": "OperationWorkflowReadinessBusinessOutcomeWatch.revision. Retained advisory business outcome watch metadata; does not modify application reports or coordination revisions.",
            "format": "int64"
          },
          "state_revision": {
            "type": "integer",
            "description": "OperationWorkflowReadinessBusinessOutcomeWatch.state_revision. Retained advisory business outcome watch metadata; does not modify application reports or coordination revisions.",
            "format": "int64"
          },
          "started_at": {
            "type": "string",
            "description": "OperationWorkflowReadinessBusinessOutcomeWatch.started_at. Retained advisory business outcome watch metadata; does not modify application reports or coordination revisions.",
            "format": "date-time"
          },
          "deadline_at": {
            "type": "string",
            "description": "OperationWorkflowReadinessBusinessOutcomeWatch.deadline_at. Retained advisory business outcome watch metadata; does not modify application reports or coordination revisions.",
            "format": "date-time"
          },
          "deadline_notified": {
            "type": "boolean",
            "description": "OperationWorkflowReadinessBusinessOutcomeWatch.deadline_notified. Retained advisory business outcome watch metadata; does not modify application reports or coordination revisions."
          },
          "last_notified_status": {
            "type": "string",
            "description": "OperationWorkflowReadinessBusinessOutcomeWatch.last_notified_status. Retained advisory business outcome watch metadata; does not modify application reports or coordination revisions.",
            "enum": [
              "achieved",
              "pending",
              "different_outcome",
              "unknown"
            ]
          },
          "current": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessBusinessOutcome"
          }
        },
        "required": [
          "id",
          "revision",
          "state_revision",
          "started_at",
          "deadline_notified",
          "current"
        ]
      },
      "OperationWorkflowReadinessBusinessOutcomeEvent": {
        "type": "object",
        "description": "Self-contained observed business result or deadline notice for a source completion. Reports never establish causation, business failure or execution authority. Source links may expire from inbox retention.",
        "additionalProperties": false,
        "properties": {
          "escalation": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessOutcomeEscalationReference"
          },
          "watch_id": {
            "type": "string",
            "description": "OperationWorkflowReadinessBusinessOutcomeEvent.watch_id. Retained advisory business outcome watch metadata; does not modify application reports or coordination revisions.",
            "format": "uuid"
          },
          "source_notification_id": {
            "type": "string",
            "description": "OperationWorkflowReadinessBusinessOutcomeEvent.source_notification_id. Retained advisory business outcome watch metadata; does not modify application reports or coordination revisions.",
            "format": "uuid"
          },
          "source_sequence": {
            "type": "integer",
            "description": "OperationWorkflowReadinessBusinessOutcomeEvent.source_sequence. Retained advisory business outcome watch metadata; does not modify application reports or coordination revisions.",
            "format": "int64"
          },
          "source": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessSnapshotEntry"
          },
          "previous_status": {
            "type": "string",
            "description": "OperationWorkflowReadinessBusinessOutcomeEvent.previous_status. Retained advisory business outcome watch metadata; does not modify application reports or coordination revisions.",
            "enum": [
              "achieved",
              "pending",
              "different_outcome",
              "unknown"
            ]
          },
          "deadline_at": {
            "type": "string",
            "description": "OperationWorkflowReadinessBusinessOutcomeEvent.deadline_at. Retained advisory business outcome watch metadata; does not modify application reports or coordination revisions.",
            "format": "date-time"
          },
          "current": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessBusinessOutcome"
          }
        },
        "required": [
          "watch_id",
          "source_notification_id",
          "source_sequence",
          "source",
          "previous_status",
          "current"
        ]
      },
      "OperationWorkflowReadinessVerificationWatch": {
        "type": "object",
        "description": "Opt-in watch of captured resolution identities. Verified proofs remain observed for later loss or explicit blocker reopening; partial coverage and source inbox retention remain explicit.",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "description": "OperationWorkflowReadinessVerificationWatch.id. Server-managed advisory verification observation for the retained source completion.",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "description": "OperationWorkflowReadinessVerificationWatch.revision. Server-managed advisory verification observation for the retained source completion.",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "started_at": {
            "type": "string",
            "description": "OperationWorkflowReadinessVerificationWatch.started_at. Server-managed advisory verification observation for the retained source completion.",
            "format": "date-time"
          },
          "evaluated_at": {
            "type": "string",
            "description": "OperationWorkflowReadinessVerificationWatch.evaluated_at. Server-managed advisory verification observation for the retained source completion.",
            "format": "date-time"
          },
          "state_revision": {
            "type": "integer",
            "description": "OperationWorkflowReadinessVerificationWatch.state_revision. Server-managed advisory verification observation for the retained source completion.",
            "format": "int64",
            "minimum": 1
          },
          "contract_version": {
            "type": "integer",
            "description": "OperationWorkflowReadinessVerificationWatch.contract_version. Server-managed advisory verification observation for the retained source completion.",
            "minimum": 1
          },
          "pending_count_at_start": {
            "type": "integer",
            "description": "OperationWorkflowReadinessVerificationWatch.pending_count_at_start. Server-managed advisory verification observation for the retained source completion.",
            "format": "int64",
            "minimum": 1
          },
          "coverage_incomplete": {
            "type": "boolean",
            "description": "OperationWorkflowReadinessVerificationWatch.coverage_incomplete. Server-managed advisory verification observation for the retained source completion."
          },
          "items": {
            "type": "array",
            "description": "OperationWorkflowReadinessVerificationWatch.items. Server-managed advisory verification observation for the retained source completion.",
            "minItems": 1,
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowReadinessVerificationWatchItem"
            }
          }
        },
        "required": [
          "id",
          "revision",
          "started_at",
          "evaluated_at",
          "state_revision",
          "contract_version",
          "pending_count_at_start",
          "coverage_incomplete",
          "items"
        ]
      },
      "OperationWorkflowReadinessVerificationWatchItem": {
        "type": "object",
        "description": "Saved resolution identity and latest watch disposition. Missing proof is unavailable; invalidated means an explicit later application report reopened the blocker. Proof is the last retained observation, not current readiness.",
        "additionalProperties": false,
        "properties": {
          "blocker_active": {
            "type": "boolean",
            "description": "OperationWorkflowReadinessVerificationWatchItem.blocker_active. Whether the blocker was present at the last comparable observation; an existing active blocker is not a new reopening."
          },
          "key": {
            "type": "string",
            "description": "OperationWorkflowReadinessVerificationWatchItem.key. Server-managed advisory verification observation for the retained source completion.",
            "pattern": "^[a-f0-9]{64}$"
          },
          "status": {
            "type": "string",
            "description": "OperationWorkflowReadinessVerificationWatchItem.status. Server-managed advisory verification observation for the retained source completion.",
            "enum": [
              "awaiting_verification",
              "verified",
              "invalidated",
              "unavailable"
            ]
          },
          "explanation": {
            "type": "string",
            "description": "OperationWorkflowReadinessVerificationWatchItem.explanation. Server-managed advisory verification observation for the retained source completion."
          },
          "reporting_revision": {
            "type": "integer",
            "format": "int64",
            "description": "OperationWorkflowReadinessVerificationWatchItem.reporting_revision. Exact state-report revision observed for the reporting or invalidating Operation."
          },
          "reporting_operation_id": {
            "type": "string",
            "description": "OperationWorkflowReadinessVerificationWatchItem.reporting_operation_id. Server-managed advisory verification observation for the retained source completion.",
            "format": "uuid"
          },
          "proof": {
            "$ref": "#/components/schemas/OperationWorkflowResolutionVerification"
          }
        },
        "required": [
          "blocker_active",
          "key",
          "status",
          "explanation",
          "proof"
        ]
      },
      "OperationWorkflowReadinessVerificationChange": {
        "type": "object",
        "description": "A changed disposition of one captured resolution, delivered once for an observed status change.",
        "additionalProperties": false,
        "properties": {
          "before_status": {
            "type": "string",
            "description": "OperationWorkflowReadinessVerificationChange.before_status. Server-managed advisory verification observation for the retained source completion.",
            "enum": [
              "awaiting_verification",
              "verified",
              "invalidated",
              "unavailable"
            ]
          },
          "after": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessVerificationWatchItem"
          }
        },
        "required": [
          "before_status",
          "after"
        ]
      },
      "OperationWorkflowReadinessVerificationEvent": {
        "type": "object",
        "description": "Durable in-app notification linked to its original completion watch. Source describes the original notification edge; verified does not imply workflow readiness or execution authority.",
        "additionalProperties": false,
        "properties": {
          "watch_id": {
            "type": "string",
            "description": "OperationWorkflowReadinessVerificationEvent.watch_id. Server-managed advisory verification observation for the retained source completion.",
            "format": "uuid"
          },
          "source_notification_id": {
            "type": "string",
            "description": "OperationWorkflowReadinessVerificationEvent.source_notification_id. Server-managed advisory verification observation for the retained source completion.",
            "format": "uuid"
          },
          "source_sequence": {
            "type": "integer",
            "description": "OperationWorkflowReadinessVerificationEvent.source_sequence. Server-managed advisory verification observation for the retained source completion.",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "checked_at": {
            "type": "string",
            "description": "OperationWorkflowReadinessVerificationEvent.checked_at. Server-managed advisory verification observation for the retained source completion.",
            "format": "date-time"
          },
          "source": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessSnapshotEntry"
          },
          "changes": {
            "type": "array",
            "description": "OperationWorkflowReadinessVerificationEvent.changes. Server-managed advisory verification observation for the retained source completion.",
            "minItems": 1,
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowReadinessVerificationChange"
            }
          }
        },
        "required": [
          "watch_id",
          "source_notification_id",
          "source_sequence",
          "checked_at",
          "source",
          "changes"
        ]
      },
      "OperationWorkflowReadinessHandoff": {
        "type": "object",
        "description": "Advisory handoff context for the same checked workflow observation; scheduling-time evidence is not retained.",
        "additionalProperties": false,
        "properties": {
          "summary": {
            "type": "string",
            "description": "OperationWorkflowReadinessHandoff.summary. Explanation of the current observation or unavailable evidence."
          },
          "baseline_evaluated_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReadinessHandoff.baseline_evaluated_at. Original notification comparison observation time."
          },
          "comparable": {
            "type": "boolean",
            "description": "OperationWorkflowReadinessHandoff.comparable. Whether current requirements can be shown without crossing a comparison boundary."
          },
          "limitations": {
            "type": "array",
            "description": "OperationWorkflowReadinessHandoff.limitations. Explicit retained-evidence and advisory authority limitations.",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "summary",
          "comparable",
          "limitations"
        ]
      },
      "OperationWorkflowReadinessNotificationCheck": {
        "type": "object",
        "description": "Current advisory evidence check preserving the original notification. Global failures remain unavailable.",
        "additionalProperties": false,
        "properties": {
          "next_action_digest": {
            "$ref": "#/components/schemas/OperationWorkflowNextActionDigestCheck"
          },
          "business_outcome": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessBusinessOutcome"
          },
          "handoff": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessHandoff"
          },
          "notification": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessNotification"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReadinessNotificationCheck.checked_at. Current check time."
          },
          "status": {
            "type": "string",
            "description": "OperationWorkflowReadinessNotificationCheck.status. Digest_checked for per-item source reconciliation; ready or blocked only for a comparable retained edge; otherwise the explicit comparison boundary status."
          },
          "change": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessChange"
          }
        },
        "required": [
          "handoff",
          "notification",
          "checked_at",
          "status"
        ]
      },
      "OperationWorkflowReadinessFollowUpOptions": {
        "type": "object",
        "description": "Selectors for the live retained follow-up queue; offset pages may move as coordination is edited.",
        "additionalProperties": false,
        "properties": {
          "view": {
            "type": "string",
            "enum": [
              "follow_ups",
              "next_actions"
            ],
            "description": "Default follow-up view or cross-case next-action rows. Next-action view uses action owners and deadlines and rejects reminder/business-impact selectors."
          },
          "action_kind": {
            "type": "string",
            "description": "Exact next-action kind; requires view=next_actions."
          },
          "action_trigger": {
            "type": "string",
            "enum": [
              "human",
              "automatic",
              "suggested"
            ],
            "description": "Action trigger selector; requires view=next_actions."
          },
          "impact_priority": {
            "type": "string",
            "enum": [
              "normal",
              "high",
              "critical"
            ],
            "description": "OperationWorkflowReadinessFollowUpOptions.impact_priority. Exact unresolved review priority filter."
          },
          "impact_kind": {
            "type": "string",
            "enum": [
              "milestone",
              "outcome"
            ],
            "description": "OperationWorkflowReadinessFollowUpOptions.impact_kind. Exact protected business result category."
          },
          "impact_code": {
            "type": "string",
            "maxLength": 64,
            "description": "OperationWorkflowReadinessFollowUpOptions.impact_code. Exact protected result code, requires impact_kind."
          },
          "sort": {
            "type": "string",
            "enum": [
              "due",
              "business_impact"
            ],
            "description": "OperationWorkflowReadinessFollowUpOptions.sort. Due by default; business_impact orders overdue first, then declared unresolved review priority and due time before pagination."
          },
          "app_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowReadinessFollowUpOptions.app_id. Follow-up queue selector; customer tenant derives from authentication."
          },
          "tenant_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowReadinessFollowUpOptions.tenant_id. Follow-up queue selector; customer tenant derives from authentication."
          },
          "scope": {
            "type": "string",
            "description": "OperationWorkflowReadinessFollowUpOptions.scope. Follow-up queue selector; customer tenant derives from authentication."
          },
          "owner": {
            "type": "string",
            "maxLength": 256,
            "description": "OperationWorkflowReadinessFollowUpOptions.owner. Follow-up queue selector; customer tenant derives from authentication."
          },
          "workflow": {
            "type": "string",
            "maxLength": 63,
            "description": "OperationWorkflowReadinessFollowUpOptions.workflow. Follow-up queue selector; customer tenant derives from authentication."
          },
          "due": {
            "type": "string",
            "enum": [
              "all",
              "overdue",
              "upcoming"
            ],
            "description": "OperationWorkflowReadinessFollowUpOptions.due. Follow-up queue selector; customer tenant derives from authentication."
          },
          "offset": {
            "type": "integer",
            "minimum": 0,
            "maximum": 278000,
            "description": "OperationWorkflowReadinessFollowUpOptions.offset. Follow-up queue selector; customer tenant derives from authentication."
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "description": "OperationWorkflowReadinessFollowUpOptions.limit. Follow-up queue selector; customer tenant derives from authentication."
          },
          "reminder_only": {
            "type": "boolean",
            "description": "OperationWorkflowReadinessFollowUpOptions.reminder_only. Select only active published due reminders; defaults to false."
          }
        },
        "required": [
          "scope"
        ]
      },
      "OperationWorkflowReadinessFollowUp": {
        "type": "object",
        "description": "Compact pending follow-up with original inbox references; no application readiness is inferred.",
        "additionalProperties": false,
        "properties": {
          "attention_due_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReadinessFollowUp.attention_due_at. Earlier of human check-in and active decision revalidation deadline, used for queue ordering and overdue filters; coordination remains unchanged."
          },
          "review_response": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponse",
            "description": "OperationWorkflowReadinessFollowUp.review_response. Explicit human response ownership, plan and check-in linked to protected-result reviews; separate from alert acknowledgment and application execution."
          },
          "business_impact": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessImpactEvent",
            "description": "OperationWorkflowReadinessFollowUp.business_impact. Aggregate alert context and its acknowledgment target; no individual subject or transition is inferred."
          },
          "playbook_step": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookStepAssignment"
          },
          "playbook_escalation": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookOutcomeEscalation",
            "description": "OperationWorkflowReadinessFollowUp.playbook_escalation. Live evidence of an assigned playbook deadline follow-up, separate from human coordination and immutable delivery evidence."
          },
          "outcome_escalation": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessOutcomeEscalation"
          },
          "subscription_id": {
            "type": "string",
            "description": "OperationWorkflowReadinessFollowUp.subscription_id. Retained notification or subscription identity; tenant fields are account-only.",
            "format": "uuid"
          },
          "subscription_name": {
            "type": "string",
            "description": "OperationWorkflowReadinessFollowUp.subscription_name. Retained notification or subscription identity; tenant fields are account-only."
          },
          "subscription_tenant_id": {
            "type": "string",
            "description": "OperationWorkflowReadinessFollowUp.subscription_tenant_id. Retained notification or subscription identity; tenant fields are account-only.",
            "format": "uuid"
          },
          "platform_tenant_id": {
            "type": "string",
            "description": "OperationWorkflowReadinessFollowUp.platform_tenant_id. Retained notification or subscription identity; tenant fields are account-only.",
            "format": "uuid"
          },
          "scope": {
            "type": "string",
            "description": "OperationWorkflowReadinessFollowUp.scope. Retained notification or subscription identity; tenant fields are account-only."
          },
          "notification_id": {
            "type": "string",
            "description": "OperationWorkflowReadinessFollowUp.notification_id. Retained notification or subscription identity; tenant fields are account-only.",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "description": "OperationWorkflowReadinessFollowUp.kind. Retained notification or subscription identity; tenant fields are account-only."
          },
          "workflow": {
            "type": "string",
            "description": "OperationWorkflowReadinessFollowUp.workflow. Retained notification or subscription identity; tenant fields are account-only."
          },
          "instance_id": {
            "type": "string",
            "description": "OperationWorkflowReadinessFollowUp.instance_id. Retained notification or subscription identity; tenant fields are account-only."
          },
          "operation": {
            "type": "string",
            "description": "OperationWorkflowReadinessFollowUp.operation. Retained notification or subscription identity; tenant fields are account-only."
          },
          "from_state": {
            "type": "string",
            "description": "OperationWorkflowReadinessFollowUp.from_state. Retained notification or subscription identity; tenant fields are account-only."
          },
          "to_state": {
            "type": "string",
            "description": "OperationWorkflowReadinessFollowUp.to_state. Retained notification or subscription identity; tenant fields are account-only."
          },
          "sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "OperationWorkflowReadinessFollowUp.sequence. Subscription-local notification sequence used for edits and evidence checks."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReadinessFollowUp.created_at. Original notification creation time."
          },
          "coordination": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessCoordination"
          },
          "subject": {
            "$ref": "#/components/schemas/OperationSubject"
          },
          "overdue": {
            "type": "boolean",
            "description": "OperationWorkflowReadinessFollowUp.overdue. Follow-up time is at or before this response evaluation clock."
          },
          "reminder": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessDueReminder"
          }
        },
        "required": [
          "subscription_id",
          "subscription_name",
          "scope",
          "notification_id",
          "sequence",
          "kind",
          "created_at",
          "coordination",
          "overdue"
        ]
      },
      "OperationWorkflowReviewResponseBlockageEvent": {
        "type": "object",
        "description": "Sampled blocker changes and positively verified recoveries for a linked response plan. Recovery does not resolve the response or establish a business result.",
        "additionalProperties": false,
        "properties": {
          "source_notification_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowReviewResponseBlockageEvent.source_notification_id. Original response alert identity."
          },
          "source_sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "OperationWorkflowReviewResponseBlockageEvent.source_sequence. Original response alert sequence within this inbox."
          },
          "checked_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseBlockageEvent.checked_at. Case observation time."
          },
          "cleared_blockers": {
            "type": "array",
            "description": "OperationWorkflowReviewResponseBlockageEvent.cleared_blockers. Previously observed blockers positively verified as cleared; unavailable sources and changed failure reasons cannot establish recovery.",
            "items": {
              "type": "string"
            }
          },
          "added_blockers": {
            "type": "array",
            "description": "OperationWorkflowReviewResponseBlockageEvent.added_blockers. Newly observed blockers labeled by fixed linked review position; first observations are silent.",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "source_notification_id",
          "source_sequence",
          "checked_at",
          "added_blockers"
        ]
      },
      "OperationWorkflowReviewResponseCheckInEvent": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowReviewResponseCheckInEvent. Frozen response plan, linked reviews and routing at one missed check-in, separate from business outcome and alert acknowledgment.",
        "required": [
          "source_notification_id",
          "source_sequence",
          "checked_at",
          "check_in_at",
          "previous_owner",
          "owner",
          "reassigned",
          "response"
        ],
        "properties": {
          "source_notification_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowReviewResponseCheckInEvent.source_notification_id. Original risk alert identity."
          },
          "source_sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "OperationWorkflowReviewResponseCheckInEvent.source_sequence. Original alert sequence within this inbox."
          },
          "checked_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseCheckInEvent.checked_at. Periodic evaluation time."
          },
          "check_in_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseCheckInEvent.check_in_at. Original missed response check-in; handoff does not reset it."
          },
          "previous_owner": {
            "type": "string",
            "description": "OperationWorkflowReviewResponseCheckInEvent.previous_owner. Response owner before the overdue check."
          },
          "owner": {
            "type": "string",
            "description": "OperationWorkflowReviewResponseCheckInEvent.owner. Effective responsible team after guarded fallback."
          },
          "reassigned": {
            "type": "boolean",
            "description": "OperationWorkflowReviewResponseCheckInEvent.reassigned. Whether guarded fallback changed both response responsibility and inbox ownership."
          },
          "response": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponse",
            "description": "OperationWorkflowReviewResponseCheckInEvent.response. Immutable response snapshot with its plan, links and bounded change history. This is informational context, not a new editable response."
          }
        }
      },
      "OperationWorkflowReviewResponseDecisionRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Explicit advisory continue, revise or pause decision on an existing active response. Saving re-observes scoped sources and checks the reviewed health digest again under the notification lock.",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "continue",
              "revise",
              "pause"
            ],
            "description": "OperationWorkflowReviewResponseDecisionRequest.kind. Human intent; pause keeps check-ins active and does not stop application execution."
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "description": "OperationWorkflowReviewResponseDecisionRequest.reason. Nonblank UTF-8 explanation up to 1024 bytes; line breaks and tabs allowed."
          },
          "health_fingerprint": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "OperationWorkflowReviewResponseDecisionRequest.health_fingerprint. Digest from the sampled health the operator reviewed; absent, legacy or changed observations conflict."
          }
        },
        "required": [
          "kind",
          "reason",
          "health_fingerprint"
        ]
      },
      "OperationWorkflowReviewResponseDecisionReview": {
        "type": "object",
        "additionalProperties": false,
        "description": "First changed observation for one explicit response decision. Remains latched until a new explicit decision; ordinary edits, acknowledgment and subsequent recovery do not clear it.",
        "properties": {
          "escalation_acknowledgment": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseEscalationAcknowledgment",
            "description": "OperationWorkflowReviewResponseDecisionReview.escalation_acknowledgment. Explicit escalation coordination commitment, separate from handoff acceptance and decision revalidation."
          },
          "acceptance_escalation_owner": {
            "type": "string",
            "maxLength": 256,
            "description": "OperationWorkflowReviewResponseDecisionReview.acceptance_escalation_owner. Escalation destination pinned at the actual handoff. Missing legacy destinations are not retroactively assigned; a destination equal to current ownership receives only the ordinary overdue notice."
          },
          "acceptance_escalated_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseDecisionReview.acceptance_escalated_at. One-time escalation delivery marker committed atomically with the overdue marker and both inbox notices. Reset only by a new handoff."
          },
          "handed_off_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseDecisionReview.handed_off_at. Current handoff timestamp; required by acceptance and decline after manual reassignment. Legacy automatic handoffs can omit it."
          },
          "reassignment": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseHandoffReassignment",
            "description": "OperationWorkflowReviewResponseDecisionReview.reassignment. Explicit reassignment after decline with accountable actor, reason and new acceptance requirement."
          },
          "reassignment_required": {
            "type": "boolean",
            "description": "OperationWorkflowReviewResponseDecisionReview.reassignment_required. Declining team still owns the unresolved review; manual owner reassignment clears this flag without erasing decline history."
          },
          "decline": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseHandoffDecline",
            "description": "OperationWorkflowReviewResponseDecisionReview.decline. Explicit immutable decline of the current handoff with accountable actor and reason."
          },
          "acceptance_due_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseDecisionReview.acceptance_due_at. Acceptance deadline pinned from the actual handoff time and effective window, separate from the unchanged decision-review deadline."
          },
          "acceptance_deadline_notified_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseDecisionReview.acceptance_deadline_notified_at. One-time unaccepted handoff alert marker, independent of notification acknowledgment."
          },
          "acceptance": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseHandoffAcceptance",
            "description": "OperationWorkflowReviewResponseDecisionReview.acceptance. Explicit acceptance for the current handed-off review, separate from notification acknowledgment and decision revalidation."
          },
          "initial_owner": {
            "type": "string",
            "description": "OperationWorkflowReviewResponseDecisionReview.initial_owner. Team responsible when this review episode began; unknown legacy ownership prevents automatic handoff."
          },
          "owner_changed": {
            "type": "boolean",
            "description": "OperationWorkflowReviewResponseDecisionReview.owner_changed. Ownership changed during this episode, including a move away and back; prevents automatic handoff."
          },
          "fallback_owner": {
            "type": "string",
            "description": "OperationWorkflowReviewResponseDecisionReview.fallback_owner. Distinct fallback team pinned when this episode began; future policy edits do not rewrite it."
          },
          "previous_owner": {
            "type": "string",
            "description": "OperationWorkflowReviewResponseDecisionReview.previous_owner. Responsible team immediately before the deadline evaluation."
          },
          "owner": {
            "type": "string",
            "description": "OperationWorkflowReviewResponseDecisionReview.owner. Responsible team after the deadline evaluation, whether handoff occurred or was protected."
          },
          "reassigned": {
            "type": "boolean",
            "description": "OperationWorkflowReviewResponseDecisionReview.reassigned. Whether the overdue evaluation transferred both response and inbox ownership."
          },
          "due_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseDecisionReview.due_at. Immutable deadline pinned from required_at and the response review window; legacy flags are backfilled."
          },
          "deadline_notified_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseDecisionReview.deadline_notified_at. One-time overdue alert marker; acknowledgment and ordinary edits do not fulfill revalidation."
          },
          "decision_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseDecisionReview.decision_at. Time of the decision that needs revalidation."
          },
          "required_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseDecisionReview.required_at. First sampled condition change, committed with its one-time inbox alert."
          },
          "changes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "OperationWorkflowReviewResponseDecisionReview.changes. Differences from the immutable reviewed snapshot, including unavailable sources without claiming business failure."
          },
          "health": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseHealth",
            "description": "OperationWorkflowReviewResponseDecisionReview.health. Frozen first changed health observation; live response health may continue changing."
          }
        },
        "required": [
          "decision_at",
          "required_at",
          "changes",
          "health"
        ]
      },
      "OperationWorkflowReviewResponseDecisionReviewEvent": {
        "type": "object",
        "additionalProperties": false,
        "description": "One durable revalidation alert per explicit decision, routed to the current response owner without changing intent, deadlines or application execution.",
        "properties": {
          "source_notification_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowReviewResponseDecisionReviewEvent.source_notification_id. Original risk alert identity."
          },
          "source_sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "OperationWorkflowReviewResponseDecisionReviewEvent.source_sequence. Original alert sequence in this inbox."
          },
          "decision": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseDecision",
            "description": "OperationWorkflowReviewResponseDecisionReviewEvent.decision. Immutable prior human intent and reviewed condition."
          },
          "review": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseDecisionReview",
            "description": "OperationWorkflowReviewResponseDecisionReviewEvent.review. First changed condition and its differences."
          }
        },
        "required": [
          "source_notification_id",
          "source_sequence",
          "decision",
          "review"
        ]
      },
      "OperationWorkflowReviewResponseDecision": {
        "type": "object",
        "additionalProperties": false,
        "description": "Immutable human decision with accountable actor and the reviewed health snapshot. Application execution remains application-owned.",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "continue",
              "revise",
              "pause"
            ],
            "description": "OperationWorkflowReviewResponseDecision.kind. Recorded human intent."
          },
          "reason": {
            "type": "string",
            "description": "OperationWorkflowReviewResponseDecision.reason. Operator explanation."
          },
          "owner": {
            "type": "string",
            "description": "OperationWorkflowReviewResponseDecision.owner. Responsible team at decision time."
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseDecision.at. Server decision time."
          },
          "actor": {
            "type": "string",
            "description": "OperationWorkflowReviewResponseDecision.actor. Authenticated operator who saved the decision."
          },
          "health": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseHealth",
            "description": "OperationWorkflowReviewResponseDecision.health. Immutable reviewed snapshot including original freshness timestamps."
          }
        },
        "required": [
          "kind",
          "reason",
          "owner",
          "at",
          "actor",
          "health"
        ]
      },
      "OperationWorkflowReviewResponseEscalationActionReviewRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Explicit scoped review of the current completed coordinator action. Supply current episode timestamps and preserve parent owner, plan and exact check-in; omit parent reviews. Cannot combine with other response actions. Evidence unavailable is not clear or application success.",
        "required": [
          "decision_at",
          "required_at",
          "handed_off_at",
          "escalated_at",
          "acknowledged_at",
          "completed_at"
        ],
        "properties": {
          "decision_at": {
            "type": "string",
            "format": "date-time"
          },
          "required_at": {
            "type": "string",
            "format": "date-time"
          },
          "handed_off_at": {
            "type": "string",
            "format": "date-time"
          },
          "escalated_at": {
            "type": "string",
            "format": "date-time"
          },
          "acknowledged_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperationWorkflowReviewResponseEscalationRevisionRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Explicit scoped review of the current completed coordinator action and creation of a revised commitment only while the handoff remains unaccepted and undeclined. Supply current episode timestamps and preserve parent owner, plan and exact check-in; omit parent reviews. Cannot combine with other response actions. Evidence unavailable is not clear or application success. Requires the recorded non-clear review timestamp and a fresh non-clear recheck; deadline must be future and within seven days.",
        "required": [
          "decision_at",
          "required_at",
          "handed_off_at",
          "escalated_at",
          "acknowledged_at",
          "completed_at",
          "review_at",
          "coordinator",
          "plan",
          "due_at"
        ],
        "properties": {
          "decision_at": {
            "type": "string",
            "format": "date-time"
          },
          "required_at": {
            "type": "string",
            "format": "date-time"
          },
          "handed_off_at": {
            "type": "string",
            "format": "date-time"
          },
          "escalated_at": {
            "type": "string",
            "format": "date-time"
          },
          "acknowledged_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          },
          "review_at": {
            "type": "string",
            "format": "date-time"
          },
          "due_at": {
            "type": "string",
            "format": "date-time"
          },
          "coordinator": {
            "type": "string",
            "maxLength": 256,
            "description": "Nonblank trimmed control-free UTF-8 coordinator label, at most 256 bytes."
          },
          "plan": {
            "type": "string",
            "maxLength": 1024,
            "description": "Nonblank revised action plan, at most 1024 UTF-8 bytes; line breaks and tabs allowed."
          }
        }
      },
      "OperationWorkflowReviewResponseEscalationActionReview": {
        "type": "object",
        "additionalProperties": false,
        "description": "Most recent explicit scoped observation of immutable completion evidence. Source indices refer to the completion evidence order. A clear observation does not establish causality or business completion; observation is not atomic with concurrent application reports. History preserves prior review snapshots within existing retention bounds.",
        "required": [
          "completed_at",
          "at",
          "actor",
          "health"
        ],
        "properties": {
          "completed_at": {
            "type": "string",
            "format": "date-time"
          },
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "actor": {
            "type": "string"
          },
          "health": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseHealth"
          }
        }
      },
      "OperationWorkflowReviewResponseScheduledReviewCancellationRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Cancel the pending evidence check for the current completed coordinator action using exact episode, completion and due timestamps. Preserve parent owner, plan and exact check-in, even if overdue; omit parent reviews. Cannot combine with other response actions. Cancellation can win while an observation is in flight; a published or already canceled check rejects cancellation. No source observation is required.",
        "required": [
          "decision_at",
          "required_at",
          "handed_off_at",
          "escalated_at",
          "acknowledged_at",
          "completed_at",
          "due_at",
          "reason"
        ],
        "properties": {
          "decision_at": {
            "type": "string",
            "format": "date-time"
          },
          "required_at": {
            "type": "string",
            "format": "date-time"
          },
          "handed_off_at": {
            "type": "string",
            "format": "date-time"
          },
          "escalated_at": {
            "type": "string",
            "format": "date-time"
          },
          "acknowledged_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          },
          "due_at": {
            "type": "string",
            "format": "date-time"
          },
          "reason": {
            "type": "string",
            "maxLength": 1024,
            "description": "Nonblank UTF-8 cancellation reason, at most 1024 bytes; line breaks and tabs allowed."
          }
        }
      },
      "OperationWorkflowReviewResponseScheduledReviewCancellation": {
        "type": "object",
        "additionalProperties": false,
        "description": "Immutable cancellation audit for one pending scheduled evidence check. Retains original completion and due timestamps, server actor and time, and human reason. Does not change completion evidence, ownership or review obligations.",
        "required": [
          "completed_at",
          "due_at",
          "reason",
          "actor",
          "at"
        ],
        "properties": {
          "completed_at": {
            "type": "string",
            "format": "date-time"
          },
          "due_at": {
            "type": "string",
            "format": "date-time"
          },
          "reason": {
            "type": "string",
            "maxLength": 1024
          },
          "actor": {
            "type": "string"
          },
          "at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperationWorkflowReviewResponseScheduledReviewRescheduleRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Reschedule a pending evidence check using exact current episode, completion and due timestamps. New time must differ from current due time and be future within seven days. Preserve parent owner, plan and exact check-in, even if overdue; omit parent reviews. Cannot combine with other response actions. Published or canceled checks reject rescheduling; no source observation is required.",
        "required": [
          "decision_at",
          "required_at",
          "handed_off_at",
          "escalated_at",
          "acknowledged_at",
          "completed_at",
          "due_at",
          "new_due_at",
          "reason"
        ],
        "properties": {
          "decision_at": {
            "type": "string",
            "format": "date-time"
          },
          "required_at": {
            "type": "string",
            "format": "date-time"
          },
          "handed_off_at": {
            "type": "string",
            "format": "date-time"
          },
          "escalated_at": {
            "type": "string",
            "format": "date-time"
          },
          "acknowledged_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          },
          "due_at": {
            "type": "string",
            "format": "date-time"
          },
          "new_due_at": {
            "type": "string",
            "format": "date-time"
          },
          "reason": {
            "type": "string",
            "maxLength": 1024,
            "description": "Nonblank UTF-8 explanation for the schedule change, at most 1024 bytes; line breaks and tabs allowed."
          }
        }
      },
      "OperationWorkflowReviewResponseScheduledReviewReschedule": {
        "type": "object",
        "additionalProperties": false,
        "description": "Immutable schedule change audit with previous and replacement due times, completion identity, human reason and server actor and time. Retained change history records each reschedule; current completion keeps the latest change and original due time.",
        "required": [
          "completed_at",
          "previous_due_at",
          "due_at",
          "reason",
          "actor",
          "at"
        ],
        "properties": {
          "completed_at": {
            "type": "string",
            "format": "date-time"
          },
          "previous_due_at": {
            "type": "string",
            "format": "date-time"
          },
          "due_at": {
            "type": "string",
            "format": "date-time"
          },
          "reason": {
            "type": "string",
            "maxLength": 1024
          },
          "actor": {
            "type": "string"
          },
          "at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperationWorkflowReviewResponseEscalationCompletionRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Complete one current escalation coordinator commitment with an action summary and saved review evidence. Preserve parent owner, plan and exact check-in, even if overdue; omit parent reviews. Cannot combine with acknowledgment, decision, acceptance, decline or reassignment. Accepted or declined handoffs can still record completed work for the same retained episode, but replaced or resolved episodes cannot. Does not establish application success.",
        "required": [
          "decision_at",
          "required_at",
          "handed_off_at",
          "escalated_at",
          "acknowledged_at",
          "summary",
          "review_indices"
        ],
        "properties": {
          "review_after_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 60,
            "maximum": 604800,
            "description": "Optional one-shot evidence check delay from server completion time, 60 seconds to seven days. Omission leaves the completion unscheduled."
          },
          "decision_at": {
            "type": "string",
            "format": "date-time"
          },
          "required_at": {
            "type": "string",
            "format": "date-time"
          },
          "handed_off_at": {
            "type": "string",
            "format": "date-time"
          },
          "escalated_at": {
            "type": "string",
            "format": "date-time"
          },
          "acknowledged_at": {
            "type": "string",
            "format": "date-time"
          },
          "summary": {
            "type": "string",
            "maxLength": 1024,
            "description": "Nonblank UTF-8 summary of performed coordination work, limited to 1024 bytes; line breaks and tabs are allowed."
          },
          "review_indices": {
            "type": "array",
            "minItems": 1,
            "maxItems": 8,
            "uniqueItems": true,
            "description": "Zero-based indices into the current parent response reviews. References are copied into immutable evidence; they are not fresh application verification or a claim that blockers cleared.",
            "items": {
              "type": "integer",
              "minimum": 0,
              "maximum": 15
            }
          }
        }
      },
      "OperationWorkflowReviewResponseEscalationCompletion": {
        "type": "object",
        "additionalProperties": false,
        "description": "Immutable human completion of escalation coordination work, with linked review references and server actor and time. Existing overdue markers remain historical.",
        "required": [
          "acknowledged_at",
          "summary",
          "evidence",
          "at",
          "actor"
        ],
        "properties": {
          "original_review_due_at": {
            "type": "string",
            "format": "date-time",
            "description": "Original schedule time retained across explicit reschedules, even if older change history is pruned. Legacy completions initialize this from their current due time on first reschedule."
          },
          "review_reschedule": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseScheduledReviewReschedule",
            "description": "OperationWorkflowReviewResponseEscalationCompletion.review_reschedule. Explicit audited change of a pending evidence check time, preserving completed work and review obligations."
          },
          "review_cancellation": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseScheduledReviewCancellation",
            "description": "OperationWorkflowReviewResponseEscalationCompletion.review_cancellation. Explicit cancellation of a pending scheduled evidence check with immutable actor, time and reason; manual reviews remain available."
          },
          "review_due_at": {
            "type": "string",
            "format": "date-time",
            "description": "Current one-shot evidence check time. Only explicit rescheduling changes it; ordinary edits and manual evidence reviews do not."
          },
          "scheduled_review_at": {
            "type": "string",
            "format": "date-time",
            "description": "Scheduled evidence check delivery marker committed atomically with its observation and durable inbox notification. Existing notification retention bounds apply."
          },
          "review": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseEscalationActionReview",
            "description": "OperationWorkflowReviewResponseEscalationCompletion.review. Scoped evidence review for completed coordinator work, separate from business success."
          },
          "acknowledged_at": {
            "type": "string",
            "format": "date-time"
          },
          "summary": {
            "type": "string",
            "maxLength": 1024
          },
          "evidence": {
            "type": "array",
            "minItems": 1,
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowReviewResponseLink"
            }
          },
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "actor": {
            "type": "string"
          }
        }
      },
      "OperationWorkflowReviewResponseEscalationAcknowledgmentRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "One immutable coordination commitment for the current escalated, unaccepted handoff. Preserve the parent response owner, plan and exact check-in, even if overdue. Cannot combine with a decision, acceptance, decline or reassignment. Current handoff and escalation timestamps are required. Due date must be in the future and within seven days.",
        "required": [
          "decision_at",
          "required_at",
          "handed_off_at",
          "escalated_at",
          "coordinator",
          "plan",
          "due_at"
        ],
        "properties": {
          "decision_at": {
            "type": "string",
            "format": "date-time"
          },
          "required_at": {
            "type": "string",
            "format": "date-time"
          },
          "handed_off_at": {
            "type": "string",
            "format": "date-time"
          },
          "escalated_at": {
            "type": "string",
            "format": "date-time"
          },
          "coordinator": {
            "type": "string",
            "maxLength": 256,
            "description": "Control-free trimmed UTF-8 coordinator or team label, nonblank and limited to 256 bytes. Uses the existing authorized operator model; not proof of team membership."
          },
          "plan": {
            "type": "string",
            "maxLength": 1024,
            "description": "Nonblank UTF-8 next-action plan, limited to 1024 bytes; line breaks and tabs are allowed."
          },
          "due_at": {
            "type": "string",
            "format": "date-time",
            "description": "Future next-action deadline within seven days. This does not extend the handoff acceptance or decision-review deadlines."
          }
        }
      },
      "OperationWorkflowReviewResponseEscalationAcknowledgment": {
        "type": "object",
        "additionalProperties": false,
        "description": "Immutable human escalation acknowledgment with a coordinator commitment, recorded actor and time. Notification acknowledgment alone does not create this record. The system overdue marker and explicit human completion may be appended without changing commitment fields.",
        "required": [
          "coordinator",
          "plan",
          "due_at",
          "at",
          "actor"
        ],
        "properties": {
          "previous_completed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Previous coordinator completion that this explicit revised commitment follows. Original completion remains in retained history."
          },
          "basis": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseEscalationActionReview",
            "description": "OperationWorkflowReviewResponseEscalationAcknowledgment.basis. Scoped evidence review for completed coordinator work, separate from business success."
          },
          "completion": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseEscalationCompletion",
            "description": "OperationWorkflowReviewResponseEscalationAcknowledgment.completion. Explicit completion of coordinator work, separate from handoff acceptance and business outcomes."
          },
          "coordinator": {
            "type": "string",
            "maxLength": 256
          },
          "plan": {
            "type": "string",
            "maxLength": 1024
          },
          "due_at": {
            "type": "string",
            "format": "date-time"
          },
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "actor": {
            "type": "string"
          },
          "overdue_notified_at": {
            "type": "string",
            "format": "date-time",
            "description": "One-time follow-up publication marker. Stored atomically with its inbox notice and mirrored in retained history; human update timestamps remain unchanged."
          }
        }
      },
      "OperationWorkflowReviewResponseHandoffAcceptanceRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Accept the current reassigned review for its responsible team. Parent response must remain active with the handed-off owner and a future check-in, without an accompanying decision.",
        "properties": {
          "handed_off_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseHandoffAcceptanceRequest.handed_off_at. Current handoff timestamp; required by acceptance and decline after manual reassignment. Legacy automatic handoffs can omit it."
          },
          "decision_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseHandoffAcceptanceRequest.decision_at. Exact decision timestamp of the handed-off episode."
          },
          "required_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseHandoffAcceptanceRequest.required_at. Exact requirement timestamp of the handed-off episode; stale episodes conflict."
          },
          "note": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "description": "OperationWorkflowReviewResponseHandoffAcceptanceRequest.note. Nonblank UTF-8 acceptance note up to 1024 bytes; line breaks and tabs allowed."
          }
        },
        "required": [
          "decision_at",
          "required_at",
          "note"
        ]
      },
      "OperationWorkflowReviewResponseHandoffAcceptance": {
        "type": "object",
        "additionalProperties": false,
        "description": "Immutable acceptance by an authenticated authorized operator for the responsible team, without verifying team membership or satisfying the original review deadline.",
        "properties": {
          "owner": {
            "type": "string",
            "description": "OperationWorkflowReviewResponseHandoffAcceptance.owner. Responsible handed-off team at acceptance time."
          },
          "actor": {
            "type": "string",
            "description": "OperationWorkflowReviewResponseHandoffAcceptance.actor. Authenticated operator who recorded acceptance."
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseHandoffAcceptance.at. Server acceptance time."
          },
          "note": {
            "type": "string",
            "description": "OperationWorkflowReviewResponseHandoffAcceptance.note. Operator acceptance note."
          },
          "check_in_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseHandoffAcceptance.check_in_at. Future check-in committed at acceptance; later edits do not rewrite this record."
          }
        },
        "required": [
          "owner",
          "actor",
          "at",
          "note",
          "check_in_at"
        ]
      },
      "OperationWorkflowReviewResponseHandoffDeclineRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Decline one current unaccepted handoff without a decision or acceptance. Retain its owner, plan and exact check-in, even if already overdue; deadlines do not restart.",
        "properties": {
          "handed_off_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseHandoffDeclineRequest.handed_off_at. Current handoff timestamp; required by acceptance and decline after manual reassignment. Legacy automatic handoffs can omit it."
          },
          "decision_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseHandoffDeclineRequest.decision_at. Exact decision timestamp of the handed-off episode."
          },
          "required_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseHandoffDeclineRequest.required_at. Exact requirement timestamp; stale episodes conflict."
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "description": "OperationWorkflowReviewResponseHandoffDeclineRequest.reason. Nonblank UTF-8 reason up to 1024 bytes; line breaks and tabs allowed."
          }
        },
        "required": [
          "decision_at",
          "required_at",
          "reason"
        ]
      },
      "OperationWorkflowReviewResponseHandoffDecline": {
        "type": "object",
        "additionalProperties": false,
        "description": "Immutable decline for a responsible team recorded by an authenticated authorized operator, without proof of team membership. Retained history carries its one-time notification intent.",
        "properties": {
          "decision_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseHandoffDecline.decision_at. Reviewed decision timestamp."
          },
          "required_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseHandoffDecline.required_at. Original review requirement timestamp."
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseHandoffDecline.at. Server decline time."
          },
          "notified_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseHandoffDecline.notified_at. One-time notification publication marker; bounded history or inbox retention can limit delivery."
          },
          "owner": {
            "type": "string",
            "description": "OperationWorkflowReviewResponseHandoffDecline.owner. Declining responsible team."
          },
          "previous_owner": {
            "type": "string",
            "description": "OperationWorkflowReviewResponseHandoffDecline.previous_owner. Previous owner to notify for manual routing."
          },
          "actor": {
            "type": "string",
            "description": "OperationWorkflowReviewResponseHandoffDecline.actor. Authenticated operator recording decline."
          },
          "reason": {
            "type": "string",
            "description": "OperationWorkflowReviewResponseHandoffDecline.reason. Operator reason; immutable after recording."
          }
        },
        "required": [
          "decision_at",
          "required_at",
          "at",
          "owner",
          "previous_owner",
          "actor",
          "reason"
        ]
      },
      "OperationWorkflowReviewResponseHandoffDeclineEvent": {
        "type": "object",
        "additionalProperties": false,
        "description": "One historical decline notification routed to the previous owner, without automatic reassignment or deadline changes. Consult current response ownership before acting.",
        "properties": {
          "source_notification_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowReviewResponseHandoffDeclineEvent.source_notification_id. Original response alert identity."
          },
          "source_sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "OperationWorkflowReviewResponseHandoffDeclineEvent.source_sequence. Original response sequence within this inbox."
          },
          "decline": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseHandoffDecline",
            "description": "OperationWorkflowReviewResponseHandoffDeclineEvent.decline. Historical decline and its published notification marker."
          }
        },
        "required": [
          "source_notification_id",
          "source_sequence",
          "decline"
        ]
      },
      "OperationWorkflowReviewResponseHandoffReassignmentRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Reassign a currently declined handoff to a different parent response owner. Preserve plan, check-in and review deadline; start a new acceptance clock. Cannot combine with a decision, acceptance or decline.",
        "properties": {
          "decision_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseHandoffReassignmentRequest.decision_at. Exact reviewed decision timestamp."
          },
          "required_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseHandoffReassignmentRequest.required_at. Exact review requirement timestamp."
          },
          "declined_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseHandoffReassignmentRequest.declined_at. Exact decline timestamp to route; stale decline conflicts."
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "description": "OperationWorkflowReviewResponseHandoffReassignmentRequest.reason. Nonblank UTF-8 explanation up to 1024 bytes; line breaks and tabs allowed."
          }
        },
        "required": [
          "decision_at",
          "required_at",
          "declined_at",
          "reason"
        ]
      },
      "OperationWorkflowReviewResponseHandoffReassignment": {
        "type": "object",
        "additionalProperties": false,
        "description": "Immutable manual routing record for an authorized operator, with preserved decline context and one-time notification intent. Ownership assignment is not acceptance.",
        "properties": {
          "decision_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseHandoffReassignment.decision_at. Original reviewed decision timestamp."
          },
          "required_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseHandoffReassignment.required_at. Original review requirement timestamp."
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseHandoffReassignment.at. Server handoff time, starting the new acceptance clock."
          },
          "notified_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseHandoffReassignment.notified_at. One-time notification marker, bounded by retained history and inbox."
          },
          "owner": {
            "type": "string",
            "description": "OperationWorkflowReviewResponseHandoffReassignment.owner. New responsible team label; membership is not verified."
          },
          "previous_owner": {
            "type": "string",
            "description": "OperationWorkflowReviewResponseHandoffReassignment.previous_owner. Declining owner before this manual transfer."
          },
          "actor": {
            "type": "string",
            "description": "OperationWorkflowReviewResponseHandoffReassignment.actor. Authenticated operator performing reassignment."
          },
          "reason": {
            "type": "string",
            "description": "OperationWorkflowReviewResponseHandoffReassignment.reason. Operator reason for choosing the new team."
          },
          "decline": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseHandoffDecline",
            "description": "OperationWorkflowReviewResponseHandoffReassignment.decline. Immutable decline context preserved at reassignment."
          }
        },
        "required": [
          "decision_at",
          "required_at",
          "at",
          "owner",
          "previous_owner",
          "actor",
          "reason",
          "decline"
        ]
      },
      "OperationWorkflowReviewResponseHandoffReassignmentEvent": {
        "type": "object",
        "additionalProperties": false,
        "description": "Historical handoff notice to the assigned team. Check current ownership before accepting; the original review deadline remains unchanged.",
        "properties": {
          "source_notification_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowReviewResponseHandoffReassignmentEvent.source_notification_id. Original response alert identity."
          },
          "source_sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "OperationWorkflowReviewResponseHandoffReassignmentEvent.source_sequence. Original response sequence in this inbox."
          },
          "reassignment": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseHandoffReassignment",
            "description": "OperationWorkflowReviewResponseHandoffReassignmentEvent.reassignment. Immutable routing and previous decline context."
          }
        },
        "required": [
          "source_notification_id",
          "source_sequence",
          "reassignment"
        ]
      },
      "OperationWorkflowReviewResponseRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowReviewResponseRequest. Explicit follow-through on an original critical or overdue business-impact alert. Saving acknowledges the alert and assigns queue attention to the response owner.",
        "required": [
          "owner",
          "plan",
          "status"
        ],
        "properties": {
          "scheduled_review_reschedule": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseScheduledReviewRescheduleRequest",
            "description": "OperationWorkflowReviewResponseRequest.scheduled_review_reschedule. Explicit audited change of a pending evidence check time, preserving completed work and review obligations."
          },
          "scheduled_review_cancellation": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseScheduledReviewCancellationRequest",
            "description": "OperationWorkflowReviewResponseRequest.scheduled_review_cancellation. Explicit cancellation of a pending scheduled evidence check with immutable actor, time and reason; manual reviews remain available."
          },
          "escalation_revision": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseEscalationRevisionRequest",
            "description": "OperationWorkflowReviewResponseRequest.escalation_revision. Scoped evidence review for completed coordinator work, separate from business success."
          },
          "escalation_action_review": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseEscalationActionReviewRequest",
            "description": "OperationWorkflowReviewResponseRequest.escalation_action_review. Scoped evidence review for completed coordinator work, separate from business success."
          },
          "escalation_completion": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseEscalationCompletionRequest",
            "description": "OperationWorkflowReviewResponseRequest.escalation_completion. Explicit completion of coordinator work, separate from handoff acceptance and business outcomes."
          },
          "escalation_acknowledgment": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseEscalationAcknowledgmentRequest",
            "description": "OperationWorkflowReviewResponseRequest.escalation_acknowledgment. Explicit escalation coordination commitment, separate from handoff acceptance and decision revalidation."
          },
          "handoff_acceptance_escalation_owner": {
            "type": "string",
            "maxLength": 256,
            "description": "OperationWorkflowReviewResponseRequest.handoff_acceptance_escalation_owner. Optional control-free UTF-8 team label for future missed acceptance deadlines. Omission preserves policy, empty string clears it; the destination is pinned at each actual handoff. Must differ from the parent request owner when explicitly configured."
          },
          "handoff_reassignment": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseHandoffReassignmentRequest",
            "description": "OperationWorkflowReviewResponseRequest.handoff_reassignment. Explicit reassignment after decline with accountable actor, reason and new acceptance requirement."
          },
          "handoff_decline": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseHandoffDeclineRequest",
            "description": "OperationWorkflowReviewResponseRequest.handoff_decline. Explicit immutable decline of the current handoff with accountable actor and reason."
          },
          "handoff_accept_after_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 60,
            "maximum": 604800,
            "description": "OperationWorkflowReviewResponseRequest.handoff_accept_after_seconds. Future handoff acceptance window, defaulting to 3600 seconds. Request omission preserves current policy; active acceptance deadlines stay pinned."
          },
          "handoff_acceptance": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseHandoffAcceptanceRequest",
            "description": "OperationWorkflowReviewResponseRequest.handoff_acceptance. Explicit acceptance for the current handed-off review, separate from notification acknowledgment and decision revalidation."
          },
          "decision_review_fallback_owner": {
            "type": "string",
            "maxLength": 256,
            "description": "OperationWorkflowReviewResponseRequest.decision_review_fallback_owner. Optional distinct fallback team for future overdue decision reviews. Request omission preserves policy and empty string clears it; active episodes retain their pinned fallback."
          },
          "decision_review_after_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 60,
            "maximum": 604800,
            "description": "OperationWorkflowReviewResponseRequest.decision_review_after_seconds. Future decision revalidation window; defaults to 86400 seconds. Existing deadlines remain pinned; request omission preserves current policy."
          },
          "decision": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseDecisionRequest",
            "description": "OperationWorkflowReviewResponseRequest.decision. Explicit human decision with reviewed condition and accountable reason."
          },
          "fallback_owner": {
            "type": "string",
            "maxLength": 256,
            "description": "OperationWorkflowReviewResponseRequest.fallback_owner. Optional distinct team for a missed check-in; omit to preserve existing policy, or send empty to clear it. Explicit ownership changes protect the current check-in from automatic takeover."
          },
          "owner": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "OperationWorkflowReviewResponseRequest.owner. Responsible team label; trimmed control-free UTF-8 limited to 256 bytes."
          },
          "plan": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "description": "OperationWorkflowReviewResponseRequest.plan. Human response plan; nonblank UTF-8 limited to 1024 bytes. Line breaks and tabs are allowed."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "resolved"
            ],
            "description": "OperationWorkflowReviewResponseRequest.status. Active ownership or human resolution after a fresh scoped check of linked source reviews."
          },
          "check_in_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseRequest.check_in_at. Required future check-in for active responses; absent when resolved. Replaces inbox attention time without changing the original alert response deadline."
          },
          "reviews": {
            "type": "array",
            "minItems": 1,
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowReviewResponseLinkRequest"
            },
            "description": "OperationWorkflowReviewResponseRequest.reviews. Required nonempty link set on first creation. Omit on later edits to preserve it; supplied sets must exactly match existing links. Links cannot be dropped to manufacture resolution."
          }
        }
      },
      "OperationWorkflowReviewResponseLinkRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowReviewResponseLinkRequest. Reference to a retained dependency review delivery in the same application and environment.",
        "required": [
          "subscription_id",
          "sequence"
        ],
        "properties": {
          "subscription_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowReviewResponseLinkRequest.subscription_id. Source review subscription identity."
          },
          "sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "OperationWorkflowReviewResponseLinkRequest.sequence. Source review notification sequence."
          }
        }
      },
      "OperationWorkflowReviewResponseLink": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowReviewResponseLink. Immutable source identity captured from an authorized matching review delivery; preserved after inbox retention loss.",
        "required": [
          "subscription_id",
          "sequence",
          "notification_id",
          "progress_id",
          "outcome_code",
          "item_index",
          "dependency_review_revision",
          "subject",
          "workflow",
          "instance_id"
        ],
        "properties": {
          "subscription_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowReviewResponseLink.subscription_id. Retained review subscription identity."
          },
          "sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "OperationWorkflowReviewResponseLink.sequence. Original delivery sequence."
          },
          "notification_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowReviewResponseLink.notification_id. Original delivery identity, captured by the server."
          },
          "progress_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowReviewResponseLink.progress_id. Pinned source playbook progress identity."
          },
          "outcome_code": {
            "type": "string",
            "description": "OperationWorkflowReviewResponseLink.outcome_code. Pinned follow-up outcome list."
          },
          "item_index": {
            "type": "integer",
            "minimum": 0,
            "maximum": 15,
            "description": "OperationWorkflowReviewResponseLink.item_index. Pinned local step index."
          },
          "dependency_review_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "OperationWorkflowReviewResponseLink.dependency_review_revision. Original review obligation revision."
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowReviewResponseLink.platform_tenant_id. Account-only exact source customer identity; customer responses omit this field."
          },
          "subject": {
            "$ref": "#/components/schemas/OperationSubject",
            "description": "OperationWorkflowReviewResponseLink.subject. Scoped case subject captured from source delivery."
          },
          "workflow": {
            "type": "string",
            "description": "OperationWorkflowReviewResponseLink.workflow. Protected workflow identity matching the parent risk alert."
          },
          "instance_id": {
            "type": "string",
            "description": "OperationWorkflowReviewResponseLink.instance_id. Scoped source workflow instance."
          }
        }
      },
      "OperationWorkflowReviewResponseHealth": {
        "type": "object",
        "additionalProperties": false,
        "description": "Sampled advisory response-plan condition. Clear means no observed blockers or review obligations, not business completion. Sampling stops on response resolution.",
        "properties": {
          "fingerprint": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "OperationWorkflowReviewResponseHealth.fingerprint. Stable digest of source revisions and current observed condition; polling timestamps and recovery history are excluded."
          },
          "status": {
            "type": "string",
            "enum": [
              "clear",
              "blocked",
              "review_required",
              "unavailable"
            ],
            "description": "OperationWorkflowReviewResponseHealth.status. Unavailable takes precedence over blocked, pending review and clear."
          },
          "checked_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseHealth.checked_at. Latest attempted sampling time; consult individual sources for freshness."
          },
          "last_complete_check_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseHealth.last_complete_check_at. Latest sample whose scoped reads all completed, including observations of missing or retired progress."
          },
          "remaining_blockers": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "OperationWorkflowReviewResponseHealth.remaining_blockers. Observed blockers plus unverified disappearances retained until positive clearance."
          },
          "recovered_blockers": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "OperationWorkflowReviewResponseHealth.recovered_blockers. Most recent positively verified recoveries, excluding blockers subsequently observed again."
          },
          "recovered_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseHealth.recovered_at. Time of the latest positive recovery sample."
          },
          "sources": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowReviewResponseSourceHealth"
            },
            "description": "OperationWorkflowReviewResponseHealth.sources. Condition and freshness for each fixed linked review."
          }
        },
        "required": [
          "status",
          "checked_at",
          "remaining_blockers",
          "recovered_blockers",
          "sources"
        ]
      },
      "OperationWorkflowReviewResponseSourceHealth": {
        "type": "object",
        "additionalProperties": false,
        "description": "A scoped source observation for one fixed linked review; unavailable observations never establish review resolution.",
        "properties": {
          "progress_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "OperationWorkflowReviewResponseSourceHealth.progress_revision. Retained linked progress revision; absent if progress could not be read."
          },
          "state_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "OperationWorkflowReviewResponseSourceHealth.state_revision. Retained application state revision sampled with this case; absent if unavailable."
          },
          "review_index": {
            "type": "integer",
            "minimum": 0,
            "maximum": 15,
            "description": "OperationWorkflowReviewResponseSourceHealth.review_index. Zero-based index into the response's fixed reviews array."
          },
          "status": {
            "type": "string",
            "enum": [
              "observed",
              "unavailable"
            ],
            "description": "OperationWorkflowReviewResponseSourceHealth.status. Whether the linked progress, step and declared evidence could be observed without availability or staleness issues."
          },
          "checked_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseSourceHealth.checked_at. Latest attempt to observe this source."
          },
          "last_successful_check_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseSourceHealth.last_successful_check_at. Most recent available source observation, retained through later read failures."
          },
          "review_required": {
            "type": "boolean",
            "description": "OperationWorkflowReviewResponseSourceHealth.review_required. Current validity review obligation when the step is observable; unavailable sources cannot prove it cleared."
          },
          "blockers": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "OperationWorkflowReviewResponseSourceHealth.blockers. Blockers observed in this attempt; consult summary remaining blockers for unverified prior observations."
          },
          "explanation": {
            "type": "string",
            "description": "OperationWorkflowReviewResponseSourceHealth.explanation. Availability explanation without backend error details."
          }
        },
        "required": [
          "review_index",
          "status",
          "checked_at",
          "review_required",
          "blockers",
          "explanation"
        ]
      },
      "OperationWorkflowReviewResponse": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowReviewResponse. Human accountability record under the notification coordination revision fence, independent of business workflow success.",
        "required": [
          "owner",
          "plan",
          "status",
          "reviews",
          "created_at",
          "created_by",
          "updated_at",
          "updated_by",
          "history",
          "history_truncated"
        ],
        "properties": {
          "handoff_acceptance_escalation_owner": {
            "type": "string",
            "maxLength": 256,
            "description": "OperationWorkflowReviewResponse.handoff_acceptance_escalation_owner. Optional control-free UTF-8 team label for future missed acceptance deadlines. Omission preserves policy, empty string clears it; the destination is pinned at each actual handoff. Must differ from the parent request owner when explicitly configured."
          },
          "handoff_accept_after_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 60,
            "maximum": 604800,
            "description": "OperationWorkflowReviewResponse.handoff_accept_after_seconds. Future handoff acceptance window, defaulting to 3600 seconds. Request omission preserves current policy; active acceptance deadlines stay pinned."
          },
          "decision_review_fallback_owner": {
            "type": "string",
            "maxLength": 256,
            "description": "OperationWorkflowReviewResponse.decision_review_fallback_owner. Optional distinct fallback team for future overdue decision reviews. Request omission preserves policy and empty string clears it; active episodes retain their pinned fallback."
          },
          "decision_review_after_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 60,
            "maximum": 604800,
            "description": "OperationWorkflowReviewResponse.decision_review_after_seconds. Future decision revalidation window; defaults to 86400 seconds. Existing deadlines remain pinned; request omission preserves current policy."
          },
          "decision_review": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseDecisionReview",
            "description": "OperationWorkflowReviewResponse.decision_review. Latched review requirement after the condition captured by an explicit decision changed."
          },
          "decision": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseDecision",
            "description": "OperationWorkflowReviewResponse.decision. Explicit human decision with reviewed condition and accountable reason."
          },
          "health": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseHealth",
            "description": "OperationWorkflowReviewResponse.health. Latest sampled plan condition with source freshness; preserved as historical context after resolution."
          },
          "fallback_owner": {
            "type": "string",
            "maxLength": 256,
            "description": "OperationWorkflowReviewResponse.fallback_owner. Declared fallback team for overdue response check-ins."
          },
          "check_in_initial_owner": {
            "type": "string",
            "description": "OperationWorkflowReviewResponse.check_in_initial_owner. Team assigned when this check-in was explicitly scheduled; unknown for legacy windows."
          },
          "check_in_owner_changed": {
            "type": "boolean",
            "description": "OperationWorkflowReviewResponse.check_in_owner_changed. Ownership changed during this check-in period; prevents automatic takeover even if the owner later reverts."
          },
          "check_in_notified_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponse.check_in_notified_at. One-time overdue notice marker for the current check-in; cleared only by a newly scheduled active check-in."
          },
          "owner": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "OperationWorkflowReviewResponse.owner. Responsible team label; trimmed control-free UTF-8 limited to 256 bytes."
          },
          "plan": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "description": "OperationWorkflowReviewResponse.plan. Human response plan; nonblank UTF-8 limited to 1024 bytes. Line breaks and tabs are allowed."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "resolved"
            ],
            "description": "OperationWorkflowReviewResponse.status. Active ownership or human resolution after a fresh scoped check of linked source reviews."
          },
          "check_in_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponse.check_in_at. Required future check-in for active responses; absent when resolved. Replaces inbox attention time without changing the original alert response deadline."
          },
          "reviews": {
            "type": "array",
            "minItems": 1,
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowReviewResponseLink"
            },
            "description": "OperationWorkflowReviewResponse.reviews. Fixed captured review links."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponse.created_at. Server creation time."
          },
          "created_by": {
            "type": "string",
            "description": "OperationWorkflowReviewResponse.created_by. Authenticated initial owner-record actor."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponse.updated_at. Server latest response update time."
          },
          "updated_by": {
            "type": "string",
            "description": "OperationWorkflowReviewResponse.updated_by. Authenticated latest response actor."
          },
          "resolution_checked_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponse.resolution_checked_at. Advisory pre-write source check time for a human resolved disposition. Missing or unresolved progress rejects resolution; later regressions do not rewrite historical closure."
          },
          "history": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowReviewResponseChange"
            },
            "description": "OperationWorkflowReviewResponse.history. Bounded owner, plan, status and check-in change history."
          },
          "history_truncated": {
            "type": "boolean",
            "description": "OperationWorkflowReviewResponse.history_truncated. Whether earlier response changes were pruned."
          }
        }
      },
      "OperationWorkflowReviewResponseChange": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowReviewResponseChange. Authenticated response update snapshot.",
        "required": [
          "owner",
          "plan",
          "status",
          "at",
          "actor"
        ],
        "properties": {
          "scheduled_review_reschedule": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseScheduledReviewReschedule",
            "description": "OperationWorkflowReviewResponseChange.scheduled_review_reschedule. Explicit audited change of a pending evidence check time, preserving completed work and review obligations."
          },
          "scheduled_review_cancellation": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseScheduledReviewCancellation",
            "description": "OperationWorkflowReviewResponseChange.scheduled_review_cancellation. Explicit cancellation of a pending scheduled evidence check with immutable actor, time and reason; manual reviews remain available."
          },
          "escalation_action_review": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseEscalationActionReview",
            "description": "OperationWorkflowReviewResponseChange.escalation_action_review. Scoped evidence review for completed coordinator work, separate from business success."
          },
          "escalation_completion": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseEscalationCompletion",
            "description": "OperationWorkflowReviewResponseChange.escalation_completion. Explicit completion of coordinator work, separate from handoff acceptance and business outcomes."
          },
          "escalation_acknowledgment": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseEscalationAcknowledgment",
            "description": "OperationWorkflowReviewResponseChange.escalation_acknowledgment. Explicit escalation coordination commitment, separate from handoff acceptance and decision revalidation."
          },
          "handoff_acceptance_escalation_owner": {
            "type": "string",
            "maxLength": 256,
            "description": "OperationWorkflowReviewResponseChange.handoff_acceptance_escalation_owner. Optional control-free UTF-8 team label for future missed acceptance deadlines. Omission preserves policy, empty string clears it; the destination is pinned at each actual handoff. Must differ from the parent request owner when explicitly configured."
          },
          "handoff_reassignment": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseHandoffReassignment",
            "description": "OperationWorkflowReviewResponseChange.handoff_reassignment. Explicit reassignment after decline with accountable actor, reason and new acceptance requirement."
          },
          "handoff_decline": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseHandoffDecline",
            "description": "OperationWorkflowReviewResponseChange.handoff_decline. Explicit immutable decline of the current handoff with accountable actor and reason."
          },
          "handoff_accept_after_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 60,
            "maximum": 604800,
            "description": "OperationWorkflowReviewResponseChange.handoff_accept_after_seconds. Future handoff acceptance window, defaulting to 3600 seconds. Request omission preserves current policy; active acceptance deadlines stay pinned."
          },
          "handoff_acceptance": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseHandoffAcceptance",
            "description": "OperationWorkflowReviewResponseChange.handoff_acceptance. Explicit acceptance for the current handed-off review, separate from notification acknowledgment and decision revalidation."
          },
          "decision_review_fallback_owner": {
            "type": "string",
            "maxLength": 256,
            "description": "OperationWorkflowReviewResponseChange.decision_review_fallback_owner. Optional distinct fallback team for future overdue decision reviews. Request omission preserves policy and empty string clears it; active episodes retain their pinned fallback."
          },
          "decision_review_after_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 60,
            "maximum": 604800,
            "description": "OperationWorkflowReviewResponseChange.decision_review_after_seconds. Future decision revalidation window; defaults to 86400 seconds. Existing deadlines remain pinned; request omission preserves current policy."
          },
          "decision": {
            "$ref": "#/components/schemas/OperationWorkflowReviewResponseDecision",
            "description": "OperationWorkflowReviewResponseChange.decision. Explicit human decision with reviewed condition and accountable reason."
          },
          "fallback_owner": {
            "type": "string",
            "description": "OperationWorkflowReviewResponseChange.fallback_owner. Fallback policy captured for this response change."
          },
          "reason": {
            "type": "string",
            "enum": [
              "human_update",
              "check_in_overdue",
              "decision_review_overdue",
              "handoff_accepted",
              "handoff_declined",
              "handoff_reassigned",
              "escalation_acknowledged",
              "escalation_commitment_completed",
              "escalation_action_reviewed",
              "escalation_commitment_revised",
              "scheduled_review_canceled",
              "scheduled_review_rescheduled"
            ],
            "description": "OperationWorkflowReviewResponseChange.reason. Explicit human edit or periodic missed-check-in event; absent in older history."
          },
          "owner": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "OperationWorkflowReviewResponseChange.owner. Responsible team label; trimmed control-free UTF-8 limited to 256 bytes."
          },
          "plan": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "description": "OperationWorkflowReviewResponseChange.plan. Human response plan; nonblank UTF-8 limited to 1024 bytes. Line breaks and tabs are allowed."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "resolved"
            ],
            "description": "OperationWorkflowReviewResponseChange.status. Active ownership or human resolution after a fresh scoped check of linked source reviews."
          },
          "check_in_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseChange.check_in_at. Required future check-in for active responses; absent when resolved. Replaces inbox attention time without changing the original alert response deadline."
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReviewResponseChange.at. Server change time."
          },
          "actor": {
            "type": "string",
            "description": "OperationWorkflowReviewResponseChange.actor. Authenticated response editor."
          }
        }
      },
      "OperationWorkflowReadinessImpactWatchRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowReadinessImpactWatchRequest. Protected business result monitoring of retained unresolved human reviews in a scoped application environment; advisory confidence only.",
        "required": [
          "workflow",
          "kind",
          "code"
        ],
        "properties": {
          "acknowledge_after_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 604800,
            "description": "OperationWorkflowReadinessImpactWatchRequest.acknowledge_after_seconds. Optional response window from delivery of critical or overdue impact alerts, requires a nonempty owner. Zero omits the target; clearance notices have no target. Acknowledgment is independent of resolving source review obligations."
          },
          "fallback_owner": {
            "type": "string",
            "maxLength": 256,
            "description": "OperationWorkflowReadinessImpactWatchRequest.fallback_owner. Optional distinct fallback team, requires a positive response window. Guarded handoff preserves manual assignment history and the original deadline."
          },
          "workflow": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "description": "OperationWorkflowReadinessImpactWatchRequest.workflow. Exact workflow identity."
          },
          "kind": {
            "type": "string",
            "enum": [
              "milestone",
              "outcome"
            ],
            "description": "OperationWorkflowReadinessImpactWatchRequest.kind. Protected result category."
          },
          "code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "OperationWorkflowReadinessImpactWatchRequest.code. Exact protected result slug."
          },
          "owner": {
            "type": "string",
            "maxLength": 256,
            "description": "OperationWorkflowReadinessImpactWatchRequest.owner. Optional team assigned new impact notifications; does not filter review queue source owners."
          }
        }
      },
      "OperationWorkflowReadinessImpactWatch": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowReadinessImpactWatch. Protected business result monitoring of retained unresolved human reviews in a scoped application environment; advisory confidence only.",
        "required": [
          "workflow",
          "kind",
          "code",
          "evaluated_at",
          "coverage_incomplete"
        ],
        "properties": {
          "acknowledge_after_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 604800,
            "description": "OperationWorkflowReadinessImpactWatch.acknowledge_after_seconds. Optional response window from delivery of critical or overdue impact alerts, requires a nonempty owner. Zero omits the target; clearance notices have no target. Acknowledgment is independent of resolving source review obligations."
          },
          "fallback_owner": {
            "type": "string",
            "maxLength": 256,
            "description": "OperationWorkflowReadinessImpactWatch.fallback_owner. Optional distinct fallback team, requires a positive response window. Guarded handoff preserves manual assignment history and the original deadline."
          },
          "workflow": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "description": "OperationWorkflowReadinessImpactWatch.workflow. Exact workflow identity."
          },
          "kind": {
            "type": "string",
            "enum": [
              "milestone",
              "outcome"
            ],
            "description": "OperationWorkflowReadinessImpactWatch.kind. Protected result category."
          },
          "code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "OperationWorkflowReadinessImpactWatch.code. Exact protected result slug."
          },
          "owner": {
            "type": "string",
            "maxLength": 256,
            "description": "OperationWorkflowReadinessImpactWatch.owner. Optional team assigned new impact notifications; does not filter review queue source owners."
          },
          "current": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessImpactSummary",
            "description": "OperationWorkflowReadinessImpactWatch.current. Last accepted retained review baseline, absent for zero reviews. Preserved when queue disappearance cannot be confirmed against tracked source progress."
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReadinessImpactWatch.evaluated_at. Time of the last accepted baseline observation."
          },
          "coverage_incomplete": {
            "type": "boolean",
            "description": "OperationWorkflowReadinessImpactWatch.coverage_incomplete. Candidate-window or 64-obligation tracking limit, missing source, or unresolved source after queue disappearance suppresses a clearance assertion."
          }
        }
      },
      "OperationWorkflowReadinessImpactEvent": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowReadinessImpactEvent. Protected business result monitoring of retained unresolved human reviews in a scoped application environment; advisory confidence only.",
        "required": [
          "workflow",
          "kind",
          "code",
          "checked_at",
          "reasons"
        ],
        "properties": {
          "response": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessEscalationResponse",
            "description": "OperationWorkflowReadinessImpactEvent.response. Immutable alert acknowledgment target and retained assignment history; source review clearance does not acknowledge the alert."
          },
          "workflow": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "description": "OperationWorkflowReadinessImpactEvent.workflow. Exact workflow identity."
          },
          "kind": {
            "type": "string",
            "enum": [
              "milestone",
              "outcome"
            ],
            "description": "OperationWorkflowReadinessImpactEvent.kind. Protected result category."
          },
          "code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "OperationWorkflowReadinessImpactEvent.code. Exact protected result slug."
          },
          "checked_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReadinessImpactEvent.checked_at. Advisory sample time."
          },
          "reasons": {
            "type": "array",
            "maxItems": 3,
            "items": {
              "type": "string",
              "enum": [
                "critical_review_added",
                "review_became_overdue",
                "reviews_cleared"
              ]
            },
            "description": "OperationWorkflowReadinessImpactEvent.reasons. First critical or overdue review transition, or source-confirmed clearance of tracked obligations; stable observations remain silent."
          },
          "previous": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessImpactSummary",
            "description": "OperationWorkflowReadinessImpactEvent.previous. Previous accepted baseline, absent for zero reviews."
          },
          "current": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessImpactSummary",
            "description": "OperationWorkflowReadinessImpactEvent.current. Latest accepted sample, absent for source-confirmed zero reviews."
          }
        }
      },
      "OperationWorkflowReadinessImpactSummary": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowReadinessImpactSummary. Retained unresolved review confidence by workflow and protected business result, separate from reported business outcome.",
        "required": [
          "workflow",
          "kind",
          "code",
          "review_count",
          "task_count",
          "case_count",
          "critical_count",
          "high_count",
          "overdue_count",
          "critical_overdue_count",
          "owners"
        ],
        "properties": {
          "workflow": {
            "type": "string",
            "description": "OperationWorkflowReadinessImpactSummary.workflow. Scoped workflow identity; identical result codes in different workflows remain separate."
          },
          "kind": {
            "type": "string",
            "enum": [
              "milestone",
              "outcome"
            ],
            "description": "OperationWorkflowReadinessImpactSummary.kind. Pinned protected result category."
          },
          "code": {
            "type": "string",
            "description": "OperationWorkflowReadinessImpactSummary.code. Pinned protected milestone or outcome code."
          },
          "review_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2000,
            "description": "OperationWorkflowReadinessImpactSummary.review_count. Distinct progress/outcome/step/regression obligations across inbox deliveries."
          },
          "task_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2000,
            "description": "OperationWorkflowReadinessImpactSummary.task_count. Matching retained inbox delivery tasks."
          },
          "case_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2000,
            "description": "OperationWorkflowReadinessImpactSummary.case_count. Distinct tenant/subject/workflow/instance cases."
          },
          "critical_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2000,
            "description": "OperationWorkflowReadinessImpactSummary.critical_count. Distinct critical review obligations."
          },
          "high_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2000,
            "description": "OperationWorkflowReadinessImpactSummary.high_count. Distinct high-priority review obligations."
          },
          "overdue_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2000,
            "description": "OperationWorkflowReadinessImpactSummary.overdue_count. Distinct review obligations with at least one overdue queue delivery."
          },
          "critical_overdue_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2000,
            "description": "OperationWorkflowReadinessImpactSummary.critical_overdue_count. Distinct critical review obligations with overdue queue attention."
          },
          "owners": {
            "type": "array",
            "maxItems": 2000,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowReadinessImpactOwner"
            },
            "description": "OperationWorkflowReadinessImpactSummary.owners. Effective inbox ownership totals, ordered by overdue task count, task count and owner label. A review delivered to several teams contributes to each delivery's owner."
          }
        }
      },
      "OperationWorkflowReadinessImpactOwner": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowReadinessImpactOwner. Effective queue ownership within a retained business impact group.",
        "required": [
          "owner",
          "task_count",
          "overdue_count"
        ],
        "properties": {
          "owner": {
            "type": "string",
            "description": "OperationWorkflowReadinessImpactOwner.owner. Current inbox owner label; empty means unassigned."
          },
          "task_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2000,
            "description": "OperationWorkflowReadinessImpactOwner.task_count. Matching retained inbox delivery tasks for this owner."
          },
          "overdue_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2000,
            "description": "OperationWorkflowReadinessImpactOwner.overdue_count. Matching tasks with overdue queue attention."
          }
        }
      },
      "OperationWorkflowReadinessFollowUpsResponse": {
        "type": "object",
        "description": "Live queue across this app/environment subscription inboxes. Owner/customer/workflow/due filters apply before pagination. No notification edits are performed by this read.",
        "additionalProperties": false,
        "properties": {
          "view": {
            "type": "string",
            "enum": [
              "next_actions"
            ],
            "description": "Present for the next-action view; items remains empty and pagination/counts describe next_actions."
          },
          "next_actions": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowNextActionQueueItem"
            }
          },
          "business_impact_summary": {
            "type": "array",
            "maxItems": 2000,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowReadinessImpactSummary"
            },
            "description": "OperationWorkflowReadinessFollowUpsResponse.business_impact_summary. Matching retained unresolved review tasks grouped by workflow and protected result before pagination. Unique obligations and cases are deduplicated across inbox deliveries; owner counts describe queue tasks. Ordered by critical overdue reviews, critical reviews, total unique reviews and stable group identity. Existing filters and candidate-window limits apply."
          },
          "items": {
            "type": "array",
            "maxItems": 100,
            "description": "OperationWorkflowReadinessFollowUpsResponse.items. Pending follow-ups ordered by due time, subscription UUID and sequence.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowReadinessFollowUp"
            }
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReadinessFollowUpsResponse.evaluated_at. Shared clock for overdue classification."
          },
          "total_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2000,
            "description": "OperationWorkflowReadinessFollowUpsResponse.total_count. Count or continuation offset within the selected retained follow-ups."
          },
          "overdue_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2000,
            "description": "OperationWorkflowReadinessFollowUpsResponse.overdue_count. Count or continuation offset within the selected retained follow-ups."
          },
          "next_offset": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2000,
            "description": "OperationWorkflowReadinessFollowUpsResponse.next_offset. Count or continuation offset within the selected retained follow-ups."
          },
          "has_more": {
            "type": "boolean",
            "description": "OperationWorkflowReadinessFollowUpsResponse.has_more. More matching retained rows follow this live page."
          },
          "retention_limited": {
            "type": "boolean",
            "description": "OperationWorkflowReadinessFollowUpsResponse.retention_limited. True: coordination only survives within each subscription latest-100 notification window; this is not an exhaustive task inventory."
          },
          "due_reminder_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2000,
            "description": "OperationWorkflowReadinessFollowUpsResponse.due_reminder_count. Active published reminders across all matching retained rows, before pagination. Overdue work may await the next bounded publisher pass."
          }
        },
        "required": [
          "items",
          "evaluated_at",
          "total_count",
          "overdue_count",
          "next_offset",
          "has_more",
          "retention_limited",
          "due_reminder_count"
        ]
      },
      "OperationWorkflowReadinessDueReminder": {
        "type": "object",
        "description": "One durable in-app reminder marker for the original notification and follow-up deadline; rescheduling or clearing retires it. Does not authorize execution.",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowReadinessDueReminder.id. Stable UUID derived from notification identity and normalized deadline, shared across retries and restarts."
          },
          "due_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReadinessDueReminder.due_at. Deadline this reminder belongs to."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowReadinessDueReminder.created_at. Successful reminder publication time."
          }
        },
        "required": [
          "id",
          "due_at",
          "created_at"
        ]
      },
      "OperationWorkflowCoordinationTimelineEvent": {
        "type": "object",
        "description": "OperationWorkflowCoordinationTimelineEvent. Retained inbox and durable pinned playbook coordination metadata.",
        "required": [
          "id",
          "at",
          "kind",
          "summary",
          "reporting_operation_ids"
        ],
        "properties": {
          "playbook_progress_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowCoordinationTimelineEvent.playbook_progress_id. Durable checklist identity for playbook start or review events; inbox fields are absent for these events."
          },
          "id": {
            "type": "string",
            "description": "OperationWorkflowCoordinationTimelineEvent.id. Stable identity within its subscription and notification."
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowCoordinationTimelineEvent.at. Retained server observation or action clock; never inferred application occurrence time."
          },
          "kind": {
            "type": "string",
            "description": "OperationWorkflowCoordinationTimelineEvent.kind. Notification, retained action, outcome observation or latest coordination snapshot."
          },
          "summary": {
            "type": "string",
            "description": "OperationWorkflowCoordinationTimelineEvent.summary. Explanation of the retained event and any evidence limitation."
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowCoordinationTimelineEvent.subscription_id. Source readiness subscription UUID."
          },
          "subscription_name": {
            "type": "string",
            "description": "OperationWorkflowCoordinationTimelineEvent.subscription_name. Current source subscription name."
          },
          "subscription_tenant_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowCoordinationTimelineEvent.subscription_tenant_id. Operator-only original subscription tenant used to navigate the source inbox; omitted for broad subscriptions."
          },
          "notification_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowCoordinationTimelineEvent.notification_id. Source inbox notification UUID."
          },
          "sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "OperationWorkflowCoordinationTimelineEvent.sequence. Source inbox sequence."
          },
          "actor": {
            "type": "string",
            "description": "OperationWorkflowCoordinationTimelineEvent.actor. Retained coordination actor, when available."
          },
          "owner": {
            "type": "string",
            "description": "OperationWorkflowCoordinationTimelineEvent.owner. Retained coordination owner label."
          },
          "status": {
            "type": "string",
            "description": "OperationWorkflowCoordinationTimelineEvent.status. Status in the event kind context."
          },
          "note": {
            "type": "string",
            "description": "OperationWorkflowCoordinationTimelineEvent.note. Retained human coordination note."
          },
          "follow_up_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowCoordinationTimelineEvent.follow_up_at. Associated follow-up or reminder due clock."
          },
          "expected_outcome_code": {
            "type": "string",
            "description": "OperationWorkflowCoordinationTimelineEvent.expected_outcome_code. Application-declared expected business outcome."
          },
          "reported_outcome_code": {
            "type": "string",
            "description": "OperationWorkflowCoordinationTimelineEvent.reported_outcome_code. Observed application-reported business outcome."
          },
          "state_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "OperationWorkflowCoordinationTimelineEvent.state_revision. Observed workflow report revision."
          },
          "reporting_operation_ids": {
            "type": "array",
            "maxItems": 48,
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "OperationWorkflowCoordinationTimelineEvent.reporting_operation_ids. Available operation evidence links; absence does not imply success or failure."
          }
        }
      },
      "OperationWorkflowCoordinationTimelineSource": {
        "type": "object",
        "description": "OperationWorkflowCoordinationTimelineSource. Retained inbox coordination projection metadata.",
        "required": [
          "subscription_id",
          "name",
          "earliest_sequence",
          "latest_sequence",
          "retained_count",
          "gap_before",
          "missing_during_read"
        ],
        "properties": {
          "subscription_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowCoordinationTimelineSource.subscription_id. Read subscription UUID."
          },
          "name": {
            "type": "string",
            "description": "OperationWorkflowCoordinationTimelineSource.name. Current subscription name."
          },
          "earliest_sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "OperationWorkflowCoordinationTimelineSource.earliest_sequence. Earliest retained sequence, or zero when empty."
          },
          "latest_sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "OperationWorkflowCoordinationTimelineSource.latest_sequence. Latest published sequence at source read."
          },
          "retained_count": {
            "type": "integer",
            "minimum": 0,
            "description": "OperationWorkflowCoordinationTimelineSource.retained_count. Notifications retained in this source, including other workflow identities."
          },
          "gap_before": {
            "type": "boolean",
            "description": "OperationWorkflowCoordinationTimelineSource.gap_before. Older notifications were pruned or an inbox resynchronization is required."
          },
          "missing_during_read": {
            "type": "boolean",
            "description": "OperationWorkflowCoordinationTimelineSource.missing_during_read. Subscription disappeared between listing and reading."
          }
        }
      },
      "OperationWorkflowCoordinationTimeline": {
        "type": "object",
        "description": "OperationWorkflowCoordinationTimeline. Retained inbox coordination projection metadata.",
        "required": [
          "items",
          "sources",
          "subject",
          "workflow",
          "instance_id",
          "scope",
          "evaluated_at",
          "total_count",
          "next_offset",
          "has_more",
          "retention_limited",
          "sources_truncated",
          "history_truncated",
          "limitations"
        ],
        "properties": {
          "items": {
            "example": [],
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowCoordinationTimelineEvent"
            },
            "description": "OperationWorkflowCoordinationTimeline.items. Chronological page ordered by retained server clock then stable event identity."
          },
          "sources": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowCoordinationTimelineSource"
            },
            "description": "OperationWorkflowCoordinationTimeline.sources. Coverage of current subscriptions within the authenticated role, app and environment."
          },
          "subject": {
            "type": "object",
            "$ref": "#/components/schemas/OperationSubject",
            "description": "OperationWorkflowCoordinationTimeline.subject. Exact requested business subject."
          },
          "workflow": {
            "type": "string",
            "description": "OperationWorkflowCoordinationTimeline.workflow. Exact requested workflow name."
          },
          "instance_id": {
            "type": "string",
            "description": "OperationWorkflowCoordinationTimeline.instance_id. Exact requested workflow instance."
          },
          "scope": {
            "type": "string",
            "description": "OperationWorkflowCoordinationTimeline.scope. Application environment."
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowCoordinationTimeline.platform_tenant_id. Operator-only exact customer selection; omitted for account-owned workflows."
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowCoordinationTimeline.evaluated_at. Server clock after independent source reads."
          },
          "total_count": {
            "type": "integer",
            "minimum": 0,
            "description": "OperationWorkflowCoordinationTimeline.total_count. Matching retained event count before live pagination."
          },
          "next_offset": {
            "type": "integer",
            "minimum": 0,
            "description": "OperationWorkflowCoordinationTimeline.next_offset. Offset for the next live page."
          },
          "has_more": {
            "type": "boolean",
            "description": "OperationWorkflowCoordinationTimeline.has_more. More events existed at evaluation."
          },
          "retention_limited": {
            "type": "boolean",
            "description": "OperationWorkflowCoordinationTimeline.retention_limited. Always true: deleted sources and pruned records cannot be reconstructed."
          },
          "sources_truncated": {
            "type": "boolean",
            "description": "OperationWorkflowCoordinationTimeline.sources_truncated. Current source list exceeded the bounded projection."
          },
          "history_truncated": {
            "type": "boolean",
            "description": "OperationWorkflowCoordinationTimeline.history_truncated. A matching response target lost older assignment history."
          },
          "limitations": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "OperationWorkflowCoordinationTimeline.limitations. Explicit retention, snapshot and pagination limitations."
          }
        }
      },
      "OperationWorkflowCoordinationTimelineOptions": {
        "type": "object",
        "description": "OperationWorkflowCoordinationTimelineOptions. Explicit business identity and live pagination selectors.",
        "properties": {
          "app_id": {
            "type": "string",
            "description": "OperationWorkflowCoordinationTimelineOptions.app_id. Exact timeline query selector; customer identity comes from authentication.",
            "format": "uuid"
          },
          "scope": {
            "type": "string",
            "description": "OperationWorkflowCoordinationTimelineOptions.scope. Exact timeline query selector; customer identity comes from authentication."
          },
          "tenant_id": {
            "type": "string",
            "description": "OperationWorkflowCoordinationTimelineOptions.tenant_id. Exact timeline query selector; customer identity comes from authentication.",
            "format": "uuid"
          },
          "subject_type": {
            "type": "string",
            "description": "OperationWorkflowCoordinationTimelineOptions.subject_type. Exact timeline query selector; customer identity comes from authentication."
          },
          "subject_id": {
            "type": "string",
            "description": "OperationWorkflowCoordinationTimelineOptions.subject_id. Exact timeline query selector; customer identity comes from authentication."
          },
          "workflow": {
            "type": "string",
            "description": "OperationWorkflowCoordinationTimelineOptions.workflow. Exact timeline query selector; customer identity comes from authentication."
          },
          "instance_id": {
            "type": "string",
            "description": "OperationWorkflowCoordinationTimelineOptions.instance_id. Exact timeline query selector; customer identity comes from authentication."
          },
          "offset": {
            "type": "integer",
            "description": "OperationWorkflowCoordinationTimelineOptions.offset. Exact timeline query selector; customer identity comes from authentication.",
            "minimum": 0,
            "maximum": 65700
          },
          "limit": {
            "type": "integer",
            "description": "OperationWorkflowCoordinationTimelineOptions.limit. Exact timeline query selector; customer identity comes from authentication.",
            "minimum": 1,
            "maximum": 100
          }
        }
      },
      "OperationWorkflowCaseAction": {
        "type": "object",
        "description": "OperationWorkflowCaseAction. Current evidence and advisory coordination for an exact scoped business workflow.",
        "required": [
          "kind",
          "summary"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "description": "OperationWorkflowCaseAction.kind. Advisory suggestion category; never an execution command."
          },
          "summary": {
            "type": "string",
            "description": "OperationWorkflowCaseAction.summary. Evidence-based human next step."
          },
          "owner": {
            "type": "string",
            "description": "OperationWorkflowCaseAction.owner. Application blocker owner, verification owner or separate human coordination owner depending on kind."
          },
          "operation_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowCaseAction.operation_id. Retained reporting operation evidence link."
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowCaseAction.subscription_id. Source readiness inbox for a follow-up suggestion."
          },
          "sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "OperationWorkflowCaseAction.sequence. Retained source notification sequence."
          }
        }
      },
      "OperationWorkflowNextActionDigestPolicy": {
        "type": "object",
        "additionalProperties": false,
        "description": "Fixed team digest selection and cadence. Owner is both the exact action-owner filter and inbox recipient label, not proof of team membership. Overdue actions, deadlines within the configured approaching window and unaccepted handoffs qualify. Unchanged delivered items are suppressed.",
        "required": [
          "owner"
        ],
        "properties": {
          "owner": {
            "type": "string",
            "maxLength": 256,
            "description": "Nonblank trimmed control-free UTF-8 team label, at most 256 bytes."
          },
          "workflow": {
            "type": "string",
            "description": "Optional exact workflow selector, independent of the subscription discovery workflow."
          },
          "action_kind": {
            "type": "string",
            "description": "Optional exact next-action kind supported by the work queue."
          },
          "action_trigger": {
            "type": "string",
            "enum": [
              "human",
              "automatic",
              "suggested"
            ]
          },
          "cadence_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 60,
            "maximum": 604800,
            "default": 3600,
            "description": "Digest cadence, default one hour. The first evaluation is scheduled from subscription creation; retries retain the due time."
          },
          "soon_after_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 60,
            "maximum": 604800,
            "default": 86400,
            "description": "Approaching deadline window from each successful evaluation, default one day. Undated suggestions do not qualify."
          }
        }
      },
      "OperationWorkflowNextActionDigest": {
        "type": "object",
        "additionalProperties": false,
        "description": "One bounded changed-item team digest. Items are advisory snapshots, not application authorization; source state may change before reading or publication. Fingerprints exclude polling timestamps and are recorded atomically with delivery under the subscription lease. Acknowledgment changes no source obligation.",
        "required": [
          "items",
          "owner",
          "scope",
          "evaluated_at",
          "soon_until",
          "matching_count",
          "changed_count",
          "remaining_changed_count",
          "retention_limited"
        ],
        "properties": {
          "explanations": {
            "type": "array",
            "maxItems": 20,
            "description": "Delivery explanations identified by source subscription, sequence and action kind. Older notifications may omit these.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowNextActionDigestExplanation"
            }
          },
          "items": {
            "type": "array",
            "minItems": 1,
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowNextActionQueueItem"
            }
          },
          "owner": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time"
          },
          "soon_until": {
            "type": "string",
            "format": "date-time"
          },
          "matching_count": {
            "type": "integer",
            "description": "All retained qualifying action rows, including unchanged items; not a workflow or global task count."
          },
          "changed_count": {
            "type": "integer",
            "description": "Newly qualifying or changed action rows pending delivery at this evaluation."
          },
          "remaining_changed_count": {
            "type": "integer",
            "description": "Changed rows beyond this delivery cap, which remain eligible at later cadence evaluations."
          },
          "retention_limited": {
            "type": "boolean",
            "description": "Queue and source inbox retention bound coverage. Deleted/pruned source work is unavailable."
          }
        }
      },
      "OperationWorkflowActionObligation": {
        "type": "object",
        "additionalProperties": false,
        "description": "Stable source-and-kind identity derived from the persisted obligation epoch, including dependency-review revision where available. Ownership changes and deadline edits preserve the identity except a newly scheduled response check-in, which defines a new check-in obligation. Older saved actions may omit identity.",
        "required": [
          "id",
          "started_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperationWorkflowObligationReplacement": {
        "type": "object",
        "additionalProperties": false,
        "description": "Same-source obligation succession recorded atomically with a source change. Links require overlapping saved case coverage and removed/new cycles or explicit transition references; a retained terminal same-kind predecessor may link a later cycle. Generic new-cycle reasons describe succession rather than business causation. Reinstated known identities, unrelated cases and missing history are not linked. These edges do not prove fulfillment.",
        "required": [
          "predecessor_id",
          "successor_id",
          "predecessor_kind",
          "successor_kind",
          "reason",
          "reason_kind"
        ],
        "properties": {
          "predecessor_id": {
            "type": "string"
          },
          "successor_id": {
            "type": "string"
          },
          "predecessor_kind": {
            "type": "string"
          },
          "successor_kind": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "reason_kind": {
            "type": "string",
            "enum": [
              "recorded_decision",
              "recorded_reassignment",
              "revised_commitment",
              "new_cycle"
            ]
          }
        }
      },
      "OperationWorkflowObligationEvent": {
        "type": "object",
        "additionalProperties": false,
        "description": "Retained source receipt anchored to the saved obligation; observed_assignment describes the delivered assignment snapshot, not a newly audited write. Available event coverage is partial.",
        "required": [
          "kind",
          "at",
          "explanation"
        ],
        "properties": {
          "fulfillment_review_escalation": {
            "$ref": "#/components/schemas/OperationWorkflowFulfillmentReviewEscalation"
          },
          "fulfillment_review_reminder": {
            "$ref": "#/components/schemas/OperationWorkflowFulfillmentReviewReminder"
          },
          "review_coordination": {
            "$ref": "#/components/schemas/OperationWorkflowFulfillmentReviewCoordinationChange"
          },
          "fulfillment_review": {
            "$ref": "#/components/schemas/OperationWorkflowObligationFulfillmentReview"
          },
          "reaffirmation": {
            "$ref": "#/components/schemas/OperationWorkflowObligationReaffirmation"
          },
          "reopening": {
            "$ref": "#/components/schemas/OperationWorkflowObligationReopening"
          },
          "fulfillment": {
            "$ref": "#/components/schemas/OperationWorkflowObligationFulfillment"
          },
          "target_binding": {
            "$ref": "#/components/schemas/OperationWorkflowObligationTargetBinding"
          },
          "replacement": {
            "$ref": "#/components/schemas/OperationWorkflowObligationReplacement"
          },
          "cases": {
            "type": "array",
            "description": "Affected case identities captured at the source change. Legacy receipts may omit them; case views exclude unscoped receipts.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowNextActionCase"
            }
          },
          "action_kind": {
            "type": "string"
          },
          "shared_plan": {
            "type": "boolean"
          },
          "obligation_id": {
            "type": "string",
            "description": "Exact obligation identity for mutation-time receipts; older inferred observations may omit it."
          },
          "kind": {
            "type": "string",
            "enum": [
              "observed_assignment",
              "accepted",
              "declined",
              "reassigned",
              "completed",
              "canceled",
              "rescheduled",
              "assigned",
              "changed",
              "superseded",
              "replaces",
              "replaced_by",
              "target_bound",
              "target_cleared",
              "fulfilled",
              "reopened",
              "fulfillment_review_required",
              "fulfillment_reaffirmed",
              "fulfillment_review_coordinated",
              "fulfillment_review_overdue",
              "fulfillment_review_escalated"
            ]
          },
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "actor": {
            "type": "string"
          },
          "explanation": {
            "type": "string"
          }
        }
      },
      "OperationWorkflowNextActionDigestCheck": {
        "type": "object",
        "additionalProperties": false,
        "description": "Read-only current source reconciliation of a saved digest, using independent retained source reads. No delivery snapshot or workflow is modified.",
        "required": [
          "items",
          "retention_limited"
        ],
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowNextActionDigestCheckItem"
            }
          },
          "retention_limited": {
            "type": "boolean"
          }
        }
      },
      "OperationWorkflowNextActionDigestCheckItem": {
        "type": "object",
        "additionalProperties": false,
        "description": "Current result for one saved source action. Completed requires an epoch-matched lifecycle receipt or an explicit resolved generic source follow-up closure; no-longer-outstanding and unavailable never imply completion. Current owner filters are intentionally not applied so reassignment remains visible. Linked evidence health and application success are not inferred.",
        "required": [
          "subscription_id",
          "sequence",
          "action_kind",
          "status",
          "explanation",
          "changed_fields",
          "history_limited"
        ],
        "properties": {
          "obligation_id": {
            "type": "string"
          },
          "history_limited": {
            "type": "boolean",
            "description": "Lifecycle coverage is bounded by source retention and available anchored receipts; missing events never prove completion."
          },
          "lifecycle": {
            "type": "array",
            "maxItems": 40,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowObligationEvent"
            }
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "sequence": {
            "type": "integer",
            "format": "int64"
          },
          "action_kind": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "outstanding",
              "changed",
              "completed",
              "no_longer_outstanding",
              "unavailable",
              "replaced",
              "canceled"
            ]
          },
          "explanation": {
            "type": "string"
          },
          "changed_fields": {
            "type": "array",
            "maxItems": 11,
            "items": {
              "type": "string"
            }
          },
          "current": {
            "$ref": "#/components/schemas/OperationWorkflowNextActionQueueItem"
          },
          "completion": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessCompletion"
          }
        }
      },
      "OperationWorkflowNextActionDigestExplanation": {
        "type": "object",
        "additionalProperties": false,
        "description": "Why one delivered action qualified, which projected fields changed since its last delivered snapshot, and advisory next steps. Missing historical snapshots never imply no changes; absence from a digest does not prove completion. Evidence comparisons describe references, not live evidence health or escalation state.",
        "required": [
          "subscription_id",
          "sequence",
          "action_kind",
          "reasons",
          "comparison",
          "changed_fields",
          "next_step"
        ],
        "properties": {
          "obligation_id": {
            "type": "string",
            "description": "Exact work-item identity, distinguishing multiple fulfillment reviews on one shared source."
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "sequence": {
            "type": "integer",
            "format": "int64"
          },
          "action_kind": {
            "type": "string"
          },
          "reasons": {
            "type": "array",
            "minItems": 1,
            "maxItems": 2,
            "items": {
              "type": "string",
              "enum": [
                "overdue",
                "approaching_deadline",
                "waiting_for_acceptance",
                "waiting_for_fulfillment_review"
              ]
            }
          },
          "comparison": {
            "type": "string",
            "enum": [
              "first_delivery",
              "previous_delivery",
              "previous_snapshot_unavailable"
            ]
          },
          "changed_fields": {
            "type": "array",
            "maxItems": 11,
            "items": {
              "type": "string",
              "enum": [
                "obligation",
                "deadline",
                "overdue",
                "owner",
                "summary",
                "trigger",
                "evidence",
                "cases",
                "shared_plan",
                "scope",
                "subscription_tenant_id",
                "fulfillment_review"
              ]
            }
          },
          "next_step": {
            "type": "string"
          }
        }
      },
      "OperationWorkflowNextActionCase": {
        "type": "object",
        "description": "Exact workflow case affected by a current source action.",
        "additionalProperties": false,
        "required": [
          "subject",
          "workflow",
          "instance_id"
        ],
        "properties": {
          "subject": {
            "$ref": "#/components/schemas/OperationSubject"
          },
          "workflow": {
            "type": "string"
          },
          "instance_id": {
            "type": "string"
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid",
            "description": "Included only for authorized account operator views; platform tenant scope is implicit."
          }
        }
      },
      "OperationWorkflowNextActionQueueItem": {
        "type": "object",
        "additionalProperties": false,
        "description": "Current source action shown once across its matching workflow cases. Owner and due filters apply to the action, not parent coordination. Shared record controls affect all covered cases; evidence and case lists respect the customer/workflow selector.",
        "required": [
          "action",
          "cases",
          "scope"
        ],
        "properties": {
          "action": {
            "$ref": "#/components/schemas/OperationWorkflowCaseNextAction"
          },
          "cases": {
            "type": "array",
            "minItems": 1,
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowNextActionCase"
            }
          },
          "scope": {
            "type": "string"
          },
          "subscription_tenant_id": {
            "type": "string",
            "format": "uuid",
            "description": "Source subscription customer selector for opening its controls, distinct from affected case customers."
          }
        }
      },
      "OperationWorkflowCaseNextAction": {
        "type": "object",
        "additionalProperties": false,
        "description": "One current coordination obligation or suggestion for an exact workflow case, including the responsible label, its own deadline and a source inbox link. Shared plans may span cases; evidence includes only references matching this case. This does not authorize application execution or infer business completion.",
        "required": [
          "kind",
          "summary",
          "trigger",
          "overdue",
          "subscription_id",
          "sequence"
        ],
        "properties": {
          "fulfillment_review": {
            "$ref": "#/components/schemas/OperationWorkflowObligationFulfillmentReview",
            "description": "Pending exact-case review of separately fulfilled work. Has an independent work-item identity and no inferred deadline."
          },
          "obligation": {
            "$ref": "#/components/schemas/OperationWorkflowActionObligation"
          },
          "kind": {
            "type": "string",
            "enum": [
              "response_check_in",
              "decision_revalidation",
              "handoff_acceptance",
              "handoff_reassignment",
              "escalation_acknowledgment",
              "coordinator_completion",
              "scheduled_evidence_check",
              "coordinator_evidence_review",
              "coordinator_revision",
              "dependency_review",
              "follow_up",
              "fulfillment_review"
            ]
          },
          "summary": {
            "type": "string"
          },
          "owner": {
            "type": "string"
          },
          "trigger": {
            "type": "string",
            "enum": [
              "human",
              "automatic",
              "suggested"
            ],
            "description": "Human obligation, automatic scheduled worker check or optional operator suggestion. Opening controls does not perform the action."
          },
          "due_at": {
            "type": "string",
            "format": "date-time"
          },
          "overdue": {
            "type": "boolean",
            "description": "This action's own due time is at or before coordination_checked_at. Undated suggestions are never overdue."
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "sequence": {
            "type": "integer",
            "format": "int64"
          },
          "evidence": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowReviewResponseLink"
            }
          },
          "shared_plan": {
            "type": "boolean",
            "description": "The originating plan or completion has references to other workflow cases. Case evidence is filtered; the source controls act on the shared record."
          }
        }
      },
      "OperationWorkflowCaseObligationHistoryItem": {
        "type": "object",
        "additionalProperties": false,
        "description": "Case-scoped receipts grouped by exact source obligation, alongside its current action when still projected. Absence of a current action is not completion. Shared source controls can affect additional cases; foreign case identities are excluded.",
        "required": [
          "obligation_id",
          "action_kind",
          "subscription_id",
          "sequence",
          "scope",
          "shared_plan",
          "events",
          "events_truncated"
        ],
        "properties": {
          "fulfillment_review": {
            "$ref": "#/components/schemas/OperationWorkflowObligationFulfillmentReview"
          },
          "obligation_id": {
            "type": "string"
          },
          "action_kind": {
            "type": "string"
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "sequence": {
            "type": "integer",
            "format": "int64"
          },
          "scope": {
            "type": "string"
          },
          "subscription_tenant_id": {
            "type": "string",
            "format": "uuid"
          },
          "shared_plan": {
            "type": "boolean"
          },
          "events": {
            "type": "array",
            "maxItems": 40,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowObligationEvent"
            }
          },
          "events_truncated": {
            "type": "boolean"
          },
          "current": {
            "$ref": "#/components/schemas/OperationWorkflowCaseNextAction"
          }
        }
      },
      "OperationWorkflowObligationContext": {
        "type": "object",
        "additionalProperties": false,
        "description": "Fresh exact-case transition context shared by obligation assessments. Detailed declared requirements and dependency identities remain in instance.readiness, avoiding duplicated evidence payloads. Stale or absent reports never produce a positive transition verdict; a satisfied edge does not grant application execution or bind a free-form plan.",
        "required": [
          "status",
          "summary",
          "checked_at",
          "coverage_incomplete",
          "transition_count",
          "evaluated_transition_count"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "evidence_unavailable",
              "terminal_reported",
              "transition_requirements_satisfied",
              "partial_readiness",
              "no_declared_transition",
              "waiting_on_requirements"
            ]
          },
          "summary": {
            "type": "string"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "coverage_incomplete": {
            "type": "boolean"
          },
          "transition_count": {
            "type": "integer"
          },
          "evaluated_transition_count": {
            "type": "integer"
          }
        }
      },
      "OperationWorkflowObligationTransitionTarget": {
        "type": "object",
        "additionalProperties": false,
        "description": "Exact declared transition identity and pinned workflow contract version; it is an advisory target, not execution authorization.",
        "required": [
          "operation",
          "from",
          "to",
          "contract_version"
        ],
        "properties": {
          "operation": {
            "type": "string"
          },
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "contract_version": {
            "type": "integer",
            "minimum": 1
          }
        }
      },
      "OperationWorkflowObligationTargetBinding": {
        "type": "object",
        "additionalProperties": false,
        "description": "One obligation-cycle and exact-case target binding, recorded with an authenticated actor and reason. Unrelated edits preserve it; a new cycle never inherits it. Current readiness is independently reassessed.",
        "required": [
          "obligation_id",
          "case",
          "transition",
          "reason",
          "bound_at",
          "bound_by"
        ],
        "properties": {
          "obligation_id": {
            "type": "string"
          },
          "case": {
            "$ref": "#/components/schemas/OperationWorkflowNextActionCase"
          },
          "transition": {
            "$ref": "#/components/schemas/OperationWorkflowObligationTransitionTarget"
          },
          "reason": {
            "type": "string"
          },
          "bound_at": {
            "type": "string",
            "format": "date-time"
          },
          "bound_by": {
            "type": "string"
          }
        }
      },
      "OperationWorkflowObligationTargetRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Bind or clear one active free-form plan obligation for an exact case. Clear requires no transition; bind requires a fresh declared current-state transition. Requires the current coordination revision and unchanged status, owner, note and deadline; cannot combine with completion or review-response edits. Customer cases omit tenant IDs; operators specify the exact customer. Source obligation identity is rechecked under its write lock; evidence observation and persistence are independent.",
        "required": [
          "obligation_id",
          "case",
          "reason"
        ],
        "properties": {
          "obligation_id": {
            "type": "string"
          },
          "case": {
            "$ref": "#/components/schemas/OperationWorkflowNextActionCase"
          },
          "transition": {
            "$ref": "#/components/schemas/OperationWorkflowObligationTransitionTarget"
          },
          "clear": {
            "type": "boolean"
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048
          }
        }
      },
      "OperationWorkflowObligationFulfillmentRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Explicit fulfillment of one current bound case/cycle. Must preserve source status, owner, note and deadline and cannot combine with target binding, response or shared completion edits. The full binding fences replacement or rebinding. Evidence must be a retained application report of the exact target transition, published after binding; current readiness is insufficient.",
        "required": [
          "binding",
          "reason",
          "evidence_operation_id",
          "evidence_report_id"
        ],
        "properties": {
          "binding": {
            "$ref": "#/components/schemas/OperationWorkflowObligationTargetBinding"
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048
          },
          "evidence_operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "evidence_report_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      },
      "OperationWorkflowObligationFulfillment": {
        "type": "object",
        "additionalProperties": false,
        "description": "Immutable human fulfillment receipt for one exact case and obligation cycle, linked to a retained application transition report. Does not close a shared source plan or assert business success or execution authority. Retained transition lookup scans at most 1000 exact-case reports.",
        "required": [
          "binding",
          "reason",
          "action_kind",
          "owner",
          "evidence",
          "evidence_checked_at",
          "completed_at",
          "completed_by"
        ],
        "properties": {
          "binding": {
            "$ref": "#/components/schemas/OperationWorkflowObligationTargetBinding"
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048
          },
          "action_kind": {
            "type": "string",
            "enum": [
              "response_check_in",
              "coordinator_completion",
              "follow_up"
            ]
          },
          "owner": {
            "type": "string"
          },
          "evidence": {
            "$ref": "#/components/schemas/OperationWorkflowStateHistoryEntry"
          },
          "evidence_checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_by": {
            "type": "string"
          }
        }
      },
      "OperationWorkflowObligationReopeningRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Explicitly reopen the latest fulfillment for an exact bound case and current source cycle, with a reason. Preserve source status, owner, note and deadline; cannot combine with other action edits. Retired sources, superseded cycles and changed/cleared bindings cannot be reopened. Reopening does not execute an application transition.",
        "required": [
          "binding",
          "fulfilled_at",
          "reason"
        ],
        "properties": {
          "binding": {
            "$ref": "#/components/schemas/OperationWorkflowObligationTargetBinding"
          },
          "fulfilled_at": {
            "type": "string",
            "format": "date-time",
            "description": "Completion time of the exact latest fulfillment being reopened."
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048
          }
        }
      },
      "OperationWorkflowObligationReopening": {
        "type": "object",
        "additionalProperties": false,
        "description": "Immutable human decision to restore one current-source case/cycle to work, retaining the original fulfillment and its application evidence. Owner notices are delivered by the worker, with durable duplicate suppression. A subsequent fulfillment requires a report published after this reopening.",
        "required": [
          "source_sequence",
          "binding",
          "fulfilled_at",
          "reason",
          "action_kind",
          "owner",
          "reopened_at",
          "reopened_by"
        ],
        "properties": {
          "source_sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "Source notification sequence within the delivering readiness subscription."
          },
          "binding": {
            "$ref": "#/components/schemas/OperationWorkflowObligationTargetBinding"
          },
          "fulfilled_at": {
            "type": "string",
            "format": "date-time"
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048
          },
          "action_kind": {
            "type": "string",
            "enum": [
              "response_check_in",
              "coordinator_completion",
              "follow_up"
            ]
          },
          "owner": {
            "type": "string"
          },
          "reopened_at": {
            "type": "string",
            "format": "date-time"
          },
          "reopened_by": {
            "type": "string"
          }
        }
      },
      "OperationWorkflowObligationFulfillmentReview": {
        "type": "object",
        "additionalProperties": false,
        "description": "Bounded independent observation of the latest fulfilled case/cycle and its original or reaffirmed proof. Flags remain latched until explicit reaffirmation or reopening; normal workflow progress is not invalidation. Reasons describe retained coverage, not inferred business failure. Identical semantic observations suppress owner notices.",
        "required": [
          "action_kind",
          "binding",
          "fulfilled_at",
          "basis_at",
          "source_sequence",
          "owner",
          "review_required",
          "reasons",
          "current_reasons",
          "checked_at",
          "fingerprint",
          "current_contract_version",
          "current_state_revision"
        ],
        "properties": {
          "escalation_owner": {
            "type": "string",
            "maxLength": 256,
            "description": "Optional escalation team, distinct from the review owner. Requires an explicit review deadline and positive grace period."
          },
          "escalate_after_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 604800,
            "description": "Grace period after actual overdue-reminder delivery. Positive values require an escalation owner; zero disables escalation."
          },
          "manual_owner": {
            "type": "boolean",
            "description": "Explicit review-cycle owner, preserved across worker observations without altering original work ownership."
          },
          "due_at": {
            "type": "string",
            "format": "date-time",
            "description": "Explicit review deadline, independent of the original source plan."
          },
          "action_kind": {
            "type": "string",
            "enum": [
              "response_check_in",
              "coordinator_completion",
              "follow_up"
            ]
          },
          "binding": {
            "$ref": "#/components/schemas/OperationWorkflowObligationTargetBinding"
          },
          "fulfilled_at": {
            "type": "string",
            "format": "date-time"
          },
          "basis_at": {
            "type": "string",
            "format": "date-time",
            "description": "Original fulfillment or latest explicit reaffirmation time; old observations cannot overwrite a newer basis."
          },
          "source_sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "owner": {
            "type": "string"
          },
          "review_required": {
            "type": "boolean"
          },
          "reasons": {
            "type": "array",
            "maxItems": 8,
            "description": "Latched reasons requiring explicit review, retained even after current evidence recovers. Possible reasons are supporting_report_unavailable, current_evidence_unavailable, contract_changed, resolution_invalidated and verification_unavailable.",
            "items": {
              "type": "string"
            }
          },
          "current_reasons": {
            "type": "array",
            "maxItems": 8,
            "description": "Current observed issues; empty does not automatically clear a latched review flag.",
            "items": {
              "type": "string"
            }
          },
          "required_at": {
            "type": "string",
            "format": "date-time"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "fingerprint": {
            "type": "string",
            "description": "Semantic comparison identity; timestamps and ordinary reporting revisions do not create new notices."
          },
          "current_contract_version": {
            "type": "integer",
            "minimum": 0
          },
          "current_state_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "current_operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "current_report_id": {
            "type": "string"
          }
        }
      },
      "OperationWorkflowObligationReaffirmationRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Explicitly reaffirm a flagged latest fulfillment without reopening work. Preserve source status, owner, note and deadline and do not combine with other actions. Source revision, binding, fulfillment time and review fingerprint fence stale decisions. Evidence must be a full application state report for the exact case under the fresh current contract and be published after review was required; current retained evidence is rechecked independently before commit.",
        "required": [
          "binding",
          "fulfilled_at",
          "review_fingerprint",
          "reason",
          "evidence_operation_id",
          "evidence_report_id"
        ],
        "properties": {
          "binding": {
            "$ref": "#/components/schemas/OperationWorkflowObligationTargetBinding"
          },
          "fulfilled_at": {
            "type": "string",
            "format": "date-time"
          },
          "review_fingerprint": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048
          },
          "evidence_operation_id": {
            "type": "string",
            "format": "uuid"
          },
          "evidence_report_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      },
      "OperationWorkflowObligationReaffirmation": {
        "type": "object",
        "additionalProperties": false,
        "description": "Immutable human review receipt with a fresh retained application state report. Original fulfillment and evidence remain intact; subsequent monitoring uses this proof as its basis. Does not authorize application execution or establish current business success. Each retained exact-case lookup scans at most 1000 reports.",
        "required": [
          "action_kind",
          "binding",
          "fulfilled_at",
          "review_fingerprint",
          "reason",
          "source_sequence",
          "owner",
          "evidence",
          "evidence_checked_at",
          "reaffirmed_at",
          "reaffirmed_by"
        ],
        "properties": {
          "action_kind": {
            "type": "string",
            "enum": [
              "response_check_in",
              "coordinator_completion",
              "follow_up"
            ]
          },
          "binding": {
            "$ref": "#/components/schemas/OperationWorkflowObligationTargetBinding"
          },
          "fulfilled_at": {
            "type": "string",
            "format": "date-time"
          },
          "review_fingerprint": {
            "type": "string"
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048
          },
          "source_sequence": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "owner": {
            "type": "string"
          },
          "evidence": {
            "$ref": "#/components/schemas/OperationWorkflowStateHistoryEntry"
          },
          "evidence_checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "reaffirmed_at": {
            "type": "string",
            "format": "date-time"
          },
          "reaffirmed_by": {
            "type": "string"
          }
        }
      },
      "OperationWorkflowFulfillmentReviewEscalation": {
        "type": "object",
        "additionalProperties": false,
        "description": "Immutable destination delivery receipt for an unresolved review after its actual overdue reminder and configured grace period. Reassignment after that reminder cancels escalation for that deadline, including reverting an owner change; a new deadline starts a new window. Reaffirmation, reopening, supersession and changed policy/deadline suppress stale delivery. Delivery preserves review ownership and original fulfillment and does not execute application work.",
        "required": [
          "review_id",
          "notification_id",
          "reminder_notification_id",
          "due_at",
          "escalate_at",
          "notified_at",
          "escalation_owner",
          "review"
        ],
        "properties": {
          "review_id": {
            "type": "string"
          },
          "notification_id": {
            "type": "string",
            "format": "uuid"
          },
          "reminder_notification_id": {
            "type": "string",
            "format": "uuid"
          },
          "due_at": {
            "type": "string",
            "format": "date-time"
          },
          "escalate_at": {
            "type": "string",
            "format": "date-time"
          },
          "notified_at": {
            "type": "string",
            "format": "date-time"
          },
          "escalation_owner": {
            "type": "string",
            "maxLength": 256
          },
          "review": {
            "$ref": "#/components/schemas/OperationWorkflowObligationFulfillmentReview"
          }
        }
      },
      "OperationWorkflowFulfillmentReviewReminder": {
        "type": "object",
        "additionalProperties": false,
        "description": "Immutable atomic inbox-delivery receipt for one review work-item and deadline. Includes the saved owner, reasons, case and evidence context. Identical deadlines do not repeat within the same review cycle; a new deadline or review cycle is independently eligible. Delivery does not complete or reopen the original work, change its owner, or assert fresh application evidence.",
        "required": [
          "review_id",
          "notification_id",
          "due_at",
          "notified_at",
          "review"
        ],
        "properties": {
          "review_id": {
            "type": "string"
          },
          "notification_id": {
            "type": "string",
            "format": "uuid"
          },
          "due_at": {
            "type": "string",
            "format": "date-time"
          },
          "notified_at": {
            "type": "string",
            "format": "date-time"
          },
          "review": {
            "$ref": "#/components/schemas/OperationWorkflowObligationFulfillmentReview"
          }
        }
      },
      "OperationWorkflowFulfillmentReviewCoordinationRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Assign and schedule one exact pending fulfillment-review cycle with a reason. Source revision and review fingerprint fence stale edits. Preserve source status, owner, note and deadline; do not combine with other actions. Configure an optional escalation team/grace period; reassignment after an overdue reminder cancels escalation for that deadline, including reverted routing. Removing the deadline disables escalation when policy fields are omitted. Empty owner explicitly unassigns; omitted due_at clears the review deadline. Original fulfillment remains intact.",
        "required": [
          "review_id",
          "review_fingerprint",
          "owner",
          "reason"
        ],
        "properties": {
          "escalation_owner": {
            "type": "string",
            "maxLength": 256,
            "description": "Omission preserves existing policy when the review owner is unchanged and a deadline remains. Empty string clears escalation. Nonempty team must differ from the review owner and requires an explicit deadline and positive grace period."
          },
          "escalate_after_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 604800,
            "description": "Optional grace period after actual overdue-reminder delivery. Omission preserves the existing value; zero clears escalation. Owner reassignment or removing the deadline clears policy when both policy fields are omitted."
          },
          "review_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "review_fingerprint": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "owner": {
            "type": "string",
            "maxLength": 256
          },
          "due_at": {
            "type": "string",
            "format": "date-time"
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048
          }
        }
      },
      "OperationWorkflowFulfillmentReviewCoordinationChange": {
        "type": "object",
        "additionalProperties": false,
        "description": "Immutable explicit ownership/deadline change for one exact pending review cycle, including prior values and authenticated actor/reason. Does not modify original work or execute an application transition.",
        "required": [
          "review_id",
          "binding",
          "fulfilled_at",
          "from_owner",
          "owner",
          "reason",
          "at",
          "actor"
        ],
        "properties": {
          "from_escalation_owner": {
            "type": "string"
          },
          "previous_escalate_after_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 604800
          },
          "escalation_owner": {
            "type": "string",
            "maxLength": 256,
            "description": "New escalation team recorded by this review coordination change; empty or absent means escalation is disabled."
          },
          "escalate_after_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 604800,
            "description": "New grace period in seconds recorded by this review coordination change; zero or absent means escalation is disabled."
          },
          "review_id": {
            "type": "string"
          },
          "binding": {
            "$ref": "#/components/schemas/OperationWorkflowObligationTargetBinding"
          },
          "fulfilled_at": {
            "type": "string",
            "format": "date-time"
          },
          "from_owner": {
            "type": "string"
          },
          "owner": {
            "type": "string"
          },
          "previous_due_at": {
            "type": "string",
            "format": "date-time"
          },
          "due_at": {
            "type": "string",
            "format": "date-time"
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048
          },
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "actor": {
            "type": "string"
          }
        }
      },
      "OperationWorkflowObligationAssessment": {
        "type": "object",
        "additionalProperties": false,
        "description": "Coordination assessment for one displayed outstanding source action. Human reviews, ownership acceptance and worker checks are distinct from executing application transitions. Free-form response/coordinator plans remain fulfillment_unassessed without a declared binding. Deadlines and histories never create dependency guards or authorize actions.",
        "required": [
          "subscription_id",
          "sequence",
          "action_kind",
          "status",
          "summary",
          "checked_at"
        ],
        "properties": {
          "binding": {
            "$ref": "#/components/schemas/OperationWorkflowObligationTargetBinding"
          },
          "readiness": {
            "$ref": "#/components/schemas/OperationWorkflowTransitionReadiness"
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid"
          },
          "sequence": {
            "type": "integer",
            "format": "int64"
          },
          "obligation_id": {
            "type": "string"
          },
          "action_kind": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "fulfillment_unassessed",
              "acceptance_required",
              "scheduled_check",
              "review_actionable",
              "review_evidence_unavailable",
              "human_action_required",
              "target_unavailable",
              "waiting_on_target_requirements",
              "target_requirements_satisfied"
            ]
          },
          "summary": {
            "type": "string"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OperationWorkflowCase": {
        "type": "object",
        "description": "OperationWorkflowCase. Current evidence and advisory coordination for an exact scoped business workflow.",
        "required": [
          "obligation_assessments",
          "obligation_history",
          "obligation_history_count",
          "obligation_history_truncated",
          "obligation_history_limited",
          "obligation_history_checked_at",
          "next_actions",
          "next_action_count",
          "next_actions_truncated",
          "playbook_progress",
          "guidance",
          "guidance_status",
          "guidance_truncated",
          "status",
          "summary",
          "follow_ups",
          "follow_up_count",
          "overdue_follow_up_count",
          "follow_ups_truncated",
          "actions",
          "actions_truncated",
          "timeline",
          "evidence_checked_at",
          "coordination_checked_at",
          "evaluated_at",
          "limitations"
        ],
        "properties": {
          "obligation_context": {
            "$ref": "#/components/schemas/OperationWorkflowObligationContext"
          },
          "obligation_assessments": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowObligationAssessment"
            }
          },
          "obligation_history": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowCaseObligationHistoryItem"
            }
          },
          "obligation_history_count": {
            "type": "integer",
            "description": "Matching obligation groups found in this bounded retained source scan."
          },
          "obligation_history_truncated": {
            "type": "boolean",
            "description": "Known receipt pruning or response caps limited this history view."
          },
          "obligation_history_limited": {
            "type": "boolean",
            "description": "Deleted sources and older receipts without case attribution are unavailable; missing events never establish completion."
          },
          "obligation_history_checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "next_actions": {
            "type": "array",
            "maxItems": 100,
            "description": "Current obligations and suggestions from retained source records, matched to the exact case before follow-up page truncation. Ordered overdue first, then dated work by due time. Historical delivery snapshots do not create work.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowCaseNextAction"
            }
          },
          "next_action_count": {
            "type": "integer",
            "description": "Number of retained matching action rows before the 100-row cap. One source can have several obligations; this is not a workflow or global task count."
          },
          "next_actions_truncated": {
            "type": "boolean",
            "description": "Additional retained actions were omitted from the bounded response."
          },
          "playbook_progress": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPlaybookProgress"
            },
            "description": "OperationWorkflowCase.playbook_progress. Durable pinned checklists for this exact case, retained independently of inboxes and current guidance; at most 100."
          },
          "guidance": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPlaybookGuidance"
            },
            "description": "OperationWorkflowCase.guidance. Matching application playbooks from the definition that reported current fresh nonterminal evidence."
          },
          "guidance_status": {
            "type": "string",
            "enum": [
              "available",
              "not_declared",
              "evidence_unavailable",
              "definition_unavailable"
            ],
            "description": "OperationWorkflowCase.guidance_status. Availability of exact reporting-definition playbooks, independent of matches and readiness."
          },
          "guidance_truncated": {
            "type": "boolean",
            "description": "OperationWorkflowCase.guidance_truncated. Matching guidance or the evaluated transition evidence was truncated."
          },
          "status": {
            "type": "string",
            "description": "OperationWorkflowCase.status. Unknown, stale, terminal_reported, no_transition, blocked or ready. Terminal state alone is not success."
          },
          "summary": {
            "type": "string",
            "description": "OperationWorkflowCase.summary. Current evidence interpretation with application authority boundaries."
          },
          "instance": {
            "type": "object",
            "$ref": "#/components/schemas/OperationWorkflowInstanceSnapshot",
            "description": "OperationWorkflowCase.instance. Current retained exact-customer workflow projection; omitted when no contract projection exists."
          },
          "follow_ups": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowReadinessFollowUp"
            },
            "description": "OperationWorkflowCase.follow_ups. Matching open scheduled follow-ups, ordered by due clock; independent of application readiness."
          },
          "follow_up_count": {
            "type": "integer",
            "minimum": 0,
            "description": "OperationWorkflowCase.follow_up_count. Total matching retained open scheduled follow-ups before overview truncation."
          },
          "overdue_follow_up_count": {
            "type": "integer",
            "minimum": 0,
            "description": "OperationWorkflowCase.overdue_follow_up_count. Matching retained follow-ups due by coordination check time."
          },
          "follow_ups_truncated": {
            "type": "boolean",
            "description": "OperationWorkflowCase.follow_ups_truncated. Only the first 100 matching follow-ups are included."
          },
          "actions": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowCaseAction"
            },
            "description": "OperationWorkflowCase.actions. At most 100 evidence-based suggestions, with stale/missing evidence requiring a refresh."
          },
          "actions_truncated": {
            "type": "boolean",
            "description": "OperationWorkflowCase.actions_truncated. Additional suggestions exceeded the bounded overview."
          },
          "timeline": {
            "type": "object",
            "$ref": "#/components/schemas/OperationWorkflowCoordinationTimeline",
            "description": "OperationWorkflowCase.timeline. Exact scope and identity with the independently read retained coordination event page."
          },
          "evidence_checked_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowCase.evidence_checked_at. Server observation clock after the application projection read."
          },
          "coordination_checked_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowCase.coordination_checked_at. Server clock used to classify follow-up overdue status."
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowCase.evaluated_at. Server completion clock for the independent live reads."
          },
          "limitations": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "OperationWorkflowCase.limitations. Explicit read consistency, retention and application authority boundaries."
          }
        }
      },
      "OperationWorkflowPlaybookEvidenceWatchRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookEvidenceWatchRequest. Opt-in durable checklist evidence monitoring; advisory observations preserve human reviews and application business authority.",
        "required": [
          "subscription_id",
          "progress_revision",
          "revision",
          "enabled",
          "owner"
        ],
        "properties": {
          "watch_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowPlaybookEvidenceWatchRequest.watch_id. Required current watch UUID when changing configuration; omit for a new watch. Prevents stale edits after a stopped slot is reclaimed."
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowPlaybookEvidenceWatchRequest.subscription_id. Existing inbox destination in the same application, environment, and caller access boundary."
          },
          "progress_revision": {
            "type": "integer",
            "minimum": 1,
            "format": "int64",
            "description": "OperationWorkflowPlaybookEvidenceWatchRequest.progress_revision. Expected exact human checklist revision; stale observations conflict."
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "OperationWorkflowPlaybookEvidenceWatchRequest.revision. Watch configuration revision. Zero creates; polling leaves it unchanged."
          },
          "enabled": {
            "type": "boolean",
            "description": "OperationWorkflowPlaybookEvidenceWatchRequest.enabled. Explicit monitoring preference; enabling establishes a silent baseline."
          },
          "owner": {
            "type": "string",
            "maxLength": 256,
            "description": "OperationWorkflowPlaybookEvidenceWatchRequest.owner. Responsible team label assigned to new inbox deliveries; no external destination."
          }
        }
      },
      "OperationWorkflowPlaybookEvidenceWatch": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookEvidenceWatch. Opt-in durable checklist evidence monitoring; advisory observations preserve human reviews and application business authority.",
        "required": [
          "id",
          "progress_id",
          "subscription_id",
          "revision",
          "status",
          "owner",
          "subject",
          "workflow",
          "instance_id",
          "contract_version",
          "playbook_id",
          "playbook_version",
          "created_at",
          "updated_at",
          "updated_by",
          "evaluated_at",
          "items"
        ],
        "properties": {
          "review_assignments": {
            "type": "array",
            "maxItems": 272,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPlaybookStepAssignmentReference"
            },
            "description": "OperationWorkflowPlaybookEvidenceWatch.review_assignments. Durable delivery references for dependency review episodes, bounded per watch and retained across disable and re-enable. Further episodes require a new watch after this limit."
          },
          "dependency_states": {
            "type": "array",
            "maxItems": 272,
            "description": "OperationWorkflowPlaybookEvidenceWatch.dependency_states. Last successful human step dependency observations; enrollment and re-enrollment establish a silent baseline.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPlaybookDependencyState"
            }
          },
          "step_assignments": {
            "type": "array",
            "maxItems": 16,
            "description": "OperationWorkflowPlaybookEvidenceWatch.step_assignments. Durable per-watch delivery references; disable and re-enable preserve deduplication even after inbox retention.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPlaybookStepAssignmentReference"
            }
          },
          "outcome_deadline": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookOutcomeDeadlinePolicy",
            "description": "OperationWorkflowPlaybookEvidenceWatch.outcome_deadline. Frozen application assignment policy, independent of the ordinary notification owner."
          },
          "deadline_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowPlaybookEvidenceWatch.deadline_at. Exact pinned checklist outcome deadline."
          },
          "deadline_checked_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowPlaybookEvidenceWatch.deadline_checked_at. First successful due observation, or achieved due enrollment observation; retained across configuration edits. Prevents retrospective deadline notices after observed fulfillment."
          },
          "escalation": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessOutcomeEscalationReference",
            "description": "OperationWorkflowPlaybookEvidenceWatch.escalation. Once-delivered assigned follow-up reference. Pruned rows are not recreated by polling."
          },
          "outcome_state_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "OperationWorkflowPlaybookEvidenceWatch.outcome_state_revision. Highest comparable case report observed for the pinned expectation; retained report regressions cannot establish a new result. Preserved across configuration edits and unavailable observations."
          },
          "business_outcome": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookBusinessOutcome",
            "description": "OperationWorkflowPlaybookEvidenceWatch.business_outcome. Latest retained observation of the pinned expected outcome. Enabling captures a silent baseline; ongoing polling observes result changes independently of human completion."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowPlaybookEvidenceWatch.id. Pinned case identity or retained watch metadata."
          },
          "progress_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowPlaybookEvidenceWatch.progress_id. Pinned case identity or retained watch metadata."
          },
          "subscription_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowPlaybookEvidenceWatch.subscription_id. Existing inbox destination in the same application, environment, and caller access boundary."
          },
          "revision": {
            "type": "integer",
            "minimum": 1,
            "format": "int64",
            "description": "OperationWorkflowPlaybookEvidenceWatch.revision. Watch configuration revision. Zero creates; polling leaves it unchanged."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "stopped"
            ],
            "description": "OperationWorkflowPlaybookEvidenceWatch.status. Active monitoring or stopped monitoring."
          },
          "stop_reason": {
            "type": "string",
            "description": "OperationWorkflowPlaybookEvidenceWatch.stop_reason. Disabled or stopped because the exact checklist was closed or unavailable."
          },
          "owner": {
            "type": "string",
            "maxLength": 256,
            "description": "OperationWorkflowPlaybookEvidenceWatch.owner. Responsible team label assigned to new inbox deliveries; no external destination."
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowPlaybookEvidenceWatch.platform_tenant_id. Exact evidence customer, included only for operator watches and deliveries."
          },
          "subject": {
            "$ref": "#/components/schemas/OperationSubject",
            "description": "OperationWorkflowPlaybookEvidenceWatch.subject. Pinned case identity or retained watch metadata."
          },
          "workflow": {
            "type": "string",
            "description": "OperationWorkflowPlaybookEvidenceWatch.workflow. Pinned case identity or retained watch metadata."
          },
          "instance_id": {
            "type": "string",
            "description": "OperationWorkflowPlaybookEvidenceWatch.instance_id. Pinned case identity or retained watch metadata."
          },
          "contract_version": {
            "type": "integer",
            "minimum": 1,
            "description": "OperationWorkflowPlaybookEvidenceWatch.contract_version. Pinned case identity or retained watch metadata."
          },
          "playbook_id": {
            "type": "string",
            "description": "OperationWorkflowPlaybookEvidenceWatch.playbook_id. Pinned case identity or retained watch metadata."
          },
          "playbook_version": {
            "type": "integer",
            "minimum": 1,
            "description": "OperationWorkflowPlaybookEvidenceWatch.playbook_version. Pinned case identity or retained watch metadata."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowPlaybookEvidenceWatch.created_at. Pinned case identity or retained watch metadata."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowPlaybookEvidenceWatch.updated_at. Pinned case identity or retained watch metadata."
          },
          "updated_by": {
            "type": "string",
            "description": "OperationWorkflowPlaybookEvidenceWatch.updated_by. Authenticated configuration actor, or system actor for automatic monitoring stop."
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowPlaybookEvidenceWatch.evaluated_at. Last successful case evidence observation clock."
          },
          "items": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPlaybookEvidenceCheck"
            },
            "description": "OperationWorkflowPlaybookEvidenceWatch.items. Latest retained requirement observations, separate from checklist reviews."
          }
        }
      },
      "OperationWorkflowPlaybookEvidenceChange": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookEvidenceChange. Opt-in durable checklist evidence monitoring; advisory observations preserve human reviews and application business authority.",
        "required": [
          "before_status",
          "before_reason",
          "after"
        ],
        "properties": {
          "before_status": {
            "type": "string",
            "description": "OperationWorkflowPlaybookEvidenceChange.before_status. Pinned case identity or retained watch metadata."
          },
          "before_reason": {
            "type": "string",
            "description": "OperationWorkflowPlaybookEvidenceChange.before_reason. Pinned case identity or retained watch metadata."
          },
          "after": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookEvidenceCheck",
            "description": "OperationWorkflowPlaybookEvidenceChange.after. Pinned case identity or retained watch metadata."
          }
        }
      },
      "OperationWorkflowPlaybookEvidenceEvent": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookEvidenceEvent. Opt-in durable checklist evidence monitoring; advisory observations preserve human reviews and application business authority.",
        "required": [
          "watch_id",
          "progress_id",
          "subject",
          "workflow",
          "instance_id",
          "contract_version",
          "playbook_id",
          "playbook_version",
          "checked_at",
          "changes"
        ],
        "properties": {
          "deadline_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowPlaybookEvidenceEvent.deadline_at. Original expected-result deadline when configured."
          },
          "business_outcome": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookBusinessOutcome",
            "description": "OperationWorkflowPlaybookEvidenceEvent.business_outcome. Immutable delivery-time result, including an unmet deadline observation. Mutable escalation evidence is stored separately."
          },
          "outcome_change": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookOutcomeChange",
            "description": "OperationWorkflowPlaybookEvidenceEvent.outcome_change. Optional grouped business-result change; requirement changes may be empty for an outcome-only notification."
          },
          "watch_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowPlaybookEvidenceEvent.watch_id. Pinned case identity or retained watch metadata."
          },
          "progress_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowPlaybookEvidenceEvent.progress_id. Pinned case identity or retained watch metadata."
          },
          "platform_tenant_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowPlaybookEvidenceEvent.platform_tenant_id. Exact evidence customer, included only for operator watches and deliveries."
          },
          "subject": {
            "$ref": "#/components/schemas/OperationSubject",
            "description": "OperationWorkflowPlaybookEvidenceEvent.subject. Pinned case identity or retained watch metadata."
          },
          "workflow": {
            "type": "string",
            "description": "OperationWorkflowPlaybookEvidenceEvent.workflow. Pinned case identity or retained watch metadata."
          },
          "instance_id": {
            "type": "string",
            "description": "OperationWorkflowPlaybookEvidenceEvent.instance_id. Pinned case identity or retained watch metadata."
          },
          "contract_version": {
            "type": "integer",
            "minimum": 1,
            "description": "OperationWorkflowPlaybookEvidenceEvent.contract_version. Pinned case identity or retained watch metadata."
          },
          "playbook_id": {
            "type": "string",
            "description": "OperationWorkflowPlaybookEvidenceEvent.playbook_id. Pinned case identity or retained watch metadata."
          },
          "playbook_version": {
            "type": "integer",
            "minimum": 1,
            "description": "OperationWorkflowPlaybookEvidenceEvent.playbook_version. Pinned case identity or retained watch metadata."
          },
          "checked_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowPlaybookEvidenceEvent.checked_at. Observed case evidence clock; this is polling, not an application transaction timestamp."
          },
          "changes": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPlaybookEvidenceChange"
            },
            "description": "OperationWorkflowPlaybookEvidenceEvent.changes. Grouped changes in requirement status or diagnostic reason; excludes observation clocks and report counters."
          }
        }
      },
      "OperationWorkflowPlaybookBusinessOutcome": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookBusinessOutcome. Exact-case application business result compared with a frozen playbook expectation. Independent of human completion and evidence satisfaction; changed guidance never silently changes the expected outcome.",
        "required": [
          "status",
          "reason",
          "evidence"
        ],
        "properties": {
          "outcome_guidance": {
            "type": "array",
            "maxItems": 17,
            "description": "OperationWorkflowPlaybookBusinessOutcome.outcome_guidance. Frozen complete guidance set retained for later exact-contract observations; never an execution instruction.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPlaybookOutcomeGuidance"
            }
          },
          "guidance": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookOutcomeGuidance",
            "description": "OperationWorkflowPlaybookBusinessOutcome.guidance. Matching pinned guidance for the fresh comparable reported terminal outcome; omitted for pending or unavailable reports."
          },
          "acceptance_policy": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookOutcomeAcceptancePolicy"
          },
          "acceptance": {
            "type": "string",
            "enum": [
              "expected",
              "acceptable_alternative",
              "unexpected",
              "pending",
              "unavailable"
            ],
            "description": "OperationWorkflowPlaybookBusinessOutcome.acceptance. Classification under the frozen explicit policy. Omitted for legacy playbooks; alternatives never change the primary expected-outcome status."
          },
          "deadline_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowPlaybookBusinessOutcome.deadline_at. Pinned expected-result deadline, if configured."
          },
          "deadline_reached": {
            "type": "boolean",
            "description": "OperationWorkflowPlaybookBusinessOutcome.deadline_reached. The observation clock is at or past the deadline; does not establish failure or historical timeliness."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "achieved",
              "different_outcome",
              "unavailable"
            ],
            "description": "OperationWorkflowPlaybookBusinessOutcome.status. Only a fresh comparable explicit terminal outcome establishes achieved or different outcome. Missing state, stale reports, missing terminal outcome and contract changes are unavailable."
          },
          "reason": {
            "type": "string",
            "description": "OperationWorkflowPlaybookBusinessOutcome.reason. Stable comparison reason; changing clocks and report revisions alone does not change the business result."
          },
          "evidence": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessBusinessOutcome",
            "description": "OperationWorkflowPlaybookBusinessOutcome.evidence. Shared application-outcome observation with report identity and clock. Under unavailable, the inner evaluator status is unknown and any reported code is diagnostic, not a comparable business result."
          }
        }
      },
      "OperationWorkflowPlaybookOutcomeChange": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookOutcomeChange. Saved before/after playbook result observation, separate from checklist review and business causation.",
        "required": [
          "before_status",
          "before_reason",
          "after"
        ],
        "properties": {
          "before_status": {
            "type": "string",
            "description": "OperationWorkflowPlaybookOutcomeChange.before_status. Prior observed playbook business-result status."
          },
          "before_reason": {
            "type": "string",
            "description": "OperationWorkflowPlaybookOutcomeChange.before_reason. Prior comparison reason."
          },
          "before_reported_outcome_code": {
            "type": "string",
            "maxLength": 64,
            "description": "OperationWorkflowPlaybookOutcomeChange.before_reported_outcome_code. Prior retained reported code, including diagnostic codes when comparability was unavailable."
          },
          "after": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookBusinessOutcome",
            "description": "OperationWorkflowPlaybookOutcomeChange.after. New exact-case result and reporting evidence."
          }
        }
      },
      "OperationWorkflowPlaybookOutcomeDeadlinePolicy": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookOutcomeDeadlinePolicy. Application-defined business attention policy. Requires an expected terminal outcome; all durations are whole seconds and the owner is a coordination label, not an external destination.",
        "required": [
          "after_seconds",
          "owner",
          "follow_up_after_seconds"
        ],
        "properties": {
          "acknowledge_after_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 604800,
            "description": "OperationWorkflowPlaybookOutcomeDeadlinePolicy.acknowledge_after_seconds. Optional response window from actual assigned escalation delivery; zero disables monitoring."
          },
          "fallback_owner": {
            "type": "string",
            "maxLength": 256,
            "description": "OperationWorkflowPlaybookOutcomeDeadlinePolicy.fallback_owner. Optional distinct fallback team; requires a response window and never overrides manual assignments."
          },
          "after_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 315360000,
            "description": "OperationWorkflowPlaybookOutcomeDeadlinePolicy.after_seconds. Expected wait from checklist creation, bounded to ten years."
          },
          "owner": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "OperationWorkflowPlaybookOutcomeDeadlinePolicy.owner. Required responsible team label with no surrounding whitespace or control characters."
          },
          "follow_up_after_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 604800,
            "description": "OperationWorkflowPlaybookOutcomeDeadlinePolicy.follow_up_after_seconds. Assigned follow-up delay from actual notice delivery, independently bounded to one week."
          },
          "note": {
            "type": "string",
            "maxLength": 1024,
            "description": "OperationWorkflowPlaybookOutcomeDeadlinePolicy.note. Optional initial plain-text follow-up note; subsequent human notes are preserved."
          }
        }
      },
      "OperationWorkflowPlaybookOutcomeEscalation": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookOutcomeEscalation. Retained assigned deadline follow-up evidence. Polling refreshes current observations and the first observed success only; acknowledgment, owner, notes, due times, reminders and completion remain human coordination.",
        "required": [
          "watch_id",
          "progress_id",
          "deadline_at",
          "current"
        ],
        "properties": {
          "response": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessEscalationResponse"
          },
          "watch_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowPlaybookOutcomeEscalation.watch_id. Exact durable watch identity for fenced evidence refresh."
          },
          "progress_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowPlaybookOutcomeEscalation.progress_id. Exact pinned checklist that originally missed its observed deadline."
          },
          "deadline_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowPlaybookOutcomeEscalation.deadline_at. Original outcome deadline, unchanged after delivery."
          },
          "current": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookBusinessOutcome",
            "description": "OperationWorkflowPlaybookOutcomeEscalation.current. Latest accepted watch evidence, independently of the original notice and human disposition."
          },
          "success_observed_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowPlaybookOutcomeEscalation.success_observed_at. First subsequent achieved observation, retained through corrections or evidence loss; does not prove when the business result occurred."
          }
        }
      },
      "OperationWorkflowPlaybookOutcomeFollowUp": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookOutcomeFollowUp. Human follow-up for one pinned reported outcome. First review captures an advisory pre-write business observation; later reviews do not rewrite it or assert execution success.",
        "required": [
          "outcome_code",
          "observation",
          "items",
          "completed_count",
          "checklist_complete"
        ],
        "properties": {
          "outcome_code": {
            "type": "string",
            "description": "OperationWorkflowPlaybookOutcomeFollowUp.outcome_code. Exact pinned outcome associated with this list."
          },
          "observation": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookBusinessOutcome"
          },
          "items": {
            "type": "array",
            "maxItems": 16,
            "description": "OperationWorkflowPlaybookOutcomeFollowUp.items. Pinned ordered steps with scoped evidence references and human review stamps.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPlaybookProgressItem"
            }
          },
          "completed_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 16,
            "description": "OperationWorkflowPlaybookOutcomeFollowUp.completed_count. Reviewed completed steps, independent of original checklist completion."
          },
          "checklist_complete": {
            "type": "boolean",
            "description": "OperationWorkflowPlaybookOutcomeFollowUp.checklist_complete. All declared steps reviewed complete; never proves application state or execution."
          }
        }
      },
      "OperationWorkflowPlaybookDependencyState": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookDependencyState. One sampled human follow-up step observation, distinct from application reports and queue coordination.",
        "required": [
          "outcome_code",
          "item_index",
          "label",
          "status",
          "owner",
          "readiness"
        ],
        "properties": {
          "regression": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessOutcomeEscalationReference",
            "description": "OperationWorkflowPlaybookDependencyState.regression. Latest delivered regression affecting this waiting step; cleared atomically after observed recovery."
          },
          "outcome_code": {
            "type": "string",
            "description": "OperationWorkflowPlaybookDependencyState.outcome_code. Exact pinned outcome list."
          },
          "item_index": {
            "type": "integer",
            "minimum": 0,
            "maximum": 15,
            "description": "OperationWorkflowPlaybookDependencyState.item_index. Local immutable step index."
          },
          "label": {
            "type": "string",
            "description": "OperationWorkflowPlaybookDependencyState.label. Exact pinned step label."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "completed"
            ],
            "description": "OperationWorkflowPlaybookDependencyState.status. Observed human review status."
          },
          "owner": {
            "type": "string",
            "description": "OperationWorkflowPlaybookDependencyState.owner. Current checklist step owner; inbox overrides remain separate."
          },
          "readiness": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookStepReadiness"
          }
        }
      },
      "OperationWorkflowPlaybookDependencyRecovery": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookDependencyRecovery. Durable sampled waiting-to-ready observation for previously regressed steps, linked to the latest regression notice. Original reviews, queue assignments and clocks remain unchanged.",
        "required": [
          "checked_at",
          "regression",
          "ready_steps"
        ],
        "properties": {
          "checked_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowPlaybookDependencyRecovery.checked_at. Successful case observation before revision-fenced publication."
          },
          "regression": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessOutcomeEscalationReference",
            "description": "OperationWorkflowPlaybookDependencyRecovery.regression. Original notice identity within the same inbox; the referenced row may have expired."
          },
          "ready_steps": {
            "type": "array",
            "maxItems": 272,
            "description": "OperationWorkflowPlaybookDependencyRecovery.ready_steps. Recovered subset grouped by current checklist owner and regression notice; completed reviews remain complete.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPlaybookDependencyState"
            }
          }
        }
      },
      "OperationWorkflowPlaybookDependencyRegression": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookDependencyRegression. Durable sampled dependency regression grouped by affected checklist owner. Existing queue assignments, reviews and clocks remain unchanged.",
        "required": [
          "checked_at",
          "reopened_prerequisites",
          "affected_steps"
        ],
        "properties": {
          "checked_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowPlaybookDependencyRegression.checked_at. Successful case observation before revision-fenced publication."
          },
          "reopened_prerequisites": {
            "type": "array",
            "maxItems": 272,
            "description": "OperationWorkflowPlaybookDependencyRegression.reopened_prerequisites. Relevant ancestors observed changing from completed to pending, including transitive causes.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPlaybookDependencyState"
            }
          },
          "affected_steps": {
            "type": "array",
            "maxItems": 272,
            "description": "OperationWorkflowPlaybookDependencyRegression.affected_steps. Downstream steps newly waiting, gaining blockers, or affected by a newly reopened ancestor; completed reviews retain a review suggestion.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPlaybookDependencyState"
            }
          }
        }
      },
      "OperationWorkflowPlaybookStepDependency": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookStepDependency. One step waits for all named prerequisite reviews in the same pinned outcome checklist; unknown labels, self-edges, duplicates and cycles are rejected.",
        "required": [
          "label",
          "prerequisites"
        ],
        "properties": {
          "label": {
            "type": "string",
            "description": "OperationWorkflowPlaybookStepDependency.label. Exact declared dependent step label, unique within the graph."
          },
          "prerequisites": {
            "type": "array",
            "minItems": 1,
            "maxItems": 15,
            "uniqueItems": true,
            "description": "OperationWorkflowPlaybookStepDependency.prerequisites. Exact declared prerequisites; each must be reviewed complete with its own prerequisites satisfied.",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "OperationWorkflowPlaybookStepReadiness": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookStepReadiness. Human review dependency status, not business state or execution authority.",
        "required": [
          "status",
          "waiting_for",
          "review_suggested"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ready",
              "waiting"
            ],
            "description": "OperationWorkflowPlaybookStepReadiness.status. Whether all declared prerequisite reviews are complete and their dependency chains satisfied."
          },
          "waiting_for": {
            "type": "array",
            "maxItems": 15,
            "description": "OperationWorkflowPlaybookStepReadiness.waiting_for. Direct prerequisites currently missing complete and ready reviews; empty for ready steps.",
            "items": {
              "type": "string"
            }
          },
          "review_suggested": {
            "type": "boolean",
            "description": "OperationWorkflowPlaybookStepReadiness.review_suggested. A previously completed dependent step now has unsatisfied prerequisites; original review is preserved."
          }
        }
      },
      "OperationWorkflowPlaybookReviewImpact": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookReviewImpact. Frozen application guidance explaining the business result protected by human review; advisory confidence, independent of reported business state.",
        "required": [
          "kind",
          "code",
          "description",
          "priority"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "milestone",
              "outcome"
            ],
            "description": "OperationWorkflowPlaybookReviewImpact.kind. Result category in this workflow case."
          },
          "code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "OperationWorkflowPlaybookReviewImpact.code. Milestone slug or expected or explicitly acceptable outcome code from this pinned playbook. A milestone name is declared guidance, not verified existence or completion."
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "description": "OperationWorkflowPlaybookReviewImpact.description. Application-authored explanation of the business risk; trimmed control-free UTF-8 text limited to 1024 bytes."
          },
          "priority": {
            "type": "string",
            "enum": [
              "normal",
              "high",
              "critical"
            ],
            "description": "OperationWorkflowPlaybookReviewImpact.priority. Declared priority for operator triage, independent of deadline and observed business success."
          }
        }
      },
      "OperationWorkflowPlaybookStepAssignmentPolicy": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookStepAssignmentPolicy. Pinned team and completion window for one declared outcome follow-up step; coordination only.",
        "required": [
          "label",
          "owner",
          "complete_after_seconds"
        ],
        "properties": {
          "review_impact": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookReviewImpact",
            "description": "OperationWorkflowPlaybookStepAssignmentPolicy.review_impact. Pinned application-declared business result and priority protected by validity review; does not assert actual business failure or change reported outcome."
          },
          "review_after_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 604800,
            "description": "OperationWorkflowPlaybookStepAssignmentPolicy.review_after_seconds. Optional validity review window starting at prerequisite reopening; zero omits the target. Pinned independently of the original step completion deadline. Inbox acknowledgment does not satisfy this target."
          },
          "review_fallback_owner": {
            "type": "string",
            "maxLength": 256,
            "description": "OperationWorkflowPlaybookStepAssignmentPolicy.review_fallback_owner. Optional fallback team after an unresolved review deadline; requires a positive review window and a team distinct from owner. Manual assignments prevent automatic takeover."
          },
          "acknowledge_after_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 604800,
            "description": "OperationWorkflowPlaybookStepAssignmentPolicy.acknowledge_after_seconds. Optional response window from queue delivery; zero disables. Separate from the original step completion deadline."
          },
          "fallback_owner": {
            "type": "string",
            "maxLength": 256,
            "description": "OperationWorkflowPlaybookStepAssignmentPolicy.fallback_owner. Optional distinct fallback team; requires a positive response window. Assignment changes preserve human ownership history."
          },
          "label": {
            "type": "string",
            "description": "OperationWorkflowPlaybookStepAssignmentPolicy.label. Exact unique declared follow-up label."
          },
          "owner": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "OperationWorkflowPlaybookStepAssignmentPolicy.owner. Required trimmed control-free UTF-8 team label."
          },
          "complete_after_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 604800,
            "description": "OperationWorkflowPlaybookStepAssignmentPolicy.complete_after_seconds. Completion window from first list review for independent steps, or first prerequisite readiness for dependent steps; bounded to seven days."
          }
        }
      },
      "OperationWorkflowPlaybookStepAssignmentReference": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookStepAssignmentReference. One retained queue delivery identity per outcome step and watch.",
        "required": [
          "outcome_code",
          "item_index",
          "notification"
        ],
        "properties": {
          "dependency_review_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "OperationWorkflowPlaybookStepAssignmentReference.dependency_review_revision. Revision of the delivered dependency review obligation; absent for ordinary assignments."
          },
          "outcome_code": {
            "type": "string",
            "description": "OperationWorkflowPlaybookStepAssignmentReference.outcome_code. Pinned outcome selector."
          },
          "item_index": {
            "type": "integer",
            "minimum": 0,
            "maximum": 15,
            "description": "OperationWorkflowPlaybookStepAssignmentReference.item_index. Exact local step index."
          },
          "notification": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessOutcomeEscalationReference"
          }
        }
      },
      "OperationWorkflowPlaybookStepAssignment": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookStepAssignment. Assigned step attention in the existing inbox and follow-up queue. Polling preserves manual coordination and bounded ownership history.",
        "required": [
          "progress_id",
          "outcome_code",
          "item_index",
          "label",
          "status",
          "due_at",
          "last_step_owner",
          "manual_owner",
          "history",
          "history_truncated"
        ],
        "properties": {
          "review_impact": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookReviewImpact",
            "description": "OperationWorkflowPlaybookStepAssignment.review_impact. Pinned application-declared business result and priority protected by validity review; does not assert actual business failure or change reported outcome."
          },
          "dependency_review_status": {
            "type": "string",
            "enum": [
              "awaiting",
              "confirmed",
              "redo_requested",
              "superseded"
            ],
            "description": "OperationWorkflowPlaybookStepAssignment.dependency_review_status. Latest source checklist decision for this review episode, observed by an active watch; independent of inbox acknowledgment or manual completion."
          },
          "dependency_review_prerequisite": {
            "type": "string",
            "description": "OperationWorkflowPlaybookStepAssignment.dependency_review_prerequisite. Reopened ancestor label captured from retained progress history when available; the immutable review revision identifies the event if history has been truncated."
          },
          "dependency_review": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookProgressItem",
            "description": "OperationWorkflowPlaybookStepAssignment.dependency_review. Immutable prior completion evidence and prerequisite reopening revision for a human validity review task. Recovery does not close it; an explicit review or newer regression supersedes this episode."
          },
          "readiness": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookStepReadiness",
            "description": "OperationWorkflowPlaybookStepAssignment.readiness. Latest accepted prerequisite observation; existing human queue coordination remains unchanged when prerequisites reopen."
          },
          "source_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "OperationWorkflowPlaybookStepAssignment.source_revision. Last synchronized progress revision, used to retain intervening owner changes; incomplete source history prevents fallback."
          },
          "response": {
            "$ref": "#/components/schemas/OperationWorkflowReadinessEscalationResponse"
          },
          "progress_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowPlaybookStepAssignment.progress_id. Exact pinned checklist identity."
          },
          "outcome_code": {
            "type": "string",
            "description": "OperationWorkflowPlaybookStepAssignment.outcome_code. Exact outcome follow-up selector."
          },
          "item_index": {
            "type": "integer",
            "minimum": 0,
            "maximum": 15,
            "description": "OperationWorkflowPlaybookStepAssignment.item_index. Local step index."
          },
          "label": {
            "type": "string",
            "description": "OperationWorkflowPlaybookStepAssignment.label. Pinned human follow-up label."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "completed"
            ],
            "description": "OperationWorkflowPlaybookStepAssignment.status. Latest accepted human step review; independent of inbox completion."
          },
          "due_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowPlaybookStepAssignment.due_at. Original immutable completion deadline."
          },
          "last_step_owner": {
            "type": "string",
            "description": "OperationWorkflowPlaybookStepAssignment.last_step_owner. Latest synchronized checklist assignment, distinct from a manual queue override."
          },
          "manual_owner": {
            "type": "boolean",
            "description": "OperationWorkflowPlaybookStepAssignment.manual_owner. Manual inbox changes or automatic fallback protect queue ownership from later checklist synchronization."
          },
          "history": {
            "type": "array",
            "maxItems": 16,
            "description": "OperationWorkflowPlaybookStepAssignment.history. Bounded retained checklist and inbox assignment changes.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowReadinessAssignmentChange"
            }
          },
          "history_truncated": {
            "type": "boolean",
            "description": "OperationWorkflowPlaybookStepAssignment.history_truncated. Older ownership changes are no longer retained."
          }
        }
      },
      "OperationWorkflowPlaybookOutcomeGuidance": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookOutcomeGuidance. Application-defined business meaning and optional suggested human follow-up, frozen with the playbook version. Plain text only; never establishes execution authority or changes outcome acceptance.",
        "required": [
          "outcome_code",
          "description"
        ],
        "properties": {
          "follow_up_dependencies": {
            "type": "array",
            "maxItems": 16,
            "description": "OperationWorkflowPlaybookOutcomeGuidance.follow_up_dependencies. Optional pinned acyclic prerequisite graph within this outcome's follow-up steps.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPlaybookStepDependency"
            }
          },
          "follow_up_assignments": {
            "type": "array",
            "maxItems": 16,
            "description": "OperationWorkflowPlaybookOutcomeGuidance.follow_up_assignments. Optional team and completion window for declared steps; at most 16 assignments across the entire playbook.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPlaybookStepAssignmentPolicy"
            }
          },
          "follow_up_steps": {
            "type": "array",
            "maxItems": 16,
            "uniqueItems": true,
            "description": "OperationWorkflowPlaybookOutcomeGuidance.follow_up_steps. Optional ordered human follow-up labels, unique and at most 256 bytes each; tracked separately from original playbook evidence items.",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          "outcome_code": {
            "type": "string",
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$",
            "description": "OperationWorkflowPlaybookOutcomeGuidance.outcome_code. Primary expected outcome or explicit acceptable alternative; unique within the playbook guidance set."
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "description": "OperationWorkflowPlaybookOutcomeGuidance.description. Required trimmed UTF-8 plain-text business meaning, at most 1024 bytes and no control characters."
          },
          "suggested_follow_up": {
            "type": "string",
            "maxLength": 1024,
            "description": "OperationWorkflowPlaybookOutcomeGuidance.suggested_follow_up. Optional trimmed UTF-8 plain-text suggestion, at most 1024 bytes and no control characters; application-owned decisions and execution remain separate."
          }
        }
      },
      "OperationWorkflowPlaybookOutcomeAcceptancePolicy": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookOutcomeAcceptancePolicy. Explicit business acceptance rules pinned with the playbook. Requires an expected outcome; an empty list permits no alternatives. Omission preserves legacy reviewer acceptance.",
        "required": [
          "alternative_outcome_codes"
        ],
        "properties": {
          "alternative_outcome_codes": {
            "type": "array",
            "maxItems": 16,
            "uniqueItems": true,
            "description": "OperationWorkflowPlaybookOutcomeAcceptancePolicy.alternative_outcome_codes. Distinct application-defined terminal outcome slugs, excluding the primary expected outcome. Sorted canonically; never overrides application reports or the primary deadline target.",
            "items": {
              "type": "string",
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          }
        }
      },
      "OperationWorkflowPlaybookCompletionOutcome": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookCompletionOutcome. Immutable human disposition and exact scoped advisory application evidence observed before completion; neither establishes causation nor authorizes execution.",
        "required": [
          "resolution",
          "alignment",
          "explanation",
          "observation"
        ],
        "properties": {
          "resolution": {
            "type": "string",
            "enum": [
              "expected_outcome_achieved",
              "alternative_accepted",
              "follow_up_canceled"
            ],
            "description": "OperationWorkflowPlaybookCompletionOutcome.resolution. Human business disposition, distinct from application reports."
          },
          "alignment": {
            "type": "string",
            "enum": [
              "matches",
              "mismatch",
              "unavailable",
              "not_applicable"
            ],
            "description": "OperationWorkflowPlaybookCompletionOutcome.alignment. Expected success matches achieved; accepted alternative matches a different terminal result permitted by an explicit pinned policy (legacy absence permits reviewer acceptance); cancellation makes no business assertion. Nonterminal evidence mismatches; incomparable evidence is unavailable."
          },
          "explanation": {
            "type": "string",
            "description": "OperationWorkflowPlaybookCompletionOutcome.explanation. Server explanation of disposition alignment; does not prevent human closure."
          },
          "observation": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookBusinessOutcome"
          }
        }
      },
      "OperationWorkflowPlaybookEvidenceRequirement": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookEvidenceRequirement. One pinned live application-evidence selector per checklist label. Milestone selects a declared operation and milestone. Prerequisite additionally selects an exact current-state transition and producer, optionally an alternative group and named path. Verification selects current-report blocker resolutions; absent obligations are unavailable.",
        "required": [
          "label",
          "kind",
          "operation"
        ],
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "OperationWorkflowPlaybookEvidenceRequirement.label. Exact label from required_evidence; unique within evidence_requirements."
          },
          "kind": {
            "type": "string",
            "enum": [
              "milestone",
              "prerequisite",
              "verification"
            ],
            "description": "OperationWorkflowPlaybookEvidenceRequirement.kind. Selector category; invalid combinations of fields are rejected."
          },
          "operation": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z][a-z0-9-]*$",
            "description": "OperationWorkflowPlaybookEvidenceRequirement.operation. Declared milestone producer, prerequisite transition operation, or blocker-resolution operation name."
          },
          "milestone": {
            "type": "string",
            "maxLength": 64,
            "description": "OperationWorkflowPlaybookEvidenceRequirement.milestone. Required milestone name for milestone and prerequisite kinds; omitted for verification."
          },
          "prerequisite_operation": {
            "type": "string",
            "maxLength": 63,
            "description": "OperationWorkflowPlaybookEvidenceRequirement.prerequisite_operation. Required fact producer name for prerequisite kind only."
          },
          "from_state": {
            "type": "string",
            "maxLength": 64,
            "description": "OperationWorkflowPlaybookEvidenceRequirement.from_state. Required exact transition source for prerequisite kind only."
          },
          "to_state": {
            "type": "string",
            "maxLength": 64,
            "description": "OperationWorkflowPlaybookEvidenceRequirement.to_state. Required exact transition destination for prerequisite kind only."
          },
          "group_id": {
            "type": "string",
            "maxLength": 64,
            "description": "OperationWorkflowPlaybookEvidenceRequirement.group_id. Optional prerequisite alternative group. Without a group, selects mandatory retained facts."
          },
          "path_id": {
            "type": "string",
            "maxLength": 64,
            "description": "OperationWorkflowPlaybookEvidenceRequirement.path_id. Optional named prerequisite path; requires group_id. Evaluates the selected fact, not the whole path or its decision."
          },
          "blocker_code": {
            "type": "string",
            "maxLength": 64,
            "description": "OperationWorkflowPlaybookEvidenceRequirement.blocker_code. Required blocker code for verification kind only; all matching obligations on the current report must be verified."
          }
        }
      },
      "OperationWorkflowPlaybookEvidenceCheck": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookEvidenceCheck. Ephemeral case-read observation of a pinned requirement, separate from human review and attachment validity. Contract or guidance changes, missing declarations and incomplete coverage remain unavailable. Does not change progress or authorize execution.",
        "required": [
          "requirement",
          "status",
          "reason",
          "checked_at",
          "review_suggested"
        ],
        "properties": {
          "requirement": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookEvidenceRequirement",
            "description": "OperationWorkflowPlaybookEvidenceCheck.requirement. Frozen application-defined selector."
          },
          "status": {
            "type": "string",
            "enum": [
              "satisfied",
              "missing",
              "stale",
              "invalidated",
              "unavailable"
            ],
            "description": "OperationWorkflowPlaybookEvidenceCheck.status. Current retained evidence observation, not external proof or business success."
          },
          "reason": {
            "type": "string",
            "description": "OperationWorkflowPlaybookEvidenceCheck.reason. Stable diagnostic code explaining the observation or uncertainty."
          },
          "checked_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowPlaybookEvidenceCheck.checked_at. Case evidence observation clock; prerequisite freshness retains its original evaluation clock."
          },
          "state_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "OperationWorkflowPlaybookEvidenceCheck.state_revision. Current report revision when available."
          },
          "reporting_operation_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowPlaybookEvidenceCheck.reporting_operation_id. Current application state-report operation."
          },
          "review_suggested": {
            "type": "boolean",
            "description": "OperationWorkflowPlaybookEvidenceCheck.review_suggested. Completed human item currently has an unsatisfied or unavailable requirement; no review is modified."
          },
          "evidence": {
            "$ref": "#/components/schemas/OperationWorkflowInstanceMilestoneRef",
            "description": "OperationWorkflowPlaybookEvidenceCheck.evidence. Current retained milestone reference, including stale or invalidated facts when present."
          },
          "prerequisite": {
            "$ref": "#/components/schemas/OperationWorkflowRetainedMilestone",
            "description": "OperationWorkflowPlaybookEvidenceCheck.prerequisite. Exact existing readiness diagnostic, including freshness and invalidation evidence."
          }
        }
      },
      "OperationWorkflowPlaybook": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybook. Application-owned advisory guidance; evidence requirements are human checklists and links are never executed by Gregale.",
        "required": [
          "id",
          "version",
          "summary",
          "match_kind",
          "match_code"
        ],
        "properties": {
          "outcome_guidance": {
            "type": "array",
            "maxItems": 17,
            "description": "OperationWorkflowPlaybook.outcome_guidance. Optional pinned descriptions and suggested follow-up for the expected outcome and explicitly allowed alternatives; unique by outcome code.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPlaybookOutcomeGuidance"
            }
          },
          "outcome_acceptance": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookOutcomeAcceptancePolicy"
          },
          "outcome_deadline": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookOutcomeDeadlinePolicy",
            "description": "OperationWorkflowPlaybook.outcome_deadline. Optional application attention policy requiring expected_outcome_code. Frozen with guidance; deadline starts at checklist creation, not watch enrollment."
          },
          "expected_outcome_code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$",
            "description": "OperationWorkflowPlaybook.expected_outcome_code. Optional expected application terminal outcome, frozen with guidance; does not infer causation or close coordination."
          },
          "id": {
            "type": "string",
            "description": "OperationWorkflowPlaybook.id. Unique bounded lowercase identifier within the workflow contract.",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "version": {
            "type": "integer",
            "description": "OperationWorkflowPlaybook.version. Explicit playbook revision, pinned alongside the workflow contract version.",
            "minimum": 1,
            "maximum": 1000000
          },
          "match_kind": {
            "type": "string",
            "description": "OperationWorkflowPlaybook.match_kind. Exact observed fact category.",
            "enum": [
              "blocker",
              "missing_milestone",
              "missing_dependency",
              "pending_verification",
              "requirement"
            ]
          },
          "match_code": {
            "type": "string",
            "description": "OperationWorkflowPlaybook.match_code. Exact blocker code, milestone, dependency workflow, verification blocker code or readiness reason code.",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9_-]{0,63}$"
          },
          "summary": {
            "type": "string",
            "description": "OperationWorkflowPlaybook.summary. Application-authored guidance without control characters or surrounding whitespace.",
            "minLength": 1,
            "maxLength": 1024
          },
          "owner": {
            "type": "string",
            "description": "OperationWorkflowPlaybook.owner. Suggested responsible team; does not assign or override coordination ownership.",
            "maxLength": 256
          },
          "evidence_requirements": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPlaybookEvidenceRequirement"
            },
            "description": "OperationWorkflowPlaybook.evidence_requirements. Optional unique live selectors for declared checklist labels. Frozen with guidance; human reviews remain independent."
          },
          "required_evidence": {
            "type": "array",
            "description": "OperationWorkflowPlaybook.required_evidence. Human checklist labels with optional live application-evidence selectors.",
            "maxItems": 16,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          "runbook_url": {
            "type": "string",
            "description": "OperationWorkflowPlaybook.runbook_url. Absolute HTTPS runbook link without user credentials; never fetched automatically.",
            "maxLength": 2048,
            "format": "uri"
          },
          "action_url": {
            "type": "string",
            "description": "OperationWorkflowPlaybook.action_url. Absolute HTTPS application action link without user credentials; application handles authorization and execution.",
            "maxLength": 2048,
            "format": "uri"
          }
        }
      },
      "OperationWorkflowPlaybookGuidance": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookGuidance. Application-owned advisory guidance; evidence requirements are human checklists and links are never executed by Gregale.",
        "required": [
          "playbook",
          "contract_version",
          "reporting_operation_id"
        ],
        "properties": {
          "playbook": {
            "type": "object",
            "$ref": "#/components/schemas/OperationWorkflowPlaybook",
            "description": "OperationWorkflowPlaybookGuidance.playbook. Matched advisory rule from the exact reporting definition."
          },
          "contract_version": {
            "type": "integer",
            "description": "OperationWorkflowPlaybookGuidance.contract_version. Workflow contract version of the retained current report.",
            "minimum": 1
          },
          "reporting_operation_id": {
            "type": "string",
            "description": "OperationWorkflowPlaybookGuidance.reporting_operation_id. Operation whose immutable definition supplied this playbook.",
            "format": "uuid"
          }
        }
      },
      "OperationWorkflowPlaybookProgressStartRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookProgressStartRequest. Durable advisory checklist coordination, independent of application business success.",
        "required": [
          "playbook_id",
          "playbook_version",
          "contract_version",
          "reporting_operation_id"
        ],
        "properties": {
          "playbook_id": {
            "type": "string",
            "description": "OperationWorkflowPlaybookProgressStartRequest.playbook_id. Exact matched rule identifier."
          },
          "playbook_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000,
            "description": "OperationWorkflowPlaybookProgressStartRequest.playbook_version. Pinned rule revision."
          },
          "contract_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000,
            "description": "OperationWorkflowPlaybookProgressStartRequest.contract_version. Pinned workflow contract version."
          },
          "reporting_operation_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowPlaybookProgressStartRequest.reporting_operation_id. Exact operation reporting the matched current guidance."
          }
        }
      },
      "OperationWorkflowPlaybookEvidence": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookEvidence. Durable advisory checklist coordination, independent of application business success.",
        "required": [
          "operation_id"
        ],
        "properties": {
          "operation_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowPlaybookEvidence.operation_id. Operation checked against exact customer, application, environment and business subject."
          },
          "milestone_id": {
            "type": "string",
            "description": "OperationWorkflowPlaybookEvidence.milestone_id. Optional retained fact additionally checked against pinned workflow, instance and contract version."
          }
        }
      },
      "OperationWorkflowPlaybookProgressUpdateRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookProgressUpdateRequest. Durable advisory checklist coordination, independent of application business success.",
        "required": [
          "revision",
          "item_index",
          "status",
          "note",
          "evidence"
        ],
        "properties": {
          "owner": {
            "type": "string",
            "maxLength": 256,
            "description": "OperationWorkflowPlaybookProgressUpdateRequest.owner. Optional manual outcome-step reassignment; omission preserves the current owner and an empty value clears it. Requires outcome_code."
          },
          "outcome_code": {
            "type": "string",
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9-]{0,63}$",
            "description": "OperationWorkflowPlaybookProgressUpdateRequest.outcome_code. Optional outcome-specific follow-up selector; item_index addresses that pinned step list. First review captures fresh comparable evidence of this exact outcome."
          },
          "revision": {
            "type": "integer",
            "minimum": 1,
            "description": "OperationWorkflowPlaybookProgressUpdateRequest.revision. Expected current progress revision; conflicting edits return 409."
          },
          "item_index": {
            "type": "integer",
            "minimum": 0,
            "maximum": 15,
            "description": "OperationWorkflowPlaybookProgressUpdateRequest.item_index. Zero-based index in the frozen evidence checklist."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "completed"
            ],
            "description": "OperationWorkflowPlaybookProgressUpdateRequest.status. Human review state; completed requires at least one scoped evidence reference."
          },
          "note": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "description": "OperationWorkflowPlaybookProgressUpdateRequest.note. Required review note, trimmed nonempty and without control characters."
          },
          "evidence": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPlaybookEvidence"
            },
            "description": "OperationWorkflowPlaybookProgressUpdateRequest.evidence. Replacement evidence references for this item; empty allowed only for pending."
          }
        }
      },
      "OperationWorkflowPlaybookProgressItem": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookProgressItem. Durable advisory checklist coordination, independent of application business success.",
        "required": [
          "label",
          "status",
          "note",
          "evidence"
        ],
        "properties": {
          "review_impact": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookReviewImpact",
            "description": "OperationWorkflowPlaybookProgressItem.review_impact. Pinned application-declared business result and priority protected by validity review; does not assert actual business failure or change reported outcome."
          },
          "dependency_review_due_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowPlaybookProgressItem.dependency_review_due_at. Frozen review deadline calculated at prerequisite reopening from the pinned assignment policy. Recovery and inbox rescheduling do not reset it; an explicit review clears it with the obligation."
          },
          "dependency_review_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "OperationWorkflowPlaybookProgressItem.dependency_review_revision. Progress revision that reopened a prerequisite; persists until an explicit step review confirms completed work with evidence or requests redo by marking it pending. Prerequisite recovery alone does not clear this obligation."
          },
          "readiness": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookStepReadiness",
            "description": "OperationWorkflowPlaybookProgressItem.readiness. Ephemeral human-step prerequisite check, separate from application transition readiness."
          },
          "owner": {
            "type": "string",
            "maxLength": 256,
            "description": "OperationWorkflowPlaybookProgressItem.owner. Outcome follow-up team label; human reassignment is recorded with the step review."
          },
          "due_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowPlaybookProgressItem.due_at. Pinned completion deadline from first list review, independent of business success."
          },
          "evidence_check": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookEvidenceCheck",
            "description": "OperationWorkflowPlaybookProgressItem.evidence_check. Optional live requirement check in case overviews only; never stored in reviews, history or mutation responses."
          },
          "label": {
            "type": "string",
            "description": "OperationWorkflowPlaybookProgressItem.label. Frozen application-authored evidence requirement."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "completed"
            ],
            "description": "OperationWorkflowPlaybookProgressItem.status. Human checklist review state."
          },
          "note": {
            "type": "string",
            "description": "OperationWorkflowPlaybookProgressItem.note. Latest reviewer note."
          },
          "evidence": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPlaybookEvidence"
            },
            "description": "OperationWorkflowPlaybookProgressItem.evidence. Scoped references checked when edited; future retention availability is not guaranteed."
          },
          "reviewed_by": {
            "type": "string",
            "description": "OperationWorkflowPlaybookProgressItem.reviewed_by. Authenticated account or API-key reviewer, assigned by the server."
          },
          "reviewed_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowPlaybookProgressItem.reviewed_at. Server review clock for the latest edit."
          }
        }
      },
      "OperationWorkflowPlaybookProgressChange": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookProgressChange. Durable advisory checklist coordination, independent of application business success.",
        "required": [
          "revision",
          "item_index",
          "item",
          "at",
          "actor"
        ],
        "properties": {
          "outcome_code": {
            "type": "string",
            "description": "OperationWorkflowPlaybookProgressChange.outcome_code. Present for outcome follow-up step reviews; item_index is local to that list."
          },
          "revision": {
            "type": "integer",
            "minimum": 2,
            "description": "OperationWorkflowPlaybookProgressChange.revision. Committed revision after this edit."
          },
          "item_index": {
            "type": "integer",
            "minimum": 0,
            "maximum": 15,
            "description": "OperationWorkflowPlaybookProgressChange.item_index. Edited frozen checklist position."
          },
          "item": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookProgressItem",
            "description": "OperationWorkflowPlaybookProgressChange.item. Full reviewed item snapshot at this edit."
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowPlaybookProgressChange.at. Server commit preparation clock."
          },
          "actor": {
            "type": "string",
            "description": "OperationWorkflowPlaybookProgressChange.actor. Server-derived reviewer identity."
          }
        }
      },
      "OperationWorkflowPlaybookProgress": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookProgress. Durable advisory checklist coordination, independent of application business success.",
        "required": [
          "id",
          "revision",
          "playbook",
          "contract_version",
          "definition_id",
          "reporting_operation_id",
          "items",
          "completed_count",
          "checklist_complete",
          "created_at",
          "created_by",
          "updated_at",
          "history",
          "history_truncated"
        ],
        "properties": {
          "outcome_follow_ups": {
            "type": "array",
            "maxItems": 17,
            "description": "OperationWorkflowPlaybookProgress.outcome_follow_ups. Human-reviewed outcome-specific follow-up lists; original checklist counts and business reports remain independent.",
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPlaybookOutcomeFollowUp"
            }
          },
          "outcome_deadline_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowPlaybookProgress.outcome_deadline_at. Immutable checklist creation time plus the pinned application wait duration; human edits and watch enrollment do not reschedule it."
          },
          "start_state_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "OperationWorkflowPlaybookProgress.start_state_revision. Original case state revision pinned when a playbook with an expected outcome starts; earlier reports cannot establish its business result."
          },
          "business_outcome": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookBusinessOutcome",
            "description": "OperationWorkflowPlaybookProgress.business_outcome. Live exact-case result in case reads only; absent from durable progress, review history and mutation responses."
          },
          "disposition": {
            "type": "string",
            "enum": [
              "active",
              "retired",
              "replaced"
            ],
            "description": "OperationWorkflowPlaybookProgress.disposition. Coordination disposition. Omitted legacy values mean active. Closed checklists reject item edits and further decisions; this is not business success."
          },
          "latest_review": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookReview",
            "description": "OperationWorkflowPlaybookProgress.latest_review. Latest committed review decision, retained even when earlier decision history is truncated."
          },
          "reviews": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPlaybookReview"
            },
            "description": "OperationWorkflowPlaybookProgress.reviews. Most recent 32 durable review decisions in shared revision order; independent of item review history."
          },
          "reviews_truncated": {
            "type": "boolean",
            "description": "OperationWorkflowPlaybookProgress.reviews_truncated. Older human review decisions were pruned from the bounded journal."
          },
          "replaces_progress_ids": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "OperationWorkflowPlaybookProgress.replaces_progress_ids. Case-read-only inverse links from replaced predecessors. Derived from retained exact-case records and never persisted or accepted in requests."
          },
          "applicability": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookApplicability",
            "description": "OperationWorkflowPlaybookProgress.applicability. Live advisory observation included in case overviews only; absent from stored progress and mutation responses. Frozen guidance, revision and history remain unchanged."
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowPlaybookProgress.id. Stable checklist identity; repeated starts for the same pinned case and definition return the existing record."
          },
          "revision": {
            "type": "integer",
            "minimum": 1,
            "description": "OperationWorkflowPlaybookProgress.revision. Optimistic concurrency revision."
          },
          "playbook": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybook",
            "description": "OperationWorkflowPlaybookProgress.playbook. Frozen full application guidance; deployment updates never upgrade this record."
          },
          "contract_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000,
            "description": "OperationWorkflowPlaybookProgress.contract_version. Pinned workflow contract revision."
          },
          "definition_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowPlaybookProgress.definition_id. Immutable original reporting definition."
          },
          "reporting_operation_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowPlaybookProgress.reporting_operation_id. Original reporting operation used when the checklist started."
          },
          "items": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPlaybookProgressItem"
            },
            "description": "OperationWorkflowPlaybookProgress.items. Frozen evidence labels and their latest review records."
          },
          "completed_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 16,
            "description": "OperationWorkflowPlaybookProgress.completed_count. Number of checklist items reviewed as completed."
          },
          "checklist_complete": {
            "type": "boolean",
            "description": "OperationWorkflowPlaybookProgress.checklist_complete. Every item in a nonempty checklist is completed; conveys no application readiness or business outcome."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowPlaybookProgress.created_at. Server start clock."
          },
          "created_by": {
            "type": "string",
            "description": "OperationWorkflowPlaybookProgress.created_by. Authenticated checklist creator."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowPlaybookProgress.updated_at. Latest review clock."
          },
          "history": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "$ref": "#/components/schemas/OperationWorkflowPlaybookProgressChange"
            },
            "description": "OperationWorkflowPlaybookProgress.history. Most recent 64 committed item review snapshots, in revision order."
          },
          "history_truncated": {
            "type": "boolean",
            "description": "OperationWorkflowPlaybookProgress.history_truncated. Older review changes were pruned from the bounded history."
          }
        }
      },
      "OperationWorkflowPlaybookApplicability": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookApplicability. Ephemeral applicability of a durable pinned checklist against current exact-case evidence. No progress, review history, readiness or outcome is mutated.",
        "required": [
          "status",
          "summary",
          "suggested_action",
          "checked_at",
          "definition_changed",
          "trigger_matched",
          "evidence_complete",
          "remaining_item_count"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "applicable",
              "trigger_absent",
              "terminal_reported",
              "contract_changed",
              "guidance_changed",
              "evidence_unavailable",
              "definition_unavailable",
              "evidence_incomplete"
            ],
            "description": "OperationWorkflowPlaybookApplicability.status. Current advisory disposition; absent triggers and terminal reports are not business success."
          },
          "summary": {
            "type": "string",
            "description": "OperationWorkflowPlaybookApplicability.summary. Evidence interpretation, including uncertainty and authority boundaries."
          },
          "suggested_action": {
            "type": "string",
            "description": "OperationWorkflowPlaybookApplicability.suggested_action. Human review suggestion; never execution permission or an automatic checklist closure."
          },
          "checked_at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowPlaybookApplicability.checked_at. Shared server observation clock for the current case checklists; sources are independently read."
          },
          "current_contract_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000,
            "description": "OperationWorkflowPlaybookApplicability.current_contract_version. Current projected workflow contract version, if a report exists; status determines comparability."
          },
          "state_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "OperationWorkflowPlaybookApplicability.state_revision. Observed application state revision, when available; stale reports remain explicitly unavailable."
          },
          "reporting_operation_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowPlaybookApplicability.reporting_operation_id. Current state-report operation, when available; distinct from the frozen original reporting operation."
          },
          "definition_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowPlaybookApplicability.definition_id. Exact current reporting definition validated under account, application, customer, environment and subject fences, if available."
          },
          "definition_changed": {
            "type": "boolean",
            "description": "OperationWorkflowPlaybookApplicability.definition_changed. An observed reporting definition differs from the pinned original. False does not establish availability; inspect definition_id and status."
          },
          "trigger_matched": {
            "type": "boolean",
            "description": "OperationWorkflowPlaybookApplicability.trigger_matched. The unchanged pinned rule positively matches current retained evidence. False may mean unevaluated or incomplete evidence; inspect status."
          },
          "evidence_complete": {
            "type": "boolean",
            "description": "OperationWorkflowPlaybookApplicability.evidence_complete. Relevant trigger coverage is complete for this retained evaluation. Does not validate existing checklist attachments or infer business correctness."
          },
          "remaining_item_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 16,
            "description": "OperationWorkflowPlaybookApplicability.remaining_item_count. Count of frozen checklist items not human-reviewed as completed; independent of current trigger or business outcome."
          }
        }
      },
      "OperationWorkflowPlaybookReviewRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookReviewRequest. Human review of frozen checklist coordination under a shared revision fence. No caller-supplied reviewer or applicability is accepted.",
        "required": [
          "revision",
          "decision",
          "reason"
        ],
        "properties": {
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "OperationWorkflowPlaybookReviewRequest.revision. Expected current source revision for requests, committed new shared revision for retained decisions."
          },
          "decision": {
            "type": "string",
            "enum": [
              "continue",
              "retire",
              "replace"
            ],
            "description": "OperationWorkflowPlaybookReviewRequest.decision. Human coordination choice; retire and replace permanently close this source checklist."
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "description": "OperationWorkflowPlaybookReviewRequest.reason. Required nonempty UTF-8 review reason, at most 1024 bytes and without control characters."
          },
          "replacement_progress_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowPlaybookReviewRequest.replacement_progress_id. Only for replace: distinct already-started active applicable checklist in the exact same case."
          },
          "replacement_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "OperationWorkflowPlaybookReviewRequest.replacement_revision. Only for replace: expected target revision, rechecked with its active disposition under the writer lock."
          }
        }
      },
      "OperationWorkflowPlaybookReview": {
        "type": "object",
        "additionalProperties": false,
        "description": "OperationWorkflowPlaybookReview. Durable human choice with server reviewer, observation context and immutable replacement reference. Not an application outcome or execution permission.",
        "required": [
          "revision",
          "decision",
          "reason",
          "actor",
          "at",
          "applicability"
        ],
        "properties": {
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "OperationWorkflowPlaybookReview.revision. Expected current source revision for requests, committed new shared revision for retained decisions."
          },
          "decision": {
            "type": "string",
            "enum": [
              "continue",
              "retire",
              "replace"
            ],
            "description": "OperationWorkflowPlaybookReview.decision. Human coordination choice; retire and replace permanently close this source checklist."
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "description": "OperationWorkflowPlaybookReview.reason. Required nonempty UTF-8 review reason, at most 1024 bytes and without control characters."
          },
          "replacement_progress_id": {
            "type": "string",
            "format": "uuid",
            "description": "OperationWorkflowPlaybookReview.replacement_progress_id. Only for replace: distinct already-started active applicable checklist in the exact same case."
          },
          "replacement_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "OperationWorkflowPlaybookReview.replacement_revision. Only for replace: expected target revision, rechecked with its active disposition under the writer lock."
          },
          "actor": {
            "type": "string",
            "description": "OperationWorkflowPlaybookReview.actor. Authenticated account or API-key reviewer assigned by the server."
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "OperationWorkflowPlaybookReview.at. Server decision clock; application evidence was independently read."
          },
          "applicability": {
            "$ref": "#/components/schemas/OperationWorkflowPlaybookApplicability",
            "description": "OperationWorkflowPlaybookReview.applicability. Retained exact-case observation reviewed by this decision; distinct from the live applicability field."
          }
        }
      },
      "CheckedProjectReleaseResponse": {
        "type": "object",
        "required": [
          "release",
          "bindings_checks"
        ],
        "properties": {
          "release": {
            "$ref": "#/components/schemas/ProjectReleaseSetResponse"
          },
          "bindings_checks": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/BindingCheckReport"
            }
          }
        },
        "description": "Result of a checked project release operation with per-member binding checks."
      },
      "ProjectReleaseDeactivationReceipt": {
        "type": "object",
        "required": [
          "id",
          "release_id",
          "completed_at",
          "fallback_members"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "release_id": {
            "type": "string",
            "format": "uuid"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          },
          "fallback_members": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/ProjectReleaseSetMemberResponse"
            }
          }
        },
        "description": "Recorded deactivation decision and exact fallback routes reviewed for a project graph."
      },
      "CheckedProjectReleaseManifest": {
        "type": "object",
        "description": "Immutable candidate graph and expected routing and policy state. This manifest conveys no evidence or waiver.",
        "additionalProperties": false,
        "required": [
          "project",
          "environment",
          "ttl_seconds",
          "deployments",
          "expected_active_release_id",
          "expected_fallback_deployments",
          "expected_policy_revisions",
          "service_targets"
        ],
        "properties": {
          "deactivate": {
            "type": "boolean",
            "description": "Explicit intent to return to checked weighted fallback routes; requires the deactivation endpoint."
          },
          "rollback_release_id": {
            "type": "string",
            "format": "uuid",
            "description": "Historical source identity; requires the checked rollback endpoint."
          },
          "project": {
            "type": "string"
          },
          "environment": {
            "type": "string"
          },
          "ttl_seconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 604800,
            "description": "Zero for deactivation; positive retention TTL for activation or rollback."
          },
          "deployments": {
            "type": "object",
            "minProperties": 1,
            "maxProperties": 100,
            "additionalProperties": {
              "type": "string",
              "format": "uuid"
            }
          },
          "expected_active_release_id": {
            "type": "string",
            "description": "Expected active release UUID or an empty string for the first graph."
          },
          "expected_fallback_deployments": {
            "type": "object",
            "maxProperties": 100,
            "additionalProperties": {
              "type": "string",
              "format": "uuid"
            }
          },
          "expected_policy_revisions": {
            "type": "object",
            "maxProperties": 100,
            "additionalProperties": {
              "type": "integer",
              "format": "int64",
              "minimum": 1
            }
          },
          "service_targets": {
            "type": "object",
            "maxProperties": 100,
            "additionalProperties": {
              "type": "object",
              "additionalProperties": {
                "type": "string",
                "format": "uuid"
              }
            }
          }
        }
      },
      "ProjectReleaseStage": {
        "type": "object",
        "required": [
          "id",
          "project",
          "environment",
          "status",
          "created_at",
          "expires_at",
          "members"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "project": {
            "type": "string"
          },
          "environment": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "waiting",
              "ready",
              "blocked",
              "expired",
              "cancelled"
            ]
          },
          "reason": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "members": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/ProjectReleaseStageMember"
            }
          }
        },
        "description": "Bounded lease for temporarily admitting candidate project services; observed readiness is not binding evidence."
      },
      "ProjectReleaseStageMember": {
        "type": "object",
        "required": [
          "app",
          "deployment_id",
          "desired",
          "ready"
        ],
        "properties": {
          "app": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "desired": {
            "type": "integer",
            "minimum": 1
          },
          "ready": {
            "type": "integer",
            "minimum": 0
          }
        },
        "description": "Candidate service deployment and observed replica state covered by a staging lease."
      },
      "StageProjectReleaseRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "manifest",
          "ttl_seconds"
        ],
        "properties": {
          "manifest": {
            "$ref": "#/components/schemas/CheckedProjectReleaseManifest"
          },
          "ttl_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1800,
            "description": "Temporary billable capacity lease; repeating the same active stage does not extend it."
          }
        },
        "description": "Pinned project release manifest and lifetime for temporary candidate service staging."
      },
      "PrepareProjectRollbackRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "release_id",
          "ttl_seconds"
        ],
        "properties": {
          "release_id": {
            "type": "string",
            "format": "uuid",
            "description": "Retained inactive historical graph in this project environment."
          },
          "ttl_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 604800
          }
        },
        "description": "Historical release selection used to prepare a checked project rollback."
      },
      "SetQueueBindingReleasePolicyRequest": {
        "description": "Revision-guarded release policy replacement with explicit per-binding queue readiness requirements and optional storage requirements.",
        "allOf": [
          {
            "$ref": "#/components/schemas/SetBindingReleasePolicyRequest"
          },
          {
            "type": "object",
            "required": [
              "queue_requirements"
            ],
            "properties": {
              "queue_requirements": {
                "$ref": "#/components/schemas/QueueReleaseRequirements"
              }
            }
          }
        ]
      },
      "QueueReleaseRequirements": {
        "type": "object",
        "maxProperties": 32,
        "description": "Binding name to explicit required queue evidence. Names match ^[a-z][a-z0-9-]{0,62}$. consumer_readiness requires one enabled push consumer with a healthy poll no older than thirty seconds; connectivity coverage remains partial.",
        "additionalProperties": {
          "type": "string",
          "enum": [
            "consumer_readiness",
            "handler_completion"
          ]
        }
      },
      "QueueBindingCanary": {
        "type": "object",
        "required": [
          "id",
          "binding",
          "deployment_id",
          "scope",
          "status",
          "published_at",
          "expires_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "binding": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "release_id": {
            "type": "string",
            "format": "uuid",
            "description": "Exact active reviewed release for a managed worker canary."
          },
          "status": {
            "type": "string",
            "enum": [
              "published",
              "dispatching",
              "succeeded",
              "failed",
              "blocked",
              "expired",
              "cancelled"
            ]
          },
          "reason": {
            "type": "string"
          },
          "published_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "delivered_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "description": "Retained deployment-bound receipt for an explicitly authorized push queue completion probe."
      },
      "CreateQueueBindingCanaryRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "deployment_id",
          "binding",
          "ttl_seconds",
          "publish_consent"
        ],
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "binding": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,62}$"
          },
          "ttl_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 600
          },
          "publish_consent": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "description": "Publication consent and deployment selection for a bounded push queue canary."
      },
      "BindingVerificationRun": {
        "type": "object",
        "description": "Public frozen review with no credentials, private probe pins or stdout. Status is an observation; traffic changes still require current atomic policy checks.",
        "required": [
          "id",
          "app",
          "deployment_id",
          "scope",
          "status",
          "created_at",
          "expires_at",
          "object_storage_write",
          "queue_publish",
          "review_digest",
          "policy",
          "inventory",
          "steps"
        ],
        "properties": {
          "qualification": {
            "$ref": "#/components/schemas/BindingVerificationQualification"
          },
          "max_concurrency": {
            "type": "integer",
            "minimum": 1,
            "maximum": 8,
            "default": 2,
            "description": "Frozen shared admission budget; omitted values use two. Graph members share the root budget."
          },
          "graph_run_id": {
            "type": "string",
            "format": "uuid"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "passed",
              "blocked",
              "cancelled",
              "expired"
            ]
          },
          "reason": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "object_storage_write": {
            "type": "boolean"
          },
          "queue_publish": {
            "type": "boolean"
          },
          "review_digest": {
            "type": "string"
          },
          "policy": {
            "$ref": "#/components/schemas/BindingReleasePolicy"
          },
          "inventory": {
            "$ref": "#/components/schemas/AppBindingInventory"
          },
          "steps": {
            "type": "array",
            "maxItems": 128,
            "items": {
              "$ref": "#/components/schemas/BindingVerificationRunStep"
            }
          }
        }
      },
      "BindingVerificationRunStep": {
        "type": "object",
        "required": [
          "plan",
          "owned",
          "status"
        ],
        "properties": {
          "plan": {
            "$ref": "#/components/schemas/BindingVerificationPlanStep"
          },
          "resource_id": {
            "type": "string",
            "format": "uuid"
          },
          "resource_kind": {
            "type": "string",
            "enum": [
              "task",
              "queue"
            ]
          },
          "owned": {
            "type": "boolean"
          },
          "status": {
            "type": "string"
          }
        },
        "description": "One frozen verification step and its retained admission and completion state."
      },
      "BindingVerificationPlanStep": {
        "type": "object",
        "required": [
          "type",
          "name",
          "binding",
          "scope",
          "action"
        ],
        "properties": {
          "target_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "binding": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          },
          "queue_environment": {
            "type": "string"
          },
          "action": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "required_evidence": {
            "type": "string"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "prefix": {
            "type": "string"
          },
          "required_mode": {
            "type": "string"
          },
          "probe_mode": {
            "type": "string"
          },
          "operations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "description": "Selected binding resource and immutable operation planned for a verification receipt."
      },
      "CreateBindingVerificationRunRequest": {
        "type": "object",
        "description": "Review digest must match current policy, configuration and deployment; caller-selected UUID permits create response recovery.",
        "required": [
          "id",
          "deployment_id",
          "review_digest",
          "ttl_seconds",
          "object_storage_write",
          "queue_publish"
        ],
        "properties": {
          "max_concurrency": {
            "type": "integer",
            "minimum": 1,
            "maximum": 8,
            "default": 2,
            "description": "Requested app receipt admission budget, from one to eight concurrent resources; defaults to two."
          },
          "service_targets": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "format": "uuid"
            },
            "maxProperties": 100
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "review_digest": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "ttl_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 600
          },
          "object_storage_write": {
            "type": "boolean"
          },
          "queue_publish": {
            "type": "boolean"
          }
        }
      },
      "ProjectBindingVerificationRun": {
        "type": "object",
        "required": [
          "id",
          "project",
          "environment",
          "status",
          "created_at",
          "expires_at",
          "review_digest",
          "manifest",
          "object_storage_write",
          "queue_publish",
          "members"
        ],
        "properties": {
          "qualification": {
            "$ref": "#/components/schemas/BindingVerificationQualification"
          },
          "max_concurrency": {
            "type": "integer",
            "minimum": 1,
            "maximum": 8,
            "default": 2,
            "description": "Project-wide admission budget frozen on this graph receipt and shared by every member run."
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "project": {
            "type": "string"
          },
          "environment": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "passed",
              "blocked",
              "cancelled",
              "expired"
            ]
          },
          "reason": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "review_digest": {
            "type": "string"
          },
          "manifest": {
            "$ref": "#/components/schemas/CheckedProjectReleaseManifest"
          },
          "object_storage_write": {
            "type": "boolean"
          },
          "queue_publish": {
            "type": "boolean"
          },
          "members": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/BindingVerificationRun"
            },
            "maxProperties": 100
          }
        },
        "description": "Durable project verification graph with pinned members, a shared budget and a fixed deadline."
      },
      "CreateProjectBindingVerificationRunRequest": {
        "type": "object",
        "required": [
          "id",
          "manifest",
          "review_digests",
          "ttl_seconds",
          "object_storage_write",
          "queue_publish"
        ],
        "properties": {
          "max_concurrency": {
            "type": "integer",
            "minimum": 1,
            "maximum": 8,
            "default": 2,
            "description": "Requested shared graph admission budget; defaults to two and applies across all project members."
          },
          "review_digest": {
            "type": "string",
            "description": "Optional aggregate digest issued by graph review; when supplied, manifest, member digests and consent must match."
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "manifest": {
            "$ref": "#/components/schemas/CheckedProjectReleaseManifest"
          },
          "review_digests": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            },
            "maxProperties": 100
          },
          "ttl_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 600
          },
          "object_storage_write": {
            "type": "boolean"
          },
          "queue_publish": {
            "type": "boolean"
          }
        },
        "description": "Reviewed project selection, consent and shared concurrency for creating a durable verification graph."
      },
      "ProjectBindingVerificationReview": {
        "type": "object",
        "required": [
          "project",
          "environment",
          "reviewed_at",
          "ready",
          "review_digest",
          "review_digests",
          "manifest",
          "object_storage_write",
          "queue_publish",
          "object_storage_write_required",
          "queue_publish_required",
          "members",
          "blockers"
        ],
        "properties": {
          "project": {
            "type": "string"
          },
          "environment": {
            "type": "string"
          },
          "reviewed_at": {
            "type": "string",
            "format": "date-time"
          },
          "ready": {
            "type": "boolean"
          },
          "review_digest": {
            "type": "string"
          },
          "review_digests": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "maxProperties": 100
          },
          "manifest": {
            "$ref": "#/components/schemas/CheckedProjectReleaseManifest"
          },
          "object_storage_write": {
            "type": "boolean"
          },
          "queue_publish": {
            "type": "boolean"
          },
          "object_storage_write_required": {
            "type": "boolean"
          },
          "queue_publish_required": {
            "type": "boolean"
          },
          "members": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/BindingVerificationReview"
            },
            "maxProperties": 100
          },
          "blockers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BindingCheckFinding"
            }
          }
        },
        "description": "Read-only project verification plan, blockers, required consent and opaque review digests."
      },
      "ReviewProjectBindingVerificationRequest": {
        "type": "object",
        "required": [
          "manifest",
          "object_storage_write",
          "queue_publish"
        ],
        "properties": {
          "manifest": {
            "$ref": "#/components/schemas/CheckedProjectReleaseManifest"
          },
          "object_storage_write": {
            "type": "boolean"
          },
          "queue_publish": {
            "type": "boolean"
          }
        },
        "description": "Project release selection to review without creating receipts or starting verification."
      },
      "BindingVerificationReview": {
        "type": "object",
        "required": [
          "app",
          "deployment_id",
          "scope",
          "service_targets",
          "reviewed_at",
          "ready",
          "review_digest",
          "object_storage_write_required",
          "queue_publish_required",
          "inventory",
          "policy",
          "plan",
          "blockers"
        ],
        "properties": {
          "app": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "service_targets": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "format": "uuid"
            },
            "maxProperties": 100
          },
          "reviewed_at": {
            "type": "string",
            "format": "date-time"
          },
          "ready": {
            "type": "boolean"
          },
          "review_digest": {
            "type": "string"
          },
          "object_storage_write_required": {
            "type": "boolean"
          },
          "queue_publish_required": {
            "type": "boolean"
          },
          "inventory": {
            "$ref": "#/components/schemas/AppBindingInventory"
          },
          "policy": {
            "$ref": "#/components/schemas/BindingReleasePolicy"
          },
          "plan": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BindingVerificationPlanStep"
            }
          },
          "blockers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BindingCheckFinding"
            }
          },
          "observed_check": {
            "$ref": "#/components/schemas/BindingCheckReport"
          }
        },
        "description": "Read-only application binding plan used to review selection and consent before receipt creation."
      },
      "ReviewBindingVerificationRequest": {
        "type": "object",
        "properties": {
          "deployment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Exact deployment; omission selects the current live deployment once."
          },
          "service_targets": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "format": "uuid"
            },
            "maxProperties": 100
          }
        },
        "description": "Application deployment and binding selection to review without admitting work."
      },
      "ProjectBindingVerificationRunDiagnostics": {
        "type": "object",
        "required": [
          "run_id",
          "project",
          "environment",
          "status",
          "checked_at",
          "expires_at",
          "complete",
          "members",
          "blockers",
          "changes",
          "recovery"
        ],
        "properties": {
          "budget": {
            "$ref": "#/components/schemas/BindingVerificationBudget"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "project": {
            "type": "string"
          },
          "environment": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "passed",
              "blocked",
              "cancelled",
              "expired"
            ]
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "complete": {
            "type": "boolean"
          },
          "members": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/BindingVerificationRunDiagnostics"
            },
            "maxProperties": 100
          },
          "blockers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BindingVerificationDiagnosticBlocker"
            }
          },
          "changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BindingVerificationDifference"
            }
          },
          "recovery": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BindingVerificationRecoveryAction"
            }
          }
        },
        "description": "Public graph receipt observations, safe differences and suggested recovery actions."
      },
      "BindingVerificationRunDiagnostics": {
        "type": "object",
        "required": [
          "run_id",
          "app",
          "deployment_id",
          "scope",
          "status",
          "checked_at",
          "expires_at",
          "complete",
          "blockers",
          "changes",
          "recovery"
        ],
        "properties": {
          "budget": {
            "$ref": "#/components/schemas/BindingVerificationBudget"
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "graph_run_id": {
            "type": "string",
            "format": "uuid"
          },
          "app": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "passed",
              "blocked",
              "cancelled",
              "expired"
            ]
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "complete": {
            "type": "boolean",
            "description": "All applicable diagnostic reads succeeded; does not authorize admission."
          },
          "check_passed": {
            "type": "boolean",
            "description": "Current public evidence satisfies current policy; does not confirm receipt completion."
          },
          "blockers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BindingVerificationDiagnosticBlocker"
            }
          },
          "changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BindingVerificationDifference"
            }
          },
          "recovery": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BindingVerificationRecoveryAction"
            }
          }
        },
        "description": "Public app receipt observations and recovery suggestions without admission authority."
      },
      "BindingVerificationRunList": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "runs",
          "observed_at"
        ],
        "properties": {
          "runs": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/BindingVerificationRunSummary"
            }
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "next_cursor": {
            "type": "string",
            "maxLength": 2048
          }
        },
        "description": "Bounded retained receipt summaries and a cursor tied to the original observation cutoff."
      },
      "BindingVerificationRunSummary": {
        "type": "object",
        "additionalProperties": false,
        "description": "Compact retained receipt identity and stored state, with expiry derived at the page observation time. Passed does not assert current evidence qualification. No resource output, plans, policy or manifest is included.",
        "required": [
          "id",
          "status",
          "created_at",
          "expires_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "scope": {
            "type": "string"
          },
          "graph_run_id": {
            "type": "string",
            "format": "uuid"
          },
          "project": {
            "type": "string"
          },
          "environment": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "passed",
              "cancelled",
              "expired"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "BindingVerificationQualification": {
        "type": "object",
        "additionalProperties": false,
        "description": "Server-confirmed temporary qualification conditions for the original receipt. No admission or release authority; wait within its original expiry and recheck.",
        "required": [
          "checked_at",
          "conditions"
        ],
        "properties": {
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "conditions": {
            "type": "array",
            "minItems": 1,
            "maxItems": 12800,
            "items": {
              "$ref": "#/components/schemas/BindingVerificationQualificationCondition"
            }
          }
        }
      },
      "BindingVerificationQualificationCondition": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "app",
          "code"
        ],
        "properties": {
          "app": {
            "type": "string"
          },
          "code": {
            "type": "string",
            "enum": [
              "runtime_updating",
              "runtime_stale",
              "queue_consumer_unobserved",
              "queue_consumer_stale",
              "application_adoption_unknown",
              "application_ack_stale",
              "application_ack_candidate_unobserved"
            ]
          },
          "type": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "binding": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          }
        },
        "description": "Temporary readiness condition preventing final qualification of a selected binding."
      },
      "BindingVerificationRecoveryAction": {
        "type": "object",
        "required": [
          "action",
          "message"
        ],
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "resume",
              "wait",
              "wait_for_application_ack",
              "cancel",
              "review_new_run",
              "retry_diagnostics"
            ]
          },
          "message": {
            "type": "string"
          }
        },
        "description": "Suggested client recovery step for a verification receipt; it grants no execution authority."
      },
      "BindingVerificationDifference": {
        "type": "object",
        "description": "Only whitelisted public scalar values; no credentials, provider origins, commands or guest output.",
        "required": [
          "field",
          "reviewed",
          "current"
        ],
        "properties": {
          "app": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "binding": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          },
          "field": {
            "type": "string"
          },
          "reviewed": {
            "type": "string"
          },
          "current": {
            "type": "string"
          }
        }
      },
      "BindingVerificationDiagnosticBlocker": {
        "type": "object",
        "required": [
          "code",
          "message",
          "recovery"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "app": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "binding": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "recovery": {
            "type": "string",
            "enum": [
              "resume",
              "wait",
              "wait_for_application_ack",
              "cancel",
              "review_new_run",
              "retry_diagnostics"
            ]
          },
          "step_index": {
            "type": "integer",
            "minimum": 0
          },
          "resource_id": {
            "type": "string",
            "format": "uuid"
          },
          "resource_kind": {
            "type": "string",
            "enum": [
              "task",
              "queue"
            ]
          }
        },
        "description": "Public reason and recovery classification for a blocked verification selection."
      },
      "BindingVerificationBudget": {
        "type": "object",
        "description": "Public observation of shared capacity. Underlying unfinished resources remain counted after diagnostic expiry or cancellation requests. No admission authority.",
        "required": [
          "run_id",
          "max_concurrency",
          "active_resources",
          "waiting_steps",
          "full"
        ],
        "properties": {
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "max_concurrency": {
            "type": "integer",
            "minimum": 1,
            "maximum": 8
          },
          "active_resources": {
            "type": "integer",
            "minimum": 0
          },
          "waiting_steps": {
            "type": "integer",
            "minimum": 0
          },
          "full": {
            "type": "boolean"
          }
        }
      },
      "OrgQueueUsageResponse": {
        "description": "Company queue counters and current plan limits across retained application namespaces.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "organization_id",
          "plan",
          "bindings",
          "pending",
          "processing",
          "dead_letter",
          "reserved_async",
          "max_async_invocations",
          "max_triggers"
        ],
        "properties": {
          "organization_id": {
            "type": "string",
            "format": "uuid"
          },
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "hobby",
              "pro",
              "scale"
            ]
          },
          "bindings": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "pending": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "processing": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "dead_letter": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "reserved_async": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Reservations across all async invocation sources sharing company capacity."
          },
          "max_async_invocations": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "max_triggers": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "OrgPlanResponse": {
        "description": "Provider-confirmed organization entitlements and any pending change.",
        "type": "object",
        "required": [
          "org_id",
          "plan"
        ],
        "properties": {
          "org_id": {
            "type": "string",
            "format": "uuid"
          },
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "hobby",
              "pro",
              "scale"
            ]
          },
          "plan_change_status": {
            "type": "string"
          },
          "requested_plan": {
            "type": "string"
          },
          "effective_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "RequestDataConnectionCheck": {
        "description": "Queue inspection of the current credential, optionally including a ready, empty managed mirror.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_revision"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "database_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "DataConnectionCheck": {
        "description": "Durable, bounded compatibility observation. Capacity separately reports measured, operator-qualified allocations; a passed compatibility check does not establish production readiness.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "connection_id",
          "connection_revision",
          "state",
          "fresh",
          "truncated",
          "checks",
          "tables",
          "created_at"
        ],
        "properties": {
          "capacity": {
            "$ref": "#/components/schemas/DataPipelineCapacity"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "connection_id": {
            "type": "string",
            "format": "uuid"
          },
          "connection_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "database_id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "running",
              "passed",
              "blocked",
              "stale"
            ]
          },
          "fresh": {
            "type": "boolean"
          },
          "truncated": {
            "type": "boolean"
          },
          "checks": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/DataConnectionIssue"
            }
          },
          "tables": {
            "type": "array",
            "maxItems": 128,
            "items": {
              "$ref": "#/components/schemas/DataSourceTable"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DataPipelineCapacity": {
        "description": "New-allocation readiness at observation time. Admission atomically rechecks and reserves capacity; observations alone reserve nothing.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "state"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "ready",
              "insufficient_capacity",
              "needs_qualification"
            ]
          },
          "source": {
            "$ref": "#/components/schemas/DataEndpointCapacity"
          },
          "destination": {
            "$ref": "#/components/schemas/DataEndpointCapacity"
          }
        }
      },
      "DataEndpointCapacity": {
        "description": "Credential-free shared physical allocation and initial-copy peak demand. Other Gregale reservations remain counted while paused or awaiting cleanup.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "state",
          "usable_connections",
          "reserved_connections",
          "required_connections"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "ready",
              "insufficient_capacity",
              "needs_qualification"
            ]
          },
          "usable_connections": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "reserved_connections": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "required_connections": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "limiting_resource": {
            "type": "string",
            "enum": [
              "connections",
              "replication_slots",
              "wal_senders",
              "logical_workers"
            ]
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DataConnectionIssue": {
        "description": "Stable compatibility code and sanitized guidance; contains neither credentials nor raw database errors.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "code",
          "state",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string",
            "pattern": "^[a-z0-9_]{1,80}$"
          },
          "state": {
            "type": "string",
            "enum": [
              "passed",
              "blocked",
              "unknown"
            ]
          },
          "message": {
            "type": "string",
            "maxLength": 512
          },
          "remediation": {
            "type": "string",
            "maxLength": 512
          },
          "column": {
            "type": "string",
            "maxLength": 63
          }
        }
      },
      "DataSourceTable": {
        "description": "A discovered public table. Unsupported tables remain visible with reasons and cannot be selected for replication.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "supported",
          "columns",
          "issues"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 63
          },
          "supported": {
            "type": "boolean"
          },
          "columns": {
            "type": "array",
            "maxItems": 129,
            "items": {
              "$ref": "#/components/schemas/DataSourceColumn"
            }
          },
          "issues": {
            "type": "array",
            "maxItems": 135,
            "items": {
              "$ref": "#/components/schemas/DataConnectionIssue"
            }
          }
        }
      },
      "DataSourceColumn": {
        "description": "Column metadata only; no stored customer values are read.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "type",
          "nullable",
          "primary_key"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 63
          },
          "type": {
            "type": "string",
            "maxLength": 128
          },
          "nullable": {
            "type": "boolean"
          },
          "primary_key": {
            "type": "boolean"
          }
        }
      },
      "DataConnection": {
        "description": "Credential-free source identity retained by the pipeline catalog.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "name",
          "revision",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "minLength": 3,
            "maxLength": 40
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DataConnectionList": {
        "description": "Account-scoped registered PostgreSQL source identities.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DataConnection"
            }
          }
        }
      },
      "CreateDataConnectionRequest": {
        "description": "Source registration containing a verified-TLS PostgreSQL URL for sealing.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "connection_url"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 3,
            "maxLength": 40
          },
          "connection_url": {
            "type": "string",
            "maxLength": 8192,
            "writeOnly": true,
            "description": "PostgreSQL URL with sslmode=verify-full. Stored encrypted and never returned. Source host and addresses must be operator-qualified."
          }
        }
      },
      "RotateDataConnectionRequest": {
        "description": "Revision-checked replacement credential for the same source database identity.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_revision",
          "connection_url"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "connection_url": {
            "type": "string",
            "maxLength": 8192,
            "writeOnly": true,
            "description": "Replacement verified-TLS URL with an explicit password for the existing source host, database and username. addresses must be operator-qualified."
          }
        }
      },
      "CreateDataPipelineRequest": {
        "description": "Selected public tables, dedicated destination and explicitly authorized JWT readers. A fresh passing connection check for the current source credential and all selected tables is required; otherwise returns data_connection_check_required.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "source_connection_id",
          "database_id",
          "tables",
          "read_subjects"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 3,
            "maxLength": 40
          },
          "source_connection_id": {
            "type": "string",
            "format": "uuid"
          },
          "database_id": {
            "type": "string",
            "format": "uuid"
          },
          "tables": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,62}$"
            },
            "minItems": 1,
            "maxItems": 16,
            "uniqueItems": true
          },
          "read_subjects": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "minItems": 1,
            "maxItems": 32,
            "uniqueItems": true
          }
        }
      },
      "ControlDataPipelineRequest": {
        "description": "Optimistic revision fence and requested pipeline lifecycle action.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_revision",
          "action"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "action": {
            "type": "string",
            "enum": [
              "pause",
              "resume",
              "resync",
              "verify",
              "delete"
            ]
          }
        }
      },
      "DataPipeline": {
        "description": "Managed replication intent with bounded, revision-specific worker observations.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "name",
          "source_connection_id",
          "database_id",
          "tables",
          "read_subjects",
          "desired_state",
          "state",
          "revision",
          "observed_revision",
          "observation_fresh",
          "generation",
          "tables_ready",
          "verification",
          "created_at"
        ],
        "properties": {
          "applied_through_at": {
            "type": "string",
            "format": "date-time",
            "description": "Conservative source checkpoint time confirmed applied by the destination replication origin. Historical evidence, not measured time lag."
          },
          "health": {
            "$ref": "#/components/schemas/DataPipelineHealth"
          },
          "capacity": {
            "$ref": "#/components/schemas/DataPipelineCapacity"
          },
          "observed_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Intent revision covered by the latest observation."
          },
          "observation_fresh": {
            "type": "boolean",
            "description": "True only when the current intent was observed within the last 90 seconds."
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "minLength": 3,
            "maxLength": 40
          },
          "source_connection_id": {
            "type": "string",
            "format": "uuid"
          },
          "database_id": {
            "type": "string",
            "format": "uuid"
          },
          "tables": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,62}$"
            },
            "minItems": 1,
            "maxItems": 16,
            "uniqueItems": true
          },
          "read_subjects": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "minItems": 1,
            "maxItems": 32,
            "uniqueItems": true
          },
          "desired_state": {
            "type": "string",
            "enum": [
              "running",
              "paused",
              "deleted"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "validating",
              "copying",
              "catching_up",
              "live",
              "paused",
              "blocked",
              "deleting",
              "deleted",
              "resync_required"
            ]
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "reason": {
            "type": "string"
          },
          "tables_ready": {
            "type": "integer",
            "minimum": 0,
            "maximum": 16
          },
          "retained_wal_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "verification": {
            "type": "string",
            "enum": [
              "unknown",
              "pending",
              "passed",
              "mismatch",
              "inconclusive"
            ]
          },
          "verified_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DataPipelineHealth": {
        "description": "Read-time freshness assessment and safe recovery guidance. Unconfirmed checkpoints can occur on idle sources.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "state",
          "code",
          "message",
          "recovery",
          "requires_confirmation"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "healthy",
              "attention",
              "unknown",
              "pending",
              "inactive"
            ]
          },
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "recovery": {
            "type": "string"
          },
          "action": {
            "type": "string",
            "enum": [
              "resume",
              "rotate_credentials",
              "resync"
            ]
          },
          "requires_confirmation": {
            "type": "boolean"
          }
        }
      },
      "DataPipelineList": {
        "description": "Bounded history of account-scoped managed data pipeline records.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DataPipeline"
            }
          }
        }
      },
      "AutomationFailurePolicy": {
        "type": "object",
        "additionalProperties": false,
        "description": "Opt-in thresholds for scheduler-enforced failure admission pausing.",
        "required": [
          "version",
          "enabled",
          "failure_threshold",
          "min_completed_runs",
          "window_seconds"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Monotonic failure monitoring policy revision; zero means no policy has been configured."
          },
          "enabled": {
            "type": "boolean",
            "description": "Whether scheduler evaluation can create a new runtime failure pause."
          },
          "failure_threshold": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Terminal failures required to latch a failure pause.",
            "maximum": 10000
          },
          "min_completed_runs": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Minimum terminal non-cancelled sample count before failure pausing.",
            "maximum": 10000
          },
          "window_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 60,
            "description": "Lookback in seconds, bounded by the latest monitoring epoch.",
            "maximum": 86400
          }
        }
      },
      "SetAutomationFailurePolicyRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Complete failure policy replacement guarded by an expected version.",
        "required": [
          "expected_version",
          "enabled",
          "failure_threshold",
          "min_completed_runs",
          "window_seconds"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Failure policy revision the caller intends to replace."
          },
          "enabled": {
            "type": "boolean",
            "description": "Requested setting controlling whether scheduler evaluation can create a new runtime failure pause."
          },
          "failure_threshold": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Requested number of terminal failures required to latch a failure pause.",
            "maximum": 10000
          },
          "min_completed_runs": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Requested minimum terminal non-cancelled sample count before failure pausing.",
            "maximum": 10000
          },
          "window_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 60,
            "description": "Requested lookback in seconds, bounded by the latest monitoring epoch.",
            "maximum": 86400
          }
        }
      },
      "ResumeAutomationFailurePauseRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Explicit failure guard resume guarded by its current generation.",
        "required": [
          "expected_generation"
        ],
        "properties": {
          "expected_generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Positive pause generation reviewed by the caller."
          }
        }
      },
      "AutomationFailureTransition": {
        "type": "object",
        "additionalProperties": false,
        "description": "Immutable bounded aggregate evidence for a failure guard transition.",
        "required": [
          "generation",
          "state",
          "reason",
          "recorded_at",
          "failures",
          "completed_runs",
          "policy_version"
        ],
        "properties": {
          "generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Unique runtime transition generation for this automation."
          },
          "state": {
            "type": "string",
            "enum": [
              "paused",
              "resumed"
            ],
            "description": "Failure guard state resulting from this transition."
          },
          "reason": {
            "type": "string",
            "enum": [
              "failure_threshold",
              "operator_resume"
            ],
            "description": "Closed reason for the recorded transition."
          },
          "recorded_at": {
            "type": "string",
            "format": "date-time",
            "description": "Server timestamp of the pause or operator resume."
          },
          "failures": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Observed failures recorded with this transition."
          },
          "completed_runs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Observed completed sample count recorded with this transition."
          },
          "policy_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Failure monitoring policy revision used for this transition."
          },
          "actor_account_id": {
            "type": "string",
            "description": "Account that explicitly resumed; empty or omitted for an automatic pause."
          }
        }
      },
      "AutomationFailurePolicyResponse": {
        "type": "object",
        "additionalProperties": false,
        "description": "Failure guard state, monitoring configuration and advisory retained-work preview.",
        "required": [
          "policy",
          "paused",
          "generation",
          "observed_failures",
          "observed_completed_runs",
          "pending_runs",
          "running_runs",
          "waiting_runs",
          "retained_events",
          "history"
        ],
        "properties": {
          "policy": {
            "$ref": "#/components/schemas/AutomationFailurePolicy"
          },
          "paused": {
            "type": "boolean",
            "description": "Whether automatic admissions are blocked by the durable failure guard."
          },
          "generation": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Current guard generation; resume requires this value."
          },
          "monitoring_since": {
            "type": "string",
            "format": "date-time",
            "description": "Start of the fresh monitoring epoch; absent before configuration."
          },
          "paused_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time the current failure pause was latched; absent while unpaused."
          },
          "observed_failures": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Failed and dead runs completed in the current bounded observation window."
          },
          "observed_completed_runs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Succeeded, failed and dead runs completed in the current observation window."
          },
          "pending_runs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Existing pending runs that continue despite a failure admission pause."
          },
          "running_runs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Already running workflows unaffected by admission pausing."
          },
          "waiting_runs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Existing workflows parked on timers or external events."
          },
          "retained_events": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Advisory count of unadmitted retained event recipients for this automation."
          },
          "history": {
            "type": "array",
            "maxItems": 100,
            "description": "Latest pause and resume transitions in descending generation order.",
            "items": {
              "$ref": "#/components/schemas/AutomationFailureTransition"
            }
          }
        }
      },
      "AutomationResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "version",
          "source",
          "draft",
          "enabled"
        ],
        "properties": {
          "test_suite": {
            "$ref": "#/components/schemas/AutomationTestSuite"
          },
          "test_report": {
            "$ref": "#/components/schemas/AutomationTestReport"
          },
          "failure_paused": {
            "type": "boolean",
            "description": "Runtime failure guard blocks automatic admissions independently of configured enabled intent."
          },
          "name": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Opaque monotonically increasing revision. Zero creates the first draft. A stale value returns automation_version_conflict."
          },
          "source": {
            "type": "string",
            "enum": [
              "manifest",
              "dashboard",
              "draft"
            ]
          },
          "draft": {
            "$ref": "#/components/schemas/WorkflowSpec"
          },
          "published": {
            "$ref": "#/components/schemas/WorkflowSpec"
          },
          "published_version": {
            "type": "integer",
            "format": "int64"
          },
          "enabled": {
            "type": "boolean"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "description": "Saved draft, publication, ownership and opaque revision of one automation."
      },
      "ListAutomationsResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "app_slug",
          "runtime_enabled",
          "max_definitions",
          "automations"
        ],
        "properties": {
          "app_slug": {
            "type": "string"
          },
          "runtime_enabled": {
            "type": "boolean"
          },
          "unavailable_reason": {
            "type": "string"
          },
          "max_definitions": {
            "type": "integer"
          },
          "automations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutomationResponse"
            }
          }
        },
        "description": "App automation definitions, plan limit and execution availability."
      },
      "AutomationHealthRun": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "status",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "running",
              "awaiting_event",
              "succeeded",
              "failed",
              "dead"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "description": "Safe recent-run identity and timestamps; workflow input, output and error text are omitted."
      },
      "AutomationHealthStepFailure": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "step_name",
          "failed_run_count",
          "last_failed_at"
        ],
        "properties": {
          "step_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "failed_run_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "last_failed_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "description": "Number of terminal runs that failed at this logical step; loop items are grouped by parent."
      },
      "AutomationQueueHealth": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "observed_at",
          "waiting_run_count",
          "due_run_count",
          "stale_run_count",
          "oldest_due_age_seconds",
          "app_running_count",
          "app_dispatch_limit",
          "tenant_dispatch_limit",
          "app_at_capacity",
          "reason_counts"
        ],
        "properties": {
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "waiting_run_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Current pending and parked runs plus expired running leases for this automation; reason counts sum to this value."
          },
          "due_run_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Due waiting runs including capacity blockers and lease recovery."
          },
          "stale_run_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Running automation runs whose dispatch lease has expired."
          },
          "oldest_due_age_seconds": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "description": "Age since the oldest due run became eligible, bounded by creation time; zero if none is due."
          },
          "app_running_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Live automation dispatch claims across all workflows and tenants in this app; excludes expired leases and native operation custody."
          },
          "app_dispatch_limit": {
            "type": "integer",
            "minimum": 1
          },
          "tenant_dispatch_limit": {
            "type": "integer",
            "minimum": 1,
            "description": "Live claim limit per tenant within this app."
          },
          "app_at_capacity": {
            "type": "boolean"
          },
          "reason_counts": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "ready",
              "scheduled",
              "retry_backoff",
              "parked_wait",
              "app_capacity",
              "tenant_capacity",
              "workflow_capacity"
            ],
            "properties": {
              "ready": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "Due and passes observed run admission checks; does not guarantee immediate handler execution."
              },
              "scheduled": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "Future scheduling deadline that is not a pending step retry."
              },
              "retry_backoff": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "A pending step retry deadline equals the future persisted run wake."
              },
              "parked_wait": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "Intentional future wait or timeout; inspect steps for timer, condition, event or callback details."
              },
              "app_capacity": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "tenant_capacity": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "workflow_capacity": {
                "type": "integer",
                "format": "int64",
                "minimum": 0,
                "description": "The captured workflow definition run budget is full."
              }
            }
          }
        },
        "description": "Current app-owned queue diagnostics independent of the historical health window. Each waiting run has one primary reason; future wakes take precedence followed by app, tenant and workflow capacity. No payloads or tenant identities, global worker occupancy or completion estimates are returned."
      },
      "AutomationHealthResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "app_slug",
          "automation_name",
          "window_start",
          "window_end",
          "run_count",
          "completed_run_count",
          "active_run_count",
          "queued_run_count",
          "success_rate",
          "status_counts",
          "failed_steps"
        ],
        "properties": {
          "app_slug": {
            "type": "string"
          },
          "automation_name": {
            "type": "string"
          },
          "window_start": {
            "type": "string",
            "format": "date-time"
          },
          "window_end": {
            "type": "string",
            "format": "date-time"
          },
          "run_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "completed_run_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "active_run_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Current non-terminal runs that have started, including retries and parked waits; independent of the requested health window."
          },
          "queued_run_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Current pending runs that have not started; independent of the requested health window."
          },
          "queue": {
            "$ref": "#/components/schemas/AutomationQueueHealth"
          },
          "success_rate": {
            "type": "number",
            "format": "double",
            "minimum": 0,
            "maximum": 1,
            "description": "Succeeded runs divided by succeeded, failed and dead runs; zero when none completed."
          },
          "status_counts": {
            "type": "object",
            "required": [
              "pending",
              "running",
              "awaiting_event",
              "succeeded",
              "failed",
              "dead"
            ],
            "properties": {
              "pending": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "running": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "awaiting_event": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "succeeded": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "failed": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "dead": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              }
            },
            "additionalProperties": false
          },
          "p50_duration_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Median duration of completed runs with start and finish timestamps; omitted when no samples exist."
          },
          "p95_duration_ms": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "95th percentile duration of completed runs with start and finish timestamps; omitted when no samples exist."
          },
          "last_run": {
            "$ref": "#/components/schemas/AutomationHealthRun"
          },
          "last_success": {
            "$ref": "#/components/schemas/AutomationHealthRun"
          },
          "last_failure": {
            "$ref": "#/components/schemas/AutomationHealthRun"
          },
          "failed_steps": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/AutomationHealthStepFailure"
            }
          }
        },
        "description": "Bounded aggregate automation health. Customer payloads and error strings are never returned."
      },
      "AutomationPublishPolicy": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "mode",
          "version"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "optional",
              "scenarios",
              "coverage"
            ]
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        },
        "description": "App policy for dashboard publication. YAML deployment is a separate surface. Changes require admin scope and invalidate previously issued receipts."
      },
      "SetAutomationPublishPolicyRequest": {
        "description": "Versioned app policy change; requires an admin credential.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "mode",
          "expected_version"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "optional",
              "scenarios",
              "coverage"
            ]
          },
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "AutomationCheckAttempt": {
        "description": "Expected ordered simulation attempt outcome and optional failure status.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "outcome"
        ],
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "success",
              "failure",
              "timeout"
            ]
          },
          "http_status": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599
          }
        }
      },
      "AutomationCheckExpectation": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "step"
        ],
        "properties": {
          "step": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "loop": {
            "type": "string",
            "maxLength": 256
          },
          "item_index": {
            "type": "integer",
            "minimum": 0,
            "maximum": 127
          },
          "state": {
            "type": "string",
            "enum": [
              "mocked",
              "would_execute",
              "resolved",
              "expanded",
              "would_wait",
              "would_retry",
              "timed_out",
              "failed",
              "dead",
              "skipped",
              "blocked",
              "error"
            ]
          },
          "reason": {
            "type": "string"
          },
          "when_matched": {
            "type": "boolean"
          },
          "output": {
            "description": "Exact JSON assertion; explicit null differs from omitted."
          },
          "attempt_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 25
          },
          "attempts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutomationCheckAttempt"
            },
            "maxItems": 25
          }
        },
        "description": "Requires at least one assertion. Loop item assertions use step <loop>/action, loop name and canonical zero-based item index."
      },
      "AutomationTestInputs": {
        "description": "Saved test data — Explicitly saved synthetic inputs and mocks. Runs always bind the current saved draft.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "input": {
            "description": "Saved test data — Workflow input as any JSON value; omission is equivalent to null."
          },
          "mock_outputs": {
            "description": "Saved test data — Successful action outputs keyed by root step name; explicit null is a supplied result.",
            "type": "object",
            "additionalProperties": {}
          },
          "mock_item_outputs": {
            "description": "Saved test data — Ordered successful output prefix keyed by for_each root name; waits and controls cannot be mocked.",
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "maxItems": 128,
              "items": {}
            }
          },
          "mock_item_attempts": {
            "description": "Saved test data — Per-item attempt outcomes keyed by for_each root name and canonical zero-based item index (0..127). Sparse indexes are allowed but must exist in the materialized collection. Cannot be combined with mock_item_outputs for the same loop. Item timeouts require an action timeout and follow its retry policy. Terminal item failures stop later items unless on_item_failure is continue; the loop remains failed or dead, with null placeholders for failed items when continuing.",
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "minProperties": 1,
              "maxProperties": 128,
              "additionalProperties": {
                "type": "array",
                "minItems": 1,
                "maxItems": 25,
                "items": {
                  "$ref": "#/components/schemas/AutomationSimulationMockAttempt"
                }
              }
            }
          },
          "mock_attempts": {
            "description": "Saved test data — Ordered per-attempt outcomes keyed by action or wait name. Event and callback waits accept exactly one success with the received payload as output, or one timeout with a configured timeout and on_timeout route. Other waits accept timeout only. Successful wait payloads cannot be the reserved timeout sentinel. Action timeouts require on_timeout. Cannot be combined with mock_outputs for the same step.",
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "minItems": 1,
              "maxItems": 25,
              "items": {
                "$ref": "#/components/schemas/AutomationSimulationMockAttempt"
              }
            }
          }
        }
      },
      "AutomationTestCase": {
        "description": "A uniquely named set of definition-free mocks and expected step results.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "simulation",
          "expectations"
        ],
        "properties": {
          "live": {
            "description": "Optional live assertions saved with this case; null disables its live test.",
            "anyOf": [
              {
                "$ref": "#/components/schemas/AutomationLiveTest"
              },
              {
                "type": "null"
              }
            ]
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "simulation": {
            "$ref": "#/components/schemas/AutomationTestInputs"
          },
          "expectations": {
            "type": "array",
            "maxItems": 4096,
            "items": {
              "$ref": "#/components/schemas/AutomationCheckExpectation"
            }
          }
        }
      },
      "AutomationLiveExpectation": {
        "description": "A separate assertion against a real terminal workflow step, not a mock trace.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "step"
        ],
        "properties": {
          "step": {
            "type": "string"
          },
          "loop": {
            "type": "string"
          },
          "item_index": {
            "type": "integer",
            "minimum": 0,
            "maximum": 127
          },
          "state": {
            "type": "string",
            "enum": [
              "succeeded",
              "failed",
              "dead",
              "skipped"
            ]
          },
          "output": {
            "description": "Optional expected JSON result; an explicit null is asserted."
          },
          "attempt_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 425
          }
        }
      },
      "AutomationLiveTest": {
        "description": "Explicit live assertions frozen when a saved case is admitted for execution.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expectations"
        ],
        "properties": {
          "expected_run_status": {
            "type": "string",
            "enum": [
              "succeeded",
              "failed",
              "dead"
            ],
            "description": "Desired terminal run state; omitted means succeeded. Cancellation always fails verification."
          },
          "expectations": {
            "type": "array",
            "minItems": 1,
            "maxItems": 128,
            "items": {
              "$ref": "#/components/schemas/AutomationLiveExpectation"
            }
          }
        }
      },
      "StartAutomationLiveVerificationRequest": {
        "description": "Fenced request to execute one saved case input against a specific published revision and deployment.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version",
          "expected_published_version",
          "expected_deployment_id",
          "case_name",
          "confirm_real_actions"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1
          },
          "expected_published_version": {
            "type": "integer",
            "minimum": 1
          },
          "expected_deployment_id": {
            "type": "string"
          },
          "case_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "confirm_real_actions": {
            "type": "boolean",
            "description": "Must be true to authorize real handler and connected-service actions."
          }
        }
      },
      "AutomationLiveReport": {
        "description": "Payload-free verdict for the frozen live assertions at one terminal run state.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "checked_at",
          "passed",
          "run_status",
          "resume_count",
          "run_updated_at",
          "steps"
        ],
        "properties": {
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "passed": {
            "type": "boolean"
          },
          "issue": {
            "type": "string"
          },
          "run_status": {
            "type": "string"
          },
          "resume_count": {
            "type": "integer",
            "minimum": 0
          },
          "run_updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "steps": {
            "type": "array",
            "maxItems": 128,
            "items": {
              "$ref": "#/components/schemas/AutomationTestStepResult"
            }
          }
        }
      },
      "StartAutomationLiveSuiteRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "At most 16 KiB. Bind an ordered selection of saved live case names to the exact saved version, published revision and deployment, with explicit real-action authorization.",
        "required": [
          "expected_version",
          "expected_published_version",
          "expected_deployment_id",
          "cases",
          "confirm_real_actions"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1
          },
          "expected_published_version": {
            "type": "integer",
            "minimum": 1
          },
          "expected_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "cases": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          "confirm_real_actions": {
            "type": "boolean"
          }
        }
      },
      "AdvanceAutomationLiveSuiteRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Explicit authorization to inspect existing identities and admit at most one remaining case. No target changes, run replacements or uploaded verdicts are accepted.",
        "required": [
          "confirm_real_actions"
        ],
        "properties": {
          "confirm_real_actions": {
            "type": "boolean"
          }
        }
      },
      "SaveAutomationLiveSuiteRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version",
          "expected_published_version",
          "expected_deployment_id",
          "cases"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1
          },
          "expected_published_version": {
            "type": "integer",
            "minimum": 1
          },
          "expected_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "cases": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/AutomationLiveSuiteMember"
            }
          }
        },
        "description": "At most 16 KiB. Freeze an ordered saved-case selection and attach existing verification run IDs. No assertions, verdicts, keys or payloads are accepted. Saving never executes or checks a run. Existing run links cannot be replaced or removed."
      },
      "AutomationLiveSuiteMember": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "description": "One saved live case and its optional existing verification run identity."
      },
      "AutomationLiveBaselinePolicy": {
        "description": "Version 2 required-case coverage and evidence-age policy reviewed during baseline promotion.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "required_cases",
          "max_candidate_age_seconds"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              2
            ]
          },
          "required_cases": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          "max_candidate_age_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9223372036
          }
        }
      },
      "PromoteAutomationLiveBaselineRequest": {
        "description": "Explicit target suite, reviewed policy and expected baseline revision for an audited promotion.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "suite_id",
          "expected_revision",
          "expected_version",
          "expected_published_version",
          "expected_deployment_id",
          "policy"
        ],
        "properties": {
          "suite_id": {
            "type": "string",
            "format": "uuid"
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "maximum": 9223372036854776000
          },
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "expected_published_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "expected_deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "policy": {
            "$ref": "#/components/schemas/AutomationLiveBaselinePolicy"
          }
        }
      },
      "AutomationLiveBaseline": {
        "description": "Immutable attributed receipt binding a named baseline revision to its retained suite and reviewed policy.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "promotion_id",
          "app_id",
          "name",
          "baseline_name",
          "revision",
          "actor_account_id",
          "promoted_at",
          "suite",
          "policy",
          "policy_hash",
          "cases_passed",
          "oldest_run_created_at",
          "evidence_age_seconds"
        ],
        "properties": {
          "promotion_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "baseline_name": {
            "type": "string"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "previous_promotion_id": {
            "type": "string",
            "format": "uuid"
          },
          "actor_account_id": {
            "type": "string",
            "format": "uuid"
          },
          "actor_api_key_id": {
            "type": "string",
            "format": "uuid"
          },
          "promoted_at": {
            "type": "string",
            "format": "date-time"
          },
          "suite": {
            "$ref": "#/components/schemas/AutomationLiveSuiteSummary"
          },
          "policy": {
            "$ref": "#/components/schemas/AutomationLiveBaselinePolicy"
          },
          "policy_hash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "cases_passed": {
            "type": "integer",
            "minimum": 1,
            "maximum": 32
          },
          "oldest_run_created_at": {
            "type": "string",
            "format": "date-time"
          },
          "evidence_age_seconds": {
            "type": "number",
            "format": "double",
            "minimum": 0
          }
        }
      },
      "AutomationLiveBaselineCaseHealth": {
        "description": "Current retained verification availability and renewal readiness for one promoted suite case.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "status"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 128
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "passed",
              "failed",
              "pending",
              "unavailable",
              "not_started"
            ]
          }
        }
      },
      "AutomationLiveBaselineHealth": {
        "description": "Coherent read-only evidence health observations for a named baseline head.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "baseline",
          "evidence_status",
          "renewal_status",
          "reasons",
          "outdated",
          "cases"
        ],
        "properties": {
          "baseline": {
            "$ref": "#/components/schemas/AutomationLiveBaseline"
          },
          "evidence_status": {
            "type": "string",
            "enum": [
              "usable",
              "failed",
              "unavailable"
            ],
            "description": "Availability of current recorded reports; not a gate verdict."
          },
          "renewal_status": {
            "type": "string",
            "enum": [
              "passed",
              "failed",
              "inconclusive"
            ],
            "description": "Whether this same suite qualifies for a new promotion now."
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "outdated": {
            "type": "boolean"
          },
          "cases": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/AutomationLiveBaselineCaseHealth"
            }
          },
          "age_seconds": {
            "type": "number",
            "description": "Oldest original retained run age. Negative values indicate future timestamps."
          },
          "oldest_run_created_at": {
            "type": "string",
            "format": "date-time"
          },
          "max_age_seconds": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9223372036
          }
        }
      },
      "ListAutomationLiveBaselinesResponse": {
        "description": "Bounded sorted catalog of active named baseline heads and their current evidence observations.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "baselines",
          "observed_at"
        ],
        "properties": {
          "baselines": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/AutomationLiveBaselineHealth"
            }
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "RetireAutomationLiveBaselineRequest": {
        "description": "Expected positive baseline revision required to permanently retire an active name.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_revision"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 9223372036854776000
          }
        }
      },
      "AutomationLiveBaselineRetirement": {
        "description": "Immutable attributed receipt recording permanent retirement and release of the baseline evidence pin.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "retirement_id",
          "app_id",
          "name",
          "baseline_name",
          "revision",
          "previous_promotion_id",
          "actor_account_id",
          "retired_at"
        ],
        "properties": {
          "retirement_id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "baseline_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 2
          },
          "previous_promotion_id": {
            "type": "string",
            "format": "uuid"
          },
          "actor_account_id": {
            "type": "string",
            "format": "uuid"
          },
          "actor_api_key_id": {
            "type": "string",
            "format": "uuid"
          },
          "retired_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AutomationLiveBaselineHistory": {
        "description": "Bounded promotion audit history and optional permanent retirement receipt for one baseline name.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "promotions"
        ],
        "properties": {
          "retirement": {
            "$ref": "#/components/schemas/AutomationLiveBaselineRetirement"
          },
          "promotions": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/AutomationLiveBaseline"
            }
          }
        }
      },
      "AutomationLiveSuiteComparison": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "baseline",
          "candidate",
          "baseline_outdated",
          "candidate_outdated",
          "observed_at",
          "summary",
          "cases"
        ],
        "properties": {
          "baseline": {
            "$ref": "#/components/schemas/AutomationLiveSuiteSummary"
          },
          "candidate": {
            "$ref": "#/components/schemas/AutomationLiveSuiteSummary"
          },
          "baseline_outdated": {
            "type": "boolean"
          },
          "candidate_outdated": {
            "type": "boolean"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "summary": {
            "$ref": "#/components/schemas/AutomationLiveSuiteComparisonCounts"
          },
          "cases": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "$ref": "#/components/schemas/AutomationLiveSuiteCaseComparison"
            }
          }
        },
        "description": "Read-only evidence comparison. Outdated identifies target drift, independently of recorded result validity. Contains no inputs, outputs, assertions or admission keys."
      },
      "AutomationLiveSuiteComparisonCounts": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "total",
          "regressions",
          "recoveries",
          "unchanged",
          "added",
          "removed",
          "incompatible",
          "unknown"
        ],
        "properties": {
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 64
          },
          "regressions": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "recoveries": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "unchanged": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "added": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "removed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "incompatible": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "unknown": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          }
        },
        "description": "Disjoint case classifications; all categories sum to total. Zero regressions alone is not evidence that the candidate passed."
      },
      "AutomationLiveSuiteCaseComparison": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "change"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "change": {
            "type": "string",
            "enum": [
              "regression",
              "recovery",
              "unchanged",
              "added",
              "removed",
              "incompatible",
              "unknown"
            ],
            "description": "Equal hashes and current terminal reports are required for regression, recovery or unchanged. Hash mismatch is incompatible even when a report is pending; absent evidence is unknown. Added and removed take precedence when only one suite selected the case."
          },
          "baseline": {
            "$ref": "#/components/schemas/AutomationLiveSuiteObservation"
          },
          "candidate": {
            "$ref": "#/components/schemas/AutomationLiveSuiteObservation"
          }
        },
        "description": "A missing side means the case was not selected in that suite. A selected case without a run has a not_started observation."
      },
      "AutomationLiveSuiteObservation": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "result"
        ],
        "properties": {
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Original linked verification creation time, when retained. Never refreshed by grouping or checking runs."
          },
          "result": {
            "type": "string",
            "enum": [
              "passed",
              "failed",
              "pending",
              "not_started",
              "unavailable"
            ],
            "description": "Result of the original run independently of target drift. Unavailable includes missing runs and terminal runs without a current assertion report."
          }
        },
        "description": "Safe original run identity, creation time and recorded result only."
      },
      "AutomationLiveSuiteSummary": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "name",
          "version",
          "published_version",
          "deployment_id",
          "created_at",
          "updated_at",
          "case_count",
          "linked_runs"
        ],
        "properties": {
          "managed": {
            "type": "boolean",
            "description": "True for suites with durable server-managed admission. Metadata PUT cannot change these records; continuation requires explicit execution authorization."
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "version": {
            "type": "integer",
            "minimum": 1
          },
          "published_version": {
            "type": "integer",
            "minimum": 1
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "case_count": {
            "type": "integer",
            "minimum": 1,
            "maximum": 32
          },
          "linked_runs": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          }
        },
        "description": "Retained suite identity and linked-run counts. Listing is not an assertion verdict."
      },
      "AutomationLiveSuiteCase": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "outcome"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "not_started",
              "passed",
              "failed",
              "pending",
              "outdated",
              "unavailable"
            ]
          },
          "verification": {
            "$ref": "#/components/schemas/AutomationLiveVerification"
          }
        },
        "description": "A server-derived case observation; unavailable records keep their original run identity."
      },
      "AutomationLiveSuiteCounts": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "selected",
          "passed",
          "failed",
          "pending",
          "not_started",
          "unavailable",
          "outdated"
        ],
        "properties": {
          "selected": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "passed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "failed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "pending": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "not_started": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "unavailable": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "outdated": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          }
        },
        "description": "Current suite case counts, including unstarted and unverifiable members."
      },
      "AutomationLiveSuite": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "name",
          "version",
          "published_version",
          "deployment_id",
          "created_at",
          "updated_at",
          "case_count",
          "linked_runs",
          "outcome",
          "outdated",
          "observed_at",
          "summary",
          "cases"
        ],
        "properties": {
          "managed": {
            "type": "boolean",
            "description": "True when the suite owns durable server-managed execution and can be continued with explicit real-action confirmation."
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "version": {
            "type": "integer",
            "minimum": 1
          },
          "published_version": {
            "type": "integer",
            "minimum": 1
          },
          "deployment_id": {
            "type": "string",
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "case_count": {
            "type": "integer",
            "minimum": 1,
            "maximum": 32
          },
          "linked_runs": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          },
          "outcome": {
            "type": "string",
            "enum": [
              "passed",
              "failed",
              "pending",
              "incomplete",
              "outdated",
              "unavailable"
            ]
          },
          "outdated": {
            "type": "boolean"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "summary": {
            "$ref": "#/components/schemas/AutomationLiveSuiteCounts"
          },
          "cases": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/AutomationLiveSuiteCase"
            }
          }
        },
        "description": "Server-derived observation of retained verification records. GET is read-only and never checks assertions or admits work. Missing records remain unavailable with their known IDs. Passed requires every linked case to have a current passing report and an unchanged saved version, published revision and deployment. Not a publication receipt."
      },
      "ListAutomationLiveSuitesResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "suites"
        ],
        "properties": {
          "suites": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/AutomationLiveSuiteSummary"
            }
          }
        },
        "description": "Twenty most recently created suites. One hundred recent suites are retained per automation; clearing saved test data clears shared suite history."
      },
      "AutomationLiveVerification": {
        "description": "Safe provenance and status for one explicitly authorized live verification run.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "run_id",
          "case_name",
          "deployment_id",
          "inputs_hash",
          "run_status",
          "version",
          "published_version",
          "created_at",
          "outdated",
          "report_current"
        ],
        "properties": {
          "run_id": {
            "type": "string",
            "format": "uuid"
          },
          "case_name": {
            "type": "string"
          },
          "deployment_id": {
            "type": "string"
          },
          "inputs_hash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "run_status": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "minimum": 1
          },
          "published_version": {
            "type": "integer",
            "minimum": 1
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "outdated": {
            "type": "boolean",
            "description": "True when the saved case, published revision, or current default deployment differs from the frozen target."
          },
          "report_current": {
            "type": "boolean",
            "description": "True when the report still matches this run status, resume count and update time; also require outdated=false for current-target evidence."
          },
          "report": {
            "$ref": "#/components/schemas/AutomationLiveReport"
          }
        }
      },
      "ListAutomationLiveVerificationsResponse": {
        "description": "Current target identities and the twenty most recent retained live verifications.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "published_version",
          "verifications"
        ],
        "properties": {
          "deployment_id": {
            "type": "string"
          },
          "published_version": {
            "type": "integer",
            "minimum": 0
          },
          "verifications": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/AutomationLiveVerification"
            }
          }
        }
      },
      "AutomationTestSuite": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "sample",
          "cases"
        ],
        "properties": {
          "sample": {
            "$ref": "#/components/schemas/AutomationTestInputs"
          },
          "cases": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/AutomationTestCase"
            }
          }
        },
        "description": "At most 32 uniquely named cases; sample up to 3 MiB, cases up to 24 MiB combined, suite up to 27 MiB. Data is explicitly persisted, never captured from real runs."
      },
      "SaveAutomationTestSuiteRequest": {
        "description": "Versioned suite replacement; explicitly sending null removes saved data and results.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version",
          "suite"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "suite": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AutomationTestSuite"
              },
              {
                "type": "null"
              }
            ],
            "description": "Null clears saved tests and the retained report. Saving advances the automation version and invalidates earlier publishing receipts."
          }
        }
      },
      "RunAutomationTestsRequest": {
        "description": "Expected current draft version for simulating its saved test cases.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        }
      },
      "AutomationTestReport": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "checked_version",
          "checked_at",
          "inputs_hash",
          "passed",
          "cases"
        ],
        "properties": {
          "checked_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "inputs_hash": {
            "type": "string"
          },
          "passed": {
            "type": "boolean"
          },
          "cases": {
            "type": "array",
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/AutomationTestCaseResult"
            }
          }
        },
        "description": "Retained observation, not a publishing receipt. Freshness compares definition and suite content; running does not advance the draft version or perform real actions."
      },
      "AutomationTestCaseResult": {
        "description": "Safe overall case result and bounded per-step assertion summaries.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "passed",
          "steps"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "passed": {
            "type": "boolean"
          },
          "issue": {
            "type": "string",
            "enum": [
              "invalid_expectations",
              "simulation_rejected",
              "definition_invalid",
              "simulation_incomplete",
              "assertion_failed"
            ]
          },
          "steps_truncated": {
            "type": "boolean"
          },
          "steps": {
            "type": "array",
            "maxItems": 1024,
            "items": {
              "$ref": "#/components/schemas/AutomationTestStepResult"
            }
          }
        }
      },
      "AutomationTestStepResult": {
        "description": "One assertion result and observed state, excluding input, output and error data.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "step",
          "passed"
        ],
        "properties": {
          "step": {
            "type": "string"
          },
          "loop": {
            "type": "string"
          },
          "item_index": {
            "type": "integer",
            "minimum": 0
          },
          "state": {
            "type": "string"
          },
          "passed": {
            "type": "boolean"
          },
          "mismatches": {
            "description": "Failed assertion field names only; expected and observed values are omitted.",
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "step",
                "state",
                "reason",
                "when_matched",
                "output",
                "attempt_count",
                "attempts"
              ]
            }
          }
        }
      },
      "AutomationPublishCheckScenario": {
        "description": "Named simulation and assertions to evaluate against a saved automation draft.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "simulation",
          "expectations"
        ],
        "properties": {
          "live": {
            "description": "Live test configuration carried by the case editor; mock publishing checks do not evaluate it.",
            "anyOf": [
              {
                "$ref": "#/components/schemas/AutomationLiveTest"
              },
              {
                "type": "null"
              }
            ]
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "simulation": {
            "$ref": "#/components/schemas/SimulateAutomationRequest"
          },
          "expectations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutomationCheckExpectation"
            },
            "minItems": 1,
            "maxItems": 4096
          }
        }
      },
      "CheckAutomationPublicationRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version",
          "scenarios",
          "exclusions"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "require_coverage": {
            "type": "boolean",
            "default": false
          },
          "scenarios": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutomationPublishCheckScenario"
            },
            "minItems": 1,
            "maxItems": 32
          },
          "exclusions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutomationCheckExclusion"
            },
            "maxItems": 256
          }
        },
        "description": "Run assertions and coverage on the saved draft on the server; mocks remain hypothetical. At most 24 MiB total and 3 MiB per simulation. Complete, valid traces and passing assertions are required. Coverage policy overrides require_coverage=false."
      },
      "CheckAutomationPublicationResponse": {
        "description": "Expiring server receipt with safe verified scenario and coverage metadata.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "receipt",
          "expires_at",
          "evidence"
        ],
        "properties": {
          "receipt": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Opaque 30-minute receipt bound to app, name, draft, actor and policy version. Do not log or expose it."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "evidence": {
            "$ref": "#/components/schemas/AutomationCheckEvidence"
          }
        }
      },
      "AutomationCheckEvidence": {
        "type": "object",
        "additionalProperties": false,
        "description": "Simulation check metadata. server_verified is set only for server-issued publishing receipts; legacy or plain client evidence is unverified. Bound to the saved draft hash and version. Contains metadata only; no sample inputs, outputs, or failure text. Checked time must be within the past day (five minutes of future clock skew allowed).",
        "required": [
          "definition_hash",
          "checked_version",
          "checked_at",
          "scenarios",
          "coverage_required",
          "coverage_passed",
          "coverage_remaining",
          "exclusions"
        ],
        "properties": {
          "server_verified": {
            "type": "boolean",
            "readOnly": true,
            "description": "True only when publication used a stored server-issued receipt. Clients cannot attest to this flag."
          },
          "definition_hash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "checked_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "scenarios": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "items": {
              "$ref": "#/components/schemas/AutomationCheckScenario"
            }
          },
          "coverage_required": {
            "type": "boolean"
          },
          "coverage_passed": {
            "type": "boolean",
            "description": "True when coverage_remaining is zero; required coverage must pass before publishing."
          },
          "coverage_remaining": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4096
          },
          "exclusions": {
            "type": "array",
            "maxItems": 256,
            "items": {
              "$ref": "#/components/schemas/AutomationCheckExclusion"
            }
          }
        }
      },
      "AutomationCheckScenario": {
        "type": "object",
        "additionalProperties": false,
        "description": "A named scenario reported as passing, definition valid, and complete by the publishing client.",
        "required": [
          "name",
          "passed",
          "definition_valid",
          "complete"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "passed": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "definition_valid": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "complete": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        }
      },
      "AutomationCheckExclusion": {
        "type": "object",
        "additionalProperties": false,
        "description": "An explicitly reviewed coverage exclusion. Reasons are user-authored metadata and should contain no secrets.",
        "required": [
          "step",
          "code",
          "reason"
        ],
        "properties": {
          "step": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "loop": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "code": {
            "type": "string",
            "enum": [
              "guard_match_missing",
              "guard_skip_missing",
              "failure_route_missing",
              "wait_success_missing",
              "wait_timeout_missing",
              "retry_missing",
              "loop_empty_missing",
              "loop_multiple_items_missing"
            ]
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          }
        }
      },
      "AutomationRevisionResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "definition",
          "definition_hash",
          "recorded_at",
          "legacy_snapshot",
          "published_by_account_id"
        ],
        "properties": {
          "check_evidence": {
            "$ref": "#/components/schemas/AutomationCheckEvidence"
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Immutable published revision identifier."
          },
          "definition": {
            "$ref": "#/components/schemas/WorkflowSpec"
          },
          "definition_hash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "SHA-256 of the canonical JSON encoding of definition."
          },
          "recorded_at": {
            "type": "string",
            "format": "date-time",
            "description": "When this immutable history record was stored; for legacy snapshots this is the migration time."
          },
          "legacy_snapshot": {
            "type": "boolean",
            "description": "True for the one current publication copied into history during rollout; older history was not retained."
          },
          "published_by_account_id": {
            "type": "string",
            "format": "uuid",
            "description": "Account that published this revision, or owned the legacy snapshot at rollout."
          },
          "published_by_api_key_id": {
            "type": "string",
            "format": "uuid",
            "description": "API key used for the publish when the request used key authentication; omitted for session authentication and legacy snapshots."
          }
        },
        "description": "Immutable published automation definition with actor and rollout provenance."
      },
      "ListAutomationRevisionsResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "revisions",
          "total",
          "limit",
          "offset"
        ],
        "properties": {
          "revisions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutomationRevisionResponse"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "offset": {
            "type": "integer",
            "minimum": 0
          }
        },
        "description": "Newest-first immutable publication history and pagination metadata."
      },
      "RestoreAutomationRevisionRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Current draft revision for optimistic concurrency; zero creates a draft after deletion."
          }
        },
        "description": "Restores a selected immutable publication into the draft without publishing it."
      },
      "SaveAutomationDraftRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version",
          "definition"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Saved revision observed by the editor; zero creates the first draft."
          },
          "definition": {
            "$ref": "#/components/schemas/WorkflowSpec"
          }
        },
        "description": "Draft definition and the revision that the caller edited."
      },
      "PublishAutomationRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version"
        ],
        "properties": {
          "check_receipt": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Server-issued receipt required by scenarios or coverage policy; stale, expired, cross-identity and reused receipts are rejected."
          },
          "check_evidence": {
            "$ref": "#/components/schemas/AutomationCheckEvidence"
          },
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Current saved draft revision to validate and publish."
          },
          "take_over_manifest": {
            "type": "boolean",
            "default": false
          }
        },
        "description": "Saved draft revision to publish, with explicit YAML takeover when needed."
      },
      "SetAutomationEnabledRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version",
          "enabled"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Current automation revision to pause or resume."
          },
          "enabled": {
            "type": "boolean"
          }
        },
        "description": "Publication revision and the desired state of automatic starts."
      },
      "SimulateAutomationRequest": {
        "description": "Sample workflow data and mocked action, event/callback payload or timeout outcomes for a stateless simulation.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "definition"
        ],
        "properties": {
          "definition": {
            "$ref": "#/components/schemas/WorkflowSpec"
          },
          "input": {
            "description": "Workflow input as any JSON value; omission is equivalent to null."
          },
          "mock_outputs": {
            "description": "Successful action outputs keyed by root step name; explicit null is a supplied result.",
            "type": "object",
            "additionalProperties": {}
          },
          "mock_item_outputs": {
            "description": "Ordered successful output prefix keyed by for_each root name; waits and controls cannot be mocked.",
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "maxItems": 128,
              "items": {}
            }
          },
          "mock_item_attempts": {
            "description": "Per-item attempt outcomes keyed by for_each root name and canonical zero-based item index (0..127). Sparse indexes are allowed but must exist in the materialized collection. Cannot be combined with mock_item_outputs for the same loop. Item timeouts require an action timeout and follow its retry policy. Terminal item failures stop later items unless on_item_failure is continue; the loop remains failed or dead, with null placeholders for failed items when continuing.",
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "minProperties": 1,
              "maxProperties": 128,
              "additionalProperties": {
                "type": "array",
                "minItems": 1,
                "maxItems": 25,
                "items": {
                  "$ref": "#/components/schemas/AutomationSimulationMockAttempt"
                }
              }
            }
          },
          "mock_attempts": {
            "description": "Ordered per-attempt outcomes keyed by action or wait name. Event and callback waits accept exactly one success with the received payload as output, or one timeout with a configured timeout and on_timeout route. Other waits accept timeout only. Successful wait payloads cannot be the reserved timeout sentinel. Action timeouts require on_timeout. Cannot be combined with mock_outputs for the same step.",
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "minItems": 1,
              "maxItems": 25,
              "items": {
                "$ref": "#/components/schemas/AutomationSimulationMockAttempt"
              }
            }
          }
        }
      },
      "AutomationSimulationMockAttempt": {
        "description": "One mocked attempt; success requires output, failure requires exactly one of error or non-2xx http_status, and timeout has no additional fields.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "outcome"
        ],
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "success",
              "failure",
              "timeout"
            ]
          },
          "output": {
            "description": "Successful action result or received event/callback payload; any JSON value, including null."
          },
          "error": {
            "type": "string",
            "minLength": 1,
            "description": "Mocked transport or action error message used as failure.message."
          },
          "http_status": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599,
            "description": "Mocked non-2xx response status."
          }
        }
      },
      "SimulateAutomationResponse": {
        "description": "Definition validity, submitted-definition SHA-256 and deterministic simulated data flow.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "definition_valid",
          "definition_hash",
          "complete",
          "issues",
          "warnings",
          "step_order",
          "trace"
        ],
        "properties": {
          "definition_valid": {
            "type": "boolean",
            "description": "Whether the definition and managed integration bindings passed validation."
          },
          "definition_hash": {
            "type": "string",
            "description": "SHA-256 of the JSON-serialized submitted definition, independent of samples; not a publication revision."
          },
          "complete": {
            "type": "boolean",
            "description": "Every root reached a known terminal outcome under these mocks; false for missing results, unresolved retries, waits or evaluation errors."
          },
          "issues": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "step_order": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "trace": {
            "type": "array",
            "maxItems": 1024,
            "items": {
              "$ref": "#/components/schemas/AutomationSimulationStep"
            }
          }
        }
      },
      "AutomationSimulationStep": {
        "description": "One hypothetical root or loop item with resolved data and its control-flow decision.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "step_name",
          "kind",
          "state"
        ],
        "properties": {
          "step_name": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "run",
              "path",
              "outbound",
              "for_each",
              "join",
              "event_wait",
              "callback_wait",
              "duration_wait",
              "condition_wait"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "would_execute",
              "mocked",
              "would_wait",
              "resolved",
              "expanded",
              "skipped",
              "blocked",
              "would_retry",
              "timed_out",
              "failed",
              "dead",
              "error"
            ]
          },
          "reason": {
            "type": "string",
            "description": "Stable decision reason with no referenced customer values."
          },
          "blocked_by": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "when_matched": {
            "type": "boolean"
          },
          "input": {
            "description": "Resolved action input or materialized loop source; any JSON type is preserved."
          },
          "output": {
            "description": "Supplied successful mock, timeout sentinel or control output; omitted when no result is known."
          },
          "attempts": {
            "type": "array",
            "description": "Safe summary of supplied action or wait outcomes; mocked error text is exposed only through eligible failure context.",
            "maxItems": 25,
            "items": {
              "$ref": "#/components/schemas/AutomationSimulationAttempt"
            }
          },
          "run": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "integration_id": {
            "type": "string"
          },
          "raw_query": {
            "type": "string",
            "maxLength": 4096,
            "description": "Canonically URL-encoded outbound query after resolving sample input and dependency outputs; omitted when empty or unresolved."
          },
          "wait_for": {
            "type": "string"
          },
          "parent_step": {
            "type": "string"
          },
          "item_index": {
            "type": "integer",
            "minimum": 0
          },
          "item_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 128
          }
        }
      },
      "AutomationSimulationAttempt": {
        "description": "Safe summary of one supplied hypothetical attempt outcome.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "attempt",
          "outcome"
        ],
        "properties": {
          "attempt": {
            "type": "integer",
            "minimum": 1,
            "maximum": 25
          },
          "outcome": {
            "type": "string",
            "enum": [
              "success",
              "failure",
              "timeout"
            ]
          },
          "http_status": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599
          }
        }
      },
      "ValidateAutomationRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "definition"
        ],
        "properties": {
          "definition": {
            "$ref": "#/components/schemas/WorkflowSpec"
          }
        },
        "description": "Candidate automation definition for a read-only validation."
      },
      "ValidateAutomationResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "valid",
          "issues",
          "step_order"
        ],
        "properties": {
          "valid": {
            "type": "boolean"
          },
          "issues": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "step_order": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "next_fire_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "description": "Validation issues, execution order and nominal next schedule occurrence."
      },
      "PutWebhookAutomationBindingRequest": {
        "description": "Bind a verified provider endpoint to a published automation with revision control.",
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expected_version",
          "workflow_name",
          "event_type",
          "take_over_delivery"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "workflow_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "event_type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "filter": {
            "type": "object",
            "additionalProperties": true
          },
          "take_over_delivery": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        }
      },
      "WebhookAutomationBindingResponse": {
        "description": "Captured automation name, event selection and current endpoint binding revision.",
        "type": "object",
        "required": [
          "endpoint_id",
          "workflow_name",
          "event_type",
          "filter",
          "version",
          "updated_at"
        ],
        "properties": {
          "endpoint_id": {
            "type": "string",
            "format": "uuid"
          },
          "workflow_name": {
            "type": "string"
          },
          "event_type": {
            "type": "string"
          },
          "filter": {
            "type": "object",
            "additionalProperties": true
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WebhookAutomationReceiptResponse": {
        "description": "Durable provider event routing decision and automation admission progress.",
        "type": "object",
        "required": [
          "receipt_id",
          "endpoint_id",
          "provider_event_id",
          "workflow_name",
          "status",
          "duplicate",
          "accepted_at",
          "event_source",
          "routing_status"
        ],
        "properties": {
          "receipt_id": {
            "type": "string",
            "format": "uuid"
          },
          "endpoint_id": {
            "type": "string",
            "format": "uuid"
          },
          "provider_event_id": {
            "type": "string"
          },
          "workflow_name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "accepted",
              "ignored"
            ]
          },
          "ignored_reason": {
            "type": "string",
            "enum": [
              "automation_paused",
              "automation_failure_paused",
              "event_filtered",
              "automation_unpublished"
            ]
          },
          "duplicate": {
            "type": "boolean"
          },
          "accepted_at": {
            "type": "string",
            "format": "date-time"
          },
          "event_source": {
            "type": "string"
          },
          "routing_status": {
            "type": "string",
            "enum": [
              "pending",
              "filtered",
              "enqueued",
              "failed",
              "ignored"
            ]
          },
          "run_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      }
    },
    "responses": {
      "SupportInvalid": {
        "description": "Support request fields do not satisfy the customer assistance contract.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "SupportUnauthenticated": {
        "description": "Authentication is required to access customer assistance records.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "SupportForbidden": {
        "description": "Current verified account or organization support access is required.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "SupportMissing": {
        "description": "The requested assistance record is unavailable in the current scope.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "SupportConflict": {
        "description": "The assistance revision, reopening allowance or request receipt conflicts with this command.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "SupportTooLarge": {
        "description": "The customer assistance JSON request exceeds its byte limit.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "SupportLimited": {
        "description": "The rolling assistance submission or mutation allowance is exhausted.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "SupportUnavailable": {
        "description": "Customer assistance storage is temporarily unavailable; retry the same request key.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "EdgeRulesVersionMismatch": {
        "description": "If-Match no longer names the app's latest edge-rule set version (edge_rules_version_mismatch). The response ETag carries the current version.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "EdgeRuleListNotFound": {
        "description": "code: edge_rule_list_not_found",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "OperationConflict": {
        "description": "A pinned contract, idempotency payload or execution generation conflicts with the retained state.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "OperationGone": {
        "description": "The retained result expired; its identity remains reserved for the deduplication window.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "TenantSurfacesNotAllowed": {
        "description": "code: tenant_surfaces_not_allowed — this account's plan does not include tenant surfaces.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "TenantSurfacesNotEnabled": {
        "description": "code: tenant_surfaces_not_enabled — the cluster operator has not enabled the tenant-surface API.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "WorkflowRunNotFound": {
        "description": "code: workflow_run_not_found — the run is absent or outside the caller's workflow access.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "WorkflowStepAttemptsNotFound": {
        "description": "The workflow run is absent or not owned by the caller, or code: workflow_step_not_found — the requested step is absent.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "StoredWorkflowConflict": {
        "description": "code: stored_workflow_version_conflict | stored_workflow_ownership_conflict — reload a stale revision or explicitly confirm transfer of YAML ownership.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "StoredWorkflowInvalid": {
        "description": "code: stored_workflow_invalid | validation_failed — the definition, revision, or request fields are invalid.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "code: unauthorized",
        "headers": {
          "WWW-Authenticate": {
            "$ref": "#/components/headers/WWWAuthenticate"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "InvalidCredentials": {
        "description": "code: invalid_credentials — wrong email or password. Drafted for the dashboard auth surface.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "ResetTokenInvalid": {
        "description": "code: reset_token_invalid | reset_token_expired — the password-reset token is unknown, already consumed, or expired.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "PaymentRequired": {
        "description": "code: billing_past_due — account is suspended; pay invoice to resume.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "PlanPerAppMetricsNotAllowed": {
        "description": "code: plan_per_app_metrics_not_allowed — the account plan does not include per-app metrics or wake narratives; upgrade to Hobby or above.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "EmailVerificationRequired": {
        "description": "code: email_verification_required — verify the account email before deploying code or changing billing settings.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "AppCreateForbidden": {
        "description": "code: plan_limit_apps | plan_limit_ram | plan_limit_concurrency | plan_min_instances_not_allowed | plan_limit_secrets | plan_cron_quota | app_layer_too_large | image_egress_denied | email_verification_required",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "DeploymentForbidden": {
        "description": "code: image_egress_denied — registry is in RFC1918 / IMDS / link-local, or blocked egress range; or email_verification_required when the account email is unverified.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "AdmissionRefused": {
        "description": "code: admission_refused — the account's spend cap (accounts.overage_cap_cents) is met/exceeded by the current-month overage. Schedd refuses new wakes until the customer raises or clears the cap via POST /v1/account/overage-cap. The Limit / Observed fields carry the cap and current overage in integer cents so a script can compute \"how much to raise\" without parsing prose. No Retry-After: the cap is a deliberate customer budget, not back-pressure.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "NotFound": {
        "description": "code: not_found",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "RehearsalNotEnabled": {
        "description": "code: rehearsal_not_enabled — a requested rehearsal capability is not enabled on this installation. Retrying will not help.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "NotImplemented": {
        "description": "code: not_implemented — this optional capability is not enabled on the serving daemon.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "ApplicationStandardsPending": {
        "description": "code: application_standards_pending. Inherited application controls must be persisted before this service accepts a deployment. Retry after enrollment completes.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "FullEnvironmentCloneUnavailable": {
        "description": "code: environment_full_clone_unavailable — complete isolated resource coverage and coordinated data copies are unavailable.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "Conflict": {
        "description": "code: conflict",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "BadRequest": {
        "description": "code: bad_request — generic 400 envelope. Specific codes (missing Upload-Offset header on PATCH /v1/uploads/{id}, malformed JSON body, plan cap exceeded as `source_too_large`) ship as the `code` field.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "ValidationError": {
        "description": "code: validation_failed | env_var_invalid_key",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "Gone": {
        "description": "code: upload_session_expired — the resumable-upload session has been swept by the reaper and cannot be appended to or committed. The CLI is expected to detect this on the first PATCH/COMMIT after expiry and mint a fresh session.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "PayloadTooLarge": {
        "description": "code: payload_too_large — the PATCH chunk body exceeds the per-plan or per-account cap. Distinct from `source_too_large` (POST /v1/uploads when total_size exceeds SourceTarballMaxMB), this fires mid-upload when the customer's chunk size or accumulated spool crosses the limit.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "ConflictDelete": {
        "description": "code: account_deletion_confirm_required | account_deletion_pending | account_not_restorable",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "ConflictRename": {
        "description": "code: app_rename_failed — slug taken by another live app, or DB unique violation.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "Forbidden": {
        "description": "code: forbidden — caller is authenticated but lacks the required scope, OR plan_limit_trusted_signers / plan_limit_secret / etc. when the resource count would exceed the plan cap.",
        "headers": {
          "WWW-Authenticate": {
            "$ref": "#/components/headers/WWWAuthenticate"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "AppNotFound": {
        "description": "code: app_not_found — slug does not exist for the authenticated account.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "ServerError": {
        "description": "code: capacity — server-side error; retry with backoff.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "NoRollbackTarget": {
        "description": "code: no_rollback_target — there is no superseded deployment to roll back to.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "RollbackConflict": {
        "description": "code: no_rollback_target | rollback_target_already_live | rollback_target_snapshot_expired — rollback was rejected; see the response body for the specific code and detail.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "RollbackTargetNotFound": {
        "description": "code: rollback_target_not_found — the named target_deployment_id does not match any deployment of this app (or does not exist).",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "RollbackTargetAlreadyLive": {
        "description": "code: rollback_target_already_live — the named target_deployment_id is already serving live traffic. Rolling back to the current serving deployment is rejected; a zero-traffic live revision is eligible.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "ValidationFailed": {
        "description": "code: validation_failed | source_invalid | build_undetected | handler_missing | image_required | cron_invalid | secret_invalid_key",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "InvalidCPURAMPair": {
        "description": "code: invalid_cpu_ram_pair — explicit ram_mb and vcpu do not match the canonical shape for the account plan.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "PlanLimit": {
        "description": "code: plan_limit_apps | plan_limit_ram | plan_limit_concurrency | plan_min_instances_not_allowed | plan_limit_secrets | plan_cron_quota | app_layer_too_large | image_egress_denied",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "PlanLimitSecrets": {
        "description": "code: plan_limit_secrets",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "PlanLimitProjectSecrets": {
        "description": "code: plan_limit_project_secrets",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "ConcurrencyLimit": {
        "description": "code: plan_limit_concurrency",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "SourceTooLarge": {
        "description": "code: source_too_large",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "SourceEgressDenied": {
        "description": "code: image_egress_denied — registry is in RFC1918 / IMDS / link-local, or blocked egress range.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "SecretValueTooLarge": {
        "description": "code: secret_value_too_large",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "SecretNotFound": {
        "description": "code: secret_not_found",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "PlanRegistryCredentialsNotAllowed": {
        "description": "code: plan_registry_credentials_not_allowed — Free plan cannot store private-registry credentials.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "PlanRegistryCredentialQuota": {
        "description": "code: plan_registry_credential_quota — per-app host cap reached (Hobby 2 / Pro 5 / Scale 20).",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "InvalidRegistryHost": {
        "description": "code: invalid_registry_host — host missing scheme/path, uppercase, port out of range, or field-length cap exceeded.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "RegistryCredentialNotFound": {
        "description": "code: registry_credential_not_found — DELETE on a host that has no sealed credential.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "PlanJobRegistryCredentialsNotAllowed": {
        "description": "code: plan_job_registry_credentials_not_allowed — Free plan cannot store job private-registry credentials.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "PlanJobRegistryCredentialQuota": {
        "description": "code: plan_job_registry_credential_quota — per-job registry credential cap reached.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "ServiceUnavailable": {
        "description": "Generic 503 envelope. Used by the API capacity gate (e.g.\nhost age recipient not loaded → registry credential PUT\nreturns 503 instead of accepting plaintext).\n",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "PlanLimitEnvVars": {
        "description": "code: plan_limit_env_vars",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "EnvValueTooLarge": {
        "description": "code: env_value_too_large",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "EnvVarInvalidKey": {
        "description": "code: env_var_invalid_key",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "EnvScopeInvalid": {
        "description": "code: env_scope_invalid — ?scope= failed the EnvScopePattern check (empty, too long, or out-of-shape slug). Applies to both env and secrets surfaces.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "EnvVarNotFound": {
        "description": "code: env_var_not_found",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "CustomMetricInvalid": {
        "description": "code: validation | custom_metric_limit — a malformed name or value, or a push of a NEW metric name by an app already at MaxCustomMetricsPerApp. A push to an EXISTING name never produces the limit error: it is an upsert and cannot grow the count.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "CronInvalid": {
        "description": "code: cron_invalid | plan_crons_not_allowed | plan_cron_quota",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "TriggerInvalid": {
        "description": "code: trigger_invalid_kind | trigger_invalid_config — kind does not exist, or per-kind validation failed (missing brokers, empty topic, malformed URL, etc.).",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "TriggerNotAllowed": {
        "description": "code: plan_triggers_not_allowed — Free plan cannot create triggers; upgrade required.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "TriggerQuotaExceeded": {
        "description": "code: trigger_kind_not_allowed | plan_trigger_quota | trigger_batch_window_too_large | trigger_tls_skip_verify_not_allowed — source-kind or delivery configuration exceeds the account plan capabilities returned by GET /v1/account.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "TriggerSecretUnavailable": {
        "description": "code: secret_store_unavailable — Kafka credentials could not be sealed or opened safely because host age key material is unavailable.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "TriggerImmutable": {
        "description": "code: trigger_immutable_field — kind and (for cron) trigger_id are immutable after create; changing them requires delete + recreate.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "TriggerRecordRetryFailed": {
        "description": "code: trigger_dlq_retry_failed — record could not be re-driven (state was not retry or dead_letter).",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "AlertRuleInvalid": {
        "description": "code: alert_rule_invalid | plan_alert_rules_not_allowed | plan_alert_rule_quota | image_egress_denied",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "CorsPresetInvalid": {
        "description": "code: cors_preset_invalid | cors_wildcard_with_credentials |\ncors_preset_update_requires_field | cors_preset_name_conflict |\nplan_cors_preset_not_allowed | plan_cors_preset_quota_reached.\nThe body validates the\nsame shape as the storage-side CHECK constraints; the\nwire-level codes are 422 for grammar violations and 402\nfor plan gates.\n",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "EdgeRuleConflict": {
        "description": "code: edge_rule_conflict — duplicate or overlapping rule state rejected.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "DeployFailed": {
        "description": "code: deploy_failed | image_not_found | image_manifest_invalid | build_oom | build_timeout | stateless_only_violation",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "InvalidMinInstances": {
        "description": "code: invalid_min_instances — must be in [0, plan max_concurrency].",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "CapacityUnavailable": {
        "description": "code: capacity_unavailable — no host headroom.\nResource increases can return service_recovery_capacity_unavailable\nwhen enabled bare-metal service protection needs more recovery headroom.\n",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "DebuggerRegressionUnavailable": {
        "description": "code: debug_regressions_unavailable — the debugger regression table or read query is unavailable; check database migrations and readiness, then retry.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "AIGatewayUnavailable": {
        "description": "code: outbound_ai_gateway_unavailable — the AI gateway is closed on this platform, or the account is not yet in its staged preview rollout.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "AIGatewayPlanGated": {
        "description": "code: plan_feature_gated — the account plan does not include the AI gateway; upgrade to Hobby or above.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "PlanFeatureGated": {
        "description": "code: feature_not_allowed — request targets a feature the plan does not entitle (async_invoke / queues / delayed_tasks on Free).",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "PlanQueueDepth": {
        "description": "code: plan_queue_depth — per-app queue at the plan's MaxQueueDepth.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "PlanDelayedTasksCap": {
        "description": "code: plan_delayed_tasks_cap — per-app delayed-task count at MaxDelayedTasksPerApp.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "PlanSourceBytes": {
        "description": "code: source_too_large — payload exceeds the plan's MaxSourceBytesPerInvocation.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "LongPollTimeout": {
        "description": "code: long_poll_timeout — server-side long-poll budget elapsed without a terminal row.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "InvalidScheduledAt": {
        "description": "code: invalid_scheduled_at — the schedule is missing, ambiguous, in the past, or beyond the one-year horizon.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "429 application/problem+json response. Authentication throttling uses\n`auth_rate_limited`; plan and usage limits use their specific stable\ncodes such as `plan_limit_concurrency`, `quota_exhausted` and\n`profile_investigation_limit`.\n",
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer",
              "example": 60
            },
            "description": "Seconds until the client may retry. Emitted by deploy admission and the authlimiter."
          },
          "RateLimit-Limit": {
            "schema": {
              "type": "integer",
              "example": 10
            },
            "description": "Account deploy admissions allowed in the current window."
          },
          "RateLimit-Remaining": {
            "schema": {
              "type": "integer",
              "example": 0
            },
            "description": "Deploy admissions remaining in the current window."
          },
          "RateLimit-Reset": {
            "schema": {
              "type": "integer",
              "example": 1800
            },
            "description": "Seconds until the current deploy window resets."
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "InboundWebhookInvalid": {
        "description": "code: inbound_webhook_invalid for malformed endpoint configuration/body or a missing Stripe event id; code: inbound_webhook_bad_signature when Stripe-Signature does not verify.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "PlanInboundWebhooksNotAllowed": {
        "description": "code: plan_inbound_webhooks_not_allowed — the plan excludes durable inbound webhook ingress.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "PlanInboundWebhookQuota": {
        "description": "code: plan_inbound_webhook_quota — the app or account endpoint cap is reached.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "InboundWebhookTooLarge": {
        "description": "code: inbound_webhook_too_large — the provider request body exceeds 1 MiB.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "AppWebhookInvalid": {
        "description": "code: app_webhook_invalid — malformed webhook body (missing target_url, invalid retry_policy, out-of-vocabulary event, oversize secret, etc.) or invalid state transition (e.g. retry on a non-dead row).",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "PlanWebhooksNotAllowed": {
        "description": "code: plan_webhooks_not_allowed — the plan does not include outbound webhooks (Free today).",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "PlanWebhookQuota": {
        "description": "code: plan_webhook_quota — per-app or per-account webhook limit reached.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "RealtimeInvalid": {
        "description": "code: realtime_invalid — malformed managed realtime endpoint URL, path, or credential.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "PlanRealtimeNotAllowed": {
        "description": "code: plan_realtime_not_allowed — the plan does not include managed realtime endpoints.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "PlanRealtimeQuota": {
        "description": "code: plan_realtime_quota — per-app or per-account managed realtime endpoint limit reached.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "AppLogDrainInvalid": {
        "description": "code: app_log_drain_invalid — malformed log-drain kind, URL, or auth header.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "PlanLogDrainsNotAllowed": {
        "description": "code: plan_log_drains_not_allowed — the plan does not include customer runtime log destinations.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "PlanLogDrainQuota": {
        "description": "code: plan_log_drain_quota — per-app or per-account runtime log destination limit reached.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "AutomationConflict": {
        "description": "code: automation_version_conflict | automation_ownership_conflict — reload a stale revision or explicitly confirm transfer of YAML ownership.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "AutomationInvalid": {
        "description": "code: automation_invalid | validation_failed — the definition, revision, or request fields are invalid.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      }
    }
  }
}
